Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

321 lines
7.7 KiB

  1. /*-------------------------------------------------------------*/
  2. /*--- Public header file for the library. ---*/
  3. /*--- bzlib.h ---*/
  4. /*-------------------------------------------------------------*/
  5. /*--
  6. This file is a part of bzip2 and/or libbzip2, a program and
  7. library for lossless, block-sorting data compression.
  8. Copyright (C) 1996-2002 Julian R Seward. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions
  11. are met:
  12. 1. Redistributions of source code must retain the above copyright
  13. notice, this list of conditions and the following disclaimer.
  14. 2. The origin of this software must not be misrepresented; you must
  15. not claim that you wrote the original software. If you use this
  16. software in a product, an acknowledgment in the product
  17. documentation would be appreciated but is not required.
  18. 3. Altered source versions must be plainly marked as such, and must
  19. not be misrepresented as being the original software.
  20. 4. The name of the author may not be used to endorse or promote
  21. products derived from this software without specific prior written
  22. permission.
  23. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
  24. OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  25. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  27. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  29. GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  31. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  32. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. Julian Seward, Cambridge, UK.
  35. jseward@acm.org
  36. bzip2/libbzip2 version 1.0 of 21 March 2000
  37. This program is based on (at least) the work of:
  38. Mike Burrows
  39. David Wheeler
  40. Peter Fenwick
  41. Alistair Moffat
  42. Radford Neal
  43. Ian H. Witten
  44. Robert Sedgewick
  45. Jon L. Bentley
  46. For more information on these sources, see the manual.
  47. --*/
  48. #ifndef _BZLIB_H
  49. #define _BZLIB_H
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. #define BZ_RUN 0
  54. #define BZ_FLUSH 1
  55. #define BZ_FINISH 2
  56. #define BZ_OK 0
  57. #define BZ_RUN_OK 1
  58. #define BZ_FLUSH_OK 2
  59. #define BZ_FINISH_OK 3
  60. #define BZ_STREAM_END 4
  61. #define BZ_SEQUENCE_ERROR (-1)
  62. #define BZ_PARAM_ERROR (-2)
  63. #define BZ_MEM_ERROR (-3)
  64. #define BZ_DATA_ERROR (-4)
  65. #define BZ_DATA_ERROR_MAGIC (-5)
  66. #define BZ_IO_ERROR (-6)
  67. #define BZ_UNEXPECTED_EOF (-7)
  68. #define BZ_OUTBUFF_FULL (-8)
  69. #define BZ_CONFIG_ERROR (-9)
  70. typedef
  71. struct {
  72. char *next_in;
  73. unsigned int avail_in;
  74. unsigned int total_in_lo32;
  75. unsigned int total_in_hi32;
  76. char *next_out;
  77. unsigned int avail_out;
  78. unsigned int total_out_lo32;
  79. unsigned int total_out_hi32;
  80. void *state;
  81. void *(*bzalloc)(void *,int,int);
  82. void (*bzfree)(void *,void *);
  83. void *opaque;
  84. }
  85. bz_stream;
  86. #ifndef BZ_IMPORT
  87. #define BZ_EXPORT
  88. #endif
  89. /* Need a definitition for FILE */
  90. #include <stdio.h>
  91. #if defined(_WIN32) && !defined(_X360)
  92. # include <windows.h>
  93. # ifdef small
  94. /* windows.h define small to char */
  95. # undef small
  96. # endif
  97. # ifdef BZ_EXPORT
  98. # define BZ_API(func) WINAPI func
  99. # define BZ_EXTERN extern
  100. # else
  101. /* import windows dll dynamically */
  102. # define BZ_API(func) (WINAPI * func)
  103. # define BZ_EXTERN
  104. # endif
  105. #else
  106. # define BZ_API(func) func
  107. # define BZ_EXTERN extern
  108. #endif
  109. /*-- Core (low-level) library functions --*/
  110. BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
  111. bz_stream* strm,
  112. int blockSize100k,
  113. int verbosity,
  114. int workFactor
  115. );
  116. BZ_EXTERN int BZ_API(BZ2_bzCompress) (
  117. bz_stream* strm,
  118. int action
  119. );
  120. BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
  121. bz_stream* strm
  122. );
  123. BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
  124. bz_stream *strm,
  125. int verbosity,
  126. int small
  127. );
  128. BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
  129. bz_stream* strm
  130. );
  131. BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
  132. bz_stream *strm
  133. );
  134. /*-- High(er) level library functions --*/
  135. #ifndef BZ_NO_STDIO
  136. #define BZ_MAX_UNUSED 5000
  137. typedef void BZFILE;
  138. BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
  139. int* bzerror,
  140. FILE* f,
  141. int verbosity,
  142. int small,
  143. void* unused,
  144. int nUnused
  145. );
  146. BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
  147. int* bzerror,
  148. BZFILE* b
  149. );
  150. BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
  151. int* bzerror,
  152. BZFILE* b,
  153. void** unused,
  154. int* nUnused
  155. );
  156. BZ_EXTERN int BZ_API(BZ2_bzRead) (
  157. int* bzerror,
  158. BZFILE* b,
  159. void* buf,
  160. int len
  161. );
  162. BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
  163. int* bzerror,
  164. FILE* f,
  165. int blockSize100k,
  166. int verbosity,
  167. int workFactor
  168. );
  169. BZ_EXTERN void BZ_API(BZ2_bzWrite) (
  170. int* bzerror,
  171. BZFILE* b,
  172. void* buf,
  173. int len
  174. );
  175. BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
  176. int* bzerror,
  177. BZFILE* b,
  178. int abandon,
  179. unsigned int* nbytes_in,
  180. unsigned int* nbytes_out
  181. );
  182. BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
  183. int* bzerror,
  184. BZFILE* b,
  185. int abandon,
  186. unsigned int* nbytes_in_lo32,
  187. unsigned int* nbytes_in_hi32,
  188. unsigned int* nbytes_out_lo32,
  189. unsigned int* nbytes_out_hi32
  190. );
  191. #endif
  192. /*-- Utility functions --*/
  193. BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
  194. char* dest,
  195. unsigned int* destLen,
  196. char* source,
  197. unsigned int sourceLen,
  198. int blockSize100k,
  199. int verbosity,
  200. int workFactor
  201. );
  202. BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
  203. char* dest,
  204. unsigned int* destLen,
  205. char* source,
  206. unsigned int sourceLen,
  207. int small,
  208. int verbosity
  209. );
  210. /*--
  211. Code contributed by Yoshioka Tsuneo
  212. (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
  213. to support better zlib compatibility.
  214. This code is not _officially_ part of libbzip2 (yet);
  215. I haven't tested it, documented it, or considered the
  216. threading-safeness of it.
  217. If this code breaks, please contact both Yoshioka and me.
  218. --*/
  219. BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
  220. void
  221. );
  222. #ifndef BZ_NO_STDIO
  223. BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
  224. const char *path,
  225. const char *mode
  226. );
  227. BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
  228. int fd,
  229. const char *mode
  230. );
  231. BZ_EXTERN int BZ_API(BZ2_bzread) (
  232. BZFILE* b,
  233. void* buf,
  234. int len
  235. );
  236. BZ_EXTERN int BZ_API(BZ2_bzwrite) (
  237. BZFILE* b,
  238. void* buf,
  239. int len
  240. );
  241. BZ_EXTERN int BZ_API(BZ2_bzflush) (
  242. BZFILE* b
  243. );
  244. BZ_EXTERN void BZ_API(BZ2_bzclose) (
  245. BZFILE* b
  246. );
  247. BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
  248. BZFILE *b,
  249. int *errnum
  250. );
  251. #endif
  252. #ifdef __cplusplus
  253. }
  254. #endif
  255. #endif
  256. /*-------------------------------------------------------------*/
  257. /*--- end bzlib.h ---*/
  258. /*-------------------------------------------------------------*/