2009-06-25 Pascal Obry <obry@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Jun 2009 09:04:31 +0000 (09:04 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Jun 2009 09:04:31 +0000 (09:04 +0000)
* a-stwise.adb, a-stzsea.adb: Fix confusion between 'Length and 'Last.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148935 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/a-stwise.adb
gcc/ada/a-stzsea.adb

index 03f594b..e3524d5 100644 (file)
@@ -1,3 +1,7 @@
+2009-06-25  Pascal Obry  <obry@adacore.com>
+
+       * a-stwise.adb, a-stzsea.adb: Fix confusion between 'Length and 'Last.
+
 2009-06-25  Emmanuel Briot  <briot@adacore.com>
 
        * fmap.ads, make.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-env.adb,
index 3220c8f..3add82b 100644 (file)
@@ -88,8 +88,7 @@ package body Ada.Strings.Wide_Search is
       --  Unmapped case
 
       if Mapping'Address = Wide_Maps.Identity'Address then
-         Ind := Source'First;
-         while Ind <= Source'Length - PL1 loop
+         while Ind <= Source'Last - PL1 loop
             if Pattern = Source (Ind .. Ind + PL1) then
                Num := Num + 1;
                Ind := Ind + Pattern'Length;
@@ -101,8 +100,7 @@ package body Ada.Strings.Wide_Search is
       --  Mapped case
 
       else
-         Ind := Source'First;
-         while Ind <= Source'Length - PL1 loop
+         while Ind <= Source'Last - PL1 loop
             Cur := Ind;
             for K in Pattern'Range loop
                if Pattern (K) /= Value (Mapping, Source (Cur)) then
index d0a7f9d..a9743e6 100644 (file)
@@ -90,8 +90,7 @@ package body Ada.Strings.Wide_Wide_Search is
       --  Unmapped case
 
       if Mapping'Address = Wide_Wide_Maps.Identity'Address then
-         Ind := Source'First;
-         while Ind <= Source'Length - PL1 loop
+         while Ind <= Source'Last - PL1 loop
             if Pattern = Source (Ind .. Ind + PL1) then
                Num := Num + 1;
                Ind := Ind + Pattern'Length;
@@ -103,8 +102,7 @@ package body Ada.Strings.Wide_Wide_Search is
       --  Mapped case
 
       else
-         Ind := Source'First;
-         while Ind <= Source'Length - PL1 loop
+         while Ind <= Source'Last - PL1 loop
             Cur := Ind;
             for K in Pattern'Range loop
                if Pattern (K) /= Value (Mapping, Source (Cur)) then