Differences From Artifact [16b7cb0b85]:
- File
src/OFLHADecompressingStream.m
— part of check-in
[9e9ce6aa1c]
at
2020-09-27 03:08:51
on branch trunk
— Work around bugs in Apple GCC 4.0.1
Still miscompiles things. (user: js, size: 12532) [annotate] [blame] [check-ins using] [more...]
To Artifact [548b68c743]:
- File src/OFLHADecompressingStream.m — part of check-in [da1fb6b21c] at 2020-11-05 02:27:35 on branch trunk — Further reduce usage of -[allocMemoryWithSize:] (user: js, size: 12532) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
106 107 108 109 110 111 112 | /* 0-7 address the bit, 8 means fetch next byte */ _bitIndex = 8; _distanceBits = distanceBits; _dictionaryBits = dictionaryBits; _slidingWindowMask = (1u << dictionaryBits) - 1; | < | > > > > | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | /* 0-7 address the bit, 8 means fetch next byte */ _bitIndex = 8; _distanceBits = distanceBits; _dictionaryBits = dictionaryBits; _slidingWindowMask = (1u << dictionaryBits) - 1; _slidingWindow = of_malloc(_slidingWindowMask + 1, 1); memset(_slidingWindow, ' ', _slidingWindowMask + 1); } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { if (_stream != nil) [self close]; free(_slidingWindow); if (_codeLenTree != NULL) of_huffman_tree_release(_codeLenTree); if (_litLenTree != NULL) of_huffman_tree_release(_litLenTree); if (_distTree != NULL) of_huffman_tree_release(_distTree); free(_codesLengths); [super dealloc]; } - (size_t)lowlevelReadIntoBuffer: (void *)buffer_ length: (size_t)length { |
︙ | ︙ | |||
170 171 172 173 174 175 176 | if OF_UNLIKELY (bits == 0) { _state = STATE_CODE_LEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | if OF_UNLIKELY (bits == 0) { _state = STATE_CODE_LEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; _codesLengths = of_calloc(bits, 1); _skip = true; _state = STATE_CODE_LEN_TREE; goto start; case STATE_CODE_LEN_TREE: while (_codesReceived < _codesCount) { if OF_UNLIKELY (_currentIsExtendedLength) { |
︙ | ︙ | |||
221 222 223 224 225 226 227 | continue; } else _codesReceived++; } _codeLenTree = of_huffman_tree_construct(_codesLengths, _codesCount); | | > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | continue; } else _codesReceived++; } _codeLenTree = of_huffman_tree_construct(_codesLengths, _codesCount); free(_codesLengths); _codesLengths = NULL; _state = STATE_LITLEN_CODES_COUNT; goto start; case STATE_CODE_LEN_TREE_SINGLE: if OF_UNLIKELY (!tryReadBits(self, &bits, 5)) return bytesWritten; |
︙ | ︙ | |||
250 251 252 253 254 255 256 | _state = STATE_LITLEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | _state = STATE_LITLEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; _codesLengths = of_calloc(bits, 1); _skip = false; _treeIter = _codeLenTree; _state = STATE_LITLEN_TREE; goto start; case STATE_LITLEN_TREE: while (_codesReceived < _codesCount) { |
︙ | ︙ | |||
310 311 312 313 314 315 316 | _skip = true; } else _codesLengths[_codesReceived++] = value - 2; } _litLenTree = of_huffman_tree_construct(_codesLengths, _codesCount); | | > | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | _skip = true; } else _codesLengths[_codesReceived++] = value - 2; } _litLenTree = of_huffman_tree_construct(_codesLengths, _codesCount); free(_codesLengths); _codesLengths = NULL; of_huffman_tree_release(_codeLenTree); _codeLenTree = NULL; _state = STATE_DIST_CODES_COUNT; goto start; case STATE_LITLEN_TREE_SINGLE: |
︙ | ︙ | |||
339 340 341 342 343 344 345 | if OF_UNLIKELY (bits == 0) { _state = STATE_DIST_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; | | | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | if OF_UNLIKELY (bits == 0) { _state = STATE_DIST_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; _codesLengths = of_calloc(bits, 1); _treeIter = _codeLenTree; _state = STATE_DIST_TREE; goto start; case STATE_DIST_TREE: while (_codesReceived < _codesCount) { if OF_UNLIKELY (_currentIsExtendedLength) { |
︙ | ︙ | |||
374 375 376 377 378 379 380 | continue; } else _codesReceived++; } _distTree = of_huffman_tree_construct(_codesLengths, _codesCount); | | > | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | continue; } else _codesReceived++; } _distTree = of_huffman_tree_construct(_codesLengths, _codesCount); free(_codesLengths); _codesLengths = NULL; _treeIter = _litLenTree; _state = STATE_BLOCK_LITLEN; goto start; case STATE_DIST_TREE_SINGLE: if OF_UNLIKELY (!tryReadBits(self, &bits, _distanceBits)) return bytesWritten; |
︙ | ︙ |