summaryrefslogtreecommitdiff
path: root/gcc/ada/s-wchstw.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/s-wchstw.adb')
-rw-r--r--gcc/ada/s-wchstw.adb36
1 files changed, 18 insertions, 18 deletions
diff --git a/gcc/ada/s-wchstw.adb b/gcc/ada/s-wchstw.adb
index 2f09ba25e61..33f6674c6cb 100644
--- a/gcc/ada/s-wchstw.adb
+++ b/gcc/ada/s-wchstw.adb
@@ -121,18 +121,20 @@ package body System.WCh_StW is
-- String_To_Wide_String --
---------------------------
- function String_To_Wide_String
+ procedure String_To_Wide_String
(S : String;
- EM : WC_Encoding_Method) return Wide_String
+ R : out Wide_String;
+ L : out Natural;
+ EM : System.WCh_Con.WC_Encoding_Method)
is
- R : Wide_String (1 .. S'Length);
- RP : Natural;
SP : Natural;
V : UTF_32_Code;
begin
+ pragma Assert (S'First = 1);
+
SP := S'First;
- RP := 0;
+ L := 0;
while SP <= S'Last loop
Get_Next_Code (S, SP, V, EM);
@@ -141,36 +143,34 @@ package body System.WCh_StW is
with "out of range value for wide character";
end if;
- RP := RP + 1;
- R (RP) := Wide_Character'Val (V);
+ L := L + 1;
+ R (L) := Wide_Character'Val (V);
end loop;
-
- return R (1 .. RP);
end String_To_Wide_String;
--------------------------------
-- String_To_Wide_Wide_String --
--------------------------------
- function String_To_Wide_Wide_String
+ procedure String_To_Wide_Wide_String
(S : String;
- EM : WC_Encoding_Method) return Wide_Wide_String
+ R : out Wide_Wide_String;
+ L : out Natural;
+ EM : System.WCh_Con.WC_Encoding_Method)
is
- R : Wide_Wide_String (1 .. S'Length);
- RP : Natural;
+ pragma Assert (S'First = 1);
+
SP : Natural;
V : UTF_32_Code;
begin
SP := S'First;
- RP := 0;
+ L := 0;
while SP <= S'Last loop
Get_Next_Code (S, SP, V, EM);
- RP := RP + 1;
- R (RP) := Wide_Wide_Character'Val (V);
+ L := L + 1;
+ R (L) := Wide_Wide_Character'Val (V);
end loop;
-
- return R (1 .. RP);
end String_To_Wide_Wide_String;
end System.WCh_StW;