diff --git a/include/aaruformat/decls.h b/include/aaruformat/decls.h index 24b7db8..369a579 100644 --- a/include/aaruformat/decls.h +++ b/include/aaruformat/decls.h @@ -138,7 +138,7 @@ AARU_EXPORT uint32_t AARU_CALL aaruf_edc_cd_compute(void *context, uint32_t edc, AARU_EXPORT int32_t AARU_CALL aaruf_read_track_sector(void *context, uint8_t *data, uint64_t sector_address, uint32_t *length, uint8_t track); -int32_t aaruf_read_sector_tag(const void *context, uint64_t sector_address, bool negative, uint8_t *buffer, +AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_tag(const void *context, uint64_t sector_address, bool negative, uint8_t *buffer, uint32_t *length, int32_t tag); AARU_LOCAL int32_t AARU_CALL aaruf_get_media_tag_type_for_datatype(int32_t type); diff --git a/src/blocks/optical.c b/src/blocks/optical.c index a12481b..bba198d 100644 --- a/src/blocks/optical.c +++ b/src/blocks/optical.c @@ -278,7 +278,7 @@ void process_tracks_block(aaruformat_context *ctx, const IndexEntry *entry) * (size / sizeof(TrackEntry)) entries. * 5. Free the buffer and close the image when done. */ -int32_t aaruf_get_tracks(const void *context, uint8_t *buffer, size_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_tracks(const void *context, uint8_t *buffer, size_t *length) { TRACE("Entering aaruf_get_tracks(%p, %p, %zu)", context, buffer, (length ? *length : 0)); @@ -389,7 +389,7 @@ int32_t aaruf_get_tracks(const void *context, uint8_t *buffer, size_t *length) * 3. To clear all tracks later call aaruf_set_tracks(ctx, NULL, 0). * 4. Use aaruf_get_tracks() afterwards to retrieve them if needed. */ -int32_t aaruf_set_tracks(void *context, TrackEntry *tracks, const int count) +AARU_EXPORT int32_t AARU_CALL aaruf_set_tracks(void *context, TrackEntry *tracks, const int count) { TRACE("Entering aaruf_set_tracks(%p, %p, %d)", context, tracks, count); diff --git a/src/blocks/tape.c b/src/blocks/tape.c index d5ace15..e3afa26 100644 --- a/src/blocks/tape.c +++ b/src/blocks/tape.c @@ -566,8 +566,8 @@ void process_tape_partitions_block(aaruformat_context *ctx, const IndexEntry *en * @see tapeFileHashEntry for the hash table entry structure * @see aaruf_get_tape_partition() for partition-level queries (if available) */ -int32_t aaruf_get_tape_file(const void *context, const uint8_t partition, const uint32_t file, uint64_t *starting_block, - uint64_t *ending_block) +AARU_EXPORT int32_t AARU_CALL aaruf_get_tape_file(const void *context, const uint8_t partition, const uint32_t file, + uint64_t *starting_block, uint64_t *ending_block) { TRACE("Entering aaruf_get_tape_file(%p, %d, %d, %llu, %llu)", context, partition, file, *starting_block, *ending_block); @@ -767,8 +767,8 @@ int32_t aaruf_get_tape_file(const void *context, const uint8_t partition, const * @see TapeFileEntry for the structure defining file block ranges * @see tapeFileHashEntry for the hash table entry structure */ -int32_t aaruf_set_tape_file(void *context, const uint8_t partition, const uint32_t file, const uint64_t starting_block, - const uint64_t ending_block) +AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_file(void *context, const uint8_t partition, const uint32_t file, + const uint64_t starting_block, const uint64_t ending_block) { TRACE("Entering aaruf_set_tape_file(%p, %d, %d, %llu, %llu)", context, partition, file, starting_block, ending_block); @@ -979,8 +979,8 @@ int32_t aaruf_set_tape_file(void *context, const uint8_t partition, const uint32 * @see aaruf_get_tape_file() for file-level queries within partitions * @see aaruf_set_tape_partition() for setting partition information during write */ -int32_t aaruf_get_tape_partition(const void *context, const uint8_t partition, uint64_t *starting_block, - uint64_t *ending_block) +AARU_EXPORT int32_t AARU_CALL aaruf_get_tape_partition(const void *context, const uint8_t partition, + uint64_t *starting_block, uint64_t *ending_block) { TRACE("Entering aaruf_get_tape_partition(%p, %d, %llu, %llu)", context, partition, *starting_block, *ending_block); @@ -1193,8 +1193,8 @@ int32_t aaruf_get_tape_partition(const void *context, const uint8_t partition, u * @see TapePartitionHashEntry for the hash table entry structure * @see aaruf_set_tape_file() for setting file metadata within partitions */ -int32_t aaruf_set_tape_partition(void *context, const uint8_t partition, const uint64_t starting_block, - const uint64_t ending_block) +AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_partition(void *context, const uint8_t partition, + const uint64_t starting_block, const uint64_t ending_block) { TRACE("Entering aaruf_set_tape_partition(%p, %d, %llu, %llu)", context, partition, starting_block, ending_block); diff --git a/src/checksum/ecc_cd.c b/src/checksum/ecc_cd.c index 6a4d44c..4399a66 100644 --- a/src/checksum/ecc_cd.c +++ b/src/checksum/ecc_cd.c @@ -32,7 +32,7 @@ * * @return Pointer to the initialized CdEccContext structure, or NULL on failure. */ -void *aaruf_ecc_cd_init() +AARU_EXPORT void *AARU_CALL aaruf_ecc_cd_init() { TRACE("Entering aaruf_ecc_cd_init()"); CdEccContext *context = NULL; @@ -98,7 +98,7 @@ void *aaruf_ecc_cd_init() * @param sector Pointer to the sector data. * @return true if the suffix is correct, false otherwise. */ -bool aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector) +AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector) { TRACE("Entering aaruf_ecc_cd_is_suffix_correct(%p, %p)", context, sector); uint32_t edc; @@ -162,7 +162,7 @@ bool aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector) * @param sector Pointer to the sector data. * @return true if the suffix is correct, false otherwise. */ -bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector) +AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector) { TRACE("Entering aaruf_ecc_cd_is_suffix_correct_mode2(%p, %p)", context, sector); uint32_t edc; @@ -224,10 +224,11 @@ bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector) * @param ecc_offset Offset for the ECC field. * @return true if ECC is correct, false otherwise. */ -bool aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count, - const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc, - const uint8_t *ecc, const int32_t address_offset, const int32_t data_offset, - const int32_t ecc_offset) +AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data, + const uint32_t major_count, const uint32_t minor_count, + const uint32_t major_mult, const uint32_t minor_inc, const uint8_t *ecc, + const int32_t address_offset, const int32_t data_offset, + const int32_t ecc_offset) { TRACE("Entering aaruf_ecc_cd_check(%p, %p, %p, %u, %u, %u, %u, %p, %d, %d, %d)", context, address, data, major_count, minor_count, major_mult, minor_inc, ecc, address_offset, data_offset, ecc_offset); @@ -289,9 +290,11 @@ bool aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *da * @param data_offset Offset for the data field. * @param ecc_offset Offset for the ECC field. */ -void aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count, - const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc, uint8_t *ecc, - const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset) +AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data, + const uint32_t major_count, const uint32_t minor_count, + const uint32_t major_mult, const uint32_t minor_inc, uint8_t *ecc, + const int32_t address_offset, const int32_t data_offset, + const int32_t ecc_offset) { TRACE("Entering aaruf_ecc_cd_write(%p, %p, %p, %u, %u, %u, %u, %p, %d, %d, %d)", context, address, data, major_count, minor_count, major_mult, minor_inc, ecc, address_offset, data_offset, ecc_offset); @@ -346,8 +349,9 @@ void aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *da * @param data_offset Offset for the data field. * @param ecc_offset Offset for the ECC field. */ -void aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data, uint8_t *ecc, - const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset) +AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data, + uint8_t *ecc, const int32_t address_offset, + const int32_t data_offset, const int32_t ecc_offset) { TRACE("Entering aaruf_ecc_cd_write_sector(%p, %p, %p, %p, %d, %d, %d)", context, address, data, ecc, address_offset, data_offset, ecc_offset); @@ -367,7 +371,7 @@ void aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint * @param second Pointer to store the second value. * @param frame Pointer to store the frame value. */ -void aaruf_cd_lba_to_msf(const int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame) +AARU_LOCAL void AARU_CALL aaruf_cd_lba_to_msf(const int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame) { TRACE("Entering aaruf_cd_lba_to_msf(%lld, %p, %p, %p)", pos, minute, second, frame); @@ -385,9 +389,9 @@ void aaruf_cd_lba_to_msf(const int64_t pos, uint8_t *minute, uint8_t *second, ui * @param type Track type (mode). * @param lba Logical Block Address. */ -void aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, const uint8_t type, const int64_t lba) +AARU_EXPORT void AARU_CALL aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, const uint8_t type, const int64_t lba) { - TRACE("Entering aaruf_ecc_cd_reconstruct_prefix(%p, %u, %lld)", sector, type, lba); + TRACE("Entering aaruf_cd_reconstruct_prefix(%p, %u, %lld)", sector, type, lba); uint8_t minute, second, frame; @@ -452,7 +456,7 @@ void aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, const uint8_t type, const * @param sector Pointer to the sector data (must be 2352 bytes). * @param type Track type (mode). */ -void aaruf_ecc_cd_reconstruct(void *context, uint8_t *sector, const uint8_t type) +AARU_EXPORT void AARU_CALL aaruf_ecc_cd_reconstruct(void *context, uint8_t *sector, const uint8_t type) { TRACE("Entering aaruf_ecc_cd_reconstruct(%p, %p, %u)", context, sector, type); @@ -540,7 +544,7 @@ void aaruf_ecc_cd_reconstruct(void *context, uint8_t *sector, const uint8_t type * @param pos Starting position in the data. * @return Computed EDC value. */ -uint32_t aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int size, int pos) +AARU_EXPORT uint32_t AARU_CALL aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int size, int pos) { TRACE("Entering aaruf_edc_cd_compute(%p, %u, %p, %d, %d)", context, edc, src, size, pos); diff --git a/src/checksum/md5.c b/src/checksum/md5.c index ec61354..17cc441 100644 --- a/src/checksum/md5.c +++ b/src/checksum/md5.c @@ -125,9 +125,9 @@ /* * The MD5 transformation for all four rounds. */ -#define STEP(f, a, b, c, d, x, t, s) \ +#define STEP(f, a, b, c, d, x, t, s) \ (a) += f((b), (c), (d)) + (x) + (uint32_t)(t); \ - (a) = ROTL32((a), (s)); \ + (a) = ROTL32((a), (s)); \ (a) += (b); /* @@ -159,27 +159,27 @@ * This processes one or more 64-byte data blocks, but does NOT update the bit * counters. There are no alignment requirements. */ -static FORCE_INLINE HOT void md5_process_block_loaded(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, - const unsigned char * AARU_RESTRICT ptr) +FORCE_INLINE HOT void md5_process_block_loaded(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, + const unsigned char *AARU_RESTRICT ptr) { - const uint32_t *wp = (const uint32_t *)ptr; // unaligned ok on supported arch (we gate optimized path) - uint32_t A = *a, B = *b, C = *c, D = *d; - uint32_t w0 = wp[0]; - uint32_t w1 = wp[1]; - uint32_t w2 = wp[2]; - uint32_t w3 = wp[3]; - uint32_t w4 = wp[4]; - uint32_t w5 = wp[5]; - uint32_t w6 = wp[6]; - uint32_t w7 = wp[7]; - uint32_t w8 = wp[8]; - uint32_t w9 = wp[9]; - uint32_t w10 = wp[10]; - uint32_t w11 = wp[11]; - uint32_t w12 = wp[12]; - uint32_t w13 = wp[13]; - uint32_t w14 = wp[14]; - uint32_t w15 = wp[15]; + const uint32_t *wp = (const uint32_t *)ptr; // unaligned ok on supported arch (we gate optimized path) + uint32_t A = *a, B = *b, C = *c, D = *d; + uint32_t w0 = wp[0]; + uint32_t w1 = wp[1]; + uint32_t w2 = wp[2]; + uint32_t w3 = wp[3]; + uint32_t w4 = wp[4]; + uint32_t w5 = wp[5]; + uint32_t w6 = wp[6]; + uint32_t w7 = wp[7]; + uint32_t w8 = wp[8]; + uint32_t w9 = wp[9]; + uint32_t w10 = wp[10]; + uint32_t w11 = wp[11]; + uint32_t w12 = wp[12]; + uint32_t w13 = wp[13]; + uint32_t w14 = wp[14]; + uint32_t w15 = wp[15]; uint32_t sA = A, sB = B, sC = C, sD = D; @@ -267,8 +267,8 @@ static FORCE_INLINE HOT void md5_process_block_loaded(uint32_t *a, uint32_t *b, */ static HOT const void *body(md5_ctx *ctx, const void *data, unsigned long size) { - const unsigned char * AARU_RESTRICT ptr = (const unsigned char *)data; - uint32_t a = ctx->a, b = ctx->b, c = ctx->c, d = ctx->d; + const unsigned char *AARU_RESTRICT ptr = (const unsigned char *)data; + uint32_t a = ctx->a, b = ctx->b, c = ctx->c, d = ctx->d; #if (defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) #if MD5_MAX_UNROLL >= 8 @@ -287,7 +287,7 @@ static HOT const void *body(md5_ctx *ctx, const void *data, unsigned long size) md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 5); md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 6); md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 7); - ptr += 512; + ptr += 512; size -= 512; } #endif @@ -322,8 +322,8 @@ static HOT const void *body(md5_ctx *ctx, const void *data, unsigned long size) #if MD5_ENABLE_PREFETCH if(size >= 64 * (MD5_PREFETCH_DISTANCE_BLOCKS)) { - __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS/2), 0, 3); - __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS/2 + 2), 0, 3); + __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS / 2), 0, 3); + __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS / 2 + 2), 0, 3); } #endif md5_process_block_loaded(&a, &b, &c, &d, ptr); @@ -332,9 +332,9 @@ static HOT const void *body(md5_ctx *ctx, const void *data, unsigned long size) } #else // Fallback original loop - uint32_t saved_a, saved_b, saved_c, saved_d; + uint32_t saved_a, saved_b, saved_c, saved_d; const unsigned char *p2 = ptr; - unsigned long sz = size; + unsigned long sz = size; while(sz >= 64) { if(sz >= 64 * 8) @@ -347,7 +347,10 @@ static HOT const void *body(md5_ctx *ctx, const void *data, unsigned long size) __builtin_prefetch((const void *)(p2 + 64 * 6)); #endif } - saved_a = a; saved_b = b; saved_c = c; saved_d = d; + saved_a = a; + saved_b = b; + saved_c = c; + saved_d = d; STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) STEP(F, c, d, a, b, SET(2), 0x242070db, 17) @@ -412,13 +415,21 @@ static HOT const void *body(md5_ctx *ctx, const void *data, unsigned long size) STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) - a += saved_a; b += saved_b; c += saved_c; d += saved_d; - p2 += 64; sz -= 64; + a += saved_a; + b += saved_b; + c += saved_c; + d += saved_d; + p2 += 64; + sz -= 64; } - ptr = p2; size = sz; + ptr = p2; + size = sz; #endif - ctx->a = a; ctx->b = b; ctx->c = c; ctx->d = d; + ctx->a = a; + ctx->b = b; + ctx->c = c; + ctx->d = d; return ptr; } @@ -433,7 +444,7 @@ AARU_EXPORT void AARU_CALL aaruf_md5_init(md5_ctx *ctx) ctx->hi = 0; } -AARU_EXPORT void AARU_CALL aaruf_md5_update(md5_ctx *ctx, const void * AARU_RESTRICT data, unsigned long size) +AARU_EXPORT void AARU_CALL aaruf_md5_update(md5_ctx *ctx, const void *AARU_RESTRICT data, unsigned long size) { const uint32_t saved_lo = ctx->lo; @@ -462,8 +473,7 @@ AARU_EXPORT void AARU_CALL aaruf_md5_update(md5_ctx *ctx, const void * AARU_REST size &= 0x3f; } - if(size) - memcpy(ctx->buffer, data, size); + if(size) memcpy(ctx->buffer, data, size); } #define OUT(dst, src) \ diff --git a/src/close.c b/src/close.c index 826f1d1..f77c42c 100644 --- a/src/close.c +++ b/src/close.c @@ -3992,7 +3992,7 @@ static int32_t write_index_block(aaruformat_context *ctx) * @retval Propagated from a write helper if future helpers add more error codes. * @note On success the context memory itself is freed; the caller must not reuse the pointer. */ -int aaruf_close(void *context) +AARU_EXPORT int AARU_CALL aaruf_close(void *context) { TRACE("Entering aaruf_close(%p)", context); diff --git a/src/compression/cst.c b/src/compression/cst.c index 341f930..057e373 100644 --- a/src/compression/cst.c +++ b/src/compression/cst.c @@ -32,7 +32,7 @@ * @param length Length of the data buffer. * @return AARUF_STATUS_OK on success, or an error code on failure. */ -int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, const size_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, const size_t length) { uint8_t *p = NULL; uint8_t *q = NULL; @@ -190,7 +190,8 @@ int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, con * @param length Length of the data in bytes. * @return AARUF_STATUS_OK on success, or an error code on failure. */ -int32_t aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, const size_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, + const size_t length) { size_t i; diff --git a/src/create.c b/src/create.c index 3b609fb..39ce49c 100644 --- a/src/create.c +++ b/src/create.c @@ -276,10 +276,12 @@ static void cleanup_failed_create(aaruformat_context *ctx) * @see aaruf_set_tape_file() for defining tape file metadata * @see aaruf_set_tape_partition() for defining tape partition metadata */ -void *aaruf_create(const char *filepath, const uint32_t media_type, const uint32_t sector_size, - const uint64_t user_sectors, const uint64_t negative_sectors, const uint64_t overflow_sectors, - const char *options, const uint8_t *application_name, const uint8_t application_name_length, - const uint8_t application_major_version, const uint8_t application_minor_version, const bool is_tape) +AARU_EXPORT void AARU_CALL *aaruf_create(const char *filepath, const uint32_t media_type, const uint32_t sector_size, + const uint64_t user_sectors, const uint64_t negative_sectors, + const uint64_t overflow_sectors, const char *options, + const uint8_t *application_name, const uint8_t application_name_length, + const uint8_t application_major_version, + const uint8_t application_minor_version, const bool is_tape) { TRACE("Entering aaruf_create(%s, %u, %u, %llu, %llu, %llu, %s, %s, %u, %u, %u, %d)", filepath, media_type, sector_size, user_sectors, negative_sectors, overflow_sectors, options, diff --git a/src/dump.c b/src/dump.c index 5724d1e..517fdb6 100644 --- a/src/dump.c +++ b/src/dump.c @@ -183,7 +183,7 @@ static void free_dump_hardware_entries(DumpHardwareEntriesWithData *entries, uin * @see DumpExtent for the extent range structure definition. * @see process_dumphw_block() for the loading process during image opening. */ -int32_t aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length) { size_t length_value = 0; if(length != NULL) length_value = *length; @@ -528,7 +528,7 @@ int32_t aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length) * @see aaruf_get_dumphw() for retrieving dump hardware from opened images. * @see write_dumphw_block() for the serialization process during image closing. */ -int32_t aaruf_set_dumphw(void *context, uint8_t *data, size_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_dumphw(void *context, uint8_t *data, size_t length) { TRACE("Entering aaruf_set_dumphw(%p, %p, %zu)", context, data, length); diff --git a/src/helpers.c b/src/helpers.c index efce319..d2c68c2 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -28,7 +28,7 @@ * @param type Image data type identifier. * @return Corresponding Aaru media tag type, or -1 if not found. */ -int32_t aaruf_get_media_tag_type_for_datatype(const int32_t type) +AARU_LOCAL int32_t AARU_CALL aaruf_get_media_tag_type_for_datatype(const int32_t type) { switch(type) { @@ -186,7 +186,7 @@ int32_t aaruf_get_media_tag_type_for_datatype(const int32_t type) * @param tag_type Aaru media tag type identifier. * @return Corresponding image data type, or -1 if not found. */ -int32_t aaruf_get_datatype_for_media_tag_type(const int32_t tag_type) +AARU_LOCAL int32_t AARU_CALL aaruf_get_datatype_for_media_tag_type(const int32_t tag_type) { switch(tag_type) { @@ -336,7 +336,7 @@ int32_t aaruf_get_datatype_for_media_tag_type(const int32_t tag_type) } // Get the CICM XML media type from AARU media type -int32_t aaruf_get_xml_mediatype(const int32_t type) +AARU_LOCAL int32_t AARU_CALL aaruf_get_xml_mediatype(const int32_t type) { switch(type) { diff --git a/src/identify.c b/src/identify.c index de4370b..3b09f9f 100644 --- a/src/identify.c +++ b/src/identify.c @@ -81,7 +81,7 @@ * indicates the file appears to be AaruFormat but doesn't guarantee the * entire file is valid or uncorrupted. */ -int aaruf_identify(const char *filename) +AARU_EXPORT int AARU_CALL aaruf_identify(const char *filename) { if(filename == NULL) return EINVAL; @@ -160,7 +160,7 @@ int aaruf_identify(const char *filename) * @warning No error codes are returned for I/O failures during header reading. * Such failures result in a return value of 0 (not recognized). */ -int aaruf_identify_stream(FILE *image_stream) +AARU_EXPORT int AARU_CALL aaruf_identify_stream(FILE *image_stream) { if(image_stream == NULL) return 0; diff --git a/src/metadata.c b/src/metadata.c index f0dc3a9..42880f0 100644 --- a/src/metadata.c +++ b/src/metadata.c @@ -91,7 +91,8 @@ * @warning Geometry values may not accurately represent physical device geometry, * especially for modern drives with zone-based recording or flash storage. */ -int32_t aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors_per_track) +AARU_EXPORT int32_t AARU_CALL aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *heads, + uint32_t *sectors_per_track) { TRACE("Entering aaruf_get_geometry(%p, %p, %p, %p)", context, cylinders, heads, sectors_per_track); @@ -226,8 +227,8 @@ int32_t aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *h * - Flash-based storage typically doesn't have meaningful CHS geometry * - Setting geometry for such media types is harmless but unnecessary */ -int32_t aaruf_set_geometry(void *context, const uint32_t cylinders, const uint32_t heads, - const uint32_t sectors_per_track) +AARU_EXPORT int32_t AARU_CALL aaruf_set_geometry(void *context, const uint32_t cylinders, const uint32_t heads, + const uint32_t sectors_per_track) { TRACE("Entering aaruf_set_geometry(%p, %u, %u, %u)", context, cylinders, heads, sectors_per_track); @@ -360,7 +361,8 @@ int32_t aaruf_set_geometry(void *context, const uint32_t cylinders, const uint32 * - Archival systems may incorrectly report missing volumes * - Restoration processes may fail if sequence is inconsistent */ -int32_t aaruf_set_media_sequence(void *context, const int32_t sequence, const int32_t last_sequence) +AARU_EXPORT int32_t AARU_CALL aaruf_set_media_sequence(void *context, const int32_t sequence, + const int32_t last_sequence) { TRACE("Entering aaruf_set_media_sequence(%p, %d, %d)", context, sequence, last_sequence); @@ -490,7 +492,7 @@ int32_t aaruf_set_media_sequence(void *context, const int32_t sequence, const in * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_creator(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_creator(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_creator(%p, %p, %d)", context, data, length); @@ -604,7 +606,7 @@ int32_t aaruf_set_creator(void *context, const uint8_t *data, const int32_t leng * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_comments(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_comments(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_comments(%p, %p, %d)", context, data, length); @@ -717,7 +719,7 @@ int32_t aaruf_set_comments(void *context, const uint8_t *data, const int32_t len * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_media_title(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_media_title(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_media_title(%p, %p, %d)", context, data, length); @@ -829,7 +831,7 @@ int32_t aaruf_set_media_title(void *context, const uint8_t *data, const int32_t * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_media_manufacturer(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_media_manufacturer(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_media_manufacturer(%p, %p, %d)", context, data, length); @@ -936,7 +938,7 @@ int32_t aaruf_set_media_manufacturer(void *context, const uint8_t *data, const i * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_media_model(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_media_model(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_media_model(%p, %p, %d)", context, data, length); @@ -1051,7 +1053,7 @@ int32_t aaruf_set_media_model(void *context, const uint8_t *data, const int32_t * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_media_serial_number(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_media_serial_number(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_media_serial_number(%p, %p, %d)", context, data, length); @@ -1173,7 +1175,7 @@ int32_t aaruf_set_media_serial_number(void *context, const uint8_t *data, const * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_media_barcode(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_media_barcode(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_media_barcode(%p, %p, %d)", context, data, length); @@ -1294,7 +1296,7 @@ int32_t aaruf_set_media_barcode(void *context, const uint8_t *data, const int32_ * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_media_part_number(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_media_part_number(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_media_part_number(%p, %p, %d)", context, data, length); @@ -1409,7 +1411,7 @@ int32_t aaruf_set_media_part_number(void *context, const uint8_t *data, const in * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_drive_manufacturer(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_manufacturer(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_drive_manufacturer(%p, %p, %d)", context, data, length); @@ -1531,7 +1533,7 @@ int32_t aaruf_set_drive_manufacturer(void *context, const uint8_t *data, const i * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_drive_model(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_model(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_drive_model(%p, %p, %d)", context, data, length); @@ -1655,7 +1657,7 @@ int32_t aaruf_set_drive_model(void *context, const uint8_t *data, const int32_t * @warning The metadata block is only written to the image file during aaruf_close(). * Changes made by this function are not immediately persisted. */ -int32_t aaruf_set_drive_serial_number(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_serial_number(void *context, const uint8_t *data, const int32_t length) { TRACE("Entering aaruf_set_drive_serial_number(%p, %p, %d)", context, data, length); @@ -1790,7 +1792,8 @@ int32_t aaruf_set_drive_serial_number(void *context, const uint8_t *data, const * - May include letters, numbers, dots, or other characters * - Should be recorded exactly as reported by the device */ -int32_t aaruf_set_drive_firmware_revision(void *context, const uint8_t *data, const int32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_firmware_revision(void *context, const uint8_t *data, + const int32_t length) { TRACE("Entering aaruf_set_drive_firmware_revision(%p, %p, %d)", context, data, length); @@ -1941,7 +1944,7 @@ int32_t aaruf_set_drive_firmware_revision(void *context, const uint8_t *data, co * @see CicmMetadataBlock for the on-disk structure definition. * @see aaruf_set_cicm_metadata() for embedding CICM XML during image creation. */ -int32_t aaruf_get_cicm_metadata(const void *context, uint8_t *buffer, size_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_cicm_metadata(const void *context, uint8_t *buffer, size_t *length) { TRACE("Entering aaruf_get_cicm_metadata(%p, %p, %p)", context, buffer, length); @@ -2096,7 +2099,7 @@ int32_t aaruf_get_cicm_metadata(const void *context, uint8_t *buffer, size_t *le * @see aaruf_get_cicm_metadata() for retrieving CICM XML metadata. * @see process_aaru_metadata_json_block() for the loading process during image opening. */ -int32_t aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_t *length) { TRACE("Entering aaruf_get_aaru_json_metadata(%p, %p, %p)", context, buffer, length); @@ -2255,7 +2258,7 @@ int32_t aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_ * @see aaruf_get_aaru_json_metadata() for retrieving Aaru JSON from opened images. * @see write_aaru_json_block() for the serialization process during image closing. */ -int32_t aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length) { TRACE("Entering aaruf_set_aaru_json_metadata(%p, %p, %d)", context, data, length); @@ -2334,7 +2337,7 @@ int32_t aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length * @note The function does not validate logical consistency (e.g., whether sequence <= last_sequence); * it simply returns the values stored in the image header. */ -int32_t aaruf_get_media_sequence(const void *context, int32_t *sequence, int32_t *last_sequence) +AARU_EXPORT int32_t AARU_CALL aaruf_get_media_sequence(const void *context, int32_t *sequence, int32_t *last_sequence) { TRACE("Entering aaruf_get_media_sequence(%p, %p, %p)", context, sequence, last_sequence); @@ -2401,7 +2404,7 @@ int32_t aaruf_get_media_sequence(const void *context, int32_t *sequence, int32_t * @note The function does not allocate memory. Callers are responsible for ensuring @p buffer is * large enough before requesting the data. */ -int32_t aaruf_get_creator(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_creator(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_creator(%p, %p, %p)", context, buffer, length); @@ -2473,7 +2476,7 @@ int32_t aaruf_get_creator(const void *context, uint8_t *buffer, int32_t *length) * @note Comments are stored exactly as provided during image creation and may include multi-line text * or other control characters. No validation or normalization is applied by the library. */ -int32_t aaruf_get_comments(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_comments(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_comments(%p, %p, %p)", context, buffer, length); @@ -2543,7 +2546,7 @@ int32_t aaruf_get_comments(const void *context, uint8_t *buffer, int32_t *length * @note Titles may contain international characters, control codes, or mixed casing. The library does * not attempt to sanitize or interpret the string. */ -int32_t aaruf_get_media_title(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_media_title(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_media_title(%p, %p, %p)", context, buffer, length); @@ -2613,7 +2616,7 @@ int32_t aaruf_get_media_title(const void *context, uint8_t *buffer, int32_t *len * @note Values may include trailing spaces or vendor-specific capitalization. Treat the returned data * as authoritative and avoid trimming unless required by the consuming application. */ -int32_t aaruf_get_media_manufacturer(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_media_manufacturer(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_media_manufacturer(%p, %p, %p)", context, buffer, length); @@ -2683,7 +2686,7 @@ int32_t aaruf_get_media_manufacturer(const void *context, uint8_t *buffer, int32 * @note Model strings often contain performance ratings (e.g., "16x", "LTO-7"). The data is opaque and * should be handled without modification unless necessary. */ -int32_t aaruf_get_media_model(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_media_model(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_media_model(%p, %p, %p)", context, buffer, length); @@ -2753,7 +2756,7 @@ int32_t aaruf_get_media_model(const void *context, uint8_t *buffer, int32_t *len * @note Serial numbers may contain spaces, hyphens, or alphanumeric characters. The library does not * normalize or validate these strings. */ -int32_t aaruf_get_media_serial_number(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_media_serial_number(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_media_serial_number(%p, %p, %p)", context, buffer, length); @@ -2822,7 +2825,7 @@ int32_t aaruf_get_media_serial_number(const void *context, uint8_t *buffer, int3 * @note Barcode values can be strict alphanumeric codes (e.g., LTO cartridge IDs) or full strings from * custom labeling systems. Preserve the returned string exactly for catalog interoperability. */ -int32_t aaruf_get_media_barcode(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_media_barcode(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_media_barcode(%p, %p, %p)", context, buffer, length); @@ -2893,7 +2896,7 @@ int32_t aaruf_get_media_barcode(const void *context, uint8_t *buffer, int32_t *l * @note Part numbers may include manufacturer-specific formatting such as hyphens or suffix letters. * The library stores and returns the data verbatim. */ -int32_t aaruf_get_media_part_number(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_media_part_number(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_media_part_number(%p, %p, %p)", context, buffer, length); @@ -2965,7 +2968,7 @@ int32_t aaruf_get_media_part_number(const void *context, uint8_t *buffer, int32_ * @note The returned manufacturer string corresponds to the value recorded by aaruf_set_drive_manufacturer() * and may include branding or OEM designations. */ -int32_t aaruf_get_drive_manufacturer(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_manufacturer(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_drive_manufacturer(%p, %p, %p)", context, buffer, length); @@ -3035,7 +3038,7 @@ int32_t aaruf_get_drive_manufacturer(const void *context, uint8_t *buffer, int32 * @note Model strings can include firmware suffixes, interface hints, or OEM variations. Consume the * data verbatim to maintain accurate provenance records. */ -int32_t aaruf_get_drive_model(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_model(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_drive_model(%p, %p, %p)", context, buffer, length); @@ -3105,7 +3108,7 @@ int32_t aaruf_get_drive_model(const void *context, uint8_t *buffer, int32_t *len * @note Serial numbers are stored exactly as returned by the imaging hardware and may include leading * zeros or spacing that should be preserved. */ -int32_t aaruf_get_drive_serial_number(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_serial_number(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_drive_serial_number(%p, %p, %p)", context, buffer, length); @@ -3175,7 +3178,7 @@ int32_t aaruf_get_drive_serial_number(const void *context, uint8_t *buffer, int3 * @note Firmware revision formats vary between manufacturers (e.g., numeric, alphanumeric, dot-separated). * The library stores the data verbatim without attempting normalization. */ -int32_t aaruf_get_drive_firmware_revision(const void *context, uint8_t *buffer, int32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_firmware_revision(const void *context, uint8_t *buffer, int32_t *length) { TRACE("Entering aaruf_get_drive_firmware_revision(%p, %p, %p)", context, buffer, length); @@ -3289,7 +3292,7 @@ int32_t aaruf_get_drive_firmware_revision(const void *context, uint8_t *buffer, * - For forensic images, ensure it matches the source medium exactly * - For virtual disks, set it to the desired capacity */ -int32_t aaruf_get_user_sectors(const void *context, uint64_t *sectors) +AARU_EXPORT int32_t AARU_CALL aaruf_get_user_sectors(const void *context, uint64_t *sectors) { TRACE("Entering aaruf_get_user_sectors(%p, %p)", context, sectors); @@ -3414,7 +3417,7 @@ int32_t aaruf_get_user_sectors(const void *context, uint64_t *sectors) * (e.g., CSS on DVDs, AACS on Blu-rays). Handle this data according to * applicable laws and licensing agreements. */ -int32_t aaruf_get_negative_sectors(const void *context, uint16_t *sectors) +AARU_EXPORT int32_t AARU_CALL aaruf_get_negative_sectors(const void *context, uint16_t *sectors) { TRACE("Entering aaruf_get_negative_sectors(%p, %p)", context, sectors); @@ -3549,7 +3552,7 @@ int32_t aaruf_get_negative_sectors(const void *context, uint16_t *sectors) * of overflow sectors in an image indicates the imaging drive was capable of * reading these extended areas, but other drives may not be able to access them. */ -int32_t aaruf_get_overflow_sectors(const void *context, uint16_t *sectors) +AARU_EXPORT int32_t AARU_CALL aaruf_get_overflow_sectors(const void *context, uint16_t *sectors) { TRACE("Entering aaruf_get_overflow_sectors(%p, %p)", context, sectors); @@ -3631,7 +3634,7 @@ int32_t aaruf_get_overflow_sectors(const void *context, uint16_t *sectors) * aaruf_open() or populated during aaruf_create(). It does not perform * file I/O operations. */ -int32_t aaruf_get_image_info(const void *context, ImageInfo *image_info) +AARU_EXPORT int32_t AARU_CALL aaruf_get_image_info(const void *context, ImageInfo *image_info) { TRACE("Entering aaruf_get_image_info(%p, %p)", context, image_info); diff --git a/src/open.c b/src/open.c index 5219201..b2d5195 100644 --- a/src/open.c +++ b/src/open.c @@ -122,7 +122,7 @@ static void cleanup_open_failure(aaruformat_context *ctx) * @warning Some memory allocations (version strings) are optional and failure doesn't * prevent opening, but may affect functionality that depends on version information. */ -void *aaruf_open(const char *filepath) // NOLINT(readability-function-size) +AARU_EXPORT void AARU_CALL *aaruf_open(const char *filepath) // NOLINT(readability-function-size) { aaruformat_context *ctx = NULL; int error_no = 0; diff --git a/src/read.c b/src/read.c index c92358a..6049d4e 100644 --- a/src/read.c +++ b/src/read.c @@ -82,7 +82,7 @@ * @warning Media tag data is stored as-is from the original medium. No format * conversion or validation is performed on the tag content. */ -int32_t aaruf_read_media_tag(void *context, uint8_t *data, const int32_t tag, uint32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_read_media_tag(void *context, uint8_t *data, const int32_t tag, uint32_t *length) { const uint32_t initial_length = length == NULL ? 0U : *length; @@ -247,7 +247,8 @@ int32_t aaruf_read_media_tag(void *context, uint8_t *data, const int32_t tag, ui * @warning Sector addresses are zero-based. The maximum valid address is * ctx->imageInfo.Sectors - 1. */ -int32_t aaruf_read_sector(void *context, const uint64_t sector_address, bool negative, uint8_t *data, uint32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_read_sector(void *context, const uint64_t sector_address, bool negative, + uint8_t *data, uint32_t *length) { const uint32_t initial_length = length == NULL ? 0U : *length; @@ -660,8 +661,8 @@ int32_t aaruf_read_sector(void *context, const uint64_t sector_address, bool neg * @warning Track sequence numbers may not be contiguous. Always verify track * existence before assuming a track number is valid. */ -int32_t aaruf_read_track_sector(void *context, uint8_t *data, const uint64_t sector_address, uint32_t *length, - const uint8_t track) +AARU_EXPORT int32_t AARU_CALL aaruf_read_track_sector(void *context, uint8_t *data, const uint64_t sector_address, + uint32_t *length, const uint8_t track) { const uint32_t initial_length = length == NULL ? 0U : *length; @@ -812,8 +813,8 @@ int32_t aaruf_read_track_sector(void *context, uint8_t *data, const uint64_t sec * @warning Not all AaruFormat images contain the metadata necessary for long sector * reading. Some images may only support basic sector reading via aaruf_read_sector(). */ -int32_t aaruf_read_sector_long(void *context, const uint64_t sector_address, bool negative, uint8_t *data, - uint32_t *length) +AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_long(void *context, const uint64_t sector_address, bool negative, + uint8_t *data, uint32_t *length) { const uint32_t initial_length = length == NULL ? 0U : *length; @@ -1460,8 +1461,9 @@ int32_t aaruf_read_sector_long(void *context, const uint64_t sector_address, boo * @warning Some tags contain binary data without string termination (e.g., ISRC). * Do not treat tag buffers as null-terminated strings without validation. */ -int32_t aaruf_read_sector_tag(const void *context, const uint64_t sector_address, const bool negative, uint8_t *buffer, - uint32_t *length, const int32_t tag) +AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_tag(const void *context, const uint64_t sector_address, + const bool negative, uint8_t *buffer, uint32_t *length, + const int32_t tag) { const uint32_t initial_length = length == NULL ? 0U : *length; diff --git a/src/verify.c b/src/verify.c index 9bb7813..3b506f0 100644 --- a/src/verify.c +++ b/src/verify.c @@ -127,7 +127,7 @@ static int32_t update_crc64_from_stream(FILE *stream, const uint64_t total_lengt * @warning The function allocates a 1MB buffer for verification. Ensure sufficient * memory is available before calling this function on resource-constrained systems. */ -int32_t aaruf_verify_image(void *context) +AARU_EXPORT int32_t AARU_CALL aaruf_verify_image(void *context) { TRACE("Entering aaruf_verify_image(%p)", context); diff --git a/src/write.c b/src/write.c index d3e7f07..532185f 100644 --- a/src/write.c +++ b/src/write.c @@ -95,8 +95,8 @@ * @warning The function may trigger automatic block closure, which can result in disk I/O * operations and potential write errors even for seemingly simple sector writes. */ -int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative, const uint8_t *data, - uint8_t sector_status, uint32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_write_sector(void *context, uint64_t sector_address, bool negative, + const uint8_t *data, uint8_t sector_status, uint32_t length) { TRACE("Entering aaruf_write_sector(%p, %" PRIu64 ", %d, %p, %u, %u)", context, sector_address, negative, data, sector_status, length); @@ -529,8 +529,8 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative * @see aaruf_read_sector_long() for corresponding long sector reading functionality * @see aaruf_close() for metadata serialization and cleanup */ -int32_t aaruf_write_sector_long(void *context, uint64_t sector_address, bool negative, const uint8_t *data, - uint8_t sector_status, uint32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t sector_address, bool negative, + const uint8_t *data, uint8_t sector_status, uint32_t length) { TRACE("Entering aaruf_write_sector_long(%p, %" PRIu64 ", %d, %p, %u, %u)", context, sector_address, negative, data, sector_status, length); @@ -1777,7 +1777,8 @@ int32_t aaruf_close_current_block(aaruformat_context *ctx) * @see aaruf_close() for media tag serialization and memory cleanup * @see MediaTagType enumeration for valid type identifier values and meanings */ -int32_t aaruf_write_media_tag(void *context, const uint8_t *data, const int32_t type, const uint32_t length) +AARU_EXPORT int32_t AARU_CALL aaruf_write_media_tag(void *context, const uint8_t *data, const int32_t type, + const uint32_t length) { TRACE("Entering aaruf_write_media_tag(%p, %p, %d, %d)", context, data, type, length); @@ -2045,8 +2046,8 @@ int32_t aaruf_write_media_tag(void *context, const uint8_t *data, const int32_t * @see write_sector_subchannel() for the serialization of CD subchannel data. * @see write_dvd_long_sector_blocks() for the serialization of DVD auxiliary data. */ -int32_t aaruf_write_sector_tag(void *context, const uint64_t sector_address, const bool negative, const uint8_t *data, - const size_t length, const int32_t tag) +AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_tag(void *context, const uint64_t sector_address, const bool negative, + const uint8_t *data, const size_t length, const int32_t tag) { TRACE("Entering aaruf_write_sector_tag(%p, %" PRIu64 ", %d, %p, %zu, %d)", context, sector_address, negative, data, length, tag); @@ -2449,4 +2450,4 @@ int32_t aaruf_write_sector_tag(void *context, const uint64_t sector_address, con TRACE("Do not know how to write sector tag %d", tag); return AARUF_ERROR_INVALID_TAG; } -} \ No newline at end of file +}