Skip to content

Commit

Permalink
switch to enums
Browse files Browse the repository at this point in the history
  • Loading branch information
aloneguid committed Sep 30, 2024
1 parent 9cb8f92 commit 478d028
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions native/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,24 +304,27 @@ bool compress_lz4(
return false;
}

bool iron_compress(bool compress, int32_t codec, char* input_buffer, int32_t input_buffer_size,
bool iron_compress(bool compress, compression_codec codec, char* input_buffer, int32_t input_buffer_size,
char* output_buffer, int32_t* output_buffer_size, compression_level compression_level) {

if(!iron_is_supported(codec)) return false;

switch(codec) {
#ifndef NO_NATIVE_SNAPPY
case 1:
case compression_codec::snappy:
return compress_snappy(compress, input_buffer, input_buffer_size, output_buffer, output_buffer_size);
#endif
#ifndef NO_NATIVE_ZSTD
case 2:
case compression_codec::zstd:
return compress_zstd(compress, input_buffer, input_buffer_size, output_buffer, output_buffer_size, compression_level);
#endif
//case 3:
// return compress_gzip(compress, input_buffer, input_buffer_size, output_buffer, output_buffer_size, compression_level);
case 4:
case compression_codec::brotli:
return compress_brotli(compress, input_buffer, input_buffer_size, output_buffer, output_buffer_size, compression_level);
case 5:
case compression_codec::lzo:
return compress_lzo(compress, input_buffer, input_buffer_size, output_buffer, output_buffer_size);
case 6:
case compression_codec::lz4:
return compress_lz4(compress, input_buffer, input_buffer_size, output_buffer, output_buffer_size, compression_level);
default:
return false;
Expand Down
2 changes: 1 addition & 1 deletion native/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extern "C"
*/
EXPORTED bool iron_compress(
bool compress,
int32_t codec,
compression_codec codec,
char* input_buffer,
int32_t input_buffer_size,
char* output_buffer,
Expand Down

0 comments on commit 478d028

Please sign in to comment.