"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xdelta3-internal.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-internal.h  (xdelta3-3.0.11):xdelta3-internal.h  (xdelta3-3.1.0)
skipping to change at line 34 skipping to change at line 34
typedef struct _main_extcomp main_extcomp; typedef struct _main_extcomp main_extcomp;
void main_buffree (void *ptr); void main_buffree (void *ptr);
void* main_bufalloc (size_t size); void* main_bufalloc (size_t size);
void main_file_init (main_file *xfile); void main_file_init (main_file *xfile);
int main_file_close (main_file *xfile); int main_file_close (main_file *xfile);
void main_file_cleanup (main_file *xfile); void main_file_cleanup (main_file *xfile);
int main_file_isopen (main_file *xfile); int main_file_isopen (main_file *xfile);
int main_file_open (main_file *xfile, const char* name, int mode); int main_file_open (main_file *xfile, const char* name, int mode);
int main_file_exists (main_file *xfile); int main_file_exists (main_file *xfile);
int main_file_stat (main_file *xfile, xoff_t *size);
int xd3_whole_append_window (xd3_stream *stream); int xd3_whole_append_window (xd3_stream *stream);
int xd3_main_cmdline (int argc, char **argv); int xd3_main_cmdline (int argc, char **argv);
int main_file_read (main_file *ifile, int main_file_read (main_file *ifile,
uint8_t *buf, uint8_t *buf,
size_t size, size_t size,
size_t *nread, size_t *nread,
const char *msg); const char *msg);
int main_file_write (main_file *ofile, uint8_t *buf, int main_file_write (main_file *ofile, uint8_t *buf,
usize_t size, const char *msg); usize_t size, const char *msg);
void* main_malloc (size_t size);
void main_free (void *ptr);
int test_compare_files (const char* f0, const char* f1); int test_compare_files (const char* f0, const char* f1);
usize_t xd3_bytes_on_srcblk (xd3_source *src, xoff_t blkno); usize_t xd3_bytes_on_srcblk (xd3_source *src, xoff_t blkno);
xoff_t xd3_source_eof(const xd3_source *src); xoff_t xd3_source_eof(const xd3_source *src);
uint32_t xd3_large_cksum_update (uint32_t cksum, uint32_t xd3_large_cksum_update (uint32_t cksum,
const uint8_t *base, const uint8_t *base,
usize_t look); usize_t look);
int xd3_emit_byte (xd3_stream *stream, int xd3_emit_byte (xd3_stream *stream,
xd3_output **outputp, xd3_output **outputp,
uint8_t code); uint8_t code);
int xd3_emit_bytes (xd3_stream *stream, int xd3_emit_bytes (xd3_stream *stream,
xd3_output **outputp, xd3_output **outputp,
const uint8_t *base, const uint8_t *base,
usize_t size); usize_t size);
xd3_output* xd3_alloc_output (xd3_stream *stream, xd3_output* xd3_alloc_output (xd3_stream *stream,
xd3_output *old_output); xd3_output *old_output);
int xd3_encode_init_full (xd3_stream *stream); int xd3_encode_init_full (xd3_stream *stream);
size_t xd3_pow2_roundup (size_t x); usize_t xd3_pow2_roundup (usize_t x);
long get_millisecs_now (void);
int xd3_process_stream (int is_encode, int xd3_process_stream (int is_encode,
xd3_stream *stream, xd3_stream *stream,
int (*func) (xd3_stream *), int (*func) (xd3_stream *),
int close_stream, int close_stream,
const uint8_t *input, const uint8_t *input,
usize_t input_size, usize_t input_size,
uint8_t *output, uint8_t *output,
usize_t *output_size, usize_t *output_size,
usize_t output_size_max); usize_t output_size_max);
#if PYTHON_MODULE || SWIG_MODULE || NOT_MAIN #if PYTHON_MODULE || SWIG_MODULE || NOT_MAIN
int xd3_main_cmdline (int argc, char **argv); int xd3_main_cmdline (int argc, char **argv);
#endif #endif
#if REGRESSION_TEST
int xd3_selftest (void);
#endif
/* main_file->mode values */ /* main_file->mode values */
typedef enum typedef enum
{ {
XO_READ = 0, XO_READ = 0,
XO_WRITE = 1 XO_WRITE = 1
} main_file_modes; } main_file_modes;
#ifndef XD3_POSIX #ifndef XD3_POSIX
#define XD3_POSIX 0 #define XD3_POSIX 0
#endif #endif
skipping to change at line 129 skipping to change at line 139
const main_extcomp *compressor; /* External compression struct. */ const main_extcomp *compressor; /* External compression struct. */
int flags; /* RD_FIRST, RD_NONEXTERNAL, ... */ int flags; /* RD_FIRST, RD_NONEXTERNAL, ... */
xoff_t nread; /* for input position */ xoff_t nread; /* for input position */
xoff_t nwrite; /* for output position */ xoff_t nwrite; /* for output position */
uint8_t *snprintf_buf; /* internal snprintf() use */ uint8_t *snprintf_buf; /* internal snprintf() use */
int size_known; /* Set by main_set_souze */ int size_known; /* Set by main_set_souze */
xoff_t source_position; /* for avoiding seek in getblk_func */ xoff_t source_position; /* for avoiding seek in getblk_func */
int seek_failed; /* after seek fails once, try FIFO */ int seek_failed; /* after seek fails once, try FIFO */
}; };
#ifdef _WIN32
#define vsnprintf_func _vsnprintf
#define snprintf_func _snprintf
#else
#define vsnprintf_func vsnprintf
#define snprintf_func snprintf
#endif
#define short_sprintf(sb,fmt,...) \
snprintf_func((sb).buf,sizeof((sb).buf),fmt,__VA_ARGS__)
/* Type used for short snprintf calls. */
typedef struct {
char buf[48];
} shortbuf;
/* Prior to SVN 303 this function was only defined in DJGPP and WIN32
* environments and other platforms would use the builtin snprintf()
* with an arrangement of macros below. In OS X 10.6, Apply made
* snprintf() a macro, which defeated those macros (since snprintf
* would be evaluated before its argument macros were expanded,
* therefore always define xsnprintf_func. */
#undef PRINTF_ATTRIBUTE
#ifdef __GNUC__
/* Let's just assume no one uses gcc 2.x! */
#define PRINTF_ATTRIBUTE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
#else
#define PRINTF_ATTRIBUTE(x,y)
#endif
/* Underlying xprintf() */
int xsnprintf_func (char *str, int n, const char *fmt, ...)
PRINTF_ATTRIBUTE(3,4);
/* XPR(NT "", ...) (used by main) prefixes an "xdelta3: " to the output. */
void xprintf(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
#define XPR xprintf
#define NT "xdelta3: "
#define NTR ""
#ifndef UINT32_MAX #ifndef UINT32_MAX
#define UINT32_MAX 4294967295U #define UINT32_MAX 4294967295U
#endif #endif
#ifndef UINT64_MAX #ifndef UINT64_MAX
#define UINT64_MAX 18446744073709551615ULL #define UINT64_MAX 18446744073709551615ULL
#endif #endif
#define UINT32_OFLOW_MASK 0xfe000000U #define UINT32_OFLOW_MASK 0xfe000000U
#define UINT64_OFLOW_MASK 0xfe00000000000000ULL #define UINT64_OFLOW_MASK 0xfe00000000000000ULL
skipping to change at line 291 skipping to change at line 262
static inline int static inline int
xd3_read_uint32_t (xd3_stream *stream, const uint8_t **inpp, xd3_read_uint32_t (xd3_stream *stream, const uint8_t **inpp,
const uint8_t *maxp, uint32_t *valp) const uint8_t *maxp, uint32_t *valp)
{ READ_INTEGER_TYPE (uint32_t, UINT32_OFLOW_MASK); } { READ_INTEGER_TYPE (uint32_t, UINT32_OFLOW_MASK); }
#if XD3_ENCODER #if XD3_ENCODER
static inline int static inline int
xd3_emit_uint32_t (xd3_stream *stream, xd3_output **output, uint32_t num) xd3_emit_uint32_t (xd3_stream *stream, xd3_output **output, uint32_t num)
{ EMIT_INTEGER_TYPE (); } { EMIT_INTEGER_TYPE (); }
#endif #endif /* XD3_ENCODER */
#endif #endif /* USE_UINT32 */
#if USE_UINT64 #if USE_UINT64
static inline int static inline uint32_t
xd3_decode_uint64_t (xd3_stream *stream, uint64_t *val)
{ DECODE_INTEGER_TYPE (stream->dec_64part, UINT64_OFLOW_MASK); }
#if XD3_ENCODER
static inline int
xd3_emit_uint64_t (xd3_stream *stream, xd3_output **output, uint64_t num)
{ EMIT_INTEGER_TYPE (); }
#endif
/* These are tested but not used */
#if REGRESSION_TEST
static int
xd3_read_uint64_t (xd3_stream *stream, const uint8_t **inpp,
const uint8_t *maxp, uint64_t *valp)
{ READ_INTEGER_TYPE (uint64_t, UINT64_OFLOW_MASK); }
static uint32_t
xd3_sizeof_uint64_t (uint64_t num) xd3_sizeof_uint64_t (uint64_t num)
{ {
IF_SIZEOF64(1); IF_SIZEOF64(1);
IF_SIZEOF64(2); IF_SIZEOF64(2);
IF_SIZEOF64(3); IF_SIZEOF64(3);
IF_SIZEOF64(4); IF_SIZEOF64(4);
IF_SIZEOF64(5); IF_SIZEOF64(5);
IF_SIZEOF64(6); IF_SIZEOF64(6);
IF_SIZEOF64(7); IF_SIZEOF64(7);
IF_SIZEOF64(8); IF_SIZEOF64(8);
IF_SIZEOF64(9); IF_SIZEOF64(9);
return 10; return 10;
} }
#endif
#endif static inline int
xd3_decode_uint64_t (xd3_stream *stream, uint64_t *val)
{ DECODE_INTEGER_TYPE (stream->dec_64part, UINT64_OFLOW_MASK); }
static inline int
xd3_read_uint64_t (xd3_stream *stream, const uint8_t **inpp,
const uint8_t *maxp, uint64_t *valp)
{ READ_INTEGER_TYPE (uint64_t, UINT64_OFLOW_MASK); }
#if XD3_ENCODER
static inline int
xd3_emit_uint64_t (xd3_stream *stream, xd3_output **output, uint64_t num)
{ EMIT_INTEGER_TYPE (); }
#endif /* XD3_ENCODER */
#endif /* USE_UINT64 */
#if SIZEOF_USIZE_T == 4 #if SIZEOF_USIZE_T == 4
#define USIZE_T_MAX UINT32_MAX #define USIZE_T_MAX UINT32_MAX
#define USIZE_T_MAXBLKSZ 0x80000000U #define USIZE_T_MAXBLKSZ 0x80000000U
#define xd3_decode_size xd3_decode_uint32_t #define XD3_MAXSRCWINSZ (1ULL << 31)
#define xd3_emit_size xd3_emit_uint32_t #define xd3_large_cksum xd3_large32_cksum
#define xd3_sizeof_size xd3_sizeof_uint32_t #define xd3_large_cksum_update xd3_large32_cksum_update
#define xd3_read_size xd3_read_uint32_t #define xd3_hash_multiplier xd3_hash_multiplier32
static inline uint32_t xd3_sizeof_size (usize_t num)
{ return xd3_sizeof_uint32_t (num); }
static inline int xd3_decode_size (xd3_stream *stream, usize_t *valp)
{ return xd3_decode_uint32_t (stream, (uint32_t*) valp); }
static inline int xd3_read_size (xd3_stream *stream, const uint8_t **inpp,
const uint8_t *maxp, usize_t *valp)
{ return xd3_read_uint32_t (stream, inpp, maxp, (uint32_t*) valp); }
#if XD3_ENCODER
static inline int xd3_emit_size (xd3_stream *stream, xd3_output **output, usize_
t num)
{ return xd3_emit_uint32_t (stream, output, num); }
#endif
#elif SIZEOF_USIZE_T == 8 #elif SIZEOF_USIZE_T == 8
#define USIZE_T_MAX UINT64_MAX #define USIZE_T_MAX UINT64_MAX
#define USIZE_T_MAXBLKSZ 0x8000000000000000ULL #define USIZE_T_MAXBLKSZ 0x8000000000000000ULL
#define xd3_decode_size xd3_decode_uint64_t #define XD3_MAXSRCWINSZ (1ULL << 61)
#define xd3_emit_size xd3_emit_uint64_t #define xd3_large_cksum xd3_large64_cksum
#define xd3_sizeof_size xd3_sizeof_uint64_t #define xd3_large_cksum_update xd3_large64_cksum_update
#define xd3_read_size xd3_read_uint64_t #define xd3_hash_multiplier xd3_hash_multiplier64
static inline uint32_t xd3_sizeof_size (usize_t num)
{ return xd3_sizeof_uint64_t (num); }
static inline int xd3_decode_size (xd3_stream *stream, usize_t *valp)
{ return xd3_decode_uint64_t (stream, (uint64_t*) valp); }
static inline int xd3_read_size (xd3_stream *stream, const uint8_t **inpp,
const uint8_t *maxp, usize_t *valp)
{ return xd3_read_uint64_t (stream, inpp, maxp, (uint64_t*) valp); }
#if XD3_ENCODER
static inline int xd3_emit_size (xd3_stream *stream, xd3_output **output, usize_
t num)
{ return xd3_emit_uint64_t (stream, output, num); }
#endif #endif
#endif /* SIZEOF_USIZE_T */
#if SIZEOF_XOFF_T == 4 #if SIZEOF_XOFF_T == 4
#define XOFF_T_MAX UINT32_MAX #define XOFF_T_MAX UINT32_MAX
#define xd3_emit_offset xd3_emit_uint32_t
static inline int static inline int xd3_decode_offset (xd3_stream *stream, xoff_t *valp)
xd3_decode_offset (xd3_stream *stream, xoff_t *val) { return xd3_decode_uint32_t (stream, (uint32_t*) valp); }
{ #if XD3_ENCODER
return xd3_decode_uint32_t (stream, (uint32_t*) val); static inline int xd3_emit_offset (xd3_stream *stream, xd3_output **output, xoff
} _t num)
{ return xd3_emit_uint32_t (stream, output, num); }
#endif
#elif SIZEOF_XOFF_T == 8 #elif SIZEOF_XOFF_T == 8
#define XOFF_T_MAX UINT64_MAX #define XOFF_T_MAX UINT64_MAX
#define xd3_emit_offset xd3_emit_uint64_t
static inline int static inline int xd3_decode_offset (xd3_stream *stream, xoff_t *valp)
xd3_decode_offset (xd3_stream *stream, xoff_t *val) { return xd3_decode_uint64_t (stream, (uint64_t*) valp); }
{ #if XD3_ENCODER
return xd3_decode_uint64_t (stream, (uint64_t*) val); static inline int xd3_emit_offset (xd3_stream *stream, xd3_output **output, xoff
} _t num)
{ return xd3_emit_uint64_t (stream, output, num); }
#endif
#endif #endif
#define USIZE_T_OVERFLOW(a,b) ((USIZE_T_MAX - (usize_t) (a)) < (usize_t) (b)) #define USIZE_T_OVERFLOW(a,b) ((USIZE_T_MAX - (usize_t) (a)) < (usize_t) (b))
#define XOFF_T_OVERFLOW(a,b) ((XOFF_T_MAX - (xoff_t) (a)) < (xoff_t) (b)) #define XOFF_T_OVERFLOW(a,b) ((XOFF_T_MAX - (xoff_t) (a)) < (xoff_t) (b))
int xd3_size_hashtable (xd3_stream *stream,
usize_t slots,
usize_t look,
xd3_hash_cfg *cfg);
usize_t xd3_checksum_hash (const xd3_hash_cfg *cfg, const usize_t cksum);
#if USE_UINT32
uint32_t xd3_large32_cksum (xd3_hash_cfg *cfg, const uint8_t *base, const usize_
t look);
uint32_t xd3_large32_cksum_update (xd3_hash_cfg *cfg, uint32_t cksum,
const uint8_t *base, const usize_t look);
#endif /* USE_UINT32 */
#if USE_UINT64
uint64_t xd3_large64_cksum (xd3_hash_cfg *cfg, const uint8_t *base, const usize_
t look);
uint64_t xd3_large64_cksum_update (xd3_hash_cfg *cfg, uint64_t cksum,
const uint8_t *base, const usize_t look);
#endif /* USE_UINT64 */
#define MAX_LRU_SIZE 32U #define MAX_LRU_SIZE 32U
#define XD3_MINSRCWINSZ (XD3_ALLOCSIZE * MAX_LRU_SIZE) #define XD3_MINSRCWINSZ (XD3_ALLOCSIZE * MAX_LRU_SIZE)
#define XD3_MAXSRCWINSZ (1ULL << 31)
#endif // XDELTA3_INTERNAL_H__ #endif // XDELTA3_INTERNAL_H__
 End of changes. 17 change blocks. 
87 lines changed or deleted 108 lines changed or added

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