diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-06-20 19:02:25 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-06-20 19:02:25 +0200 |
commit | 1d19b22b3851a92ca908581b006b5642e9fc651e (patch) | |
tree | ccc4ce9bbb9bd363263c43af7c2820116900b247 | |
parent | 1a45a56d43d621a25bbeee8f39c88924b2083e60 (diff) | |
download | ghdl-1d19b22b3851a92ca908581b006b5642e9fc651e.tar.gz ghdl-1d19b22b3851a92ca908581b006b5642e9fc651e.tar.bz2 ghdl-1d19b22b3851a92ca908581b006b5642e9fc651e.zip |
files_map: change the meaning of Get_Buffer_Length for
-rw-r--r-- | src/files_map-editor.adb | 3 | ||||
-rw-r--r-- | src/files_map.adb | 2 | ||||
-rw-r--r-- | src/files_map.ads | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/files_map-editor.adb b/src/files_map-editor.adb index ad04973dc..fb5721a47 100644 --- a/src/files_map-editor.adb +++ b/src/files_map-editor.adb @@ -393,6 +393,7 @@ package body Files_Map.Editor is Buf_Len : constant Source_Ptr := Get_Buffer_Length (File); begin if Text_Len + 2 > Buf_Len then + -- Buffer is too small! raise Constraint_Error; end if; @@ -401,6 +402,8 @@ package body Files_Map.Editor is Text_Ptr (Source_Ptr_Org .. Source_Ptr_Org + Text_Len - 1); end if; Set_File_Length (File, Text_Len); + + -- Move the gap after the two terminal EOT. Set_Gap (File, Text_Len + 2, Buf_Len - 1); -- Clear cache. diff --git a/src/files_map.adb b/src/files_map.adb index 1f316b879..24917592c 100644 --- a/src/files_map.adb +++ b/src/files_map.adb @@ -909,7 +909,7 @@ package body Files_Map is pragma Assert (File <= Source_Files.Last); F : Source_File_Record renames Source_Files.Table (File); begin - return Source_Ptr (F.Last_Location - F.First_Location - 1); + return Source_Ptr (F.Last_Location - F.First_Location + 1); end Get_Buffer_Length; -- Return the name of the file. diff --git a/src/files_map.ads b/src/files_map.ads index 41e37751e..a72c75d07 100644 --- a/src/files_map.ads +++ b/src/files_map.ads @@ -108,7 +108,7 @@ package Files_Map is procedure Set_File_Length (File : Source_File_Entry; Length : Source_Ptr); function Get_File_Length (File : Source_File_Entry) return Source_Ptr; - -- Get the length of the buffer, which includes the gap, but not the + -- Get the length of the buffer, which includes the gap and the -- two terminal EOT. function Get_Buffer_Length (File : Source_File_Entry) return Source_Ptr; |