OSDN Git Service

* 1aexcept.adb, 1aexcept.ads, 1ic.ads, 1ssecsta.adb,
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-stwifi.adb
index e998bcd..dc71f1b 100644 (file)
@@ -6,9 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                            $Revision: 1.17 $                             --
---                                                                          --
---          Copyright (C) 1992-1997 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
 -- covered by the  GNU Public License.                                      --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
-
 with Ada.Strings.Wide_Maps; use Ada.Strings.Wide_Maps;
 with Ada.Strings.Wide_Search;
 
@@ -158,9 +155,11 @@ package body Ada.Strings.Wide_Fixed is
 
       else
          declare
-            Result : constant Wide_String :=
-                       Source (Source'First .. From - 1) &
-                       Source (Through + 1 .. Source'Last);
+            Len    : constant Integer := Source'Length - (Through - From + 1);
+            Result : constant
+                       Wide_String (Source'First .. Source'First + Len - 1) :=
+                         Source (Source'First .. From - 1) &
+                         Source (Through + 1 .. Source'Last);
          begin
             return Result;
          end;
@@ -381,13 +380,15 @@ package body Ada.Strings.Wide_Fixed is
       else
          declare
             Result_Length : Natural :=
-                Natural'Max (Source'Length,
-                             Position - Source'First + New_Item'Length);
+                              Natural'Max
+                                (Source'Length,
+                                 Position - Source'First + New_Item'Length);
+
             Result : Wide_String (1 .. Result_Length);
 
          begin
             Result := Source (Source'First .. Position - 1) & New_Item &
-                     Source (Position + New_Item'Length .. Source'Last);
+                        Source (Position + New_Item'Length .. Source'Last);
             return Result;
          end;
       end if;