Deleted Added
full compact
list.c (213700) list.c (223935)
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file list.c
4/// \brief Listing information about .xz files
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 368 unchanged lines hidden (view full) ---

377 io_buf buf;
378 if (io_pread(pair, &buf, size, iter->block.compressed_file_offset))
379 return true;
380
381 // Zero would mean Index Indicator and thus not a valid Block.
382 if (buf.u8[0] == 0)
383 goto data_error;
384
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file list.c
4/// \brief Listing information about .xz files
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 368 unchanged lines hidden (view full) ---

377 io_buf buf;
378 if (io_pread(pair, &buf, size, iter->block.compressed_file_offset))
379 return true;
380
381 // Zero would mean Index Indicator and thus not a valid Block.
382 if (buf.u8[0] == 0)
383 goto data_error;
384
385 lzma_block block;
386 lzma_filter filters[LZMA_FILTERS_MAX + 1];
387
388 // Initialize the pointers so that they can be passed to free().
389 for (size_t i = 0; i < ARRAY_SIZE(filters); ++i)
390 filters[i].options = NULL;
391
392 // Initialize the block structure and decode Block Header Size.
385 // Initialize the block structure and decode Block Header Size.
386 lzma_filter filters[LZMA_FILTERS_MAX + 1];
387 lzma_block block;
393 block.version = 0;
394 block.check = iter->stream.flags->check;
395 block.filters = filters;
396
397 block.header_size = lzma_block_header_size_decode(buf.u8[0]);
398 if (block.header_size > size)
399 goto data_error;
400

--- 31 unchanged lines hidden (view full) ---

432
433 // Validate or set block.compressed_size.
434 switch (lzma_block_compressed_size(&block,
435 iter->block.unpadded_size)) {
436 case LZMA_OK:
437 break;
438
439 case LZMA_DATA_ERROR:
388 block.version = 0;
389 block.check = iter->stream.flags->check;
390 block.filters = filters;
391
392 block.header_size = lzma_block_header_size_decode(buf.u8[0]);
393 if (block.header_size > size)
394 goto data_error;
395

--- 31 unchanged lines hidden (view full) ---

427
428 // Validate or set block.compressed_size.
429 switch (lzma_block_compressed_size(&block,
430 iter->block.unpadded_size)) {
431 case LZMA_OK:
432 break;
433
434 case LZMA_DATA_ERROR:
435 // Free the memory allocated by lzma_block_header_decode().
436 for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
437 free(filters[i].options);
438
440 goto data_error;
441
442 default:
443 message_bug();
444 }
445
446 // Copy the known sizes.
447 bhi->header_size = block.header_size;

--- 13 unchanged lines hidden (view full) ---

461 free(filters[i].options);
462
463 return false;
464
465data_error:
466 // Show the error message.
467 message_error("%s: %s", pair->src_name,
468 message_strm(LZMA_DATA_ERROR));
439 goto data_error;
440
441 default:
442 message_bug();
443 }
444
445 // Copy the known sizes.
446 bhi->header_size = block.header_size;

--- 13 unchanged lines hidden (view full) ---

460 free(filters[i].options);
461
462 return false;
463
464data_error:
465 // Show the error message.
466 message_error("%s: %s", pair->src_name,
467 message_strm(LZMA_DATA_ERROR));
469
470 // Free the memory allocated by lzma_block_header_decode().
471 // This is truly needed only if we get here after a succcessful
472 // call to lzma_block_header_decode() but it doesn't hurt to
473 // always do it.
474 for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
475 free(filters[i].options);
476
477 return true;
478}
479
480
481/// \brief Parse the Check field and put it into check_value[]
482///
483/// \return False on success, true on error.
484static bool

--- 634 unchanged lines hidden ---
468 return true;
469}
470
471
472/// \brief Parse the Check field and put it into check_value[]
473///
474/// \return False on success, true on error.
475static bool

--- 634 unchanged lines hidden ---