aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/block_private.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-06-18 18:02:10 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-06-18 18:02:10 +0300
commit7d17818cec8597f847b0a2537fde991bbc3d9e96 (patch)
tree9c41502e3eb96f103fe98e13456b382fbba7a292 /src/liblzma/common/block_private.h
parentUpdate the file format specification draft. The new one is (diff)
downloadxz-7d17818cec8597f847b0a2537fde991bbc3d9e96.tar.xz
Update the code to mostly match the new simpler file format
specification. Simplify things by removing most of the support for known uncompressed size in most places. There are some miscellaneous changes here and there too. The API of liblzma has got many changes and still some more will be done soon. While most of the code has been updated, some things are not fixed (the command line tool will choke with invalid filter chain, if nothing else). Subblock filter is somewhat broken for now. It will be updated once the encoded format of the Subblock filter has been decided.
Diffstat (limited to 'src/liblzma/common/block_private.h')
-rw-r--r--src/liblzma/common/block_private.h51
1 files changed, 1 insertions, 50 deletions
diff --git a/src/liblzma/common/block_private.h b/src/liblzma/common/block_private.h
index 16d95b9f..235e96b8 100644
--- a/src/liblzma/common/block_private.h
+++ b/src/liblzma/common/block_private.h
@@ -22,6 +22,7 @@
#include "common.h"
+
static inline bool
update_size(lzma_vli *size, lzma_vli add, lzma_vli limit)
{
@@ -43,54 +44,4 @@ is_size_valid(lzma_vli size, lzma_vli reference)
return reference == LZMA_VLI_VALUE_UNKNOWN || reference == size;
}
-
-/// If any of these tests fail, the caller has to return LZMA_PROG_ERROR.
-static inline bool
-validate_options_1(const lzma_options_block *options)
-{
- return options == NULL
- || !lzma_vli_is_valid(options->compressed_size)
- || !lzma_vli_is_valid(options->uncompressed_size)
- || !lzma_vli_is_valid(options->total_size)
- || !lzma_vli_is_valid(options->total_limit)
- || !lzma_vli_is_valid(options->uncompressed_limit);
-}
-
-
-/// If any of these tests fail, the encoder has to return LZMA_PROG_ERROR
-/// because something is going horribly wrong if such values get passed
-/// to the encoder. In contrast, the decoder has to return LZMA_DATA_ERROR,
-/// since these tests failing indicate that something is wrong in the Stream.
-static inline bool
-validate_options_2(const lzma_options_block *options)
-{
- if ((options->uncompressed_size != LZMA_VLI_VALUE_UNKNOWN
- && options->uncompressed_size
- > options->uncompressed_limit)
- || (options->total_size != LZMA_VLI_VALUE_UNKNOWN
- && options->total_size
- > options->total_limit)
- || (!options->has_eopm && options->uncompressed_size
- == LZMA_VLI_VALUE_UNKNOWN)
- || options->header_size > options->total_size)
- return true;
-
- if (options->compressed_size != LZMA_VLI_VALUE_UNKNOWN) {
- // Calculate a rough minimum possible valid Total Size of
- // this Block, and check that total_size and total_limit
- // are big enough. Note that the real minimum size can be
- // bigger due to the Check, Uncompressed Size, Backwards
- // Size, pr Padding being present. A rough check here is
- // enough for us to catch the most obvious errors as early
- // as possible.
- const lzma_vli total_min = options->compressed_size
- + (lzma_vli)(options->header_size);
- if (total_min > options->total_size
- || total_min > options->total_limit)
- return true;
- }
-
- return false;
-}
-
#endif