unxz: remove debugging. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-05-30 04:50:21 +02:00
parent 6948f210ed
commit acaaca839a
4 changed files with 11 additions and 33 deletions

View File

@ -12,7 +12,6 @@
#include "libbb.h" #include "libbb.h"
#include "unarchive.h" #include "unarchive.h"
//#define XZ_DEBUG_MSG(...) bb_error_msg(__VA_ARGS)
#define XZ_REALLOC_DICT_BUF(ptr, size) xrealloc(ptr, size) #define XZ_REALLOC_DICT_BUF(ptr, size) xrealloc(ptr, size)
#define XZ_FUNC FAST_FUNC #define XZ_FUNC FAST_FUNC
#define XZ_EXTERN static #define XZ_EXTERN static

View File

@ -19,10 +19,6 @@
# include <stdint.h> # include <stdint.h>
#endif #endif
#ifndef XZ_DEBUG_MSG
# define XZ_DEBUG_MSG(...) ((void)0)
#endif
/* In Linux, this is used to make extern functions static when needed. */ /* In Linux, this is used to make extern functions static when needed. */
#ifndef XZ_EXTERN #ifndef XZ_EXTERN
# define XZ_EXTERN extern # define XZ_EXTERN extern

View File

@ -1117,10 +1117,8 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_reset(
struct xz_dec_lzma2 *s, uint8_t props) struct xz_dec_lzma2 *s, uint8_t props)
{ {
/* This limits dictionary size to 3 GiB to keep parsing simpler. */ /* This limits dictionary size to 3 GiB to keep parsing simpler. */
if (props > 39) { if (props > 39)
XZ_DEBUG_MSG("props:%d", props);
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
}
s->dict.size = 2 + (props & 1); s->dict.size = 2 + (props & 1);
s->dict.size <<= (props >> 1) + 11; s->dict.size <<= (props >> 1) + 11;

View File

@ -365,16 +365,14 @@ static enum xz_ret XZ_FUNC dec_stream_header(struct xz_dec *s)
/* /*
* Decode the Stream Flags field. Of integrity checks, we support * Decode the Stream Flags field. Of integrity checks, we support
* only none (Check ID = 0) and CRC32 (Check ID = 1). * only none (Check ID = 0) and CRC32 (Check ID = 1).
* We also accept CRC64 and SHA-256, but they will not be verified.
*/ */
if (s->temp.buf[HEADER_MAGIC_SIZE] != 0 if (s->temp.buf[HEADER_MAGIC_SIZE] != 0
|| (s->temp.buf[HEADER_MAGIC_SIZE + 1] > 1 || (s->temp.buf[HEADER_MAGIC_SIZE + 1] > 1
&& s->temp.buf[HEADER_MAGIC_SIZE + 1] != 0x04 && s->temp.buf[HEADER_MAGIC_SIZE + 1] != 0x04 /* CRC64 */
&& s->temp.buf[HEADER_MAGIC_SIZE + 1] != 0x0A && s->temp.buf[HEADER_MAGIC_SIZE + 1] != 0x0A /* SHA-256 */
) )
) { ) {
XZ_DEBUG_MSG("unsupported stream flags %x:%x",
s->temp.buf[HEADER_MAGIC_SIZE],
s->temp.buf[HEADER_MAGIC_SIZE+1]);
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
} }
@ -435,10 +433,7 @@ static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s)
#else #else
if (s->temp.buf[1] & 0x3F) if (s->temp.buf[1] & 0x3F)
#endif #endif
{
XZ_DEBUG_MSG("s->temp.buf[1] & 0x3E/3F != 0");
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
}
/* Compressed Size */ /* Compressed Size */
if (s->temp.buf[1] & 0x40) { if (s->temp.buf[1] & 0x40) {
@ -466,10 +461,8 @@ static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s)
/* If there are two filters, the first one must be a BCJ filter. */ /* If there are two filters, the first one must be a BCJ filter. */
s->bcj_active = s->temp.buf[1] & 0x01; s->bcj_active = s->temp.buf[1] & 0x01;
if (s->bcj_active) { if (s->bcj_active) {
if (s->temp.size - s->temp.pos < 2) { if (s->temp.size - s->temp.pos < 2)
XZ_DEBUG_MSG("temp.size - temp.pos < 2");
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
}
ret = xz_dec_bcj_reset(s->bcj, s->temp.buf[s->temp.pos++]); ret = xz_dec_bcj_reset(s->bcj, s->temp.buf[s->temp.pos++]);
if (ret != XZ_OK) if (ret != XZ_OK)
@ -479,10 +472,8 @@ static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s)
* We don't support custom start offset, * We don't support custom start offset,
* so Size of Properties must be zero. * so Size of Properties must be zero.
*/ */
if (s->temp.buf[s->temp.pos++] != 0x00) { if (s->temp.buf[s->temp.pos++] != 0x00)
XZ_DEBUG_MSG("size of properties != 0");
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
}
} }
#endif #endif
@ -491,16 +482,12 @@ static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s)
return XZ_DATA_ERROR; return XZ_DATA_ERROR;
/* Filter ID = LZMA2 */ /* Filter ID = LZMA2 */
if (s->temp.buf[s->temp.pos++] != 0x21) { if (s->temp.buf[s->temp.pos++] != 0x21)
XZ_DEBUG_MSG("filter ID != 0x21");
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
}
/* Size of Properties = 1-byte Filter Properties */ /* Size of Properties = 1-byte Filter Properties */
if (s->temp.buf[s->temp.pos++] != 0x01) { if (s->temp.buf[s->temp.pos++] != 0x01)
XZ_DEBUG_MSG("size of properties != 1");
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
}
/* Filter Properties contains LZMA2 dictionary size. */ /* Filter Properties contains LZMA2 dictionary size. */
if (s->temp.size - s->temp.pos < 1) if (s->temp.size - s->temp.pos < 1)
@ -512,10 +499,8 @@ static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s)
/* The rest must be Header Padding. */ /* The rest must be Header Padding. */
while (s->temp.pos < s->temp.size) while (s->temp.pos < s->temp.size)
if (s->temp.buf[s->temp.pos++] != 0x00) { if (s->temp.buf[s->temp.pos++] != 0x00)
XZ_DEBUG_MSG("padding is not zero-filled");
return XZ_OPTIONS_ERROR; return XZ_OPTIONS_ERROR;
}
s->temp.pos = 0; s->temp.pos = 0;
s->block.compressed = 0; s->block.compressed = 0;