Move all function declarations to library header.

This commit is contained in:
2021-10-30 21:45:58 +01:00
parent e06a4976ee
commit 00cc6f2b09
9 changed files with 48 additions and 66 deletions

View File

@@ -88,7 +88,7 @@ endif()
add_subdirectory(3rdparty) add_subdirectory(3rdparty)
add_library("Aaru.Compression.Native" SHARED library.c apple_rle.c apple_rle.h adc.c adc.h lzip.c lzip.h flac.c flac.h) add_library("Aaru.Compression.Native" SHARED library.c apple_rle.c apple_rle.h adc.c adc.h lzip.c flac.c flac.h)
MACRO(TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE target) MACRO(TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE target)
if("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") if("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC")

5
adc.h
View File

@@ -9,9 +9,4 @@
#define ADC_TWO_BYTE 2 #define ADC_TWO_BYTE 2
#define ADC_THREE_BYTE 3 #define ADC_THREE_BYTE 3
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);
#endif // AARU_COMPRESSION_NATIVE__ADC_H_ #endif // AARU_COMPRESSION_NATIVE__ADC_H_

View File

@@ -18,6 +18,7 @@
*/ */
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "library.h" #include "library.h"

View File

@@ -21,9 +21,4 @@
#define DART_CHUNK 20960 #define DART_CHUNK 20960
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);
#endif // AARU_CHECKSUMS_NATIVE__APPLE_RLE_H_ #endif // AARU_CHECKSUMS_NATIVE__APPLE_RLE_H_

21
flac.h
View File

@@ -16,25 +16,4 @@ typedef struct
uint8_t error; uint8_t error;
} aaru_flac_ctx; } aaru_flac_ctx;
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);
#endif // AARU_COMPRESSION_NATIVE__FLAC_H_ #endif // AARU_COMPRESSION_NATIVE__FLAC_H_

View File

@@ -16,6 +16,8 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stddef.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include "library.h" #include "library.h"

View File

@@ -54,4 +54,47 @@
#define FORCE_INLINE static inline __attribute__((always_inline)) #define FORCE_INLINE static inline __attribute__((always_inline))
#endif #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 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 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);
#endif // AARU_COMPRESSION_NATIVE_LIBRARY_H #endif // AARU_COMPRESSION_NATIVE_LIBRARY_H

2
lzip.c
View File

@@ -17,11 +17,11 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "library.h" #include "library.h"
#include "3rdparty/lzlib-1.12/lzlib.h" #include "3rdparty/lzlib-1.12/lzlib.h"
#include "lzip.h"
AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer, AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size, int32_t dst_size,

33
lzip.h
View File

@@ -1,33 +0,0 @@
/*
* This file is part of the Aaru Data Preservation Suite.
* Copyright (c) 2019-2021 Natalia Portillo.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AARU_CHECKSUMS_NATIVE__LZIP_H_
#define AARU_CHECKSUMS_NATIVE__LZIP_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 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_CHECKSUMS_NATIVE__LZIP_H_