aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/files_map.adb1
-rw-r--r--src/files_map.ads7
2 files changed, 6 insertions, 2 deletions
diff --git a/src/files_map.adb b/src/files_map.adb
index fc7ba06e9..1f316b879 100644
--- a/src/files_map.adb
+++ b/src/files_map.adb
@@ -704,6 +704,7 @@ package body Files_Map is
(Directory : Name_Id; Name: Name_Id; Length : Source_Ptr)
return Source_File_Entry
is
+ pragma Assert (Length >= 2);
Res : Source_File_Entry;
begin
Res := Create_Source_File_Entry (Directory, Name);
diff --git a/src/files_map.ads b/src/files_map.ads
index e2b66fd7d..41e37751e 100644
--- a/src/files_map.ads
+++ b/src/files_map.ads
@@ -49,6 +49,7 @@ package Files_Map is
return Source_File_Entry;
-- Reserve an entry, but do not read any file.
+ -- The length should includes the two terminal EOT.
function Reserve_Source_File
(Directory : Name_Id; Name : Name_Id; Length : Source_Ptr)
return Source_File_Entry;
@@ -102,11 +103,13 @@ package Files_Map is
function Get_File_Buffer (File : Source_File_Entry) return File_Buffer_Ptr;
-- Set/Get the length of the file (which is less than the size of the
- -- file buffer). Set also append two EOT at the end of the file.
+ -- file buffer). The gap is not included in the length.
+ -- Set also append two EOT at the end of the file.
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.
+ -- Get the length of the buffer, which includes the gap, but not the
+ -- two terminal EOT.
function Get_Buffer_Length (File : Source_File_Entry) return Source_Ptr;
-- Return the name of the file.