Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: src/liblzma/common/index_decoder.c

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/liblzma/common/index.c ('k') | src/liblzma/common/index_encoder.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /////////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////////
2 // 2 //
3 /// \file index_decoder.c 3 /// \file index_decoder.c
4 /// \brief Decodes the Index field 4 /// \brief Decodes the Index field
5 // 5 //
6 // Author: Lasse Collin 6 // Author: Lasse Collin
7 // 7 //
8 // This file has been put into the public domain. 8 // This file has been put into the public domain.
9 // You can do whatever you want with this file. 9 // You can do whatever you want with this file.
10 // 10 //
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 size_t pos; 49 size_t pos;
50 50
51 /// CRC32 of the List of Records field 51 /// CRC32 of the List of Records field
52 uint32_t crc32; 52 uint32_t crc32;
53 }; 53 };
54 54
55 55
56 static lzma_ret 56 static lzma_ret
57 index_decode(lzma_coder *coder, lzma_allocator *allocator, 57 index_decode(lzma_coder *coder, lzma_allocator *allocator,
58 const uint8_t *restrict in, size_t *restrict in_pos, 58 const uint8_t *restrict in, size_t *restrict in_pos,
59 » » size_t in_size, uint8_t *restrict out lzma_attribute((unused)), 59 » » size_t in_size,
60 » » size_t *restrict out_pos lzma_attribute((unused)), 60 » » uint8_t *restrict out lzma_attribute((__unused__)),
61 » » size_t out_size lzma_attribute((unused)), 61 » » size_t *restrict out_pos lzma_attribute((__unused__)),
62 » » lzma_action action lzma_attribute((unused))) 62 » » size_t out_size lzma_attribute((__unused__)),
63 » » lzma_action action lzma_attribute((__unused__)))
63 { 64 {
64 // Similar optimization as in index_encoder.c 65 // Similar optimization as in index_encoder.c
65 const size_t in_start = *in_pos; 66 const size_t in_start = *in_pos;
66 lzma_ret ret = LZMA_OK; 67 lzma_ret ret = LZMA_OK;
67 68
68 while (*in_pos < in_size) 69 while (*in_pos < in_size)
69 switch (coder->sequence) { 70 switch (coder->sequence) {
70 case SEQ_INDICATOR: 71 case SEQ_INDICATOR:
71 // Return LZMA_DATA_ERROR instead of e.g. LZMA_PROG_ERROR or 72 // Return LZMA_DATA_ERROR instead of e.g. LZMA_PROG_ERROR or
72 // LZMA_FORMAT_ERROR, because a typical usage case for Index 73 // LZMA_FORMAT_ERROR, because a typical usage case for Index
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return index_decoder_reset(next->coder, allocator, i, memlimit); 285 return index_decoder_reset(next->coder, allocator, i, memlimit);
285 } 286 }
286 287
287 288
288 extern LZMA_API(lzma_ret) 289 extern LZMA_API(lzma_ret)
289 lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit) 290 lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
290 { 291 {
291 lzma_next_strm_init(index_decoder_init, strm, i, memlimit); 292 lzma_next_strm_init(index_decoder_init, strm, i, memlimit);
292 293
293 strm->internal->supported_actions[LZMA_RUN] = true; 294 strm->internal->supported_actions[LZMA_RUN] = true;
295 strm->internal->supported_actions[LZMA_FINISH] = true;
294 296
295 return LZMA_OK; 297 return LZMA_OK;
296 } 298 }
297 299
298 300
299 extern LZMA_API(lzma_ret) 301 extern LZMA_API(lzma_ret)
300 lzma_index_buffer_decode( 302 lzma_index_buffer_decode(
301 lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator, 303 lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator,
302 const uint8_t *in, size_t *in_pos, size_t in_size) 304 const uint8_t *in, size_t *in_pos, size_t in_size)
303 { 305 {
(...skipping 30 matching lines...) Expand all
334 336
335 } else if (ret == LZMA_MEMLIMIT_ERROR) { 337 } else if (ret == LZMA_MEMLIMIT_ERROR) {
336 // Tell the caller how much memory would have 338 // Tell the caller how much memory would have
337 // been needed. 339 // been needed.
338 *memlimit = lzma_index_memusage(1, coder.count); 340 *memlimit = lzma_index_memusage(1, coder.count);
339 } 341 }
340 } 342 }
341 343
342 return ret; 344 return ret;
343 } 345 }
OLDNEW
« no previous file with comments | « src/liblzma/common/index.c ('k') | src/liblzma/common/index_encoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698