OLD | NEW |
1 /* | 1 /* |
2 Additional tools for Minizip | 2 Additional tools for Minizip |
3 Code: Xavier Roche '2004 | 3 Code: Xavier Roche '2004 |
4 License: Same as ZLIB (www.gzip.org) | 4 License: Same as ZLIB (www.gzip.org) |
5 */ | 5 */ |
6 | 6 |
7 /* Code */ | 7 /* Code */ |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
11 #if defined(USE_SYSTEM_ZLIB) | |
12 #include <zlib.h> | |
13 #else | |
14 #include "third_party/zlib/zlib.h" | 11 #include "third_party/zlib/zlib.h" |
15 #endif | |
16 #include "unzip.h" | 12 #include "unzip.h" |
17 | 13 |
18 #define READ_8(adr) ((unsigned char)*(adr)) | 14 #define READ_8(adr) ((unsigned char)*(adr)) |
19 #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) | 15 #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) |
20 #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) | 16 #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) |
21 | 17 |
22 #define WRITE_8(buff, n) do { \ | 18 #define WRITE_8(buff, n) do { \ |
23 *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ | 19 *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ |
24 } while(0) | 20 } while(0) |
25 #define WRITE_16(buff, n) do { \ | 21 #define WRITE_16(buff, n) do { \ |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 272 } |
277 if (bytesRecovered != NULL) { | 273 if (bytesRecovered != NULL) { |
278 *bytesRecovered = totalBytes; | 274 *bytesRecovered = totalBytes; |
279 } | 275 } |
280 } | 276 } |
281 } else { | 277 } else { |
282 err = Z_STREAM_ERROR; | 278 err = Z_STREAM_ERROR; |
283 } | 279 } |
284 return err; | 280 return err; |
285 } | 281 } |
OLD | NEW |