summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3.h')
-rw-r--r--xdelta3/xdelta3.h45
1 files changed, 31 insertions, 14 deletions
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index e440f70..2046fe5 100644
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -328,12 +328,6 @@ typedef uint32_t usize_t;
328#include <stdio.h> 328#include <stdio.h>
329#endif 329#endif
330 330
331/* XPRINT. Debug output and VCDIFF_TOOLS functions report to stderr.
332 * I have used an irregular style to abbreviate [fprintf(stderr, "] as
333 * [DP(RINT "]. */
334#define DP fprintf
335#define RINT stderr,
336
337typedef struct _xd3_stream xd3_stream; 331typedef struct _xd3_stream xd3_stream;
338typedef struct _xd3_source xd3_source; 332typedef struct _xd3_source xd3_source;
339typedef struct _xd3_hash_cfg xd3_hash_cfg; 333typedef struct _xd3_hash_cfg xd3_hash_cfg;
@@ -372,16 +366,40 @@ typedef int (xd3_getblk_func) (xd3_stream *stream,
372 xd3_source *source, 366 xd3_source *source,
373 xoff_t blkno); 367 xoff_t blkno);
374 368
375/* These are internal functions to delay construction of encoding
376 * tables and support alternate code tables. See the comments & code
377 * enabled by GENERIC_ENCODE_TABLES. */
378
379typedef const xd3_dinst* (xd3_code_table_func) (void); 369typedef const xd3_dinst* (xd3_code_table_func) (void);
380typedef int (xd3_comp_table_func) (xd3_stream *stream,
381 const uint8_t **data,
382 usize_t *size);
383 370
384 371
372#ifdef _WIN32
373#define vsnprintf_func _vsnprintf
374#define snprintf_func _snprintf
375#else
376#define vsnprintf_func vsnprintf
377#define snprintf_func snprintf
378#endif
379#define short_sprintf(sb,fmt,...) \
380 snprintf_func((sb).buf,sizeof((sb).buf),fmt,__VA_ARGS__)
381
382/* Type used for short snprintf calls. */
383typedef struct {
384 char buf[48];
385} shortbuf;
386
387#ifndef PRINTF_ATTRIBUTE
388#define PRINTF_ATTRIBUTE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
389#endif
390
391/* Underlying xprintf() */
392int xsnprintf_func (char *str, size_t n, const char *fmt, ...)
393 PRINTF_ATTRIBUTE(3,4);
394
395/* XPR(NT "", ...) (used by main) prefixes an "xdelta3: " to the output. */
396void xprintf(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
397#define XPR xprintf
398#define NT "xdelta3: "
399#define NTR ""
400/* DP(RINT ...) */
401#define DP xprintf
402#define RINT ""
385 403
386#if XD3_DEBUG 404#if XD3_DEBUG
387#define XD3_ASSERT(x) \ 405#define XD3_ASSERT(x) \
@@ -1048,7 +1066,6 @@ struct _xd3_stream
1048 xd3_desect data_sect; 1066 xd3_desect data_sect;
1049 1067
1050 xd3_code_table_func *code_table_func; 1068 xd3_code_table_func *code_table_func;
1051 xd3_comp_table_func *comp_table_func;
1052 const xd3_dinst *code_table; 1069 const xd3_dinst *code_table;
1053 const xd3_code_table_desc *code_table_desc; 1070 const xd3_code_table_desc *code_table_desc;
1054 xd3_dinst *code_table_alloc; 1071 xd3_dinst *code_table_alloc;