Express C code `part_length' in 512B blocks (as FILO does)
Signed-off-by: Nico Huber <nico.huber@secunet.com>
diff --git a/src/filo-fs.adb b/src/filo-fs.adb
index 91f86f0..bc4c246 100644
--- a/src/filo-fs.adb
+++ b/src/filo-fs.adb
@@ -18,10 +18,19 @@
Convention => C,
External_Name => "filepos";
+ pragma Warnings
+ (GNAT, Off, "condition can only be False*",
+ Reason => "Depends on `unsigned long` size.");
+ pragma Warnings
+ (GNAT, Off, "condition is always True",
+ Reason => "Depends on `unsigned long` size.");
function Part_Len return Partition_Length
is
- (Partition_Length (Unsigned_64'Min (
- Unsigned_64 (C_Part_Length), Unsigned_64 (Partition_Length'Last))));
+ (if Unsigned_64 (C_Part_Length) <= Unsigned_64 (Partition_Length'Last) / 512
+ then Partition_Length (C_Part_Length) * 512
+ else Partition_Length'Last);
+ pragma Warnings (GNAT, On, "condition can only be False*");
+ pragma Warnings (GNAT, On, "condition is always True");
function File_Max return File_Length is
begin