summaryrefslogtreecommitdiff
path: root/src/libsndfile.ads
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2024-10-08 16:47:13 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2024-10-08 16:47:13 +1300
commit3181961ad2eefb3a6d9151db99661411792d4097 (patch)
tree30cd06dc02cda116f146bd43b42a7132a150faf2 /src/libsndfile.ads
parent79c1381d198f5b4ae1b75210971a8ccea1049bad (diff)
Changed System.Address to Integer_Address
Diffstat (limited to 'src/libsndfile.ads')
-rw-r--r--src/libsndfile.ads29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/libsndfile.ads b/src/libsndfile.ads
index ad82d0c..65ffeac 100644
--- a/src/libsndfile.ads
+++ b/src/libsndfile.ads
@@ -14,7 +14,7 @@ with
private with
Interfaces.C,
- System;
+ System.Storage_Elements;
package Libsndfile is
@@ -343,8 +343,27 @@ package Libsndfile is
private
+ package Storage renames System.Storage_Elements;
+ use type Interfaces.C.size_t, Storage.Integer_Address;
+
+
+ Null_Pointer : constant Storage.Integer_Address := Storage.To_Integer (System.Null_Address);
+
+
pragma Linker_Options ("-lsndfile");
+
+ function c_pointer_size
+ return Interfaces.C.size_t;
+ pragma Import (C, c_pointer_size, "c_pointer_size");
+
+ -- If this fails then we are on an architecture that for whatever reason
+ -- has significant problems interfacing between C and Ada
+ pragma Assert
+ (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");
+
+
pragma Inline (Is_Open);
pragma Inline (Write_Sync);
pragma Inline (Read_Raw);
@@ -353,9 +372,9 @@ private
type Sound_File is tagged limited record
- Ptr : System.Address := System.Null_Address;
- FMode : File_Mode := Read_Only;
- Chans : Interfaces.C.int := 0;
+ Ptr : Storage.Integer_Address := Null_Pointer;
+ FMode : File_Mode := Read_Only;
+ Chans : Interfaces.C.int := 0;
end record;
@@ -441,7 +460,7 @@ private
function sf_error
- (File : in System.Address)
+ (File : in Storage.Integer_Address)
return Interfaces.C.int;
pragma Import (C, sf_error, "sf_error");