]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Un-mix declarations and code 2375/head
authorsenhuang42 <senhuang96@fb.com>
Wed, 28 Oct 2020 21:49:54 +0000 (17:49 -0400)
committersenhuang42 <senhuang96@fb.com>
Wed, 28 Oct 2020 22:51:03 +0000 (18:51 -0400)
tests/fuzzer.c

index c2f5d5707fe7fdb7454367e41aad6c3d658e0512..1297b61b5bfff205b18297dd96bc7f70373ba046 100644 (file)
@@ -721,20 +721,21 @@ static int basicUnitTests(U32 const seed, double compressibility)
     DISPLAYLEVEL(3, "test%3i : LDM + opt parser with small uncompressible block ", testNb++);
     {   ZSTD_CCtx* cctx = ZSTD_createCCtx();
         ZSTD_DCtx* dctx = ZSTD_createDCtx();
-        if (!cctx || !dctx) {
-            DISPLAY("Not enough memory, aborting\n");
-            testResult = 1;
-            goto _end;
-        }
         size_t const srcSize = 300 KB;
         size_t const flushSize = 128 KB + 5;
         size_t const dstSize = ZSTD_compressBound(srcSize);
-        char* src = CNBuffer;
-        char* dst = compressedBuffer;
+        char* src = (char*)CNBuffer;
+        char* dst = (char*)compressedBuffer;
 
         ZSTD_outBuffer out = { dst, dstSize, 0 };
         ZSTD_inBuffer in = { src, flushSize, 0 };
 
+        if (!cctx || !dctx) {
+            DISPLAY("Not enough memory, aborting\n");
+            testResult = 1;
+            goto _end;
+        }
+
         RDG_genBuffer(src, srcSize, 0.5, 0.5, seed);
         /* Force an LDM to exist that crosses block boundary into uncompressible block */
         memcpy(src + 125 KB, src, 3 KB + 5);