diff options
author | Josh MacDonald <josh.macdonald@gmail.com> | 2015-07-12 23:42:47 -0700 |
---|---|---|
committer | Josh MacDonald <josh.macdonald@gmail.com> | 2015-07-12 23:42:47 -0700 |
commit | 53c2be245f503bc5e41b822ac2364f67a346d087 (patch) | |
tree | a1aa5bf5547311b45da34ae1adb2a0cefbf8c271 /xdelta3 | |
parent | ab5fac1b46411bdf6151013978a721d52342cc4f (diff) |
XD3_WIN32: Handle size_t case in printf; avoid setting XD3_POSIX in Makefile
Diffstat (limited to 'xdelta3')
-rw-r--r-- | xdelta3/Makefile.am | 1 | ||||
-rwxr-xr-x | xdelta3/run_release.sh | 13 | ||||
-rw-r--r-- | xdelta3/testing/modify.h | 10 | ||||
-rw-r--r-- | xdelta3/testing/regtest.cc | 12 | ||||
-rw-r--r-- | xdelta3/xdelta3-blkcache.h | 10 | ||||
-rw-r--r-- | xdelta3/xdelta3-internal.h | 6 | ||||
-rw-r--r-- | xdelta3/xdelta3-main.h | 2 | ||||
-rw-r--r-- | xdelta3/xdelta3.h | 11 |
8 files changed, 39 insertions, 26 deletions
diff --git a/xdelta3/Makefile.am b/xdelta3/Makefile.am index 29fa193..a1bb6d9 100644 --- a/xdelta3/Makefile.am +++ b/xdelta3/Makefile.am | |||
@@ -47,7 +47,6 @@ common_CFLAGS = \ | |||
47 | -DREGRESSION_TEST=1 \ | 47 | -DREGRESSION_TEST=1 \ |
48 | -DSECONDARY_DJW=1 \ | 48 | -DSECONDARY_DJW=1 \ |
49 | -DSECONDARY_FGK=1 \ | 49 | -DSECONDARY_FGK=1 \ |
50 | -DXD3_POSIX=1 \ | ||
51 | -DXD3_MAIN=1 | 50 | -DXD3_MAIN=1 |
52 | 51 | ||
53 | if DEBUG_SYMBOLS | 52 | if DEBUG_SYMBOLS |
diff --git a/xdelta3/run_release.sh b/xdelta3/run_release.sh index de33020..8b09ab3 100755 --- a/xdelta3/run_release.sh +++ b/xdelta3/run_release.sh | |||
@@ -9,8 +9,9 @@ export LDFLAGS | |||
9 | 9 | ||
10 | LIBBASE=$HOME/lib | 10 | LIBBASE=$HOME/lib |
11 | 11 | ||
12 | MINGW_CCFLAGS="-DEXTERNAL_COMPRESSION=0 -DVCDIFF_TOOLS=0 -DXD3_WIN32=1 -DSHELL_TESTS=0" | 12 | MINGW_CFLAGS="-DEXTERNAL_COMPRESSION=0 -DVCDIFF_TOOLS=0 -DXD3_WIN32=1 -DSHELL_TESTS=0" |
13 | MINGW_LDFLAGS="-lmingw32" | 13 | |
14 | MINGW_LDFLAGS="" | ||
14 | 15 | ||
15 | # Location where mingw-w64-build script runs. | 16 | # Location where mingw-w64-build script runs. |
16 | MINGW_BASE="/volume/home/jmacd/src/mingwb" | 17 | MINGW_BASE="/volume/home/jmacd/src/mingwb" |
@@ -19,7 +20,7 @@ MINGW_BASE="/volume/home/jmacd/src/mingwb" | |||
19 | # Run from the source dir. | 20 | # Run from the source dir. |
20 | SRCDIR=$PWD | 21 | SRCDIR=$PWD |
21 | 22 | ||
22 | rm -rf build | 23 | rm -rf build/*/*/* |
23 | 24 | ||
24 | function setup { | 25 | function setup { |
25 | aclocal -I m4 | 26 | aclocal -I m4 |
@@ -50,10 +51,12 @@ function buildit { | |||
50 | (cd $D && $SRCDIR/configure \ | 51 | (cd $D && $SRCDIR/configure \ |
51 | --host=${host} \ | 52 | --host=${host} \ |
52 | --prefix=$PWD \ | 53 | --prefix=$PWD \ |
54 | --enable-static \ | ||
55 | --disable-shared \ | ||
53 | --enable-debug-symbols) | 56 | --enable-debug-symbols) |
54 | 57 | ||
55 | # echo "Building $D ..." | 58 | echo "Building $D ..." |
56 | # (cd $D && make all) | 59 | (cd $D && make all) |
57 | # echo "Installing $D ..." | 60 | # echo "Installing $D ..." |
58 | # (cd $D && make install) | 61 | # (cd $D && make install) |
59 | # echo "Testing $D ..." | 62 | # echo "Testing $D ..." |
diff --git a/xdelta3/testing/modify.h b/xdelta3/testing/modify.h index 023e6ce..93f7bde 100644 --- a/xdelta3/testing/modify.h +++ b/xdelta3/testing/modify.h | |||
@@ -12,12 +12,12 @@ public: | |||
12 | enum Kind { | 12 | enum Kind { |
13 | MODIFY = 1, // Mutate a certain range w/ random or supplied data | 13 | MODIFY = 1, // Mutate a certain range w/ random or supplied data |
14 | ADD = 2, // Insert random or supplied data | 14 | ADD = 2, // Insert random or supplied data |
15 | DELETE = 3, // Delete a specified range of data | 15 | DELRANGE = 3, // Delete a specified range of data |
16 | COPY = 4, // Copy from one region, inserting elsewhere | 16 | COPY = 4, // Copy from one region, inserting elsewhere |
17 | MOVE = 5, // Copy then delete copied-from range | 17 | MOVE = 5, // Copy then delete copied-from range |
18 | COPYOVER = 6 // Copy then delete copied-to range | 18 | COPYOVER = 6 // Copy then delete copied-to range |
19 | 19 | ||
20 | // ADD, DELETE, and COPY change the file size | 20 | // ADD, DELRANGE, and COPY change the file size |
21 | // MODIFY, MOVE, COPYOVER preserve the file size | 21 | // MODIFY, MOVE, COPYOVER preserve the file size |
22 | }; | 22 | }; |
23 | 23 | ||
@@ -97,7 +97,7 @@ public: | |||
97 | case Change::MODIFY: | 97 | case Change::MODIFY: |
98 | ModifyChange(ch, table, source_table, rand); | 98 | ModifyChange(ch, table, source_table, rand); |
99 | break; | 99 | break; |
100 | case Change::DELETE: | 100 | case Change::DELRANGE: |
101 | DeleteChange(ch, table, source_table, rand); | 101 | DeleteChange(ch, table, source_table, rand); |
102 | break; | 102 | break; |
103 | case Change::COPY: | 103 | case Change::COPY: |
@@ -269,7 +269,7 @@ public: | |||
269 | SegmentMap tmp; | 269 | SegmentMap tmp; |
270 | CHECK_NE(ch.addr1, ch.addr2); | 270 | CHECK_NE(ch.addr1, ch.addr2); |
271 | CopyChange(ch, &tmp, source_table, rand); | 271 | CopyChange(ch, &tmp, source_table, rand); |
272 | Change d(Change::DELETE, ch.size, | 272 | Change d(Change::DELRANGE, ch.size, |
273 | ch.addr1 < ch.addr2 ? ch.addr1 : ch.addr1 + ch.size); | 273 | ch.addr1 < ch.addr2 ? ch.addr1 : ch.addr1 + ch.size); |
274 | DeleteChange(d, table, &tmp, rand); | 274 | DeleteChange(d, table, &tmp, rand); |
275 | } | 275 | } |
@@ -282,7 +282,7 @@ public: | |||
282 | SegmentMap tmp; | 282 | SegmentMap tmp; |
283 | CHECK_NE(ch.addr1, ch.addr2); | 283 | CHECK_NE(ch.addr1, ch.addr2); |
284 | CopyChange(ch, &tmp, source_table, rand); | 284 | CopyChange(ch, &tmp, source_table, rand); |
285 | Change d(Change::DELETE, ch.size, ch.addr2 + ch.size); | 285 | Change d(Change::DELRANGE, ch.size, ch.addr2 + ch.size); |
286 | DeleteChange(d, table, &tmp, rand); | 286 | DeleteChange(d, table, &tmp, rand); |
287 | } | 287 | } |
288 | 288 | ||
diff --git a/xdelta3/testing/regtest.cc b/xdelta3/testing/regtest.cc index 566e4f5..a36bded 100644 --- a/xdelta3/testing/regtest.cc +++ b/xdelta3/testing/regtest.cc | |||
@@ -576,7 +576,7 @@ void TestDeleteMutator() { | |||
576 | 576 | ||
577 | for (size_t i = 0; i < SIZEOF_ARRAY(test_cases); i++) { | 577 | for (size_t i = 0; i < SIZEOF_ARRAY(test_cases); i++) { |
578 | ChangeList cl1; | 578 | ChangeList cl1; |
579 | cl1.push_back(Change(Change::DELETE, test_cases[i].size, | 579 | cl1.push_back(Change(Change::DELRANGE, test_cases[i].size, |
580 | test_cases[i].addr)); | 580 | test_cases[i].addr)); |
581 | spec0.ModifyTo(ChangeListMutator(cl1), &spec1); | 581 | spec0.ModifyTo(ChangeListMutator(cl1), &spec1); |
582 | CHECK_EQ(spec0.Size() - test_cases[i].size, spec1.Size()); | 582 | CHECK_EQ(spec0.Size() - test_cases[i].size, spec1.Size()); |
@@ -1129,7 +1129,7 @@ void TestMergeCommand1() { | |||
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | cl1.push_back(Change(Change::ADD, change1, add1_pos)); | 1131 | cl1.push_back(Change(Change::ADD, change1, add1_pos)); |
1132 | cl2.push_back(Change(Change::DELETE, change1, del2_pos)); | 1132 | cl2.push_back(Change(Change::DELRANGE, change1, del2_pos)); |
1133 | cl3.push_back(Change(Change::MODIFY, change3, change3_pos)); | 1133 | cl3.push_back(Change(Change::MODIFY, change3, change3_pos)); |
1134 | 1134 | ||
1135 | spec0.ModifyTo(ChangeListMutator(cl1), &spec1); | 1135 | spec0.ModifyTo(ChangeListMutator(cl1), &spec1); |
@@ -1183,9 +1183,9 @@ void TestMergeCommand2() { | |||
1183 | 1183 | ||
1184 | ChangeList cl1, cl2, cl3; | 1184 | ChangeList cl1, cl2, cl3; |
1185 | 1185 | ||
1186 | cl1.push_back(Change(Change::DELETE, size0 - size1, 0)); | 1186 | cl1.push_back(Change(Change::DELRANGE, size0 - size1, 0)); |
1187 | cl2.push_back(Change(Change::DELETE, size0 - size2, 0)); | 1187 | cl2.push_back(Change(Change::DELRANGE, size0 - size2, 0)); |
1188 | cl3.push_back(Change(Change::DELETE, size0 - size3, 0)); | 1188 | cl3.push_back(Change(Change::DELRANGE, size0 - size3, 0)); |
1189 | 1189 | ||
1190 | spec0.ModifyTo(ChangeListMutator(cl1), &spec1); | 1190 | spec0.ModifyTo(ChangeListMutator(cl1), &spec1); |
1191 | spec0.ModifyTo(ChangeListMutator(cl2), &spec2); | 1191 | spec0.ModifyTo(ChangeListMutator(cl2), &spec2); |
@@ -1259,7 +1259,7 @@ void UnitTest() { | |||
1259 | // These are Xdelta tests. | 1259 | // These are Xdelta tests. |
1260 | template <class T> | 1260 | template <class T> |
1261 | void MainTest() { | 1261 | void MainTest() { |
1262 | XPR(NT "Blocksize %"Q"u windowsize %zu\n", | 1262 | XPR(NT "Blocksize %"Q"u windowsize %"Z"u\n", |
1263 | T::BLOCK_SIZE, T::WINDOW_SIZE); | 1263 | T::BLOCK_SIZE, T::WINDOW_SIZE); |
1264 | Regtest<T> regtest; | 1264 | Regtest<T> regtest; |
1265 | TEST(TestEmptyInMemory); | 1265 | TEST(TestEmptyInMemory); |
diff --git a/xdelta3/xdelta3-blkcache.h b/xdelta3/xdelta3-blkcache.h index 080aebd..1ae663e 100644 --- a/xdelta3/xdelta3-blkcache.h +++ b/xdelta3/xdelta3-blkcache.h | |||
@@ -427,7 +427,7 @@ main_read_seek_source (xd3_stream *stream, | |||
427 | 427 | ||
428 | if (nread != source->blksize) | 428 | if (nread != source->blksize) |
429 | { | 429 | { |
430 | IF_DEBUG1 (DP(RINT "[getblk] short skip block nread = %zu\n", | 430 | IF_DEBUG1 (DP(RINT "[getblk] short skip block nread = %"Z"u\n", |
431 | nread)); | 431 | nread)); |
432 | stream->msg = "non-seekable input is short"; | 432 | stream->msg = "non-seekable input is short"; |
433 | return XD3_INVALID_INPUT; | 433 | return XD3_INVALID_INPUT; |
@@ -532,20 +532,20 @@ main_getblk_func (xd3_stream *stream, | |||
532 | { | 532 | { |
533 | if (blru->blkno != blkno) | 533 | if (blru->blkno != blkno) |
534 | { | 534 | { |
535 | XPR(NT "source block %"Q"u read %zu ejects %"Q"u (lru_hits=%u, " | 535 | XPR(NT "source block %"Q"u read %"Z"u ejects %"Q"u (lru_hits=%u, " |
536 | "lru_misses=%u, lru_filled=%u)\n", | 536 | "lru_misses=%u, lru_filled=%u)\n", |
537 | blkno, nread, blru->blkno, lru_hits, lru_misses, lru_filled); | 537 | blkno, nread, blru->blkno, lru_hits, lru_misses, lru_filled); |
538 | } | 538 | } |
539 | else | 539 | else |
540 | { | 540 | { |
541 | XPR(NT "source block %"Q"u read %zu (lru_hits=%u, " | 541 | XPR(NT "source block %"Q"u read %"Z"u (lru_hits=%u, " |
542 | "lru_misses=%u, lru_filled=%u)\n", | 542 | "lru_misses=%u, lru_filled=%u)\n", |
543 | blkno, nread, lru_hits, lru_misses, lru_filled); | 543 | blkno, nread, lru_hits, lru_misses, lru_filled); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | else | 546 | else |
547 | { | 547 | { |
548 | XPR(NT "source block %"Q"u read %zu (lru_hits=%u, lru_misses=%u, " | 548 | XPR(NT "source block %"Q"u read %"Z"u (lru_hits=%u, lru_misses=%u, " |
549 | "lru_filled=%u)\n", blkno, nread, | 549 | "lru_filled=%u)\n", blkno, nread, |
550 | lru_hits, lru_misses, lru_filled); | 550 | lru_hits, lru_misses, lru_filled); |
551 | } | 551 | } |
@@ -557,7 +557,7 @@ main_getblk_func (xd3_stream *stream, | |||
557 | blru->size = nread; | 557 | blru->size = nread; |
558 | blru->blkno = blkno; | 558 | blru->blkno = blkno; |
559 | 559 | ||
560 | IF_DEBUG1 (DP(RINT "[main_getblk] blkno %"Q"u onblk %zu pos %"Q"u " | 560 | IF_DEBUG1 (DP(RINT "[main_getblk] blkno %"Q"u onblk %"Z"u pos %"Q"u " |
561 | "srcpos %"Q"u\n", | 561 | "srcpos %"Q"u\n", |
562 | blkno, nread, pos, sfile->source_position)); | 562 | blkno, nread, pos, sfile->source_position)); |
563 | 563 | ||
diff --git a/xdelta3/xdelta3-internal.h b/xdelta3/xdelta3-internal.h index 72bf141..b14408f 100644 --- a/xdelta3/xdelta3-internal.h +++ b/xdelta3/xdelta3-internal.h | |||
@@ -82,12 +82,12 @@ typedef enum | |||
82 | 82 | ||
83 | struct _main_file | 83 | struct _main_file |
84 | { | 84 | { |
85 | #if XD3_STDIO | 85 | #if XD3_WIN32 |
86 | HANDLE file; | ||
87 | #elif XD3_STDIO | ||
86 | FILE *file; | 88 | FILE *file; |
87 | #elif XD3_POSIX | 89 | #elif XD3_POSIX |
88 | int file; | 90 | int file; |
89 | #elif XD3_WIN32 | ||
90 | HANDLE file; | ||
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | int mode; /* XO_READ and XO_WRITE */ | 93 | int mode; /* XO_READ and XO_WRITE */ |
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index d993bc4..875dd71 100644 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h | |||
@@ -1073,7 +1073,7 @@ main_file_read (main_file *ifile, | |||
1073 | } | 1073 | } |
1074 | else | 1074 | else |
1075 | { | 1075 | { |
1076 | if (option_verbose > 4) { XPR(NT "read %s: %zu bytes\n", | 1076 | if (option_verbose > 4) { XPR(NT "read %s: %"Z"u bytes\n", |
1077 | ifile->filename, (*nread)); } | 1077 | ifile->filename, (*nread)); } |
1078 | ifile->nread += (*nread); | 1078 | ifile->nread += (*nread); |
1079 | } | 1079 | } |
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h index 6e03c31..b317203 100644 --- a/xdelta3/xdelta3.h +++ b/xdelta3/xdelta3.h | |||
@@ -176,6 +176,16 @@ typedef unsigned long long xoff_t; | |||
176 | #define Q "ll" | 176 | #define Q "ll" |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | #ifdef _WIN32 | ||
180 | #if SIZEOF_SIZE_T == 4 | ||
181 | #define Z "" | ||
182 | #elif SIZEOF_SIZE_T == 8 | ||
183 | #define Z "I64" | ||
184 | #endif | ||
185 | #else | ||
186 | #define Z "z" | ||
187 | #endif | ||
188 | |||
179 | #define SIZEOF_XOFF_T 8 | 189 | #define SIZEOF_XOFF_T 8 |
180 | #define SIZEOF_USIZE_T 4 | 190 | #define SIZEOF_USIZE_T 4 |
181 | #else | 191 | #else |
@@ -188,6 +198,7 @@ typedef uint32_t xoff_t; | |||
188 | #define SIZEOF_XOFF_T 4 | 198 | #define SIZEOF_XOFF_T 4 |
189 | #define SIZEOF_USIZE_T 4 | 199 | #define SIZEOF_USIZE_T 4 |
190 | #define Q | 200 | #define Q |
201 | #define Z | ||
191 | #endif | 202 | #endif |
192 | 203 | ||
193 | #define USE_UINT32 (SIZEOF_USIZE_T == 4 || \ | 204 | #define USE_UINT32 (SIZEOF_USIZE_T == 4 || \ |