Mercurial > hg > dmlib
comparison src/dmzlib.c @ 1002:2da97be2aa1f
Rename some variables.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 01 Mar 2015 03:07:39 +0200 |
parents | 198156b930d7 |
children | 7a0c2fe22e60 |
comparison
equal
deleted
inserted
replaced
1001:198156b930d7 | 1002:2da97be2aa1f |
---|---|
243 | 243 |
244 return DMERR_OK; | 244 return DMERR_OK; |
245 } | 245 } |
246 | 246 |
247 | 247 |
248 static const int stbi__zlength_base[31] = | 248 static const int dm_zlib_length_base[31] = |
249 { | 249 { |
250 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, | 250 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, |
251 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, | 251 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, |
252 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 | 252 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 |
253 }; | 253 }; |
254 | 254 |
255 static const int stbi__zlength_extra[31] = | 255 static const int dm_zlib_length_extra[31] = |
256 { | 256 { |
257 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, | 257 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, |
258 5, 5, 5, 5, 0, 0, 0 | 258 5, 5, 5, 5, 0, 0, 0 |
259 }; | 259 }; |
260 | 260 |
261 static const int stbi__zdist_base[32] = | 261 static const int dm_zlib_dist_base[32] = |
262 { | 262 { |
263 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, | 263 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, |
264 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, | 264 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, |
265 16385, 24577, 0, 0 | 265 16385, 24577, 0, 0 |
266 }; | 266 }; |
267 | 267 |
268 static const int stbi__zdist_extra[32] = | 268 static const int dm_zlib_dist_extra[32] = |
269 { | 269 { |
270 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, | 270 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, |
271 10, 11, 11, 12, 12, 13, 13 | 271 10, 11, 11, 12, 12, 13, 13 |
272 }; | 272 }; |
273 | 273 |
301 a->zout = zout; | 301 a->zout = zout; |
302 return DMERR_OK; | 302 return DMERR_OK; |
303 } | 303 } |
304 z -= 257; | 304 z -= 257; |
305 | 305 |
306 len = stbi__zlength_base[z]; | 306 len = dm_zlib_length_base[z]; |
307 if (stbi__zlength_extra[z]) | 307 if (dm_zlib_length_extra[z]) |
308 len += dmZReceive(a, stbi__zlength_extra[z]); | 308 len += dmZReceive(a, dm_zlib_length_extra[z]); |
309 | 309 |
310 if ((ret = dmZLibHuffmanDecode(a, &a->zdistance, &z)) != DMERR_OK) | 310 if ((ret = dmZLibHuffmanDecode(a, &a->zdistance, &z)) != DMERR_OK) |
311 return ret; | 311 return ret; |
312 | 312 |
313 dist = stbi__zdist_base[z]; | 313 dist = dm_zlib_dist_base[z]; |
314 if (stbi__zdist_extra[z]) | 314 if (dm_zlib_dist_extra[z]) |
315 dist += dmZReceive(a, stbi__zdist_extra[z]); | 315 dist += dmZReceive(a, dm_zlib_dist_extra[z]); |
316 | 316 |
317 if (zout - a->zoutStart < dist) | 317 if (zout - a->zoutStart < dist) |
318 { | 318 { |
319 return dmError(DMERR_DATA_ERROR, | 319 return dmError(DMERR_DATA_ERROR, |
320 "Bad Huffman block distance.\n"); | 320 "Bad Huffman block distance.\n"); |