aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-files_operations.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/grt/grt-files_operations.adb')
-rw-r--r--src/grt/grt-files_operations.adb19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/grt/grt-files_operations.adb b/src/grt/grt-files_operations.adb
index ed15f7fa0..c7770b5f3 100644
--- a/src/grt/grt-files_operations.adb
+++ b/src/grt/grt-files_operations.adb
@@ -528,14 +528,14 @@ package body Grt.Files_Operations is
Status := Op_Ok;
end Ghdl_Text_Read_Length;
- procedure Ghdl_Untruncated_Text_Read
- (File : Ghdl_File_Index; Str : Std_String_Ptr; Len : out Std_Integer;
- Status : out Op_Status)
+ procedure Ghdl_Untruncated_Text_Read (File : Ghdl_File_Index;
+ Buf : Ghdl_C_String;
+ Len : in out Std_Integer;
+ Status : out Op_Status)
is
Stream : C_Files;
Max_Len : int;
begin
- Len := 0;
Get_File (File, Stream, Status);
if Status /= Op_Ok then
return;
@@ -545,19 +545,14 @@ package body Grt.Files_Operations is
return;
end if;
- Max_Len := int (Str.Bounds.Dim_1.Length);
- if fgets (Str.Base (0)'Address, Max_Len, Stream) = Null_Address then
+ Max_Len := int (Len);
+ if fgets (To_Address (Buf), Max_Len, Stream) = Null_Address then
Status := Op_End_Of_File;
return;
end if;
-- Compute the length.
- for I in Ghdl_Index_Type loop
- if Str.Base (I) = NUL then
- Len := Std_Integer (I);
- exit;
- end if;
- end loop;
+ Len := Std_Integer (strlen (Buf));
Status := Op_Ok;
end Ghdl_Untruncated_Text_Read;