From fe5148417feea3d984ef792fb420f1329dbe8542 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 9 Nov 2016 11:45:55 +0100 Subject: introduced LZ4_COMPILED_AS_DLL --- lib/lz4frame.c | 7 +++++++ tests/fullbench.c | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/lz4frame.c b/lib/lz4frame.c index a946f29..93657aa 100644 --- a/lib/lz4frame.c +++ b/lib/lz4frame.c @@ -67,6 +67,12 @@ You can contact the author at : /*-************************************ +* Common Utils +**************************************/ +#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ + + +/*-************************************ * Basic Types **************************************/ #if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) @@ -378,6 +384,7 @@ size_t LZ4F_compressBegin(LZ4F_cctx* cctxPtr, void* dstBuffer, size_t dstMaxSize BYTE* headerStart; size_t requiredBuffSize; + LZ4_STATIC_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t)); /* A compilation error here means sizeof(ptrdiff_t) is not large enough */ if (dstMaxSize < maxFHSize) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); if (cctxPtr->cStage != 0) return err0r(LZ4F_ERROR_GENERIC); memset(&prefNull, 0, sizeof(prefNull)); diff --git a/tests/fullbench.c b/tests/fullbench.c index 67442b2..baebb14 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -294,6 +294,7 @@ static int local_LZ4_compress_limitedOutput_continue(const char* in, char* out, return LZ4_compress_limitedOutput_continue(&LZ4_stream, in, out, inSize, LZ4_compressBound(inSize)-1); } +#ifndef LZ4_COMPILED_AS_DLL /* declare hidden function */ int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize); @@ -301,6 +302,7 @@ static int local_LZ4_compress_forceDict(const char* in, char* out, int inSize) { return LZ4_compress_forceExtDict(&LZ4_stream, in, out, inSize); } +#endif /* HC compression functions */ @@ -364,6 +366,7 @@ static int local_LZ4_decompress_safe_usingDict(const char* in, char* out, int in return outSize; } +#ifndef LZ4_COMPILED_AS_DLL extern int LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize, const char* dict, int dictSize); static int local_LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize) @@ -372,6 +375,7 @@ static int local_LZ4_decompress_safe_forceExtDict(const char* in, char* out, int LZ4_decompress_safe_forceExtDict(in, out, inSize, outSize, out - 65536, 65536); return outSize; } +#endif static int local_LZ4_decompress_safe_partial(const char* in, char* out, int inSize, int outSize) { @@ -521,8 +525,10 @@ int fullSpeedBench(const char** fileNamesTable, int nbFiles) case 13: compressionFunction = local_LZ4_compressHC_limitedOutput_withStateHC; compressorName = "LZ4_compressHC_limitedOutput_withStateHC"; break; case 14: compressionFunction = local_LZ4_compressHC_continue; initFunction = local_LZ4_resetStreamHC; compressorName = "LZ4_compressHC_continue"; break; case 15: compressionFunction = local_LZ4_compressHC_limitedOutput_continue; initFunction = local_LZ4_resetStreamHC; compressorName = "LZ4_compressHC_limitedOutput_continue"; break; - case 20: compressionFunction = local_LZ4_compress_forceDict; initFunction = local_LZ4_resetDictT; compressorName = "LZ4_compress_forceDict"; break; - case 30: compressionFunction = local_LZ4F_compressFrame; compressorName = "LZ4F_compressFrame"; +#ifndef LZ4_COMPILED_AS_DLL + case 20: compressionFunction = local_LZ4_compress_forceDict; initFunction = local_LZ4_resetDictT; compressorName = "LZ4_compress_forceDict"; break; +#endif + case 30: compressionFunction = local_LZ4F_compressFrame; compressorName = "LZ4F_compressFrame"; chunkP[0].origSize = (int)benchedSize; nbChunks=1; break; case 40: compressionFunction = local_LZ4_saveDict; compressorName = "LZ4_saveDict"; @@ -614,8 +620,10 @@ int fullSpeedBench(const char** fileNamesTable, int nbFiles) case 4: decompressionFunction = LZ4_decompress_safe; dName = "LZ4_decompress_safe"; break; case 6: decompressionFunction = local_LZ4_decompress_safe_usingDict; dName = "LZ4_decompress_safe_usingDict"; break; case 7: decompressionFunction = local_LZ4_decompress_safe_partial; dName = "LZ4_decompress_safe_partial"; break; - case 8: decompressionFunction = local_LZ4_decompress_safe_forceExtDict; dName = "LZ4_decompress_safe_forceExtDict"; break; - case 9: decompressionFunction = local_LZ4F_decompress; dName = "LZ4F_decompress"; +#ifndef LZ4_COMPILED_AS_DLL + case 8: decompressionFunction = local_LZ4_decompress_safe_forceExtDict; dName = "LZ4_decompress_safe_forceExtDict"; break; +#endif + case 9: decompressionFunction = local_LZ4F_decompress; dName = "LZ4F_decompress"; errorCode = LZ4F_compressFrame(compressed_buff, compressedBuffSize, orig_buff, benchedSize, NULL); if (LZ4F_isError(errorCode)) { DISPLAY("Error while preparing compressed frame\n"); -- cgit v0.12