zbuff_static.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <contrib/libs/zstd06/renames.h>
  2. /*
  3. zstd - buffered version of compression library
  4. experimental complementary API, for static linking only
  5. Copyright (C) 2015-2016, Yann Collet.
  6. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
  7. Redistribution and use in source and binary forms, with or without
  8. modification, are permitted provided that the following conditions are
  9. met:
  10. * Redistributions of source code must retain the above copyright
  11. notice, this list of conditions and the following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the following disclaimer
  14. in the documentation and/or other materials provided with the
  15. distribution.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  20. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  21. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  22. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. You can contact the author at :
  28. - zstd homepage : http://www.zstd.net
  29. */
  30. #ifndef ZSTD_BUFFERED_STATIC_H
  31. #define ZSTD_BUFFERED_STATIC_H
  32. /* The objects defined into this file should be considered experimental.
  33. * They are not labelled stable, as their prototype may change in the future.
  34. * You can use them for tests, provide feedback, or if you can endure risk of future changes.
  35. */
  36. #if defined (__cplusplus)
  37. extern "C" {
  38. #endif
  39. /* *************************************
  40. * Includes
  41. ***************************************/
  42. #include "zstd_static.h" /* ZSTD_parameters */
  43. #include "zbuff.h"
  44. #include "zstd_internal.h" /* MIN */
  45. /* *************************************
  46. * Advanced Streaming functions
  47. ***************************************/
  48. ZSTDLIB_API size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* cctx,
  49. const void* dict, size_t dictSize,
  50. ZSTD_parameters params, U64 pledgedSrcSize);
  51. MEM_STATIC size_t ZBUFF_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize)
  52. {
  53. size_t length = MIN(dstCapacity, srcSize);
  54. memcpy(dst, src, length);
  55. return length;
  56. }
  57. #if defined (__cplusplus)
  58. }
  59. #endif
  60. #endif /* ZSTD_BUFFERED_STATIC_H */