From 3181961ad2eefb3a6d9151db99661411792d4097 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 8 Oct 2024 16:47:13 +1300 Subject: Changed System.Address to Integer_Address --- src/libsndfile.ads | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/libsndfile.ads') 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"); -- cgit