From d0a3f2569755deb1fa8dad7b73d5c7bc7c46980a Mon Sep 17 00:00:00 2001 From: shakeelrao Date: Thu, 28 Feb 2019 01:52:01 -0800 Subject: [PATCH] change return type to ULL --- doc/zstd_manual.html | 10 +++++----- lib/decompress/zstd_decompress.c | 4 ++-- lib/zstd.h | 10 +++++----- tests/fuzzer.c | 9 +-------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/doc/zstd_manual.html b/doc/zstd_manual.html index a11a95892..426c6cf24 100644 --- a/doc/zstd_manual.html +++ b/doc/zstd_manual.html @@ -127,11 +127,11 @@ unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize);


Helper functions

#define ZSTD_COMPRESSBOUND(srcSize)   ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0))  /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
-size_t      ZSTD_compressBound(size_t srcSize);                    /*!< maximum compressed size in worst case single-pass scenario */
-size_t      ZSTD_decompressBound(const void* src, size_t srcSice); /*!< maximum decompressed size of the compressed source */
-unsigned    ZSTD_isError(size_t code);                             /*!< tells if a `size_t` function result is an error code */
-const char* ZSTD_getErrorName(size_t code);                        /*!< provides readable string from an error code */
-int         ZSTD_maxCLevel(void);                                  /*!< maximum compression level available */
+size_t             ZSTD_compressBound(size_t srcSize);                    /*!< maximum compressed size in worst case single-pass scenario */
+unsigned long long ZSTD_decompressBound(const void* src, size_t srcSice); /*!< maximum decompressed size of the compressed source */
+unsigned           ZSTD_isError(size_t code);                             /*!< tells if a `size_t` function result is an error code */
+const char*        ZSTD_getErrorName(size_t code);                        /*!< provides readable string from an error code */
+int                ZSTD_maxCLevel(void);                                  /*!< maximum compression level available */
 

Explicit context


 
diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c
index a1f656ea4..6d56b08c8 100644
--- a/lib/decompress/zstd_decompress.c
+++ b/lib/decompress/zstd_decompress.c
@@ -503,9 +503,9 @@ size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
  *  `srcSize` must be at least as large as the frame contained
  *  @return : maximum decompressed size of the compressed source
  */
-size_t ZSTD_decompressBound(const void* src, size_t srcSize)
+unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize)
 {
-    size_t totalDstSize = 0;
+    unsigned long long totalDstSize = 0;
 #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
     if (ZSTD_isLegacy(src, srcSize))
         return ERROR(version_unsupported);
diff --git a/lib/zstd.h b/lib/zstd.h
index 313411017..4d764680e 100644
--- a/lib/zstd.h
+++ b/lib/zstd.h
@@ -148,11 +148,11 @@ ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t
 
 /*======  Helper functions  ======*/
 #define ZSTD_COMPRESSBOUND(srcSize)   ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0))  /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
-ZSTDLIB_API size_t      ZSTD_compressBound(size_t srcSize);                    /*!< maximum compressed size in worst case single-pass scenario */
-ZSTDLIB_API size_t      ZSTD_decompressBound(const void* src, size_t srcSice); /*!< maximum decompressed size of the compressed source */
-ZSTDLIB_API unsigned    ZSTD_isError(size_t code);                             /*!< tells if a `size_t` function result is an error code */
-ZSTDLIB_API const char* ZSTD_getErrorName(size_t code);                        /*!< provides readable string from an error code */
-ZSTDLIB_API int         ZSTD_maxCLevel(void);                                  /*!< maximum compression level available */
+ZSTDLIB_API size_t             ZSTD_compressBound(size_t srcSize);                    /*!< maximum compressed size in worst case single-pass scenario */
+ZSTDLIB_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSice); /*!< maximum decompressed size of the compressed source */
+ZSTDLIB_API unsigned           ZSTD_isError(size_t code);                             /*!< tells if a `size_t` function result is an error code */
+ZSTDLIB_API const char*        ZSTD_getErrorName(size_t code);                        /*!< provides readable string from an error code */
+ZSTDLIB_API int                ZSTD_maxCLevel(void);                                  /*!< maximum compression level available */
 
 
 /***************************************
diff --git a/tests/fuzzer.c b/tests/fuzzer.c
index 00e7f5442..c64fff883 100644
--- a/tests/fuzzer.c
+++ b/tests/fuzzer.c
@@ -378,14 +378,7 @@ static int basicUnitTests(U32 seed, double compressibility)
 
     DISPLAYLEVEL(3, "test%3i : tight ZSTD_decompressBound test : ", testNb++);
     {
-        size_t bound = ZSTD_decompressBound(compressedBuffer, cSize);
-        if (bound != CNBuffSize) goto _output_error;
-    }
-    DISPLAYLEVEL(3, "OK \n");
-
-    DISPLAYLEVEL(3, "test%3i : ZSTD_decompressBound test missing Frame_Content_Size : ", testNb++);
-    {
-        size_t bound = ZSTD_decompressBound(compressedBuffer, cSize);
+        unsigned long long bound = ZSTD_decompressBound(compressedBuffer, cSize);
         if (bound != CNBuffSize) goto _output_error;
     }
     DISPLAYLEVEL(3, "OK \n");
-- 
2.47.2