summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.h
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2009-02-12 03:35:51 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2009-02-12 03:35:51 +0000
commit9be16d928d7386488efc34bd99293b3360105da0 (patch)
tree3440373325be084dd364260636e50db16e382f88 /xdelta3/xdelta3.h
parent1b96ad8ae09b53cdcd7dd03d4bac09ba8c61e5a6 (diff)
Fixes issue 79, adds more testing.
Diffstat (limited to 'xdelta3/xdelta3.h')
-rw-r--r--xdelta3/xdelta3.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index b3e79f5..772ad07 100644
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -283,17 +283,16 @@ typedef int (xd3_comp_table_func) (xd3_stream *stream,
283 abort (); } } while (0) 283 abort (); } } while (0)
284#else 284#else
285#define XD3_ASSERT(x) (void)0 285#define XD3_ASSERT(x) (void)0
286#endif 286#endif /* XD3_DEBUG */
287 287
288#ifdef __GNUC__ 288#ifdef __GNUC__
289/* As seen on linux-kernel. */
290#ifndef max 289#ifndef max
291#define max(x,y) ({ \ 290#define max(x,y) ({ \
292 const typeof(x) _x = (x); \ 291 const typeof(x) _x = (x); \
293 const typeof(y) _y = (y); \ 292 const typeof(y) _y = (y); \
294 (void) (&_x == &_y); \ 293 (void) (&_x == &_y); \
295 _x > _y ? _x : _y; }) 294 _x > _y ? _x : _y; })
296#endif 295#endif /* __GNUC__ */
297 296
298#ifndef min 297#ifndef min
299#define min(x,y) ({ \ 298#define min(x,y) ({ \
@@ -302,14 +301,14 @@ typedef int (xd3_comp_table_func) (xd3_stream *stream,
302 (void) (&_x == &_y); \ 301 (void) (&_x == &_y); \
303 _x < _y ? _x : _y; }) 302 _x < _y ? _x : _y; })
304#endif 303#endif
305#else 304#else /* __GNUC__ */
306#ifndef max 305#ifndef max
307#define max(x,y) ((x) < (y) ? (y) : (x)) 306#define max(x,y) ((x) < (y) ? (y) : (x))
308#endif 307#endif
309#ifndef min 308#ifndef min
310#define min(x,y) ((x) < (y) ? (x) : (y)) 309#define min(x,y) ((x) < (y) ? (x) : (y))
311#endif 310#endif
312#endif 311#endif /* __GNUC__ */
313 312
314/**************************************************************** 313/****************************************************************
315 PUBLIC ENUMS 314 PUBLIC ENUMS
@@ -854,7 +853,7 @@ struct _xd3_stream
854 match (across windows) */ 853 match (across windows) */
855 854
856 uint8_t *buf_in; /* for saving buffered input */ 855 uint8_t *buf_in; /* for saving buffered input */
857 usize_t buf_avail; /* amount of saved input */ 856 usize_t buf_avail; /* amount of saved input */
858 const uint8_t *buf_leftover; /* leftover content of next_in 857 const uint8_t *buf_leftover; /* leftover content of next_in
859 (i.e., user's buffer) */ 858 (i.e., user's buffer) */
860 usize_t buf_leftavail; /* amount of leftover content */ 859 usize_t buf_leftavail; /* amount of leftover content */
@@ -1205,7 +1204,21 @@ void xd3_init_config (xd3_config *config,
1205 config->flags = flags; 1204 config->flags = flags;
1206} 1205}
1207 1206
1208/* This supplies some input to the stream. */ 1207/* This supplies some input to the stream.
1208 *
1209 * For encoding, if the input is larger than the configured window
1210 * size (xd3_config.winsize), the entire input will be consumed and
1211 * encoded anyway. If you wish to strictly limit the window size,
1212 * limit the buffer passed to xd3_avail_input to the window size.
1213 *
1214 * For encoding, if the input is smaller than the configured window
1215 * size (xd3_config.winsize), the library will create a window-sized
1216 * buffer and accumulate input until a full-sized window can be
1217 * encoded. The input must remain valid until the next time
1218 * xd3_encode_input() returns XD3_INPUT.
1219 *
1220 * For decoding, the entire input will be consumed for each call.
1221 */
1209static inline 1222static inline
1210void xd3_avail_input (xd3_stream *stream, 1223void xd3_avail_input (xd3_stream *stream,
1211 const uint8_t *idata, 1224 const uint8_t *idata,