summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3.h')
-rw-r--r--xdelta3/xdelta3.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index bb7736e..6258957 100644
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -132,8 +132,12 @@ typedef ULONGLONG uint64_t;
132 * 64bit platform because we allocate large arrays of these values. */ 132 * 64bit platform because we allocate large arrays of these values. */
133#if XD3_USE_LARGEFILE64 133#if XD3_USE_LARGEFILE64
134#define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */ 134#define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */
135#ifndef _LARGEFILE_SOURCE
135#define _LARGEFILE_SOURCE 136#define _LARGEFILE_SOURCE
137#endif
138#ifndef _FILE_OFFSET_BITS
136#define _FILE_OFFSET_BITS 64 139#define _FILE_OFFSET_BITS 64
140#endif
137 141
138typedef uint64_t xoff_t; 142typedef uint64_t xoff_t;
139#define SIZEOF_XOFF_T 8 143#define SIZEOF_XOFF_T 8
@@ -346,6 +350,7 @@ typedef enum {
346 XD3_INVALID_INPUT = -17712, /* invalid input/decoder error */ 350 XD3_INVALID_INPUT = -17712, /* invalid input/decoder error */
347 XD3_NOSECOND = -17713, /* when secondary compression finds no 351 XD3_NOSECOND = -17713, /* when secondary compression finds no
348 improvement. */ 352 improvement. */
353 XD3_UNIMPLEMENTED = -17714, /* currently VCD_TARGET */
349} xd3_rvalues; 354} xd3_rvalues;
350 355
351/* special values in config->flags */ 356/* special values in config->flags */
@@ -1307,6 +1312,28 @@ void xd3_blksize_div (const xoff_t offset,
1307 usize_t *blkoff) { 1312 usize_t *blkoff) {
1308 *blkno = (xoff_t) (offset >> source->shiftby); 1313 *blkno = (xoff_t) (offset >> source->shiftby);
1309 *blkoff = (usize_t) (offset & source->maskby); 1314 *blkoff = (usize_t) (offset & source->maskby);
1315 XD3_ASSERT (*blkoff < source->blksize);
1316}
1317
1318static inline
1319void xd3_blksize_add (xoff_t *blkno,
1320 usize_t *blkoff,
1321 const xd3_source *source,
1322 const usize_t add)
1323{
1324 usize_t blkdiff;
1325
1326 /* Does not check for overflow, checked in xdelta3-decode.h. */
1327 *blkoff += add;
1328 blkdiff = *blkoff >> source->shiftby;
1329
1330 if (blkdiff)
1331 {
1332 *blkno += blkdiff;
1333 *blkoff &= source->maskby;
1334 }
1335
1336 XD3_ASSERT (*blkoff < source->blksize);
1310} 1337}
1311 1338
1312#endif /* _XDELTA3_H_ */ 1339#endif /* _XDELTA3_H_ */