modules/libbz2/src/bzlib.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1
michael@0 2 /*-------------------------------------------------------------*/
michael@0 3 /*--- Public header file for the library. ---*/
michael@0 4 /*--- bzlib.h ---*/
michael@0 5 /*-------------------------------------------------------------*/
michael@0 6
michael@0 7 /* ------------------------------------------------------------------
michael@0 8 This file is part of bzip2/libbzip2, a program and library for
michael@0 9 lossless, block-sorting data compression.
michael@0 10
michael@0 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
michael@0 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
michael@0 13
michael@0 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
michael@0 15 README file.
michael@0 16
michael@0 17 This program is released under the terms of the license contained
michael@0 18 in the file LICENSE.
michael@0 19 ------------------------------------------------------------------ */
michael@0 20
michael@0 21
michael@0 22 #ifndef _BZLIB_H
michael@0 23 #define _BZLIB_H
michael@0 24
michael@0 25 #ifdef __cplusplus
michael@0 26 extern "C" {
michael@0 27 #endif
michael@0 28
michael@0 29 #define BZ_RUN 0
michael@0 30 #define BZ_FLUSH 1
michael@0 31 #define BZ_FINISH 2
michael@0 32
michael@0 33 #define BZ_OK 0
michael@0 34 #define BZ_RUN_OK 1
michael@0 35 #define BZ_FLUSH_OK 2
michael@0 36 #define BZ_FINISH_OK 3
michael@0 37 #define BZ_STREAM_END 4
michael@0 38 #define BZ_SEQUENCE_ERROR (-1)
michael@0 39 #define BZ_PARAM_ERROR (-2)
michael@0 40 #define BZ_MEM_ERROR (-3)
michael@0 41 #define BZ_DATA_ERROR (-4)
michael@0 42 #define BZ_DATA_ERROR_MAGIC (-5)
michael@0 43 #define BZ_IO_ERROR (-6)
michael@0 44 #define BZ_UNEXPECTED_EOF (-7)
michael@0 45 #define BZ_OUTBUFF_FULL (-8)
michael@0 46 #define BZ_CONFIG_ERROR (-9)
michael@0 47
michael@0 48 typedef
michael@0 49 struct {
michael@0 50 char *next_in;
michael@0 51 unsigned int avail_in;
michael@0 52 unsigned int total_in_lo32;
michael@0 53 unsigned int total_in_hi32;
michael@0 54
michael@0 55 char *next_out;
michael@0 56 unsigned int avail_out;
michael@0 57 unsigned int total_out_lo32;
michael@0 58 unsigned int total_out_hi32;
michael@0 59
michael@0 60 void *state;
michael@0 61
michael@0 62 void *(*bzalloc)(void *,int,int);
michael@0 63 void (*bzfree)(void *,void *);
michael@0 64 void *opaque;
michael@0 65 }
michael@0 66 bz_stream;
michael@0 67
michael@0 68
michael@0 69 #ifndef BZ_IMPORT
michael@0 70 #define BZ_EXPORT
michael@0 71 #endif
michael@0 72
michael@0 73 #ifndef BZ_NO_STDIO
michael@0 74 /* Need a definitition for FILE */
michael@0 75 #include <stdio.h>
michael@0 76 #endif
michael@0 77
michael@0 78 #ifdef _WIN32
michael@0 79 # include <windows.h>
michael@0 80 # ifdef small
michael@0 81 /* windows.h define small to char */
michael@0 82 # undef small
michael@0 83 # endif
michael@0 84 # ifdef BZ_EXPORT
michael@0 85 # define BZ_API(func) WINAPI func
michael@0 86 # define BZ_EXTERN extern
michael@0 87 # else
michael@0 88 /* import windows dll dynamically */
michael@0 89 # define BZ_API(func) (WINAPI * func)
michael@0 90 # define BZ_EXTERN
michael@0 91 # endif
michael@0 92 #else
michael@0 93 # define BZ_API(func) func
michael@0 94 # define BZ_EXTERN extern
michael@0 95 #endif
michael@0 96
michael@0 97
michael@0 98 /*-- Core (low-level) library functions --*/
michael@0 99
michael@0 100 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
michael@0 101 bz_stream* strm,
michael@0 102 int blockSize100k,
michael@0 103 int verbosity,
michael@0 104 int workFactor
michael@0 105 );
michael@0 106
michael@0 107 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
michael@0 108 bz_stream* strm,
michael@0 109 int action
michael@0 110 );
michael@0 111
michael@0 112 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
michael@0 113 bz_stream* strm
michael@0 114 );
michael@0 115
michael@0 116 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
michael@0 117 bz_stream *strm,
michael@0 118 int verbosity,
michael@0 119 int small
michael@0 120 );
michael@0 121
michael@0 122 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
michael@0 123 bz_stream* strm
michael@0 124 );
michael@0 125
michael@0 126 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
michael@0 127 bz_stream *strm
michael@0 128 );
michael@0 129
michael@0 130
michael@0 131
michael@0 132 /*-- High(er) level library functions --*/
michael@0 133
michael@0 134 #ifndef BZ_NO_STDIO
michael@0 135 #define BZ_MAX_UNUSED 5000
michael@0 136
michael@0 137 typedef void BZFILE;
michael@0 138
michael@0 139 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
michael@0 140 int* bzerror,
michael@0 141 FILE* f,
michael@0 142 int verbosity,
michael@0 143 int small,
michael@0 144 void* unused,
michael@0 145 int nUnused
michael@0 146 );
michael@0 147
michael@0 148 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
michael@0 149 int* bzerror,
michael@0 150 BZFILE* b
michael@0 151 );
michael@0 152
michael@0 153 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
michael@0 154 int* bzerror,
michael@0 155 BZFILE* b,
michael@0 156 void** unused,
michael@0 157 int* nUnused
michael@0 158 );
michael@0 159
michael@0 160 BZ_EXTERN int BZ_API(BZ2_bzRead) (
michael@0 161 int* bzerror,
michael@0 162 BZFILE* b,
michael@0 163 void* buf,
michael@0 164 int len
michael@0 165 );
michael@0 166
michael@0 167 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
michael@0 168 int* bzerror,
michael@0 169 FILE* f,
michael@0 170 int blockSize100k,
michael@0 171 int verbosity,
michael@0 172 int workFactor
michael@0 173 );
michael@0 174
michael@0 175 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
michael@0 176 int* bzerror,
michael@0 177 BZFILE* b,
michael@0 178 void* buf,
michael@0 179 int len
michael@0 180 );
michael@0 181
michael@0 182 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
michael@0 183 int* bzerror,
michael@0 184 BZFILE* b,
michael@0 185 int abandon,
michael@0 186 unsigned int* nbytes_in,
michael@0 187 unsigned int* nbytes_out
michael@0 188 );
michael@0 189
michael@0 190 BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
michael@0 191 int* bzerror,
michael@0 192 BZFILE* b,
michael@0 193 int abandon,
michael@0 194 unsigned int* nbytes_in_lo32,
michael@0 195 unsigned int* nbytes_in_hi32,
michael@0 196 unsigned int* nbytes_out_lo32,
michael@0 197 unsigned int* nbytes_out_hi32
michael@0 198 );
michael@0 199 #endif
michael@0 200
michael@0 201
michael@0 202 /*-- Utility functions --*/
michael@0 203
michael@0 204 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
michael@0 205 char* dest,
michael@0 206 unsigned int* destLen,
michael@0 207 char* source,
michael@0 208 unsigned int sourceLen,
michael@0 209 int blockSize100k,
michael@0 210 int verbosity,
michael@0 211 int workFactor
michael@0 212 );
michael@0 213
michael@0 214 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
michael@0 215 char* dest,
michael@0 216 unsigned int* destLen,
michael@0 217 char* source,
michael@0 218 unsigned int sourceLen,
michael@0 219 int small,
michael@0 220 int verbosity
michael@0 221 );
michael@0 222
michael@0 223
michael@0 224 /*--
michael@0 225 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
michael@0 226 to support better zlib compatibility.
michael@0 227 This code is not _officially_ part of libbzip2 (yet);
michael@0 228 I haven't tested it, documented it, or considered the
michael@0 229 threading-safeness of it.
michael@0 230 If this code breaks, please contact both Yoshioka and me.
michael@0 231 --*/
michael@0 232
michael@0 233 BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
michael@0 234 void
michael@0 235 );
michael@0 236
michael@0 237 #ifndef BZ_NO_STDIO
michael@0 238 BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
michael@0 239 const char *path,
michael@0 240 const char *mode
michael@0 241 );
michael@0 242
michael@0 243 BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
michael@0 244 int fd,
michael@0 245 const char *mode
michael@0 246 );
michael@0 247
michael@0 248 BZ_EXTERN int BZ_API(BZ2_bzread) (
michael@0 249 BZFILE* b,
michael@0 250 void* buf,
michael@0 251 int len
michael@0 252 );
michael@0 253
michael@0 254 BZ_EXTERN int BZ_API(BZ2_bzwrite) (
michael@0 255 BZFILE* b,
michael@0 256 void* buf,
michael@0 257 int len
michael@0 258 );
michael@0 259
michael@0 260 BZ_EXTERN int BZ_API(BZ2_bzflush) (
michael@0 261 BZFILE* b
michael@0 262 );
michael@0 263
michael@0 264 BZ_EXTERN void BZ_API(BZ2_bzclose) (
michael@0 265 BZFILE* b
michael@0 266 );
michael@0 267
michael@0 268 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
michael@0 269 BZFILE *b,
michael@0 270 int *errnum
michael@0 271 );
michael@0 272 #endif
michael@0 273
michael@0 274 #ifdef __cplusplus
michael@0 275 }
michael@0 276 #endif
michael@0 277
michael@0 278 #endif
michael@0 279
michael@0 280 /*-------------------------------------------------------------*/
michael@0 281 /*--- end bzlib.h ---*/
michael@0 282 /*-------------------------------------------------------------*/

mercurial