diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-20 15:05:53 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-20 15:05:53 +0200 |
commit | e34ca162e700cb23aa7a247b394bfbf17135498b (patch) | |
tree | 4c2aff5aa77d2398eadd8e5d221c3a6d9885b3a1 /gcc/ada/a-direct.adb | |
parent | ee9aa7b6637c3254a12f5887d9ca2b425543b5a0 (diff) | |
download | gcc-e34ca162e700cb23aa7a247b394bfbf17135498b.zip gcc-e34ca162e700cb23aa7a247b394bfbf17135498b.tar.gz gcc-e34ca162e700cb23aa7a247b394bfbf17135498b.tar.bz2 |
[multiple changes]
2009-04-20 Pascal Obry <obry@adacore.com>
* a-direct.adb (To_Lower_If_Case_Insensitive): Removed.
Remove all calls to To_Lower_If_Case_Insensitive to preserve
the pathname original casing.
2009-04-20 Robert Dewar <dewar@adacore.com>
* g-trasym.adb: Minor reformatting
* s-os_lib.adb: Minor reformatting
* sem.adb: Minor reformatting
Minor code reorganization
* sem_ch3.adb: Minor reformatting
* sem_ch4.adb: Minor reformatting
* sem_ch8.adb: Minor reformatting
* sem_type.adb: Minor reformatting
From-SVN: r146412
Diffstat (limited to 'gcc/ada/a-direct.adb')
-rw-r--r-- | gcc/ada/a-direct.adb | 81 |
1 files changed, 21 insertions, 60 deletions
diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb index db40b8c..723833c 100644 --- a/gcc/ada/a-direct.adb +++ b/gcc/ada/a-direct.adb @@ -93,20 +93,15 @@ package body Ada.Directories is -- Get the next entry in a directory, setting Entry_Fetched if successful -- or resetting Is_Valid if not. - procedure To_Lower_If_Case_Insensitive (S : in out String); - -- Put S in lower case if file and path names are case-insensitive - --------------- -- Base_Name -- --------------- function Base_Name (Name : String) return String is - Simple : String := Simple_Name (Name); + Simple : constant String := Simple_Name (Name); -- Simple'First is guaranteed to be 1 begin - To_Lower_If_Case_Insensitive (Simple); - -- Look for the last dot in the file name and return the part of the -- file name preceding this last dot. If the first dot is the first -- character of the file name, the base name is the empty string. @@ -198,7 +193,6 @@ package body Ada.Directories is Last := Last + Extension'Length; end if; - To_Lower_If_Case_Insensitive (Result (1 .. Last)); return Result (1 .. Last); end if; end Compose; @@ -287,7 +281,6 @@ package body Ada.Directories is return Containing_Directory (Current_Directory); else - To_Lower_If_Case_Insensitive (Result (1 .. Last)); return Result (1 .. Last); end if; end; @@ -448,11 +441,9 @@ package body Ada.Directories is Local_Get_Current_Dir (Buffer'Address, Path_Len'Address); declare - Cur : String := Normalize_Pathname (Buffer (1 .. Path_Len)); + Cur : constant String := Normalize_Pathname (Buffer (1 .. Path_Len)); begin - To_Lower_If_Case_Insensitive (Cur); - if Cur'Length > 1 and then Cur (Cur'Last) = Dir_Separator then return Cur (1 .. Cur'Last - 1); else @@ -790,10 +781,9 @@ package body Ada.Directories is -- Use System.OS_Lib.Normalize_Pathname declare - Value : String := Normalize_Pathname (Name); + Value : constant String := Normalize_Pathname (Name); subtype Result is String (1 .. Value'Length); begin - To_Lower_If_Case_Insensitive (Value); return Result (Value); end; end if; @@ -1061,18 +1051,14 @@ package body Ada.Directories is function Simple_Name (Name : String) return String is - function Simple_Name_CI (Path : String) return String; - -- This function does the job. The difference between Simple_Name_CI - -- and Simple_Name (the parent function) is that the former is case - -- sensitive, while the latter is not. Path and Suffix are adjusted - -- appropriately before calling Simple_Name_CI under platforms where - -- the file system is not case sensitive. + function Simple_Name_Internal (Path : String) return String; + -- This function does the job - -------------------- - -- Simple_Name_CI -- - -------------------- + -------------------------- + -- Simple_Name_Internal -- + -------------------------- - function Simple_Name_CI (Path : String) return String is + function Simple_Name_Internal (Path : String) return String is Cut_Start : Natural := Strings.Fixed.Index (Path, Dir_Seps, Going => Strings.Backward); @@ -1093,11 +1079,7 @@ package body Ada.Directories is Cut_End := Path'Last; Check_For_Standard_Dirs : declare - Offset : constant Integer := Path'First - Name'First; - BN : constant String := - Name (Cut_Start - Offset .. Cut_End - Offset); - -- Here we use Simple_Name.Name to keep the original casing - + BN : constant String := Path (Cut_Start .. Cut_End); Has_Drive_Letter : constant Boolean := System.OS_Lib.Path_Separator /= ':'; -- If Path separator is not ':' then we are on a DOS based OS @@ -1120,7 +1102,7 @@ package body Ada.Directories is return BN; end if; end Check_For_Standard_Dirs; - end Simple_Name_CI; + end Simple_Name_Internal; -- Start of processing for Simple_Name @@ -1133,23 +1115,12 @@ package body Ada.Directories is else -- Build the value to return with lower bound 1 - if Is_Path_Name_Case_Sensitive then - declare - Value : constant String := Simple_Name_CI (Name); - subtype Result is String (1 .. Value'Length); - begin - return Result (Value); - end; - - else - declare - Value : constant String := - Simple_Name_CI (Characters.Handling.To_Lower (Name)); - subtype Result is String (1 .. Value'Length); - begin - return Result (Value); - end; - end if; + declare + Value : constant String := Simple_Name_Internal (Name); + subtype Result is String (1 .. Value'Length); + begin + return Result (Value); + end; end if; end Simple_Name; @@ -1233,7 +1204,10 @@ package body Ada.Directories is -- Check the pattern begin - Pat := Compile (Pattern, Glob => True); + Pat := Compile + (Pattern, + Glob => True, + Case_Sensitive => Is_Path_Name_Case_Sensitive); exception when Error_In_Regexp => Free (Search.Value); @@ -1264,17 +1238,4 @@ package body Ada.Directories is Search.Value.Is_Valid := True; end Start_Search; - ---------------------------------- - -- To_Lower_If_Case_Insensitive -- - ---------------------------------- - - procedure To_Lower_If_Case_Insensitive (S : in out String) is - begin - if not Is_Path_Name_Case_Sensitive then - for J in S'Range loop - S (J) := To_Lower (S (J)); - end loop; - end if; - end To_Lower_If_Case_Insensitive; - end Ada.Directories; |