diff options
Diffstat (limited to 'xdelta3/xdelta3.h')
-rw-r--r-- | xdelta3/xdelta3.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h index c05df08..686e05c 100644 --- a/xdelta3/xdelta3.h +++ b/xdelta3/xdelta3.h | |||
@@ -110,6 +110,7 @@ | |||
110 | */ | 110 | */ |
111 | #ifndef _WIN32 | 111 | #ifndef _WIN32 |
112 | #include <stdint.h> | 112 | #include <stdint.h> |
113 | typedef uint32_t usize_t; | ||
113 | #else | 114 | #else |
114 | #define WIN32_LEAN_AND_MEAN | 115 | #define WIN32_LEAN_AND_MEAN |
115 | #if XD3_USE_LARGEFILE64 | 116 | #if XD3_USE_LARGEFILE64 |
@@ -124,9 +125,10 @@ | |||
124 | #define _WIN32_WINNT 0x0400 | 125 | #define _WIN32_WINNT 0x0400 |
125 | #endif | 126 | #endif |
126 | #include <windows.h> | 127 | #include <windows.h> |
128 | typedef uint32_t usize_t; | ||
127 | #ifdef _MSC_VER | 129 | #ifdef _MSC_VER |
128 | #define inline | 130 | #define inline |
129 | typedef signed long ssize_t; | 131 | typedef signed int ssize_t; |
130 | #if _MSC_VER < 1600 | 132 | #if _MSC_VER < 1600 |
131 | typedef unsigned char uint8_t; | 133 | typedef unsigned char uint8_t; |
132 | typedef unsigned short uint16_t; | 134 | typedef unsigned short uint16_t; |
@@ -142,8 +144,6 @@ typedef ULONGLONG uint64_t; | |||
142 | #endif | 144 | #endif |
143 | #endif | 145 | #endif |
144 | 146 | ||
145 | typedef uint32_t usize_t; | ||
146 | |||
147 | #if XD3_USE_LARGEFILE64 | 147 | #if XD3_USE_LARGEFILE64 |
148 | #define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */ | 148 | #define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */ |
149 | #ifndef _LARGEFILE_SOURCE | 149 | #ifndef _LARGEFILE_SOURCE |
@@ -632,9 +632,9 @@ struct _xd3_smatcher | |||
632 | /* hash table size & power-of-two hash function. */ | 632 | /* hash table size & power-of-two hash function. */ |
633 | struct _xd3_hash_cfg | 633 | struct _xd3_hash_cfg |
634 | { | 634 | { |
635 | usize_t size; | 635 | usize_t size; |
636 | usize_t shift; | 636 | usize_t shift; |
637 | usize_t mask; | 637 | usize_t mask; |
638 | }; | 638 | }; |
639 | 639 | ||
640 | /* the sprev list */ | 640 | /* the sprev list */ |
@@ -718,7 +718,7 @@ struct _xd3_config | |||
718 | struct _xd3_source | 718 | struct _xd3_source |
719 | { | 719 | { |
720 | /* you set */ | 720 | /* you set */ |
721 | xoff_t blksize; /* block size */ | 721 | usize_t blksize; /* block size */ |
722 | const char *name; /* its name, for debug/print | 722 | const char *name; /* its name, for debug/print |
723 | purposes */ | 723 | purposes */ |
724 | void *ioh; /* opaque handle */ | 724 | void *ioh; /* opaque handle */ |
@@ -727,7 +727,7 @@ struct _xd3_source | |||
727 | /* getblk sets */ | 727 | /* getblk sets */ |
728 | xoff_t curblkno; /* current block number: client | 728 | xoff_t curblkno; /* current block number: client |
729 | sets after getblk request */ | 729 | sets after getblk request */ |
730 | xoff_t onblk; /* number of bytes on current | 730 | usize_t onblk; /* number of bytes on current |
731 | block: client sets, must be >= 0 | 731 | block: client sets, must be >= 0 |
732 | and <= blksize */ | 732 | and <= blksize */ |
733 | const uint8_t *curblk; /* current block array: client | 733 | const uint8_t *curblk; /* current block array: client |
@@ -738,9 +738,9 @@ struct _xd3_source | |||
738 | xoff_t srcbase; /* offset of this source window | 738 | xoff_t srcbase; /* offset of this source window |
739 | in the source itself */ | 739 | in the source itself */ |
740 | int shiftby; /* for power-of-two blocksizes */ | 740 | int shiftby; /* for power-of-two blocksizes */ |
741 | usize_t maskby; /* for power-of-two blocksizes */ | 741 | int maskby; /* for power-of-two blocksizes */ |
742 | xoff_t cpyoff_blocks; /* offset of dec_cpyoff in blocks */ | 742 | xoff_t cpyoff_blocks; /* offset of dec_cpyoff in blocks */ |
743 | xoff_t cpyoff_blkoff; /* offset of copy window in | 743 | usize_t cpyoff_blkoff; /* offset of copy window in |
744 | blocks, remainder */ | 744 | blocks, remainder */ |
745 | xoff_t getblkno; /* request block number: xd3 sets | 745 | xoff_t getblkno; /* request block number: xd3 sets |
746 | current getblk request */ | 746 | current getblk request */ |
@@ -753,7 +753,7 @@ struct _xd3_source | |||
753 | * source position to be read. | 753 | * source position to be read. |
754 | * Otherwise, equal to | 754 | * Otherwise, equal to |
755 | * max_blkno. */ | 755 | * max_blkno. */ |
756 | xoff_t onlastblk; /* Number of bytes on max_blkno */ | 756 | usize_t onlastblk; /* Number of bytes on max_blkno */ |
757 | int eof_known; /* Set to true when the first | 757 | int eof_known; /* Set to true when the first |
758 | * partial block is read. */ | 758 | * partial block is read. */ |
759 | }; | 759 | }; |
@@ -808,10 +808,10 @@ struct _xd3_stream | |||
808 | 808 | ||
809 | xd3_smatcher smatcher; | 809 | xd3_smatcher smatcher; |
810 | 810 | ||
811 | uint32_t *large_table; /* table of large checksums */ | 811 | usize_t *large_table; /* table of large checksums */ |
812 | xd3_hash_cfg large_hash; /* large hash config */ | 812 | xd3_hash_cfg large_hash; /* large hash config */ |
813 | 813 | ||
814 | uint32_t *small_table; /* table of small checksums */ | 814 | usize_t *small_table; /* table of small checksums */ |
815 | xd3_slist *small_prev; /* table of previous offsets, | 815 | xd3_slist *small_prev; /* table of previous offsets, |
816 | circular linked list */ | 816 | circular linked list */ |
817 | int small_reset; /* true if small table should | 817 | int small_reset; /* true if small table should |
@@ -1315,19 +1315,19 @@ static inline | |||
1315 | void xd3_blksize_div (const xoff_t offset, | 1315 | void xd3_blksize_div (const xoff_t offset, |
1316 | const xd3_source *source, | 1316 | const xd3_source *source, |
1317 | xoff_t *blkno, | 1317 | xoff_t *blkno, |
1318 | xoff_t *blkoff) { | 1318 | usize_t *blkoff) { |
1319 | *blkno = (xoff_t) (offset >> source->shiftby); | 1319 | *blkno = (xoff_t) (offset >> source->shiftby); |
1320 | *blkoff = (xoff_t) (offset & source->maskby); | 1320 | *blkoff = (usize_t) (offset & source->maskby); |
1321 | XD3_ASSERT (*blkoff < source->blksize); | 1321 | XD3_ASSERT (*blkoff < source->blksize); |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | static inline | 1324 | static inline |
1325 | void xd3_blksize_add (xoff_t *blkno, | 1325 | void xd3_blksize_add (xoff_t *blkno, |
1326 | xoff_t *blkoff, | 1326 | usize_t *blkoff, |
1327 | const xd3_source *source, | 1327 | const xd3_source *source, |
1328 | const usize_t add) | 1328 | const usize_t add) |
1329 | { | 1329 | { |
1330 | xoff_t blkdiff; | 1330 | usize_t blkdiff; |
1331 | 1331 | ||
1332 | /* Does not check for overflow, checked in xdelta3-decode.h. */ | 1332 | /* Does not check for overflow, checked in xdelta3-decode.h. */ |
1333 | *blkoff += add; | 1333 | *blkoff += add; |