"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xdelta3-main.h" between
xdelta3-3.0.11.tar.gz and xdelta3-3.1.0.tar.gz

About: xdelta is a tool and library for differential compression (supports VCDIFF encoding and decoding). Beta version.

xdelta3-main.h  (xdelta3-3.0.11):xdelta3-main.h  (xdelta3-3.1.0)
skipping to change at line 52 skipping to change at line 52
* throughout Xdelta code, but special attention is required here for * throughout Xdelta code, but special attention is required here for
* the operating system calls with different error handling. See the * the operating system calls with different error handling. See the
* main_file_* routines. All errors in this file have a message * main_file_* routines. All errors in this file have a message
* printed at the time of occurance. Since some of these calls occur * printed at the time of occurance. Since some of these calls occur
* within calls to the library, the error may end up being printed * within calls to the library, the error may end up being printed
* again with a more general error message. * again with a more general error message.
*/ */
/*********************************************************************/ /*********************************************************************/
#include <limits.h>
#ifndef XD3_POSIX
#define XD3_POSIX 0
#endif
#ifndef XD3_STDIO
#define XD3_STDIO 0
#endif
#ifndef XD3_WIN32
#define XD3_WIN32 0
#endif
#ifndef NOT_MAIN
#define NOT_MAIN 0
#endif
/* Combines xd3_strerror() and strerror() */ /* Combines xd3_strerror() and strerror() */
const char* xd3_mainerror(int err_num); const char* xd3_mainerror(int err_num);
#include "xdelta3-internal.h" #include "xdelta3-internal.h"
int int
xsnprintf_func (char *str, int n, const char *fmt, ...) xsnprintf_func (char *str, size_t n, const char *fmt, ...)
{ {
va_list a; va_list a;
int ret; int ret;
va_start (a, fmt); va_start (a, fmt);
ret = vsnprintf_func (str, n, fmt, a); ret = vsnprintf_func (str, n, fmt, a);
va_end (a); va_end (a);
if (ret < 0) if (ret < 0)
{ {
ret = n; ret = n;
} }
skipping to change at line 233 skipping to change at line 248
static const char* option_secondary = NULL; static const char* option_secondary = NULL;
static int option_use_checksum = 1; static int option_use_checksum = 1;
static const char* option_smatch_config = NULL; static const char* option_smatch_config = NULL;
static int option_no_compress = 0; static int option_no_compress = 0;
static int option_no_output = 0; /* do not write output */ static int option_no_output = 0; /* do not write output */
static const char *option_source_filename = NULL; static const char *option_source_filename = NULL;
static int option_level = XD3_DEFAULT_LEVEL; static int option_level = XD3_DEFAULT_LEVEL;
static usize_t option_iopt_size = XD3_DEFAULT_IOPT_SIZE; static usize_t option_iopt_size = XD3_DEFAULT_IOPT_SIZE;
static usize_t option_winsize = XD3_DEFAULT_WINSIZE; static usize_t option_winsize = XD3_DEFAULT_WINSIZE;
/* Note: option_srcwinsz is restricted from [16Kb, 4Gb], because
* addresses in the large hash checksum are 32 bits. The flag is read /* option_srcwinsz is restricted to [16kB, 2GB] when usize_t is 32 bits. */
* as xoff_t, so that 4Gb != 0. */
static xoff_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ; static xoff_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ;
static usize_t option_sprevsz = XD3_DEFAULT_SPREVSZ; static usize_t option_sprevsz = XD3_DEFAULT_SPREVSZ;
/* These variables are supressed to avoid their use w/o support. main() warns /* These variables are supressed to avoid their use w/o support. main() warns
* appropriately when external compression is not enabled. */ * appropriately when external compression is not enabled. */
#if EXTERNAL_COMPRESSION #if EXTERNAL_COMPRESSION
static int num_subprocs = 0; static int num_subprocs = 0;
static int option_force2 = 0; static int option_force2 = 0;
static int option_decompress_inputs = 1; static int option_decompress_inputs = 1;
static int option_recompress_outputs = 1; static int option_recompress_outputs = 1;
skipping to change at line 291 skipping to change at line 305
}; };
static int main_input (xd3_cmd cmd, main_file *ifile, static int main_input (xd3_cmd cmd, main_file *ifile,
main_file *ofile, main_file *sfile); main_file *ofile, main_file *sfile);
static void main_get_appheader (xd3_stream *stream, main_file *ifile, static void main_get_appheader (xd3_stream *stream, main_file *ifile,
main_file *output, main_file *sfile); main_file *output, main_file *sfile);
static int main_getblk_func (xd3_stream *stream, static int main_getblk_func (xd3_stream *stream,
xd3_source *source, xd3_source *source,
xoff_t blkno); 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_file_seek (main_file *xfile, xoff_t pos);
static int main_read_primary_input (main_file *file, static int main_read_primary_input (main_file *file,
uint8_t *buf, uint8_t *buf,
size_t size, size_t size,
size_t *nread); size_t *nread);
static const char* main_format_bcnt (xoff_t r, shortbuf *buf); static const char* main_format_bcnt (xoff_t r, shortbuf *buf);
static int main_help (void); static int main_help (void);
#if XD3_ENCODER #if XD3_ENCODER
static int xd3_merge_input_output (xd3_stream *stream, static int xd3_merge_input_output (xd3_stream *stream,
xd3_whole_state *source); xd3_whole_state *source);
#endif #endif
/* The code in xdelta3-blk.h is essentially part of this unit, see /* The code in xdelta3-blk.h is essentially part of this unit, see
* comments there. */ * comments there. */
#include "xdelta3-blkcache.h" #include "xdelta3-blkcache.h"
void (*xprintf_message_func)(const char*msg) = NULL; static void (*xprintf_message_func)(const char*msg) = NULL;
void void
xprintf (const char *fmt, ...) xprintf (const char *fmt, ...)
{ {
char buf[1000]; char buf[1000];
va_list a; va_list a;
int size; int size;
va_start (a, fmt); va_start (a, fmt);
size = vsnprintf_func (buf, 1000, fmt, a); size = vsnprintf_func (buf, 1000, fmt, a);
va_end (a); va_end (a);
skipping to change at line 340 skipping to change at line 350
xprintf_message_func(buf); xprintf_message_func(buf);
} else { } else {
size_t ignore = fwrite(buf, 1, size, stderr); size_t ignore = fwrite(buf, 1, size, stderr);
(void) ignore; (void) ignore;
} }
} }
static int static int
main_version (void) main_version (void)
{ {
/* $Format: " XPR(NTR \"Xdelta version $Xdelta3Version$, Copyright (C) 2007, /* $Format: " XPR(NTR \"Xdelta version $Xdelta3Version$, Copyright (C) Joshua
2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, Joshua MacDonald\\n\");" $ */ MacDonald\\n\");" $ */
XPR(NTR "Xdelta version 3.0.11, Copyright (C) 2007, 2008, 2009, 2010, 2011, 20 XPR(NTR "Xdelta version 3.1.0, Copyright (C) Joshua MacDonald\n");
12, 2013, 2014, 2015 Joshua MacDonald\n");
XPR(NTR "Xdelta comes with ABSOLUTELY NO WARRANTY.\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 "This is free software, and you are welcome to redistribute it\n");
XPR(NTR "under certain conditions; see \"COPYING\" for details.\n"); XPR(NTR "under certain conditions; see \"COPYING\" for details.\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
static int static int
main_config (void) main_config (void)
{ {
main_version (); main_version ();
skipping to change at line 367 skipping to change at line 377
XPR(NTR "SECONDARY_LZMA=%d\n", SECONDARY_LZMA); XPR(NTR "SECONDARY_LZMA=%d\n", SECONDARY_LZMA);
XPR(NTR "UNALIGNED_OK=%d\n", UNALIGNED_OK); XPR(NTR "UNALIGNED_OK=%d\n", UNALIGNED_OK);
XPR(NTR "VCDIFF_TOOLS=%d\n", VCDIFF_TOOLS); XPR(NTR "VCDIFF_TOOLS=%d\n", VCDIFF_TOOLS);
XPR(NTR "XD3_ALLOCSIZE=%d\n", XD3_ALLOCSIZE); XPR(NTR "XD3_ALLOCSIZE=%d\n", XD3_ALLOCSIZE);
XPR(NTR "XD3_DEBUG=%d\n", XD3_DEBUG); XPR(NTR "XD3_DEBUG=%d\n", XD3_DEBUG);
XPR(NTR "XD3_ENCODER=%d\n", XD3_ENCODER); XPR(NTR "XD3_ENCODER=%d\n", XD3_ENCODER);
XPR(NTR "XD3_POSIX=%d\n", XD3_POSIX); XPR(NTR "XD3_POSIX=%d\n", XD3_POSIX);
XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO); XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO);
XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32); XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32);
XPR(NTR "XD3_USE_LARGEFILE64=%d\n", XD3_USE_LARGEFILE64); 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_LEVEL=%d\n", XD3_DEFAULT_LEVEL);
XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE); XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE);
XPR(NTR "XD3_DEFAULT_SPREVSZ=%d\n", XD3_DEFAULT_SPREVSZ); XPR(NTR "XD3_DEFAULT_SPREVSZ=%d\n", XD3_DEFAULT_SPREVSZ);
XPR(NTR "XD3_DEFAULT_SRCWINSZ=%d\n", XD3_DEFAULT_SRCWINSZ); XPR(NTR "XD3_DEFAULT_SRCWINSZ=%d\n", XD3_DEFAULT_SRCWINSZ);
XPR(NTR "XD3_DEFAULT_WINSIZE=%d\n", XD3_DEFAULT_WINSIZE); XPR(NTR "XD3_DEFAULT_WINSIZE=%d\n", XD3_DEFAULT_WINSIZE);
XPR(NTR "XD3_HARDMAXWINSIZE=%d\n", XD3_HARDMAXWINSIZE); XPR(NTR "XD3_HARDMAXWINSIZE=%d\n", XD3_HARDMAXWINSIZE);
XPR(NTR "sizeof(void*)=%d\n", (int)sizeof(void*)); XPR(NTR "sizeof(void*)=%d\n", (int)sizeof(void*));
XPR(NTR "sizeof(int)=%d\n", (int)sizeof(int)); XPR(NTR "sizeof(int)=%d\n", (int)sizeof(int));
XPR(NTR "sizeof(long)=%d\n", (int)sizeof(long)); XPR(NTR "sizeof(long)=%d\n", (int)sizeof(long));
XPR(NTR "sizeof(long long)=%d\n", (int)sizeof(long long)); XPR(NTR "sizeof(long long)=%d\n", (int)sizeof(long long));
skipping to change at line 443 skipping to change at line 454
} }
void* main_bufalloc (size_t size) { void* main_bufalloc (size_t size) {
#if XD3_WIN32 #if XD3_WIN32
return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
#else #else
return main_malloc1(size); return main_malloc1(size);
#endif #endif
} }
static void* void*
main_malloc (size_t size) main_malloc (size_t size)
{ {
void *r = main_malloc1 (size); void *r = main_malloc1 (size);
if (r) { IF_DEBUG (main_mallocs += 1); } if (r) { IF_DEBUG (main_mallocs += 1); }
return r; return r;
} }
static void* static void*
main_alloc (void *opaque, main_alloc (void *opaque,
size_t items, size_t items,
skipping to change at line 465 skipping to change at line 476
{ {
return main_malloc1 (items * size); return main_malloc1 (items * size);
} }
static void static void
main_free1 (void *opaque, void *ptr) main_free1 (void *opaque, void *ptr)
{ {
free (ptr); free (ptr);
} }
static void void
main_free (void *ptr) main_free (void *ptr)
{ {
if (ptr) if (ptr)
{ {
IF_DEBUG (main_mallocs -= 1); IF_DEBUG (main_mallocs -= 1);
main_free1 (NULL, ptr); main_free1 (NULL, ptr);
IF_DEBUG (XD3_ASSERT(main_mallocs >= 0)); IF_DEBUG (XD3_ASSERT(main_mallocs >= 0));
} }
} }
skipping to change at line 536 skipping to change at line 547
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
err_buf, 256, NULL); err_buf, 256, NULL);
if (err_buf[0] != 0 && err_buf[strlen(err_buf) - 1] == '\n') if (err_buf[0] != 0 && err_buf[strlen(err_buf) - 1] == '\n')
{ {
err_buf[strlen(err_buf) - 1] = 0; err_buf[strlen(err_buf) - 1] = 0;
} }
return err_buf; return err_buf;
#endif #endif
} }
static long long
get_millisecs_now (void) get_millisecs_now (void)
{ {
#ifndef _WIN32 #ifndef _WIN32
struct timeval tv; struct timeval tv;
gettimeofday (& tv, NULL); gettimeofday (& tv, NULL);
return (tv.tv_sec) * 1000L + (tv.tv_usec) / 1000; return (tv.tv_sec) * 1000L + (tv.tv_usec) / 1000;
#else #else
SYSTEMTIME st; SYSTEMTIME st;
skipping to change at line 659 skipping to change at line 670
/* A safe version of strtol for xoff_t. */ /* A safe version of strtol for xoff_t. */
static int static int
main_strtoxoff (const char* s, xoff_t *xo, char which) main_strtoxoff (const char* s, xoff_t *xo, char which)
{ {
char *e; char *e;
xoff_t x; xoff_t x;
XD3_ASSERT(s && *s != 0); XD3_ASSERT(s && *s != 0);
{ {
/* Should check LONG_MIN, LONG_MAX, LLONG_MIN, LLONG_MAX? */ #if SIZEOF_XOFF_T == SIZEOF_UNSIGNED_LONG_LONG
#if SIZEOF_XOFF_T == 4 unsigned long long xx = strtoull (s, &e, 0);
long xx = strtol (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;
#else #else
long long xx = strtoll (s, &e, 0); /* Something wrong with SIZEOF_XOFF_T, SIZEOF_UNSIGNED_LONG, etc. */
#endif #endif
if (xx < 0) if (xx == bad)
{ {
XPR(NT "-%c: negative integer: %s\n", which, s); XPR(NT "-%c: negative integer: %s\n", which, s);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
x = xx; x = xx;
} }
if (*e != 0) if (*e != 0)
{ {
skipping to change at line 1073 skipping to change at line 1087
} }
return ret; return ret;
} }
int int
main_file_write (main_file *ofile, uint8_t *buf, usize_t size, const char *msg) main_file_write (main_file *ofile, uint8_t *buf, usize_t size, const char *msg)
{ {
int ret = 0; int ret = 0;
IF_DEBUG1(DP(RINT "[main] write %u\n bytes", size)); IF_DEBUG1(DP(RINT "[main] write %"W"u\n bytes", size));
#if XD3_STDIO #if XD3_STDIO
usize_t result; usize_t result;
result = fwrite (buf, 1, size, ofile->file); result = fwrite (buf, 1, size, ofile->file);
if (result != size) { ret = get_errno (); } if (result != size) { ret = get_errno (); }
#elif XD3_POSIX #elif XD3_POSIX
ret = xd3_posix_io (ofile->file, buf, size, (xd3_posix_func*) &write, NULL); ret = xd3_posix_io (ofile->file, buf, size, (xd3_posix_func*) &write, NULL);
skipping to change at line 1096 skipping to change at line 1110
ret = xd3_win32_io (ofile->file, buf, size, 0, NULL); ret = xd3_win32_io (ofile->file, buf, size, 0, NULL);
#endif #endif
if (ret) if (ret)
{ {
XPR(NT "%s: %s: %s\n", msg, ofile->filename, xd3_mainerror (ret)); XPR(NT "%s: %s: %s\n", msg, ofile->filename, xd3_mainerror (ret));
} }
else else
{ {
if (option_verbose > 5) { XPR(NT "write %s: %u bytes\n", if (option_verbose > 5) { XPR(NT "write %s: %"W"u bytes\n",
ofile->filename, size); } ofile->filename, size); }
ofile->nwrite += size; ofile->nwrite += size;
} }
return ret; return ret;
} }
static int static int
main_file_seek (main_file *xfile, xoff_t pos) main_file_seek (main_file *xfile, xoff_t pos)
{ {
skipping to change at line 1144 skipping to change at line 1158
} }
/* This function simply writes the stream output buffer, if there is /* This function simply writes the stream output buffer, if there is
* any, for encode, decode and recode commands. (The VCDIFF tools use * any, for encode, decode and recode commands. (The VCDIFF tools use
* main_print_func()). */ * main_print_func()). */
static int static int
main_write_output (xd3_stream* stream, main_file *ofile) main_write_output (xd3_stream* stream, main_file *ofile)
{ {
int ret; int ret;
IF_DEBUG1(DP(RINT "[main] write(%s) %u\n bytes", ofile->filename, stream->avai l_out)); IF_DEBUG1(DP(RINT "[main] write(%s) %"W"u\n bytes", ofile->filename, stream->a vail_out));
if (option_no_output) if (option_no_output)
{ {
return 0; return 0;
} }
if (stream->avail_out > 0 && if (stream->avail_out > 0 &&
(ret = main_file_write (ofile, stream->next_out, (ret = main_file_write (ofile, stream->next_out,
stream->avail_out, "write failed"))) stream->avail_out, "write failed")))
{ {
skipping to change at line 1234 skipping to change at line 1248
{ {
if (!option_quiet) if (!option_quiet)
{ {
XPR(NT "unrecognized or not compiled secondary compressor: %s\n", XPR(NT "unrecognized or not compiled secondary compressor: %s\n",
option_secondary); 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; return 0;
} }
/****************************************************************** /******************************************************************
VCDIFF TOOLS VCDIFF TOOLS
*****************************************************************/ *****************************************************************/
#include "xdelta3-merge.h" #include "xdelta3-merge.h"
#if VCDIFF_TOOLS #if VCDIFF_TOOLS
skipping to change at line 1294 skipping to change at line 1317
if ((ret = xd3_decode_instruction (stream))) if ((ret = xd3_decode_instruction (stream)))
{ {
XPR(NT "instruction decode error at %"Q"u: %s\n", XPR(NT "instruction decode error at %"Q"u: %s\n",
stream->dec_winstart + size, stream->msg); stream->dec_winstart + size, stream->msg);
return ret; return ret;
} }
addr_bytes = (usize_t)(stream->addr_sect.buf - addr_before); addr_bytes = (usize_t)(stream->addr_sect.buf - addr_before);
inst_bytes = (usize_t)(stream->inst_sect.buf - inst_before); inst_bytes = (usize_t)(stream->inst_sect.buf - inst_before);
VC(UT " %06"Q"u %03u %s %6u", stream->dec_winstart + size, VC(UT " %06"Q"u %03"W"u %s %6"W"u",
stream->dec_winstart + size,
option_print_cpymode ? code : 0, option_print_cpymode ? code : 0,
xd3_rtype_to_string ((xd3_rtype) stream->dec_current1.type, xd3_rtype_to_string ((xd3_rtype) stream->dec_current1.type,
option_print_cpymode), option_print_cpymode),
stream->dec_current1.size)VE; stream->dec_current1.size)VE;
if (stream->dec_current1.type != XD3_NOOP) if (stream->dec_current1.type != XD3_NOOP)
{ {
if (stream->dec_current1.type >= XD3_CPY) if (stream->dec_current1.type >= XD3_CPY)
{ {
if (stream->dec_current1.addr >= stream->dec_cpylen) if (stream->dec_current1.addr >= stream->dec_cpylen)
{ {
VC(UT " T@%-6u", VC(UT " T@%-6"W"u",
stream->dec_current1.addr - stream->dec_cpylen)VE; stream->dec_current1.addr - stream->dec_cpylen)VE;
} }
else else
{ {
VC(UT " S@%-6"Q"u", VC(UT " S@%-6"Q"u",
stream->dec_cpyoff + stream->dec_current1.addr)VE; stream->dec_cpyoff + stream->dec_current1.addr)VE;
} }
} }
else else
{ {
VC(UT " ")VE; VC(UT " ")VE;
} }
size += stream->dec_current1.size; size += stream->dec_current1.size;
} }
if (stream->dec_current2.type != XD3_NOOP) if (stream->dec_current2.type != XD3_NOOP)
{ {
VC(UT " %s %6u", VC(UT " %s %6"W"u",
xd3_rtype_to_string ((xd3_rtype) stream->dec_current2.type, xd3_rtype_to_string ((xd3_rtype) stream->dec_current2.type,
option_print_cpymode), option_print_cpymode),
stream->dec_current2.size)VE; stream->dec_current2.size)VE;
if (stream->dec_current2.type >= XD3_CPY) if (stream->dec_current2.type >= XD3_CPY)
{ {
if (stream->dec_current2.addr >= stream->dec_cpylen) if (stream->dec_current2.addr >= stream->dec_cpylen)
{ {
VC(UT " T@%-6u", VC(UT " T@%-6"W"u",
stream->dec_current2.addr - stream->dec_cpylen)VE; stream->dec_current2.addr - stream->dec_cpylen)VE;
} }
else else
{ {
VC(UT " S@%-6"Q"u", VC(UT " S@%-6"Q"u",
stream->dec_cpyoff + stream->dec_current2.addr)VE; stream->dec_cpyoff + stream->dec_current2.addr)VE;
} }
} }
size += stream->dec_current2.size; size += stream->dec_current2.size;
} }
VC(UT "\n")VE; VC(UT "\n")VE;
if (option_verbose && if (option_verbose &&
addr_bytes + inst_bytes >= (size - size_before) && addr_bytes + inst_bytes >= (size - size_before) &&
(stream->dec_current1.type >= XD3_CPY || (stream->dec_current1.type >= XD3_CPY ||
stream->dec_current2.type >= XD3_CPY)) stream->dec_current2.type >= XD3_CPY))
{ {
VC(UT " %06"Q"u (inefficiency) %u encoded as %u bytes\n", VC(UT " %06"Q"u (inefficiency) %"W"u encoded as %"W"u bytes\n",
stream->dec_winstart + size_before, stream->dec_winstart + size_before,
size - size_before, size - size_before,
addr_bytes + inst_bytes)VE; addr_bytes + inst_bytes)VE;
} }
} }
if (stream->dec_tgtlen != size && (stream->flags & XD3_SKIP_WINDOW) == 0) if (stream->dec_tgtlen != size && (stream->flags & XD3_SKIP_WINDOW) == 0)
{ {
XPR(NT "target window size inconsistency"); XPR(NT "target window size inconsistency");
return XD3_INTERNAL; return XD3_INTERNAL;
skipping to change at line 1422 skipping to change at line 1446
if ((xfile->snprintf_buf = if ((xfile->snprintf_buf =
(uint8_t*)main_malloc(SNPRINTF_BUFSIZE)) == NULL) (uint8_t*)main_malloc(SNPRINTF_BUFSIZE)) == NULL)
{ {
return ENOMEM; return ENOMEM;
} }
} }
if (stream->dec_winstart == 0) if (stream->dec_winstart == 0)
{ {
VC(UT "VCDIFF version: 0\n")VE; VC(UT "VCDIFF version: 0\n")VE;
VC(UT "VCDIFF header size: %d\n", VC(UT "VCDIFF header size: %"W"u\n",
stream->dec_hdrsize)VE; stream->dec_hdrsize)VE;
VC(UT "VCDIFF header indicator: ")VE; VC(UT "VCDIFF header indicator: ")VE;
if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0) if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0)
VC(UT "VCD_SECONDARY ")VE; VC(UT "VCD_SECONDARY ")VE;
if ((stream->dec_hdr_ind & VCD_CODETABLE) != 0) if ((stream->dec_hdr_ind & VCD_CODETABLE) != 0)
VC(UT "VCD_CODETABLE ")VE; VC(UT "VCD_CODETABLE ")VE;
if ((stream->dec_hdr_ind & VCD_APPHEADER) != 0) if ((stream->dec_hdr_ind & VCD_APPHEADER) != 0)
VC(UT "VCD_APPHEADER ")VE; VC(UT "VCD_APPHEADER ")VE;
if (stream->dec_hdr_ind == 0) if (stream->dec_hdr_ind == 0)
VC(UT "none")VE; VC(UT "none")VE;
skipping to change at line 1488 skipping to change at line 1512
VC(UT "VCDIFF window indicator: ")VE; VC(UT "VCDIFF window indicator: ")VE;
if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE ")VE; if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE ")VE;
if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET ")VE; if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET ")VE;
if ((stream->dec_win_ind & VCD_ADLER32) != 0) VC(UT "VCD_ADLER32 ")VE; if ((stream->dec_win_ind & VCD_ADLER32) != 0) VC(UT "VCD_ADLER32 ")VE;
if (stream->dec_win_ind == 0) VC(UT "none")VE; if (stream->dec_win_ind == 0) VC(UT "none")VE;
VC(UT "\n")VE; VC(UT "\n")VE;
if ((stream->dec_win_ind & VCD_ADLER32) != 0) if ((stream->dec_win_ind & VCD_ADLER32) != 0)
{ {
VC(UT "VCDIFF adler32 checksum: %08X\n", VC(UT "VCDIFF adler32 checksum: %08X\n",
(usize_t)stream->dec_adler32)VE; stream->dec_adler32)VE;
} }
if (stream->dec_del_ind != 0) if (stream->dec_del_ind != 0)
{ {
VC(UT "VCDIFF delta indicator: ")VE; VC(UT "VCDIFF delta indicator: ")VE;
if ((stream->dec_del_ind & VCD_DATACOMP) != 0) VC(UT "VCD_DATACOMP ")VE; if ((stream->dec_del_ind & VCD_DATACOMP) != 0) VC(UT "VCD_DATACOMP ")VE;
if ((stream->dec_del_ind & VCD_INSTCOMP) != 0) VC(UT "VCD_INSTCOMP ")VE; if ((stream->dec_del_ind & VCD_INSTCOMP) != 0) VC(UT "VCD_INSTCOMP ")VE;
if ((stream->dec_del_ind & VCD_ADDRCOMP) != 0) VC(UT "VCD_ADDRCOMP ")VE; if ((stream->dec_del_ind & VCD_ADDRCOMP) != 0) VC(UT "VCD_ADDRCOMP ")VE;
if (stream->dec_del_ind == 0) VC(UT "none")VE; if (stream->dec_del_ind == 0) VC(UT "none")VE;
VC(UT "\n")VE; VC(UT "\n")VE;
} }
if (stream->dec_winstart != 0) if (stream->dec_winstart != 0)
{ {
VC(UT "VCDIFF window at offset: %"Q"u\n", stream->dec_winstart)VE; VC(UT "VCDIFF window at offset: %"Q"u\n", stream->dec_winstart)VE;
} }
if (SRCORTGT (stream->dec_win_ind)) if (SRCORTGT (stream->dec_win_ind))
{ {
VC(UT "VCDIFF copy window length: %u\n", VC(UT "VCDIFF copy window length: %"W"u\n",
(usize_t)stream->dec_cpylen)VE; stream->dec_cpylen)VE;
VC(UT "VCDIFF copy window offset: %"Q"u\n", VC(UT "VCDIFF copy window offset: %"Q"u\n",
stream->dec_cpyoff)VE; stream->dec_cpyoff)VE;
} }
VC(UT "VCDIFF delta encoding length: %u\n", VC(UT "VCDIFF delta encoding length: %"W"u\n",
(usize_t)stream->dec_enclen)VE; (usize_t)stream->dec_enclen)VE;
VC(UT "VCDIFF target window length: %u\n", VC(UT "VCDIFF target window length: %"W"u\n",
(usize_t)stream->dec_tgtlen)VE; (usize_t)stream->dec_tgtlen)VE;
VC(UT "VCDIFF data section length: %u\n", VC(UT "VCDIFF data section length: %"W"u\n",
(usize_t)stream->data_sect.size)VE; (usize_t)stream->data_sect.size)VE;
VC(UT "VCDIFF inst section length: %u\n", VC(UT "VCDIFF inst section length: %"W"u\n",
(usize_t)stream->inst_sect.size)VE; (usize_t)stream->inst_sect.size)VE;
VC(UT "VCDIFF addr section length: %u\n", VC(UT "VCDIFF addr section length: %"W"u\n",
(usize_t)stream->addr_sect.size)VE; (usize_t)stream->addr_sect.size)VE;
ret = 0; ret = 0;
if ((stream->flags & XD3_JUST_HDR) != 0) if ((stream->flags & XD3_JUST_HDR) != 0)
{ {
/* Print a header -- finished! */ /* Print a header -- finished! */
ret = PRINTHDR_SPECIAL; ret = PRINTHDR_SPECIAL;
} }
else if ((stream->flags & XD3_SKIP_WINDOW) == 0) else if ((stream->flags & XD3_SKIP_WINDOW) == 0)
{ {
skipping to change at line 1962 skipping to change at line 1986
window_srcmin = inst->addr; window_srcmin = inst->addr;
window_srcmax = inst->addr + take; window_srcmax = inst->addr + take;
} }
addr = inst->addr; addr = inst->addr;
} }
else else
{ {
XD3_ASSERT (inst->addr >= window_start); XD3_ASSERT (inst->addr >= window_start);
addr = inst->addr - window_start; addr = inst->addr - window_start;
} }
IF_DEBUG2 (XPR(NTR "[merge copy] winpos %u take %u addr %"Q"u mode IF_DEBUG2 ({
%u\n", XPR(NTR "[merge copy] winpos %"W"u take %"W"u "
window_pos, take, addr, inst->mode)); "addr %"Q"u mode %u\n",
window_pos, take, addr, inst->mode);
});
if ((ret = xd3_found_match (recode_stream, window_pos, take, if ((ret = xd3_found_match (recode_stream, window_pos, take,
addr, inst->mode != 0))) addr, inst->mode != 0)))
{ {
return ret; return ret;
} }
break; break;
} }
window_pos += take; window_pos += take;
output_pos += take; output_pos += take;
skipping to change at line 3035 skipping to change at line 3062
case CMD_ENCODE: case CMD_ENCODE:
do_src_fifo = 1; do_src_fifo = 1;
input_func = xd3_encode_input; input_func = xd3_encode_input;
output_func = main_write_output; output_func = main_write_output;
if (option_no_compress) { stream_flags |= XD3_NOCOMPRESS; } if (option_no_compress) { stream_flags |= XD3_NOCOMPRESS; }
if (option_smatch_config) if (option_smatch_config)
{ {
const char *s = option_smatch_config; const char *s = option_smatch_config;
char *e; char *e;
int values[XD3_SOFTCFG_VARCNT]; long values[XD3_SOFTCFG_VARCNT];
int got; int got;
config.smatch_cfg = XD3_SMATCH_SOFT; config.smatch_cfg = XD3_SMATCH_SOFT;
for (got = 0; got < XD3_SOFTCFG_VARCNT; got += 1, s = e + 1) for (got = 0; got < XD3_SOFTCFG_VARCNT; got += 1, s = e + 1)
{ {
values[got] = strtol (s, &e, 10); values[got] = strtol (s, &e, 10);
if ((values[got] < 0) || if ((values[got] < 0) ||
(e == s) || (e == s) ||
skipping to change at line 3292 skipping to change at line 3319
XD3_ASSERT (stream.src != NULL); XD3_ASSERT (stream.src != NULL);
} }
/* Limited i-buffer size affects source copies /* Limited i-buffer size affects source copies
* when the sourcewin is decided early. */ * when the sourcewin is decided early. */
if (option_verbose > 1 && if (option_verbose > 1 &&
stream.srcwin_decided_early && stream.srcwin_decided_early &&
stream.i_slots_used > stream.iopt_size) stream.i_slots_used > stream.iopt_size)
{ {
XPR(NT "warning: input position %"Q"u overflowed " XPR(NT "warning: input position %"Q"u overflowed "
"instruction buffer, needed %u (vs. %u), " "instruction buffer, needed %"W"u (vs. %"W"u), "
"consider changing -I\n", "consider changing -I\n",
stream.current_window * winsize, stream.current_window * winsize,
stream.i_slots_used, stream.iopt_size); stream.i_slots_used, stream.iopt_size);
} }
} }
if (option_verbose) if (option_verbose)
{ {
shortbuf rrateavg, wrateavg, tm; shortbuf rrateavg, wrateavg, tm;
shortbuf rdb, wdb; shortbuf rdb, wdb;
skipping to change at line 3417 skipping to change at line 3444
if ((ret = xd3_close_stream (& stream))) if ((ret = xd3_close_stream (& stream)))
{ {
XPR(NT XD3_LIB_ERRMSG (& stream, ret)); XPR(NT XD3_LIB_ERRMSG (& stream, ret));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#if XD3_ENCODER #if XD3_ENCODER
if (option_verbose > 1 && cmd == CMD_ENCODE) if (option_verbose > 1 && cmd == CMD_ENCODE)
{ {
XPR(NT "scanner configuration: %s\n", stream.smatcher.name); XPR(NT "scanner configuration: %s\n", stream.smatcher.name);
XPR(NT "target hash table size: %u\n", stream.small_hash.size); XPR(NT "target hash table size: %"W"u\n", stream.small_hash.size);
if (sfile != NULL && sfile->filename != NULL) if (sfile != NULL && sfile->filename != NULL)
{ {
XPR(NT "source hash table size: %u\n", stream.large_hash.size); XPR(NT "source hash table size: %"W"u\n", stream.large_hash.size);
} }
} }
if (option_verbose > 2 && cmd == CMD_ENCODE) if (option_verbose > 2 && cmd == CMD_ENCODE)
{ {
XPR(NT "source copies: %"Q"u (%"Q"u bytes)\n", XPR(NT "source copies: %"Q"u (%"Q"u bytes)\n",
stream.n_scpy, stream.l_scpy); stream.n_scpy, stream.l_scpy);
XPR(NT "target copies: %"Q"u (%"Q"u bytes)\n", XPR(NT "target copies: %"Q"u (%"Q"u bytes)\n",
stream.n_tcpy, stream.l_tcpy); stream.n_tcpy, stream.l_tcpy);
XPR(NT "adds: %"Q"u (%"Q"u bytes)\n", stream.n_add, stream.l_add); XPR(NT "adds: %"Q"u (%"Q"u bytes)\n", stream.n_add, stream.l_add);
 End of changes. 35 change blocks. 
45 lines changed or deleted 70 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS