zbz2err.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2007-Mar-4 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. /*---------------------------------------------------------------------------
  9. zbz2err.c
  10. This file contains the "fatal error" callback routine required by the
  11. "minimal" (silent, non-stdio) setup of the bzip2 compression library.
  12. The fatal bzip2 error bail-out routine is provided in a separate code
  13. module, so that it can be easily overridden when the Zip package is
  14. used as a static link library. One example is the WinDLL static library
  15. usage for building a monolithic binary of the Windows application "WiZ"
  16. that supports bzip2 both in compression and decompression operations.
  17. Contains: bz_internal_error() (BZIP2_SUPPORT only)
  18. Adapted from UnZip ubz2err.c, with all the DLL fine print stripped
  19. out.
  20. ---------------------------------------------------------------------------*/
  21. #define __ZBZ2ERR_C /* identifies this source module */
  22. #include "zip.h"
  23. #ifdef BZIP2_SUPPORT
  24. # ifdef BZIP2_USEBZIP2DIR
  25. # include "bzip2/bzlib.h"
  26. # else
  27. /* If IZ_BZIP2 is defined as the location of the bzip2 files then
  28. assume the location has been added to include path. For Unix
  29. this is done by the configure script. */
  30. /* Also do not need path for bzip2 include if OS includes support
  31. for bzip2 library. */
  32. # include "bzlib.h"
  33. # endif
  34. /**********************************/
  35. /* Function bz_internal_error() */
  36. /**********************************/
  37. /* Call-back function for the bzip2 decompression code (compiled with
  38. * BZ_NO_STDIO), required to handle fatal internal bug-type errors of
  39. * the bzip2 library.
  40. */
  41. void bz_internal_error(errcode)
  42. int errcode;
  43. {
  44. sprintf(errbuf, "fatal error (code %d) in bzip2 library", errcode);
  45. ziperr(ZE_LOGIC, errbuf);
  46. } /* end function bz_internal_error() */
  47. #endif /* def BZIP2_SUPPORT */