LzmaDecode.h.svn-base 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. LzmaDecode.h
  3. LZMA Decoder interface
  4. LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
  5. http://www.7-zip.org/
  6. LZMA SDK is licensed under two licenses:
  7. 1) GNU Lesser General Public License (GNU LGPL)
  8. 2) Common Public License (CPL)
  9. It means that you can select one of these two licenses and
  10. follow rules of that license.
  11. SPECIAL EXCEPTION:
  12. Igor Pavlov, as the author of this code, expressly permits you to
  13. statically or dynamically link your code (or bind by name) to the
  14. interfaces of this file without subjecting your linked code to the
  15. terms of the CPL or GNU LGPL. Any modifications or additions
  16. to this file, however, are subject to the LGPL or CPL terms.
  17. */
  18. #ifndef __LZMADECODE_H
  19. #define __LZMADECODE_H
  20. /* #define _LZMA_IN_CB */
  21. /* Use callback for input data */
  22. /* #define _LZMA_OUT_READ */
  23. /* Use read function for output data */
  24. /* #define _LZMA_PROB32 */
  25. /* It can increase speed on some 32-bit CPUs,
  26. but memory usage will be doubled in that case */
  27. /* #define _LZMA_LOC_OPT */
  28. /* Enable local speed optimizations inside code */
  29. #ifndef UInt32
  30. #ifdef _LZMA_UINT32_IS_ULONG
  31. #define UInt32 unsigned long
  32. #else
  33. #define UInt32 unsigned int
  34. #endif
  35. #endif
  36. #ifdef _LZMA_PROB32
  37. #define CProb UInt32
  38. #else
  39. #define CProb unsigned short
  40. #endif
  41. #define LZMA_RESULT_OK 0
  42. #define LZMA_RESULT_DATA_ERROR 1
  43. #define LZMA_RESULT_NOT_ENOUGH_MEM 2
  44. #ifdef _LZMA_IN_CB
  45. typedef struct _ILzmaInCallback
  46. {
  47. int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
  48. } ILzmaInCallback;
  49. #endif
  50. #define LZMA_BASE_SIZE 1846
  51. #define LZMA_LIT_SIZE 768
  52. /*
  53. bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
  54. bufferSize += 100 in case of _LZMA_OUT_READ
  55. by default CProb is unsigned short,
  56. but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
  57. */
  58. #ifdef _LZMA_OUT_READ
  59. int LzmaDecoderInit(
  60. unsigned char *buffer, UInt32 bufferSize,
  61. int lc, int lp, int pb,
  62. unsigned char *dictionary, UInt32 dictionarySize,
  63. #ifdef _LZMA_IN_CB
  64. ILzmaInCallback *inCallback
  65. #else
  66. unsigned char *inStream, UInt32 inSize
  67. #endif
  68. );
  69. #endif
  70. int LzmaDecode(
  71. unsigned char *buffer,
  72. #ifndef _LZMA_OUT_READ
  73. UInt32 bufferSize,
  74. int lc, int lp, int pb,
  75. #ifdef _LZMA_IN_CB
  76. ILzmaInCallback *inCallback,
  77. #else
  78. unsigned char *inStream, UInt32 inSize,
  79. #endif
  80. #endif
  81. unsigned char *outStream, UInt32 outSize,
  82. UInt32 *outSizeProcessed);
  83. #endif