aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-files_operations.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-11-16 08:05:59 +0100
committerTristan Gingold <tgingold@free.fr>2019-11-16 08:05:59 +0100
commit706fd3a64ca9d55591542d0488b87698e3835c21 (patch)
tree08673255458c20801c8d77a0149538935203220f /src/grt/grt-files_operations.adb
parent2d50cc903f5cf5eb55ebdc082c9ccb7168e75987 (diff)
downloadghdl-706fd3a64ca9d55591542d0488b87698e3835c21.tar.gz
ghdl-706fd3a64ca9d55591542d0488b87698e3835c21.tar.bz2
ghdl-706fd3a64ca9d55591542d0488b87698e3835c21.zip
synth: handle untruncated_text_read.
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;