summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2024-10-08 20:41:47 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2024-10-08 20:41:47 +1300
commit0c774f937f169f31f9b11136d3375901597f9269 (patch)
treeba45bf63374321c95eb0fccf1fc2acce14009ecc
parent3181961ad2eefb3a6d9151db99661411792d4097 (diff)
Cleaned up some assertionsHEADmaster
-rw-r--r--src/libsndfile-commands.adb3
-rw-r--r--src/libsndfile.adb11
-rw-r--r--src/libsndfile.ads7
3 files changed, 7 insertions, 14 deletions
diff --git a/src/libsndfile-commands.adb b/src/libsndfile-commands.adb
index 1939cd7..6bdd3cf 100644
--- a/src/libsndfile-commands.adb
+++ b/src/libsndfile-commands.adb
@@ -9,7 +9,6 @@ pragma Ada_2012;
with
- Ada.Assertions,
Ada.Strings.Fixed,
Interfaces.C.Strings;
@@ -496,7 +495,6 @@ package body Libsndfile.Commands is
Result : Long_Float_Array (1 .. Natural (File.Chans));
Code : Interfaces.C.int;
begin
- Ada.Assertions.Assert (Long_Float'Size = Interfaces.C.double'Size);
Code := sf_command
(File.Ptr,
sfc_calc_max_all_channels,
@@ -517,7 +515,6 @@ package body Libsndfile.Commands is
Result : Long_Float_Array (1 .. Natural (File.Chans));
Code : Interfaces.C.int;
begin
- Ada.Assertions.Assert (Long_Float'Size = Interfaces.C.double'Size);
Code := sf_command
(File.Ptr,
sfc_calc_norm_max_all_channels,
diff --git a/src/libsndfile.adb b/src/libsndfile.adb
index 7cc9837..25cfd42 100644
--- a/src/libsndfile.adb
+++ b/src/libsndfile.adb
@@ -9,7 +9,6 @@ pragma Ada_2012;
with
- Ada.Assertions,
Interfaces.C.Strings;
use type
@@ -893,7 +892,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Short_Integer'Size = Interfaces.C.short'Size);
return Count_Type (asf_readf_short (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Read_Short;
@@ -907,7 +905,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Integer'Size = Interfaces.C.int'Size);
return Count_Type (asf_readf_int (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Read_Integer;
@@ -921,7 +918,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Float'Size = Interfaces.C.C_float'Size);
return Count_Type (asf_readf_float (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Read_Float;
@@ -935,7 +931,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Long_Float'Size = Interfaces.C.double'Size);
return Count_Type (asf_readf_double (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Read_Double;
@@ -949,7 +944,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Short_Integer'Size = Interfaces.C.short'Size);
return Count_Type (asf_writef_short (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Write_Short;
@@ -963,7 +957,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Integer'Size = Interfaces.C.int'Size);
return Count_Type (asf_writef_int (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Write_Integer;
@@ -977,7 +970,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Float'Size = Interfaces.C.C_float'Size);
return Count_Type (asf_writef_float (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Write_Float;
@@ -991,7 +983,6 @@ package body Libsndfile is
for Buffer'Address use Data'Address;
pragma Import (Ada, Buffer);
begin
- Ada.Assertions.Assert (Long_Float'Size = Interfaces.C.double'Size);
return Count_Type (asf_writef_double (File.Ptr, Buffer, Interfaces.Integer_64 (Frames)));
end Write_Double;
@@ -1001,7 +992,6 @@ package body Libsndfile is
Bytes : in Count_Type)
return Count_Type is
begin
- Ada.Assertions.Assert (Character'Size = 8);
return Count_Type (asf_read_raw
(File.Ptr,
Storage.To_Integer (Data'Address),
@@ -1014,7 +1004,6 @@ package body Libsndfile is
Bytes : in Count_Type)
return Count_Type is
begin
- Ada.Assertions.Assert (Character'Size = 8);
return Count_Type (asf_write_raw
(File.Ptr,
Storage.To_Integer (Data'Address),
diff --git a/src/libsndfile.ads b/src/libsndfile.ads
index 65ffeac..f996f9d 100644
--- a/src/libsndfile.ads
+++ b/src/libsndfile.ads
@@ -363,6 +363,13 @@ private
(c_pointer_size * Interfaces.C.CHAR_BIT = Storage.Integer_Address'Size,
"Size of C void pointers and size of Ada address values do not match");
+ -- More things that shouldn't fail unless something really weird happens
+ pragma Assert (Short_Integer'Size = Interfaces.C.short'Size);
+ pragma Assert (Integer'Size = Interfaces.C.int'Size);
+ pragma Assert (Float'Size = Interfaces.C.C_float'Size);
+ pragma Assert (Long_Float'Size = Interfaces.C.double'Size);
+ pragma Assert (Character'Size = Interfaces.C.CHAR_BIT);
+
pragma Inline (Is_Open);
pragma Inline (Write_Sync);