From 37e8a8b4c72e6707601aed2164602c907be98f25 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 30 Oct 2021 21:58:10 +0100 Subject: [PATCH] Namespace exported symbols. --- adc.c | 8 ++--- apple_rle.c | 8 ++--- flac.c | 38 +++++++++++------------ library.h | 74 ++++++++++++++++++++++----------------------- lzip.c | 20 ++++++------ tests/adc.cpp | 4 +-- tests/apple_rle.cpp | 10 +++--- tests/flac.cpp | 36 +++++++++++----------- tests/lzip.cpp | 8 ++--- 9 files changed, 102 insertions(+), 104 deletions(-) diff --git a/adc.c b/adc.c index a673c15..459ef7e 100644 --- a/adc.c +++ b/adc.c @@ -37,10 +37,10 @@ FORCE_INLINE int GetOffset(uint8_t chunk[]) } } -AARU_EXPORT int32_t AARU_CALL adc_decode_buffer(uint8_t* dst_buffer, - int32_t dst_size, - const uint8_t* src_buffer, - int32_t src_size) +AARU_EXPORT int32_t AARU_CALL AARU_adc_decode_buffer(uint8_t* dst_buffer, + int32_t dst_size, + const uint8_t* src_buffer, + int32_t src_size) { int inputPosition = 0; int chunkSize; diff --git a/apple_rle.c b/apple_rle.c index 5fc55f4..de1c4e7 100644 --- a/apple_rle.c +++ b/apple_rle.c @@ -24,10 +24,10 @@ #include "library.h" #include "apple_rle.h" -AARU_EXPORT int32_t AARU_CALL apple_rle_decode_buffer(uint8_t* dst_buffer, - int32_t dst_size, - const uint8_t* src_buffer, - int32_t src_size) +AARU_EXPORT int32_t AARU_CALL AARU_apple_rle_decode_buffer(uint8_t* dst_buffer, + int32_t dst_size, + const uint8_t* src_buffer, + int32_t src_size) { static int32_t count = 0; static bool nextA = true; // true if A, false if B diff --git a/flac.c b/flac.c index c9e4e3b..29fc421 100644 --- a/flac.c +++ b/flac.c @@ -21,10 +21,10 @@ static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* static void error_callback(const FLAC__StreamDecoder* decoder, FLAC__StreamDecoderErrorStatus status, void* client_data); -AARU_EXPORT size_t AARU_CALL flac_decode_redbook_buffer(uint8_t* dst_buffer, - size_t dst_size, - const uint8_t* src_buffer, - size_t src_size) +AARU_EXPORT size_t AARU_CALL AARU_flac_decode_redbook_buffer(uint8_t* dst_buffer, + size_t dst_size, + const uint8_t* src_buffer, + size_t src_size) { FLAC__StreamDecoder* decoder; FLAC__StreamDecoderInitStatus init_status; @@ -135,21 +135,21 @@ static FLAC__StreamEncoderWriteStatus encoder_write_callback(const FLAC__StreamE uint32_t current_frame, void* client_data); -AARU_EXPORT size_t AARU_CALL flac_encode_redbook_buffer(uint8_t* dst_buffer, - size_t dst_size, - const uint8_t* src_buffer, - size_t src_size, - uint32_t blocksize, - int32_t do_mid_side_stereo, - int32_t loose_mid_side_stereo, - const char* apodization, - uint32_t qlp_coeff_precision, - int32_t do_qlp_coeff_prec_search, - int32_t do_exhaustive_model_search, - uint32_t min_residual_partition_order, - uint32_t max_residual_partition_order, - const char* application_id, - uint32_t application_id_len) +AARU_EXPORT size_t AARU_CALL AARU_flac_encode_redbook_buffer(uint8_t* dst_buffer, + size_t dst_size, + const uint8_t* src_buffer, + size_t src_size, + uint32_t blocksize, + int32_t do_mid_side_stereo, + int32_t loose_mid_side_stereo, + const char* apodization, + uint32_t qlp_coeff_precision, + int32_t do_qlp_coeff_prec_search, + int32_t do_exhaustive_model_search, + uint32_t min_residual_partition_order, + uint32_t max_residual_partition_order, + const char* application_id, + uint32_t application_id_len) { FLAC__StreamEncoder* encoder; aaru_flac_ctx* ctx = (aaru_flac_ctx*)malloc(sizeof(aaru_flac_ctx)); diff --git a/library.h b/library.h index a962a79..2ede1f7 100644 --- a/library.h +++ b/library.h @@ -54,47 +54,47 @@ #define FORCE_INLINE static inline __attribute__((always_inline)) #endif -AARU_EXPORT int32_t AARU_CALL adc_decode_buffer(uint8_t* dst_buffer, - int32_t dst_size, - const uint8_t* src_buffer, - int32_t src_size); +AARU_EXPORT int32_t AARU_CALL AARU_adc_decode_buffer(uint8_t* dst_buffer, + int32_t dst_size, + const uint8_t* src_buffer, + int32_t src_size); -AARU_EXPORT int32_t AARU_CALL apple_rle_decode_buffer(uint8_t* dst_buffer, +AARU_EXPORT int32_t AARU_CALL AARU_apple_rle_decode_buffer(uint8_t* dst_buffer, + int32_t dst_size, + const uint8_t* src_buffer, + int32_t src_size); + +AARU_EXPORT size_t AARU_CALL AARU_flac_decode_redbook_buffer(uint8_t* dst_buffer, + size_t dst_size, + const uint8_t* src_buffer, + size_t src_size); + +AARU_EXPORT size_t AARU_CALL AARU_flac_encode_redbook_buffer(uint8_t* dst_buffer, + size_t dst_size, + const uint8_t* src_buffer, + size_t src_size, + uint32_t blocksize, + int32_t do_mid_side_stereo, + int32_t loose_mid_side_stereo, + const char* apodization, + uint32_t qlp_coeff_precision, + int32_t do_qlp_coeff_prec_search, + int32_t do_exhaustive_model_search, + uint32_t min_residual_partition_order, + uint32_t max_residual_partition_order, + const char* application_id, + uint32_t application_id_len); + +AARU_EXPORT int32_t AARU_CALL AARU_lzip_decode_buffer(uint8_t* dst_buffer, int32_t dst_size, const uint8_t* src_buffer, int32_t src_size); -AARU_EXPORT size_t AARU_CALL flac_decode_redbook_buffer(uint8_t* dst_buffer, - size_t dst_size, - const uint8_t* src_buffer, - size_t src_size); - -AARU_EXPORT size_t AARU_CALL flac_encode_redbook_buffer(uint8_t* dst_buffer, - size_t dst_size, - const uint8_t* src_buffer, - size_t src_size, - uint32_t blocksize, - int32_t do_mid_side_stereo, - int32_t loose_mid_side_stereo, - const char* apodization, - uint32_t qlp_coeff_precision, - int32_t do_qlp_coeff_prec_search, - int32_t do_exhaustive_model_search, - uint32_t min_residual_partition_order, - uint32_t max_residual_partition_order, - const char* application_id, - uint32_t application_id_len); - -AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer, - int32_t dst_size, - const uint8_t* src_buffer, - int32_t src_size); - -AARU_EXPORT int32_t AARU_CALL lzip_encode_buffer(uint8_t* dst_buffer, - int32_t dst_size, - const uint8_t* src_buffer, - int32_t src_size, - int32_t dictionary_size, - int32_t match_len_limit); +AARU_EXPORT int32_t AARU_CALL AARU_lzip_encode_buffer(uint8_t* dst_buffer, + int32_t dst_size, + const uint8_t* src_buffer, + int32_t src_size, + int32_t dictionary_size, + int32_t match_len_limit); #endif // AARU_COMPRESSION_NATIVE_LIBRARY_H diff --git a/lzip.c b/lzip.c index b8b0d92..6626c86 100644 --- a/lzip.c +++ b/lzip.c @@ -23,10 +23,10 @@ #include "library.h" #include "3rdparty/lzlib-1.12/lzlib.h" -AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer, - int32_t dst_size, - const uint8_t* src_buffer, - int32_t src_size) +AARU_EXPORT int32_t AARU_CALL AARU_lzip_decode_buffer(uint8_t* dst_buffer, + int32_t dst_size, + const uint8_t* src_buffer, + int32_t src_size) { int max_in_size; void* ctx; @@ -83,12 +83,12 @@ AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer, return out_pos; } -AARU_EXPORT int32_t AARU_CALL lzip_encode_buffer(uint8_t* dst_buffer, - int32_t dst_size, - const uint8_t* src_buffer, - int32_t src_size, - int32_t dictionary_size, - int32_t match_len_limit) +AARU_EXPORT int32_t AARU_CALL AARU_lzip_encode_buffer(uint8_t* dst_buffer, + int32_t dst_size, + const uint8_t* src_buffer, + int32_t src_size, + int32_t dictionary_size, + int32_t match_len_limit) { int max_in_size; void* ctx; diff --git a/tests/adc.cpp b/tests/adc.cpp index d6c0e4c..fa79e77 100644 --- a/tests/adc.cpp +++ b/tests/adc.cpp @@ -20,8 +20,8 @@ #include #include -#include "../library.h" #include "../adc.h" +#include "../library.h" #include "crc32.h" #include "gtest/gtest.h" @@ -67,7 +67,7 @@ TEST_F(adcFixture, adc) { auto* outBuf = (uint8_t*)malloc(327680); - auto decoded = adc_decode_buffer(outBuf, 327680, buffer, 34367); + auto decoded = AARU_adc_decode_buffer(outBuf, 327680, buffer, 34367); EXPECT_EQ(decoded, 262144); diff --git a/tests/apple_rle.cpp b/tests/apple_rle.cpp index 58c46ab..3a90c4a 100644 --- a/tests/apple_rle.cpp +++ b/tests/apple_rle.cpp @@ -20,8 +20,8 @@ #include #include -#include "../library.h" #include "../apple_rle.h" +#include "../library.h" #include "crc32.h" #include "gtest/gtest.h" @@ -53,9 +53,7 @@ class apple_rleFixture : public ::testing::Test fclose(file); } - void TearDown() { - free((void*)buffer); - } + void TearDown() { free((void*)buffer); } ~apple_rleFixture() { @@ -67,9 +65,9 @@ class apple_rleFixture : public ::testing::Test TEST_F(apple_rleFixture, apple_rle) { - auto *outBuf = (uint8_t*)malloc(32768); + auto* outBuf = (uint8_t*)malloc(32768); - auto decoded = apple_rle_decode_buffer(outBuf, 32768, buffer, 1102); + auto decoded = AARU_apple_rle_decode_buffer(outBuf, 32768, buffer, 1102); EXPECT_EQ(decoded, 20960); diff --git a/tests/flac.cpp b/tests/flac.cpp index 3f1b3aa..6234788 100644 --- a/tests/flac.cpp +++ b/tests/flac.cpp @@ -20,8 +20,8 @@ #include #include -#include "../library.h" #include "../flac.h" +#include "../library.h" #include "crc32.h" #include "gtest/gtest.h" @@ -67,7 +67,7 @@ TEST_F(flacFixture, flac) { auto* outBuf = (uint8_t*)malloc(9633792); - auto decoded = flac_decode_redbook_buffer(outBuf, 9633792, buffer, 6534197); + auto decoded = AARU_flac_decode_redbook_buffer(outBuf, 9633792, buffer, 6534197); EXPECT_EQ(decoded, 9633792); @@ -109,25 +109,25 @@ TEST_F(flacFixture, flacCompress) original_crc = crc32_data(original, original_len); // Compress - newSize = flac_encode_redbook_buffer(cmp_buffer, - cmp_len, - original, - original_len, - 4608, - 1, - 0, - "partial_tukey(0/1.0/1.0)", - 0, - 1, - false, - 0, - 8, - "Aaru.Compression.Native.Tests", - strlen("Aaru.Compression.Native.Tests")); + newSize = AARU_flac_encode_redbook_buffer(cmp_buffer, + cmp_len, + original, + original_len, + 4608, + 1, + 0, + "partial_tukey(0/1.0/1.0)", + 0, + 1, + false, + 0, + 8, + "Aaru.Compression.Native.Tests", + strlen("Aaru.Compression.Native.Tests")); cmp_len = newSize; // Decompress - newSize = flac_decode_redbook_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len); + newSize = AARU_flac_decode_redbook_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len); decmp_len = newSize; EXPECT_EQ(decmp_len, original_len); diff --git a/tests/lzip.cpp b/tests/lzip.cpp index c9a3e9f..d93dfba 100644 --- a/tests/lzip.cpp +++ b/tests/lzip.cpp @@ -17,10 +17,10 @@ */ #include +#include #include #include "../library.h" -#include "../lzip.h" #include "crc32.h" #include "gtest/gtest.h" @@ -66,7 +66,7 @@ TEST_F(lzipFixture, lzip) { auto* outBuf = (uint8_t*)malloc(1048576); - auto decoded = lzip_decode_buffer(outBuf, 1048576, buffer, 1062874); + auto decoded = AARU_lzip_decode_buffer(outBuf, 1048576, buffer, 1062874); EXPECT_EQ(decoded, 1048576); @@ -108,11 +108,11 @@ TEST_F(lzipFixture, lzipCompress) original_crc = crc32_data(original, original_len); // Compress - newSize = lzip_encode_buffer(cmp_buffer, cmp_len, original, original_len, 1048576, 273); + newSize = AARU_lzip_encode_buffer(cmp_buffer, cmp_len, original, original_len, 1048576, 273); cmp_len = newSize; // Decompress - newSize = lzip_decode_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len); + newSize = AARU_lzip_decode_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len); decmp_len = newSize; EXPECT_EQ(decmp_len, original_len);