]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
merged `zbuff_static.h` into `zbuff.h` . Now requires `ZBUFF_STATIC_LINKING_ONLY...
authorYann Collet <yann.collet.73@gmail.com>
Sat, 4 Jun 2016 17:12:48 +0000 (19:12 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Sat, 4 Jun 2016 17:12:48 +0000 (19:12 +0200)
lib/common/zbuff.h
lib/common/zbuff_static.h [deleted file]
lib/compress/zbuff_compress.c
lib/decompress/zbuff_decompress.c
programs/fileio.c
programs/zbufftest.c

index 89207bd2496bec4ab7895dfbda0ec3d05ec05561..d761a273f19067c80178207a0e4d1513cfbeb9bf 100644 (file)
@@ -28,8 +28,8 @@
     You can contact the author at :
     - zstd homepage : http://www.zstd.net/
 */
-#ifndef ZSTD_BUFFERED_H
-#define ZSTD_BUFFERED_H
+#ifndef ZSTD_BUFFERED_H_23987
+#define ZSTD_BUFFERED_H_23987
 
 #if defined (__cplusplus)
 extern "C" {
@@ -160,8 +160,48 @@ ZSTDLIB_API size_t ZBUFF_recommendedDInSize(void);
 ZSTDLIB_API size_t ZBUFF_recommendedDOutSize(void);
 
 
+#ifdef ZBUFF_STATIC_LINKING_ONLY
+
+/* *************************************
+*  Includes
+***************************************/
+#include "zstd_static.h"     /* ZSTD_parameters */
+
+/* internal util function */
+#define ZBUFF_MIN(a,b) ((a)<(b) ? (a) : (b))
+MEM_STATIC size_t ZBUFF_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize)
+{
+    size_t length = ZBUFF_MIN(dstCapacity, srcSize);
+    memcpy(dst, src, length);
+    return length;
+}
+
+
+/*-*************************************
+*  Advanced functions
+***************************************/
+/*! ZBUFF_createCCtx_advanced() :
+ *  Create a ZBUFF compression context using external alloc and free functions */
+ZSTDLIB_API ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem);
+
+/*! ZBUFF_createDCtx_advanced() :
+ *  Create a ZBUFF decompression context using external alloc and free functions */
+ZSTDLIB_API ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem);
+
+
+/* *************************************
+*  Advanced Streaming functions
+***************************************/
+ZSTDLIB_API size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc,
+                                               const void* dict, size_t dictSize,
+                                               ZSTD_parameters params, U64 pledgedSrcSize);
+
+
+#endif
+
+
 #if defined (__cplusplus)
 }
 #endif
 
-#endif  /* ZSTD_BUFFERED_H */
+#endif  /* ZSTD_BUFFERED_H_23987 */
diff --git a/lib/common/zbuff_static.h b/lib/common/zbuff_static.h
deleted file mode 100644 (file)
index 44a0321..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-    zstd - buffered version of compression library
-    experimental complementary API, for static linking only
-    Copyright (C) 2015-2016, Yann Collet.
-
-    BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are
-    met:
-    * Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-    copyright notice, this list of conditions and the following disclaimer
-    in the documentation and/or other materials provided with the
-    distribution.
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-    You can contact the author at :
-    - zstd homepage : http://www.zstd.net
-*/
-#ifndef ZSTD_BUFFERED_STATIC_H
-#define ZSTD_BUFFERED_STATIC_H
-
-/* The objects defined into this file must be considered experimental.
- * Their prototype may change in future versions.
- * Never use them with a dynamic library.
- */
-
-#if defined (__cplusplus)
-extern "C" {
-#endif
-
-/* *************************************
-*  Includes
-***************************************/
-#include "zstd_static.h"     /* ZSTD_parameters */
-#include "zbuff.h"
-
-#define ZBUFF_MIN(a,b) ((a)<(b) ? (a) : (b))
-
-
-/*-*************************************
-*  Advanced functions
-***************************************/
-/*! ZBUFF_createCCtx_advanced() :
- *  Create a ZBUFF compression context using external alloc and free functions */
-ZSTDLIB_API ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem);
-
-/*! ZBUFF_createDCtx_advanced() :
- *  Create a ZBUFF decompression context using external alloc and free functions */
-ZSTDLIB_API ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem);
-
-
-/* *************************************
-*  Advanced Streaming functions
-***************************************/
-ZSTDLIB_API size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc,
-                                               const void* dict, size_t dictSize,
-                                               ZSTD_parameters params, U64 pledgedSrcSize);
-
-
-/* internal util function */
-
-MEM_STATIC size_t ZBUFF_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize)
-{
-    size_t length = ZBUFF_MIN(dstCapacity, srcSize);
-    memcpy(dst, src, length);
-    return length;
-}
-
-
-#if defined (__cplusplus)
-}
-#endif
-
-#endif  /* ZSTD_BUFFERED_STATIC_H */
index bae66815495040ab8fb68bace05c7108cb402ffe..65390c29bd16835c05f8c666fa2c10e303f79187 100644 (file)
@@ -37,7 +37,8 @@
 #include "error_private.h"
 #include "zstd_internal.h"  /* MIN, ZSTD_blockHeaderSize */
 #include "zstd_static.h"    /* ZSTD_BLOCKSIZE_MAX */
-#include "zbuff_static.h"
+#define ZBUFF_STATIC_LINKING_ONLY
+#include "zbuff.h"
 
 
 /* *************************************
index 01937bb068dca51165aff3f958f227f2555f4d1b..e3d574355fbda5e170f5a810124a1223508fb6c4 100644 (file)
@@ -37,7 +37,8 @@
 #include "error_private.h"
 #include "zstd_internal.h"  /* MIN, ZSTD_blockHeaderSize */
 #include "zstd_static.h"    /* ZSTD_BLOCKSIZE_MAX */
-#include "zbuff_static.h"
+#define ZBUFF_STATIC_LINKING_ONLY
+#include "zbuff.h"
 
 
 /*-***************************************************************************
@@ -183,7 +184,7 @@ size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbd,
             }   }
 
             if (zbd->fParams.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN) zbd->fParams.windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN;  /* required for buffer allocation */
-    
+
             /* Frame header instruct buffer sizes */
             {   size_t const blockSize = MIN(1 << zbd->fParams.windowLog, ZSTD_BLOCKSIZE_MAX);
                 zbd->blockSize = blockSize;
index 4211e4a0f460de36565ae7509ef1f93a36a1f305..e00a123f80466ce9039fa1f7cf90f56b222e941f 100644 (file)
@@ -58,7 +58,8 @@
 #include "fileio.h"
 #include "zstd_static.h"   /* ZSTD_magicNumber, ZSTD_frameHeaderSize_max */
 #include "zstd_internal.h" /* MIN, KB, MB */
-#include "zbuff_static.h"
+#define ZBUFF_STATIC_LINKING_ONLY
+#include "zbuff.h"
 
 #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT==1)
 #  include "zstd_legacy.h"    /* ZSTD_isLegacy */
index 387119815ed12dd9edf490c7e2b8139de9b29ea0..a50e085411d2055ec74a897ab377b64c81d43cad 100644 (file)
 #include <sys/timeb.h>    /* timeb */
 #include <string.h>       /* strcmp */
 #include "mem.h"
-#include "zbuff.h"
 #include "zstd_static.h"  /* ZSTD_compressBound(), ZSTD_maxCLevel() */
-#include "zbuff_static.h" /* ZBUFF_createCCtx_advanced */
+#define ZBUFF_STATIC_LINKING_ONLY
+#include "zbuff.h"        /* ZBUFF_createCCtx_advanced */
 #include "datagen.h"      /* RDG_genBuffer */
 #define XXH_STATIC_LINKING_ONLY
-#include "xxhash.h"       /* XXH64 */
+#include "xxhash.h"       /* XXH64_* */
 
 
 /*-************************************