zstd_common.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. Common functions of Zstd compression library
  3. Copyright (C) 2015-2016, Yann Collet.
  4. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions are
  7. met:
  8. * Redistributions of source code must retain the above copyright
  9. notice, this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above
  11. copyright notice, this list of conditions and the following disclaimer
  12. in the documentation and/or other materials provided with the
  13. distribution.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  18. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  20. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. You can contact the author at :
  26. - zstd homepage : http://www.zstd.net/
  27. */
  28. /*-*************************************
  29. * Dependencies
  30. ***************************************/
  31. #include "error_private.h"
  32. #include "zstd.h" /* declaration of ZSTD_isError, ZSTD_getErrorName */
  33. #include "zbuff.h" /* declaration of ZBUFF_isError, ZBUFF_getErrorName */
  34. /*-****************************************
  35. * Version
  36. ******************************************/
  37. unsigned ZSTD_versionNumber (void) { return ZSTD_VERSION_NUMBER; }
  38. /*-****************************************
  39. * ZSTD Error Management
  40. ******************************************/
  41. /*! ZSTD_isError() :
  42. * tells if a return value is an error code */
  43. unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
  44. /*! ZSTD_getErrorName() :
  45. * provides error code string from function result (useful for debugging) */
  46. const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); }
  47. /*! ZSTD_getError() :
  48. * convert a `size_t` function result into a proper ZSTD_errorCode enum */
  49. ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
  50. /*! ZSTD_getErrorString() :
  51. * provides error code string from enum */
  52. const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorName(code); }
  53. /* **************************************************************
  54. * ZBUFF Error Management
  55. ****************************************************************/
  56. unsigned ZBUFF_isError(size_t errorCode) { return ERR_isError(errorCode); }
  57. const char* ZBUFF_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); }