Differences From Artifact [d790744286]:
- File
src/OFDeflateStream.m
— part of check-in
[5dbf9298bd]
at
2013-10-10 21:33:51
on branch trunk
— OFDeflateStream: Fix uint_fast16_t != uint16_t.
On systems where uint_fast16_t is different from uint16_t, the pointer
operator creates incompatible pointers for those two, thus leading to a
compile time error. Therefore, one uint_fast16_t needed to be changed to
an uint16_t. (user: js, size: 17640) [annotate] [blame] [check-ins using]
To Artifact [b262daf9b1]:
- File src/OFDeflateStream.m — part of check-in [f91dbd8975] at 2013-10-29 10:09:19 on branch trunk — OFDeflateStream: Minor improvements. (user: js, size: 17535) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
420 421 422 423 424 425 426 | case HUFFMAN_TREE: #define CTX _context.huffmanTree if OF_LIKELY (CTX.value == 0xFE) { if OF_LIKELY (CTX.litLenCodesCount == 0xFF) { if OF_UNLIKELY (!tryReadBits(self, &bits, 5)) return bytesWritten; | | < < < < | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | case HUFFMAN_TREE: #define CTX _context.huffmanTree if OF_LIKELY (CTX.value == 0xFE) { if OF_LIKELY (CTX.litLenCodesCount == 0xFF) { if OF_UNLIKELY (!tryReadBits(self, &bits, 5)) return bytesWritten; if OF_UNLIKELY (bits > 29) @throw [OFInvalidFormatException exception]; CTX.litLenCodesCount = bits; } if OF_LIKELY (CTX.distCodesCount == 0xFF) { if OF_UNLIKELY (!tryReadBits(self, &bits, 5)) return bytesWritten; CTX.distCodesCount = bits; } if OF_LIKELY (CTX.codeLenCodesCount == 0xFF) { if OF_UNLIKELY (!tryReadBits(self, &bits, 4)) return bytesWritten; CTX.codeLenCodesCount = bits; } if OF_LIKELY (CTX.lengths == NULL) { CTX.lengths = [self allocMemoryWithSize: 19]; memset(CTX.lengths, 0, 19); } |
︙ | ︙ | |||
474 475 476 477 478 479 480 | } if OF_LIKELY (CTX.lengths == NULL) CTX.lengths = [self allocMemoryWithSize: CTX.litLenCodesCount + CTX.distCodesCount + 258]; for (i = CTX.receivedCount; | | | | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | } 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;) { uint_fast8_t j, count; if OF_LIKELY (CTX.value == 0xFF) { if OF_UNLIKELY (!walkTree(self, &CTX.treeIter, &value)) { CTX.receivedCount = i; return bytesWritten; } CTX.treeIter = CTX.codeLenTree; if (value < 16) { CTX.lengths[i++] = value; continue; } } else value = CTX.value; switch (value) { case 16: |
︙ | ︙ | |||
541 542 543 544 545 546 547 | if OF_UNLIKELY (i + count > CTX.litLenCodesCount + CTX.distCodesCount + 258) @throw [OFInvalidFormatException exception]; for (j = 0; j < count; j++) CTX.lengths[i++] = value; | < | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | if OF_UNLIKELY (i + count > CTX.litLenCodesCount + CTX.distCodesCount + 258) @throw [OFInvalidFormatException exception]; for (j = 0; j < count; j++) CTX.lengths[i++] = value; CTX.value = 0xFF; } releaseTree(CTX.codeLenTree); CTX.litLenTree = constructTree(CTX.lengths, |
︙ | ︙ | |||
587 588 589 590 591 592 593 | _slidingWindow = [self allocMemoryWithSize: 0x8000]; /* Avoid leaking data */ memset(_slidingWindow, 0, 0x8000); } _slidingWindow[_slidingWindowIndex] = CTX.value; | | | | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | _slidingWindow = [self allocMemoryWithSize: 0x8000]; /* Avoid leaking data */ memset(_slidingWindow, 0, 0x8000); } _slidingWindow[_slidingWindowIndex] = CTX.value; _slidingWindowIndex = (_slidingWindowIndex + 1) & 0x7FFF; CTX.state = AWAIT_CODE; CTX.treeIter = CTX.litLenTree; } if OF_UNLIKELY (CTX.state == AWAIT_LENGTH_EXTRA_BITS) { if OF_UNLIKELY (!tryReadBits(self, &bits, |
︙ | ︙ | |||
707 708 709 710 711 712 713 | _slidingWindow = [self allocMemoryWithSize: 0x8000]; /* Avoid leaking data */ memset(_slidingWindow, 0, 0x8000); } _slidingWindow[_slidingWindowIndex] = value; | | | | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | _slidingWindow = [self allocMemoryWithSize: 0x8000]; /* Avoid leaking data */ memset(_slidingWindow, 0, 0x8000); } _slidingWindow[_slidingWindowIndex] = value; _slidingWindowIndex = (_slidingWindowIndex + 1) & 0x7FFF; CTX.treeIter = CTX.litLenTree; continue; } if OF_UNLIKELY (value > 285) @throw [OFInvalidFormatException exception]; |
︙ | ︙ |