summaryrefslogtreecommitdiff
path: root/xdelta3-main.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3-main.h')
-rw-r--r--xdelta3-main.h269
1 files changed, 127 insertions, 142 deletions
diff --git a/xdelta3-main.h b/xdelta3-main.h
index ff0bdcb..090b7d9 100644
--- a/xdelta3-main.h
+++ b/xdelta3-main.h
@@ -1,6 +1,6 @@
/* xdelta3 - delta compression tools and library
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- * 2009, 2010, 2011, 2012, 2013, 2014, 2015 Joshua P. MacDonald
+ * 2009, 2010, 2011, 2012, 2013 Joshua P. MacDonald
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,8 +49,6 @@
/*********************************************************************/
-#include <limits.h>
-
#ifndef XD3_POSIX
#define XD3_POSIX 0
#endif
@@ -70,7 +68,7 @@ const char* xd3_mainerror(int err_num);
#include "xdelta3-internal.h"
int
-xsnprintf_func (char *str, size_t n, const char *fmt, ...)
+xsnprintf_func (char *str, int n, const char *fmt, ...)
{
va_list a;
int ret;
@@ -84,6 +82,12 @@ xsnprintf_func (char *str, size_t n, const char *fmt, ...)
return ret;
}
+/* If none are set, default to posix. */
+#if (XD3_POSIX + XD3_STDIO + XD3_WIN32) == 0
+#undef XD3_POSIX
+#define XD3_POSIX 1
+#endif
+
/* Handle externally-compressed inputs. */
#ifndef EXTERNAL_COMPRESSION
#define EXTERNAL_COMPRESSION 1
@@ -234,9 +238,10 @@ static int option_verbose = DEFAULT_VERBOSE;
static int option_quiet = 0;
static int option_use_appheader = 1;
static uint8_t* option_appheader = NULL;
-static int option_use_secondary = 1;
+static int option_use_secondary = 0;
static const char* option_secondary = NULL;
static int option_use_checksum = 1;
+static int option_use_altcodetable = 0;
static const char* option_smatch_config = NULL;
static int option_no_compress = 0;
static int option_no_output = 0; /* do not write output */
@@ -245,8 +250,9 @@ static const char *option_source_filename = NULL;
static int option_level = XD3_DEFAULT_LEVEL;
static usize_t option_iopt_size = XD3_DEFAULT_IOPT_SIZE;
static usize_t option_winsize = XD3_DEFAULT_WINSIZE;
-
-/* option_srcwinsz is restricted to [16kB, 2GB] when usize_t is 32 bits. */
+/* Note: option_srcwinsz is restricted from [16Kb, 4Gb], because
+ * addresses in the large hash checksum are 32 bits. The flag is read
+ * as xoff_t, so that 4Gb != 0. */
static xoff_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ;
static usize_t option_sprevsz = XD3_DEFAULT_SPREVSZ;
@@ -302,6 +308,10 @@ static void main_get_appheader (xd3_stream *stream, main_file *ifile,
static int main_getblk_func (xd3_stream *stream,
xd3_source *source,
xoff_t blkno);
+static void main_free (void *ptr);
+static void* main_malloc (size_t size);
+
+static int main_file_stat (main_file *xfile, xoff_t *size);
static int main_file_seek (main_file *xfile, xoff_t pos);
static int main_read_primary_input (main_file *file,
uint8_t *buf,
@@ -320,7 +330,7 @@ static int xd3_merge_input_output (xd3_stream *stream,
* comments there. */
#include "xdelta3-blkcache.h"
-static void (*xprintf_message_func)(const char*msg) = NULL;
+void (*xprintf_message_func)(const char*msg) = NULL;
void
xprintf (const char *fmt, ...)
@@ -347,8 +357,8 @@ xprintf (const char *fmt, ...)
static int
main_version (void)
{
- /* $Format: " XPR(NTR \"Xdelta version $Xdelta3Version$, Copyright (C) Joshua MacDonald\\n\");" $ */
- XPR(NTR "Xdelta version 3.1.0, Copyright (C) Joshua MacDonald\n");
+ /* $Format: " XPR(NTR \"Xdelta version $Xdelta3Version$, Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, Joshua MacDonald\\n\");" $ */
+ XPR(NTR "Xdelta version 3.0.8, Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Joshua MacDonald\n");
XPR(NTR "Xdelta comes with ABSOLUTELY NO WARRANTY.\n");
XPR(NTR "This is free software, and you are welcome to redistribute it\n");
XPR(NTR "under certain conditions; see \"COPYING\" for details.\n");
@@ -361,6 +371,8 @@ main_config (void)
main_version ();
XPR(NTR "EXTERNAL_COMPRESSION=%d\n", EXTERNAL_COMPRESSION);
+ XPR(NTR "GENERIC_ENCODE_TABLES=%d\n", GENERIC_ENCODE_TABLES);
+ XPR(NTR "GENERIC_ENCODE_TABLES_COMPUTE=%d\n", GENERIC_ENCODE_TABLES_COMPUTE);
XPR(NTR "REGRESSION_TEST=%d\n", REGRESSION_TEST);
XPR(NTR "SECONDARY_DJW=%d\n", SECONDARY_DJW);
XPR(NTR "SECONDARY_FGK=%d\n", SECONDARY_FGK);
@@ -374,7 +386,6 @@ main_config (void)
XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO);
XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32);
XPR(NTR "XD3_USE_LARGEFILE64=%d\n", XD3_USE_LARGEFILE64);
- XPR(NTR "XD3_USE_LARGESIZET=%d\n", XD3_USE_LARGESIZET);
XPR(NTR "XD3_DEFAULT_LEVEL=%d\n", XD3_DEFAULT_LEVEL);
XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE);
XPR(NTR "XD3_DEFAULT_SPREVSZ=%d\n", XD3_DEFAULT_SPREVSZ);
@@ -383,8 +394,6 @@ main_config (void)
XPR(NTR "XD3_HARDMAXWINSIZE=%d\n", XD3_HARDMAXWINSIZE);
XPR(NTR "sizeof(void*)=%d\n", (int)sizeof(void*));
XPR(NTR "sizeof(int)=%d\n", (int)sizeof(int));
- XPR(NTR "sizeof(long)=%d\n", (int)sizeof(long));
- XPR(NTR "sizeof(long long)=%d\n", (int)sizeof(long long));
XPR(NTR "sizeof(size_t)=%d\n", (int)sizeof(size_t));
XPR(NTR "sizeof(uint32_t)=%d\n", (int)sizeof(uint32_t));
XPR(NTR "sizeof(uint64_t)=%d\n", (int)sizeof(uint64_t));
@@ -402,8 +411,9 @@ reset_defaults(void)
option_verbose = DEFAULT_VERBOSE;
option_quiet = 0;
option_appheader = NULL;
- option_use_secondary = 1;
+ option_use_secondary = 0;
option_secondary = NULL;
+ option_use_altcodetable = 0;
option_smatch_config = NULL;
option_no_compress = 0;
option_no_output = 0;
@@ -451,7 +461,7 @@ void* main_bufalloc (size_t size) {
#endif
}
-void*
+static void*
main_malloc (size_t size)
{
void *r = main_malloc1 (size);
@@ -473,7 +483,7 @@ main_free1 (void *opaque, void *ptr)
free (ptr);
}
-void
+static void
main_free (void *ptr)
{
if (ptr)
@@ -544,7 +554,7 @@ xd3_mainerror(int err_num) {
#endif
}
-long
+static long
get_millisecs_now (void)
{
#ifndef _WIN32
@@ -667,17 +677,14 @@ main_strtoxoff (const char* s, xoff_t *xo, char which)
XD3_ASSERT(s && *s != 0);
{
-#if SIZEOF_XOFF_T == SIZEOF_UNSIGNED_LONG_LONG
- unsigned long long xx = strtoull (s, &e, 0);
- unsigned long long bad = ULLONG_MAX;
-#elif SIZEOF_XOFF_T <= SIZEOF_UNSIGNED_LONG
- unsigned long xx = strtoul (s, &e, 0);
- unsigned long long bad = ULONG_MAX;
+ /* Should check LONG_MIN, LONG_MAX, LLONG_MIN, LLONG_MAX? */
+#if SIZEOF_XOFF_T == 4
+ long xx = strtol (s, &e, 0);
#else
- /* Something wrong with SIZEOF_XOFF_T, SIZEOF_UNSIGNED_LONG, etc. */
+ long long xx = strtoll (s, &e, 0);
#endif
- if (xx == bad)
+ if (xx < 0)
{
XPR(NT "-%c: negative integer: %s\n", which, s);
return EXIT_FAILURE;
@@ -870,8 +877,6 @@ main_file_open (main_file *xfile, const char* name, int mode)
return XD3_INVALID;
}
- IF_DEBUG1(DP(RINT "[main] open source %s\n", name));
-
#if XD3_STDIO
xfile->file = fopen (name, XOPEN_STDIO);
@@ -977,7 +982,7 @@ xd3_posix_io (int fd, uint8_t *buf, size_t size,
while (nproc < size)
{
- size_t tryread = xd3_min(size - nproc, 1U << 30);
+ size_t tryread = min(size - nproc, 1U << 30);
ssize_t result = (*func) (fd, buf + nproc, tryread);
if (result < 0)
@@ -1043,7 +1048,6 @@ main_file_read (main_file *ifile,
const char *msg)
{
int ret = 0;
- IF_DEBUG1(DP(RINT "[main] read %s up to %"Z"u\n", ifile->filename, size));
#if XD3_STDIO
size_t result;
@@ -1071,7 +1075,7 @@ main_file_read (main_file *ifile,
}
else
{
- if (option_verbose > 4) { XPR(NT "read %s: %"Z"u bytes\n",
+ if (option_verbose > 4) { XPR(NT "read %s: %zu bytes\n",
ifile->filename, (*nread)); }
ifile->nread += (*nread);
}
@@ -1084,8 +1088,6 @@ main_file_write (main_file *ofile, uint8_t *buf, usize_t size, const char *msg)
{
int ret = 0;
- IF_DEBUG1(DP(RINT "[main] write %"W"u\n bytes", size));
-
#if XD3_STDIO
usize_t result;
@@ -1107,7 +1109,7 @@ main_file_write (main_file *ofile, uint8_t *buf, usize_t size, const char *msg)
}
else
{
- if (option_verbose > 5) { XPR(NT "write %s: %"W"u bytes\n",
+ if (option_verbose > 5) { XPR(NT "write %s: %u bytes\n",
ofile->filename, size); }
ofile->nwrite += size;
}
@@ -1155,8 +1157,6 @@ main_write_output (xd3_stream* stream, main_file *ofile)
{
int ret;
- IF_DEBUG1(DP(RINT "[main] write(%s) %"W"u\n bytes", ofile->filename, stream->avail_out));
-
if (option_no_output)
{
return 0;
@@ -1176,84 +1176,73 @@ static int
main_set_secondary_flags (xd3_config *config)
{
int ret;
- if (!option_use_secondary)
- {
- return 0;
- }
- if (option_secondary == NULL)
+ if (option_use_secondary)
{
- /* Set a default secondary compressor if LZMA is built in, otherwise
- * default to no secondary compressor. */
- if (SECONDARY_LZMA)
+ /* The default secondary compressor is DJW, if it's compiled. */
+ if (option_secondary == NULL)
{
- config->flags |= XD3_SEC_LZMA;
- }
- }
- else
- {
- if (strcmp (option_secondary, "lzma") == 0 && SECONDARY_LZMA)
- {
- config->flags |= XD3_SEC_LZMA;
- }
- else if (strcmp (option_secondary, "fgk") == 0 && SECONDARY_FGK)
- {
- config->flags |= XD3_SEC_FGK;
+ if (SECONDARY_DJW)
+ {
+ config->flags |= XD3_SEC_DJW;
+ }
}
- else if (strncmp (option_secondary, "djw", 3) == 0 && SECONDARY_DJW)
+ else
{
- usize_t level = XD3_DEFAULT_SECONDARY_LEVEL;
-
- config->flags |= XD3_SEC_DJW;
-
- if (strlen (option_secondary) > 3 &&
- (ret = main_atou (option_secondary + 3,
- &level,
- 0, 9, 'S')) != 0 &&
- !option_quiet)
+ if (strcmp (option_secondary, "fgk") == 0 && SECONDARY_FGK)
{
- return XD3_INVALID;
+ config->flags |= XD3_SEC_FGK;
}
+ else if (strcmp (option_secondary, "lzma") == 0 && SECONDARY_LZMA)
+ {
+ config->flags |= XD3_SEC_LZMA;
+ }
+ else if (strncmp (option_secondary, "djw", 3) == 0 && SECONDARY_DJW)
+ {
+ usize_t level = XD3_DEFAULT_SECONDARY_LEVEL;
- /* XD3_SEC_NOXXXX flags disable secondary compression on
- * a per-section basis. For djw, ngroups=1 indicates
- * minimum work, ngroups=0 uses default settings, which
- * is > 1 groups by default. */
- if (level < 1) { config->flags |= XD3_SEC_NODATA; }
- if (level < 7) { config->sec_data.ngroups = 1; }
- else { config->sec_data.ngroups = 0; }
+ config->flags |= XD3_SEC_DJW;
- if (level < 3) { config->flags |= XD3_SEC_NOINST; }
- if (level < 8) { config->sec_inst.ngroups = 1; }
- else { config->sec_inst.ngroups = 0; }
+ if (strlen (option_secondary) > 3 &&
+ (ret = main_atou (option_secondary + 3,
+ &level,
+ 0, 9, 'S')) != 0 &&
+ !option_quiet)
+ {
+ return XD3_INVALID;
+ }
- if (level < 5) { config->flags |= XD3_SEC_NOADDR; }
- if (level < 9) { config->sec_addr.ngroups = 1; }
- else { config->sec_addr.ngroups = 0; }
- }
- else if (*option_secondary == 0 ||
- strcmp (option_secondary, "none") == 0)
- {
- }
- else
- {
- if (!option_quiet)
+ /* XD3_SEC_NOXXXX flags disable secondary compression on
+ * a per-section basis. For djw, ngroups=1 indicates
+ * minimum work, ngroups=0 uses default settings, which
+ * is > 1 groups by default. */
+ if (level < 1) { config->flags |= XD3_SEC_NODATA; }
+ if (level < 7) { config->sec_data.ngroups = 1; }
+ else { config->sec_data.ngroups = 0; }
+
+ if (level < 3) { config->flags |= XD3_SEC_NOINST; }
+ if (level < 8) { config->sec_inst.ngroups = 1; }
+ else { config->sec_inst.ngroups = 0; }
+
+ if (level < 5) { config->flags |= XD3_SEC_NOADDR; }
+ if (level < 9) { config->sec_addr.ngroups = 1; }
+ else { config->sec_addr.ngroups = 0; }
+ }
+ else if (strcmp (option_secondary, "none") == 0 && SECONDARY_DJW)
{
- XPR(NT "unrecognized or not compiled secondary compressor: %s\n",
- option_secondary);
+ /* No secondary */
+ }
+ else
+ {
+ if (!option_quiet)
+ {
+ XPR(NT "unrecognized secondary compressor type: %s\n",
+ option_secondary);
+ return XD3_INVALID;
+ }
}
- return XD3_INVALID;
}
}
- if (option_verbose)
- {
- XPR(NT "secondary compression: %s\n",
- (config->flags | XD3_SEC_LZMA) ? "lzma" :
- ((config->flags | XD3_SEC_FGK) ? "fgk" :
- ((config->flags | XD3_SEC_DJW) ? "djw" :
- "none")));
- }
-
return 0;
}
@@ -1261,9 +1250,8 @@ main_set_secondary_flags (xd3_config *config)
VCDIFF TOOLS
*****************************************************************/
-#include "xdelta3-merge.h"
-
#if VCDIFF_TOOLS
+#include "xdelta3-merge.h"
/* The following macros let VCDIFF print using main_file_write(),
* for example:
@@ -1314,8 +1302,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
addr_bytes = (usize_t)(stream->addr_sect.buf - addr_before);
inst_bytes = (usize_t)(stream->inst_sect.buf - inst_before);
- VC(UT " %06"Q"u %03"W"u %s %6"W"u",
- stream->dec_winstart + size,
+ VC(UT " %06"Q"u %03u %s %6u", stream->dec_winstart + size,
option_print_cpymode ? code : 0,
xd3_rtype_to_string ((xd3_rtype) stream->dec_current1.type,
option_print_cpymode),
@@ -1327,7 +1314,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
{
if (stream->dec_current1.addr >= stream->dec_cpylen)
{
- VC(UT " T@%-6"W"u",
+ VC(UT " T@%-6u",
stream->dec_current1.addr - stream->dec_cpylen)VE;
}
else
@@ -1346,7 +1333,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
if (stream->dec_current2.type != XD3_NOOP)
{
- VC(UT " %s %6"W"u",
+ VC(UT " %s %6u",
xd3_rtype_to_string ((xd3_rtype) stream->dec_current2.type,
option_print_cpymode),
stream->dec_current2.size)VE;
@@ -1355,7 +1342,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
{
if (stream->dec_current2.addr >= stream->dec_cpylen)
{
- VC(UT " T@%-6"W"u",
+ VC(UT " T@%-6u",
stream->dec_current2.addr - stream->dec_cpylen)VE;
}
else
@@ -1375,7 +1362,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
(stream->dec_current1.type >= XD3_CPY ||
stream->dec_current2.type >= XD3_CPY))
{
- VC(UT " %06"Q"u (inefficiency) %"W"u encoded as %"W"u bytes\n",
+ VC(UT " %06"Q"u (inefficiency) %u encoded as %u bytes\n",
stream->dec_winstart + size_before,
size - size_before,
addr_bytes + inst_bytes)VE;
@@ -1443,7 +1430,7 @@ main_print_func (xd3_stream* stream, main_file *xfile)
if (stream->dec_winstart == 0)
{
VC(UT "VCDIFF version: 0\n")VE;
- VC(UT "VCDIFF header size: %"W"u\n",
+ VC(UT "VCDIFF header size: %d\n",
stream->dec_hdrsize)VE;
VC(UT "VCDIFF header indicator: ")VE;
if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0)
@@ -1509,7 +1496,7 @@ main_print_func (xd3_stream* stream, main_file *xfile)
if ((stream->dec_win_ind & VCD_ADLER32) != 0)
{
VC(UT "VCDIFF adler32 checksum: %08X\n",
- stream->dec_adler32)VE;
+ (usize_t)stream->dec_adler32)VE;
}
if (stream->dec_del_ind != 0)
@@ -1529,22 +1516,22 @@ main_print_func (xd3_stream* stream, main_file *xfile)
if (SRCORTGT (stream->dec_win_ind))
{
- VC(UT "VCDIFF copy window length: %"W"u\n",
- stream->dec_cpylen)VE;
+ VC(UT "VCDIFF copy window length: %u\n",
+ (usize_t)stream->dec_cpylen)VE;
VC(UT "VCDIFF copy window offset: %"Q"u\n",
stream->dec_cpyoff)VE;
}
- VC(UT "VCDIFF delta encoding length: %"W"u\n",
+ VC(UT "VCDIFF delta encoding length: %u\n",
(usize_t)stream->dec_enclen)VE;
- VC(UT "VCDIFF target window length: %"W"u\n",
+ VC(UT "VCDIFF target window length: %u\n",
(usize_t)stream->dec_tgtlen)VE;
- VC(UT "VCDIFF data section length: %"W"u\n",
+ VC(UT "VCDIFF data section length: %u\n",
(usize_t)stream->data_sect.size)VE;
- VC(UT "VCDIFF inst section length: %"W"u\n",
+ VC(UT "VCDIFF inst section length: %u\n",
(usize_t)stream->inst_sect.size)VE;
- VC(UT "VCDIFF addr section length: %"W"u\n",
+ VC(UT "VCDIFF addr section length: %u\n",
(usize_t)stream->addr_sect.size)VE;
ret = 0;
@@ -1947,7 +1934,7 @@ main_merge_output (xd3_stream *stream, main_file *ofile)
inst_pos < stream->whole_target.instlen)
{
xd3_winst *inst = &stream->whole_target.inst[inst_pos];
- usize_t take = xd3_min(inst->size, window_size - window_pos);
+ usize_t take = min(inst->size, window_size - window_pos);
xoff_t addr;
switch (inst->type)
@@ -1970,8 +1957,8 @@ main_merge_output (xd3_stream *stream, main_file *ofile)
if (inst->mode != 0)
{
if (window_srcset) {
- window_srcmin = xd3_min (window_srcmin, inst->addr);
- window_srcmax = xd3_max (window_srcmax, inst->addr + take);
+ window_srcmin = min(window_srcmin, inst->addr);
+ window_srcmax = max(window_srcmax, inst->addr + take);
} else {
window_srcset = 1;
window_srcmin = inst->addr;
@@ -1984,11 +1971,8 @@ main_merge_output (xd3_stream *stream, main_file *ofile)
XD3_ASSERT (inst->addr >= window_start);
addr = inst->addr - window_start;
}
- IF_DEBUG2 ({
- XPR(NTR "[merge copy] winpos %"W"u take %"W"u "
- "addr %"Q"u mode %u\n",
- window_pos, take, addr, inst->mode);
- });
+ IF_DEBUG2 (XPR(NTR "[merge copy] winpos %u take %u addr %"Q"u mode %u\n",
+ window_pos, take, addr, inst->mode));
if ((ret = xd3_found_match (recode_stream, window_pos, take,
addr, inst->mode != 0)))
{
@@ -2434,9 +2418,9 @@ main_secondary_decompress_check (main_file *file,
{
int ret;
usize_t i;
- usize_t try_read = xd3_min (input_size, XD3_ALLOCSIZE);
+ usize_t try_read = min (input_size, XD3_ALLOCSIZE);
size_t check_nread = 0;
- uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: heap allocate */
+ uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: stack limit */
const main_extcomp *decompressor = NULL;
if ((ret = main_file_read (file, check_buf,
@@ -2829,12 +2813,11 @@ main_get_appheader (xd3_stream *stream, main_file *ifile,
char *start = (char*)apphead;
char *slash;
int place = 0;
- const int kMaxArgs = 4;
char *parsed[4];
memset (parsed, 0, sizeof (parsed));
- while ((slash = strchr (start, '/')) != NULL && place < (kMaxArgs-1))
+ while ((slash = strchr (start, '/')) != NULL)
{
*slash = 0;
parsed[place++] = start;
@@ -2959,10 +2942,10 @@ main_get_winsize (main_file *ifile) {
if (main_file_stat (ifile, &file_size) == 0)
{
- size = (usize_t) xd3_min (file_size, (xoff_t) size);
+ size = (usize_t) min(file_size, (xoff_t) size);
}
- size = xd3_max (size, XD3_ALLOCSIZE);
+ size = max(size, XD3_ALLOCSIZE);
if (option_verbose > 1)
{
@@ -3057,11 +3040,12 @@ main_input (xd3_cmd cmd,
output_func = main_write_output;
if (option_no_compress) { stream_flags |= XD3_NOCOMPRESS; }
+ if (option_use_altcodetable) { stream_flags |= XD3_ALT_CODE_TABLE; }
if (option_smatch_config)
{
const char *s = option_smatch_config;
char *e;
- long values[XD3_SOFTCFG_VARCNT];
+ int values[XD3_SOFTCFG_VARCNT];
int got;
config.smatch_cfg = XD3_SMATCH_SOFT;
@@ -3193,7 +3177,7 @@ main_input (xd3_cmd cmd,
input_remain = XOFF_T_MAX - input_offset;
- try_read = (usize_t) xd3_min ((xoff_t) config.winsize, input_remain);
+ try_read = (usize_t) min ((xoff_t) config.winsize, input_remain);
if ((ret = main_read_primary_input (ifile, main_bdata,
try_read, & nread)))
@@ -3318,7 +3302,7 @@ main_input (xd3_cmd cmd,
stream.i_slots_used > stream.iopt_size)
{
XPR(NT "warning: input position %"Q"u overflowed "
- "instruction buffer, needed %"W"u (vs. %"W"u), "
+ "instruction buffer, needed %u (vs. %u), "
"consider changing -I\n",
stream.current_window * winsize,
stream.i_slots_used, stream.iopt_size);
@@ -3351,7 +3335,7 @@ main_input (xd3_cmd cmd,
main_format_bcnt (stream.total_in, &trdb),
main_format_bcnt (stream.total_out, &twdb),
main_format_millis (millis, &tm),
- main_format_bcnt (stream.srcwin_cksum_pos, &srcpos));
+ main_format_bcnt (sfile->source_position, &srcpos));
}
else
{
@@ -3372,8 +3356,7 @@ main_input (xd3_cmd cmd,
default:
/* input_func() error */
XPR(NT XD3_LIB_ERRMSG (& stream, ret));
- if (! option_quiet && ret == XD3_INVALID_INPUT &&
- sfile != NULL && sfile->filename != NULL)
+ if (! option_quiet && ret == XD3_INVALID_INPUT)
{
XPR(NT "normally this indicates that the source file is incorrect\n");
XPR(NT "please verify the source file with sha1sum or equivalent\n");
@@ -3443,10 +3426,10 @@ done:
if (option_verbose > 1 && cmd == CMD_ENCODE)
{
XPR(NT "scanner configuration: %s\n", stream.smatcher.name);
- XPR(NT "target hash table size: %"W"u\n", stream.small_hash.size);
+ XPR(NT "target hash table size: %u\n", stream.small_hash.size);
if (sfile != NULL && sfile->filename != NULL)
{
- XPR(NT "source hash table size: %"W"u\n", stream.large_hash.size);
+ XPR(NT "source hash table size: %u\n", stream.large_hash.size);
}
}
@@ -3574,7 +3557,7 @@ int main (int argc, char **argv)
#endif
{
static const char *flags =
- "0123456789cdefhnqvDFJNORVs:m:B:C:E:I:L:O:M:P:W:A::S::";
+ "0123456789cdefhnqvDFJNORTVs:m:B:C:E:I:L:O:M:P:W:A::S::";
xd3_cmd cmd;
main_file ifile;
main_file ofile;
@@ -3774,12 +3757,13 @@ int main (int argc, char **argv)
case 'n': option_use_checksum = 0; break;
case 'N': option_no_compress = 1; break;
+ case 'T': option_use_altcodetable = 1; break;
case 'C': option_smatch_config = my_optarg; break;
case 'J': option_no_output = 1; break;
case 'S': if (my_optarg == NULL)
{
- option_use_secondary = 0;
- option_secondary = NULL;
+ option_use_secondary = 1;
+ option_secondary = "none";
}
else
{
@@ -4045,7 +4029,7 @@ main_help (void)
XPR(NTR "compression options:\n");
XPR(NTR " -s source source file to copy from (if any)\n");
- XPR(NTR " -S [lzma|djw|fgk] enable/disable secondary compression\n");
+ XPR(NTR " -S [djw|fgk] enable/disable secondary compression\n");
XPR(NTR " -N disable small string-matching compression\n");
XPR(NTR " -D disable external decompression (encode/decode)\n");
XPR(NTR " -R disable external recompression (decode)\n");
@@ -4053,6 +4037,7 @@ main_help (void)
XPR(NTR " -C soft config (encode, undocumented)\n");
XPR(NTR " -A [apphead] disable/provide application header (encode)\n");
XPR(NTR " -J disable output (check/compute only)\n");
+ XPR(NTR " -T use alternate code table (test)\n");
XPR(NTR " -m arguments for \"merge\"\n");
XPR(NTR "the XDELTA environment variable may contain extra args:\n");