Differences From Artifact [91e7a25cd0]:
- File
src/OFInflateStream.m
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 18862) [annotate] [blame] [check-ins using] [more...]
To Artifact [47e2756e95]:
- File
src/OFInflateStream.m
— part of check-in
[d3158d091f]
at
2016-01-05 22:00:03
on branch trunk
— (u)int_fast*_t -> (u)int*_t
(U)INT_FAST*_MAX is broken on Android, which makes (u)int_fast*_t
dangerous to use while it does not provide any real speed benefit. (user: js, size: 18741) [annotate] [blame] [check-ins using]
| ︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + - + |
struct huffman_tree {
struct huffman_tree *leafs[2];
uint16_t value;
};
#ifndef DEFLATE64
|
| ︙ | |||
101 102 103 104 105 106 107 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | - + - - + + |
#endif
static const uint8_t codeLengthsOrder[19] = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
static struct huffman_tree *fixedLitLenTree, *fixedDistTree;
static bool
|
| ︙ | |||
126 127 128 129 130 131 132 | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | - + | stream->_savedBits = ret; stream->_savedBitsLength = i; return false; } stream->_byte = stream->_buffer[0]; stream->_bufferIndex = 1; |
| ︙ | |||
158 159 160 161 162 163 164 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - + - + - + - + | tree->leafs[0] = tree->leafs[1] = NULL; tree->value = 0xFFFF; return tree; } static void |
| ︙ | |||
218 219 220 221 222 223 224 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | - + - + - + |
return tree;
}
static bool
walkTree(OFInflateStream *stream, struct huffman_tree **tree, uint16_t *value)
{
struct huffman_tree *iter = *tree;
|
| ︙ | |||
308 309 310 311 312 313 314 | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | - + - + |
}
#endif
- (size_t)lowlevelReadIntoBuffer: (void*)buffer_
length: (size_t)length
{
uint8_t *buffer = buffer_;
|
| ︙ | |||
399 400 401 402 403 404 405 | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | - + - - - + + | #undef CTX case UNCOMPRESSED_BLOCK: #define CTX _context.uncompressed if OF_UNLIKELY (length == 0) return bytesWritten; tmp = (length < CTX.length - CTX.position |
| ︙ | |||
489 490 491 492 493 494 495 | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | - + |
if OF_LIKELY (CTX.lengths == NULL)
CTX.lengths = [self allocMemoryWithSize:
CTX.litLenCodesCount + CTX.distCodesCount + 258];
for (i = CTX.receivedCount;
i < CTX.litLenCodesCount + CTX.distCodesCount + 258;) {
|
| ︙ | |||
583 584 585 586 587 588 589 | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | - + |
_context.huffman.treeIter = CTX.litLenTree;
goto start;
#undef CTX
case HUFFMAN_BLOCK:
#define CTX _context.huffman
for (;;) {
|
| ︙ | |||
659 660 661 662 663 664 665 | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | - + - + |
CTX.distance += bits;
CTX.state = PROCESS_PAIR;
}
/* Length distance pair */
if (CTX.state == PROCESS_PAIR) {
|
| ︙ |