Differences From Artifact [459199aede]:
- File
src/OFDeflateStream.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 20156) [annotate] [blame] [check-ins using]
To Artifact [be9beadf26]:
- File
src/OFDeflateStream.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 20161) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
150 151 152 153 154 155 156 | ivars->savedBits = 0; ivars->savedBitsLength = 0; *bits = ret; return true; } | | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ivars->savedBits = 0; ivars->savedBitsLength = 0; *bits = ret; return true; } static struct huffman_tree * newTree(void) { struct huffman_tree *tree; if ((tree = malloc(sizeof(*tree))) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: sizeof(*tree)]; |
︙ | ︙ | |||
184 185 186 187 188 189 190 | tree = tree->leafs[bit]; } tree->value = value; } | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | tree = tree->leafs[bit]; } tree->value = value; } static struct huffman_tree * constructTree(uint8_t lengths[], uint16_t count) { struct huffman_tree *tree; uint16_t lengthCount[MAX_BITS + 1] = { 0 }; uint16_t code, maxCode = 0, nextCode[MAX_BITS + 1]; for (uint16_t i = 0; i < count; i++) { |
︙ | ︙ | |||
281 282 283 284 285 286 287 | for (uint16_t i = 0; i <= 31; i++) lengths[i] = 5; fixedDistTree = constructTree(lengths, 32); } #ifndef DEFLATE64 | | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | for (uint16_t i = 0; i <= 31; i++) lengths[i] = 5; fixedDistTree = constructTree(lengths, 32); } #ifndef DEFLATE64 + (instancetype)streamWithStream: (OFStream *)stream { return [[[self alloc] initWithStream: stream] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithStream: (OFStream *)stream { self = [super init]; _stream = [stream retain]; return self; } |
︙ | ︙ | |||
336 337 338 339 340 341 342 | #ifdef DEFLATE64 _decompression->slidingWindowMask = 0xFFFF; #else _decompression->slidingWindowMask = 0x7FFF; #endif } | | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | #ifdef DEFLATE64 _decompression->slidingWindowMask = 0xFFFF; #else _decompression->slidingWindowMask = 0x7FFF; #endif } - (size_t)lowlevelReadIntoBuffer: (void *)buffer_ length: (size_t)length { struct of_deflate_stream_decompression_ivars *ivars = _decompression; uint8_t *buffer = buffer_; uint16_t bits, tmp; uint16_t value; size_t bytesWritten = 0; |
︙ | ︙ |