summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-main.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3-main.h')
-rw-r--r--xdelta3/xdelta3-main.h85
1 files changed, 45 insertions, 40 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 108a71a..030bc85 100644
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -383,6 +383,7 @@ main_config (void)
383 XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO); 383 XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO);
384 XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32); 384 XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32);
385 XPR(NTR "XD3_USE_LARGEFILE64=%d\n", XD3_USE_LARGEFILE64); 385 XPR(NTR "XD3_USE_LARGEFILE64=%d\n", XD3_USE_LARGEFILE64);
386 XPR(NTR "XD3_USE_LARGEWINDOW64=%d\n", XD3_USE_LARGEWINDOW64);
386 XPR(NTR "XD3_DEFAULT_LEVEL=%d\n", XD3_DEFAULT_LEVEL); 387 XPR(NTR "XD3_DEFAULT_LEVEL=%d\n", XD3_DEFAULT_LEVEL);
387 XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE); 388 XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE);
388 XPR(NTR "XD3_DEFAULT_SPREVSZ=%d\n", XD3_DEFAULT_SPREVSZ); 389 XPR(NTR "XD3_DEFAULT_SPREVSZ=%d\n", XD3_DEFAULT_SPREVSZ);
@@ -610,7 +611,7 @@ main_format_bcnt (xoff_t r, shortbuf *buf)
610 611
611 if (r >= 100 && r < 1000) 612 if (r >= 100 && r < 1000)
612 { 613 {
613 short_sprintf (*buf, "%"Q"u %s", r, fmts[i]); 614 short_sprintf (*buf, "%"Q" %s", r, fmts[i]);
614 return buf->buf; 615 return buf->buf;
615 } 616 }
616 617
@@ -710,12 +711,12 @@ main_atoux (const char* arg, xoff_t *xo, xoff_t low,
710 711
711 if (x < low) 712 if (x < low)
712 { 713 {
713 XPR(NT "-%c: minimum value: %"Q"u\n", which, low); 714 XPR(NT "-%c: minimum value: %"Q"\n", which, low);
714 return EXIT_FAILURE; 715 return EXIT_FAILURE;
715 } 716 }
716 if (high != 0 && x > high) 717 if (high != 0 && x > high)
717 { 718 {
718 XPR(NT "-%c: maximum value: %"Q"u\n", which, high); 719 XPR(NT "-%c: maximum value: %"Q"\n", which, high);
719 return EXIT_FAILURE; 720 return EXIT_FAILURE;
720 } 721 }
721 (*xo) = x; 722 (*xo) = x;
@@ -1105,7 +1106,7 @@ main_file_write (main_file *ofile, uint8_t *buf, usize_t size, const char *msg)
1105 } 1106 }
1106 else 1107 else
1107 { 1108 {
1108 if (option_verbose > 5) { XPR(NT "write %s: %u bytes\n", 1109 if (option_verbose > 5) { XPR(NT "write %s: %"Z" bytes\n",
1109 ofile->filename, size); } 1110 ofile->filename, size); }
1110 ofile->nwrite += size; 1111 ofile->nwrite += size;
1111 } 1112 }
@@ -1290,7 +1291,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1290 1291
1291 if ((ret = xd3_decode_instruction (stream))) 1292 if ((ret = xd3_decode_instruction (stream)))
1292 { 1293 {
1293 XPR(NT "instruction decode error at %"Q"u: %s\n", 1294 XPR(NT "instruction decode error at %"Q": %s\n",
1294 stream->dec_winstart + size, stream->msg); 1295 stream->dec_winstart + size, stream->msg);
1295 return ret; 1296 return ret;
1296 } 1297 }
@@ -1298,7 +1299,8 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1298 addr_bytes = (usize_t)(stream->addr_sect.buf - addr_before); 1299 addr_bytes = (usize_t)(stream->addr_sect.buf - addr_before);
1299 inst_bytes = (usize_t)(stream->inst_sect.buf - inst_before); 1300 inst_bytes = (usize_t)(stream->inst_sect.buf - inst_before);
1300 1301
1301 VC(UT " %06"Q"u %03u %s %6u", stream->dec_winstart + size, 1302 VC(UT " %06"Q" %03"Z" %s %6"Z,
1303 stream->dec_winstart + size,
1302 option_print_cpymode ? code : 0, 1304 option_print_cpymode ? code : 0,
1303 xd3_rtype_to_string ((xd3_rtype) stream->dec_current1.type, 1305 xd3_rtype_to_string ((xd3_rtype) stream->dec_current1.type,
1304 option_print_cpymode), 1306 option_print_cpymode),
@@ -1310,12 +1312,12 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1310 { 1312 {
1311 if (stream->dec_current1.addr >= stream->dec_cpylen) 1313 if (stream->dec_current1.addr >= stream->dec_cpylen)
1312 { 1314 {
1313 VC(UT " T@%-6u", 1315 VC(UT " T@%-6"Z,
1314 stream->dec_current1.addr - stream->dec_cpylen)VE; 1316 stream->dec_current1.addr - stream->dec_cpylen)VE;
1315 } 1317 }
1316 else 1318 else
1317 { 1319 {
1318 VC(UT " S@%-6"Q"u", 1320 VC(UT " S@%-6"Q,
1319 stream->dec_cpyoff + stream->dec_current1.addr)VE; 1321 stream->dec_cpyoff + stream->dec_current1.addr)VE;
1320 } 1322 }
1321 } 1323 }
@@ -1329,7 +1331,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1329 1331
1330 if (stream->dec_current2.type != XD3_NOOP) 1332 if (stream->dec_current2.type != XD3_NOOP)
1331 { 1333 {
1332 VC(UT " %s %6u", 1334 VC(UT " %s %6"Z,
1333 xd3_rtype_to_string ((xd3_rtype) stream->dec_current2.type, 1335 xd3_rtype_to_string ((xd3_rtype) stream->dec_current2.type,
1334 option_print_cpymode), 1336 option_print_cpymode),
1335 stream->dec_current2.size)VE; 1337 stream->dec_current2.size)VE;
@@ -1338,12 +1340,12 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1338 { 1340 {
1339 if (stream->dec_current2.addr >= stream->dec_cpylen) 1341 if (stream->dec_current2.addr >= stream->dec_cpylen)
1340 { 1342 {
1341 VC(UT " T@%-6u", 1343 VC(UT " T@%-6"Q,
1342 stream->dec_current2.addr - stream->dec_cpylen)VE; 1344 stream->dec_current2.addr - stream->dec_cpylen)VE;
1343 } 1345 }
1344 else 1346 else
1345 { 1347 {
1346 VC(UT " S@%-6"Q"u", 1348 VC(UT " S@%-6"Q"",
1347 stream->dec_cpyoff + stream->dec_current2.addr)VE; 1349 stream->dec_cpyoff + stream->dec_current2.addr)VE;
1348 } 1350 }
1349 } 1351 }
@@ -1358,7 +1360,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1358 (stream->dec_current1.type >= XD3_CPY || 1360 (stream->dec_current1.type >= XD3_CPY ||
1359 stream->dec_current2.type >= XD3_CPY)) 1361 stream->dec_current2.type >= XD3_CPY))
1360 { 1362 {
1361 VC(UT " %06"Q"u (inefficiency) %u encoded as %u bytes\n", 1363 VC(UT " %06"Q" (inefficiency) %"Z" encoded as %"Z" bytes\n",
1362 stream->dec_winstart + size_before, 1364 stream->dec_winstart + size_before,
1363 size - size_before, 1365 size - size_before,
1364 addr_bytes + inst_bytes)VE; 1366 addr_bytes + inst_bytes)VE;
@@ -1426,7 +1428,7 @@ main_print_func (xd3_stream* stream, main_file *xfile)
1426 if (stream->dec_winstart == 0) 1428 if (stream->dec_winstart == 0)
1427 { 1429 {
1428 VC(UT "VCDIFF version: 0\n")VE; 1430 VC(UT "VCDIFF version: 0\n")VE;
1429 VC(UT "VCDIFF header size: %d\n", 1431 VC(UT "VCDIFF header size: %"Z"\n",
1430 stream->dec_hdrsize)VE; 1432 stream->dec_hdrsize)VE;
1431 VC(UT "VCDIFF header indicator: ")VE; 1433 VC(UT "VCDIFF header indicator: ")VE;
1432 if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0) 1434 if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0)
@@ -1481,7 +1483,7 @@ main_print_func (xd3_stream* stream, main_file *xfile)
1481 VC(UT "\n")VE; 1483 VC(UT "\n")VE;
1482 } 1484 }
1483 1485
1484 VC(UT "VCDIFF window number: %"Q"u\n", stream->current_window)VE; 1486 VC(UT "VCDIFF window number: %"Q"\n", stream->current_window)VE;
1485 VC(UT "VCDIFF window indicator: ")VE; 1487 VC(UT "VCDIFF window indicator: ")VE;
1486 if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE ")VE; 1488 if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE ")VE;
1487 if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET ")VE; 1489 if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET ")VE;
@@ -1492,7 +1494,7 @@ main_print_func (xd3_stream* stream, main_file *xfile)
1492 if ((stream->dec_win_ind & VCD_ADLER32) != 0) 1494 if ((stream->dec_win_ind & VCD_ADLER32) != 0)
1493 { 1495 {
1494 VC(UT "VCDIFF adler32 checksum: %08X\n", 1496 VC(UT "VCDIFF adler32 checksum: %08X\n",
1495 (usize_t)stream->dec_adler32)VE; 1497 stream->dec_adler32)VE;
1496 } 1498 }
1497 1499
1498 if (stream->dec_del_ind != 0) 1500 if (stream->dec_del_ind != 0)
@@ -1507,27 +1509,27 @@ main_print_func (xd3_stream* stream, main_file *xfile)
1507 1509
1508 if (stream->dec_winstart != 0) 1510 if (stream->dec_winstart != 0)
1509 { 1511 {
1510 VC(UT "VCDIFF window at offset: %"Q"u\n", stream->dec_winstart)VE; 1512 VC(UT "VCDIFF window at offset: %"Q"\n", stream->dec_winstart)VE;
1511 } 1513 }
1512 1514
1513 if (SRCORTGT (stream->dec_win_ind)) 1515 if (SRCORTGT (stream->dec_win_ind))
1514 { 1516 {
1515 VC(UT "VCDIFF copy window length: %u\n", 1517 VC(UT "VCDIFF copy window length: %"Z"\n",
1516 (usize_t)stream->dec_cpylen)VE; 1518 stream->dec_cpylen)VE;
1517 VC(UT "VCDIFF copy window offset: %"Q"u\n", 1519 VC(UT "VCDIFF copy window offset: %"Q"\n",
1518 stream->dec_cpyoff)VE; 1520 stream->dec_cpyoff)VE;
1519 } 1521 }
1520 1522
1521 VC(UT "VCDIFF delta encoding length: %u\n", 1523 VC(UT "VCDIFF delta encoding length: %"Z"\n",
1522 (usize_t)stream->dec_enclen)VE; 1524 (usize_t)stream->dec_enclen)VE;
1523 VC(UT "VCDIFF target window length: %u\n", 1525 VC(UT "VCDIFF target window length: %"Z"\n",
1524 (usize_t)stream->dec_tgtlen)VE; 1526 (usize_t)stream->dec_tgtlen)VE;
1525 1527
1526 VC(UT "VCDIFF data section length: %u\n", 1528 VC(UT "VCDIFF data section length: %"Z"\n",
1527 (usize_t)stream->data_sect.size)VE; 1529 (usize_t)stream->data_sect.size)VE;
1528 VC(UT "VCDIFF inst section length: %u\n", 1530 VC(UT "VCDIFF inst section length: %"Z"\n",
1529 (usize_t)stream->inst_sect.size)VE; 1531 (usize_t)stream->inst_sect.size)VE;
1530 VC(UT "VCDIFF addr section length: %u\n", 1532 VC(UT "VCDIFF addr section length: %"Z"\n",
1531 (usize_t)stream->addr_sect.size)VE; 1533 (usize_t)stream->addr_sect.size)VE;
1532 1534
1533 ret = 0; 1535 ret = 0;
@@ -1967,8 +1969,11 @@ main_merge_output (xd3_stream *stream, main_file *ofile)
1967 XD3_ASSERT (inst->addr >= window_start); 1969 XD3_ASSERT (inst->addr >= window_start);
1968 addr = inst->addr - window_start; 1970 addr = inst->addr - window_start;
1969 } 1971 }
1970 IF_DEBUG2 (XPR(NTR "[merge copy] winpos %u take %u addr %"Q"u mode %u\n", 1972 IF_DEBUG2 ({
1971 window_pos, take, addr, inst->mode)); 1973 XPR(NTR "[merge copy] winpos %"Z" take %"Z" "
1974 "addr %"Q" mode %u\n",
1975 window_pos, take, addr, inst->mode);
1976 });
1972 if ((ret = xd3_found_match (recode_stream, window_pos, take, 1977 if ((ret = xd3_found_match (recode_stream, window_pos, take,
1973 addr, inst->mode != 0))) 1978 addr, inst->mode != 0)))
1974 { 1979 {
@@ -2243,7 +2248,7 @@ main_pipe_copier (uint8_t *pipe_buf,
2243 2248
2244 if (option_verbose && skipped != 0) 2249 if (option_verbose && skipped != 0)
2245 { 2250 {
2246 XPR(NT "skipping %"Q"u bytes in %s\n", 2251 XPR(NT "skipping %"Q" bytes in %s\n",
2247 skipped, ifile->filename); 2252 skipped, ifile->filename);
2248 } 2253 }
2249 return 0; 2254 return 0;
@@ -3041,7 +3046,7 @@ main_input (xd3_cmd cmd,
3041 { 3046 {
3042 const char *s = option_smatch_config; 3047 const char *s = option_smatch_config;
3043 char *e; 3048 char *e;
3044 usize_t values[XD3_SOFTCFG_VARCNT]; 3049 long values[XD3_SOFTCFG_VARCNT];
3045 int got; 3050 int got;
3046 3051
3047 config.smatch_cfg = XD3_SMATCH_SOFT; 3052 config.smatch_cfg = XD3_SMATCH_SOFT;
@@ -3284,7 +3289,7 @@ main_input (xd3_cmd cmd,
3284 /* Warn when no source copies are found */ 3289 /* Warn when no source copies are found */
3285 if (option_verbose && ! xd3_encoder_used_source (& stream)) 3290 if (option_verbose && ! xd3_encoder_used_source (& stream))
3286 { 3291 {
3287 XPR(NT "warning: input window %"Q"u..%"Q"u has " 3292 XPR(NT "warning: input window %"Q"..%"Q" has "
3288 "no source copies\n", 3293 "no source copies\n",
3289 stream.current_window * winsize, 3294 stream.current_window * winsize,
3290 (stream.current_window+1) * winsize); 3295 (stream.current_window+1) * winsize);
@@ -3297,8 +3302,8 @@ main_input (xd3_cmd cmd,
3297 stream.srcwin_decided_early && 3302 stream.srcwin_decided_early &&
3298 stream.i_slots_used > stream.iopt_size) 3303 stream.i_slots_used > stream.iopt_size)
3299 { 3304 {
3300 XPR(NT "warning: input position %"Q"u overflowed " 3305 XPR(NT "warning: input position %"Q" overflowed "
3301 "instruction buffer, needed %u (vs. %u), " 3306 "instruction buffer, needed %"Z" (vs. %"Z"), "
3302 "consider changing -I\n", 3307 "consider changing -I\n",
3303 stream.current_window * winsize, 3308 stream.current_window * winsize,
3304 stream.i_slots_used, stream.iopt_size); 3309 stream.i_slots_used, stream.iopt_size);
@@ -3321,7 +3326,7 @@ main_input (xd3_cmd cmd,
3321 3326
3322 if (option_verbose > 1) 3327 if (option_verbose > 1)
3323 { 3328 {
3324 XPR(NT "%"Q"u: in %s (%s): out %s (%s): " 3329 XPR(NT "%"Q": in %s (%s): out %s (%s): "
3325 "total in %s: out %s: %s: srcpos %s\n", 3330 "total in %s: out %s: %s: srcpos %s\n",
3326 stream.current_window, 3331 stream.current_window,
3327 main_format_bcnt (this_read, &rdb), 3332 main_format_bcnt (this_read, &rdb),
@@ -3335,7 +3340,7 @@ main_input (xd3_cmd cmd,
3335 } 3340 }
3336 else 3341 else
3337 { 3342 {
3338 XPR(NT "%"Q"u: in %s: out %s: total in %s: " 3343 XPR(NT "%"Q": in %s: out %s: total in %s: "
3339 "out %s: %s\n", 3344 "out %s: %s\n",
3340 stream.current_window, 3345 stream.current_window,
3341 main_format_bcnt (this_read, &rdb), 3346 main_format_bcnt (this_read, &rdb),
@@ -3422,21 +3427,21 @@ done:
3422 if (option_verbose > 1 && cmd == CMD_ENCODE) 3427 if (option_verbose > 1 && cmd == CMD_ENCODE)
3423 { 3428 {
3424 XPR(NT "scanner configuration: %s\n", stream.smatcher.name); 3429 XPR(NT "scanner configuration: %s\n", stream.smatcher.name);
3425 XPR(NT "target hash table size: %u\n", stream.small_hash.size); 3430 XPR(NT "target hash table size: %"Z"\n", stream.small_hash.size);
3426 if (sfile != NULL && sfile->filename != NULL) 3431 if (sfile != NULL && sfile->filename != NULL)
3427 { 3432 {
3428 XPR(NT "source hash table size: %u\n", stream.large_hash.size); 3433 XPR(NT "source hash table size: %"Z"\n", stream.large_hash.size);
3429 } 3434 }
3430 } 3435 }
3431 3436
3432 if (option_verbose > 2 && cmd == CMD_ENCODE) 3437 if (option_verbose > 2 && cmd == CMD_ENCODE)
3433 { 3438 {
3434 XPR(NT "source copies: %"Q"u (%"Q"u bytes)\n", 3439 XPR(NT "source copies: %"Q" (%"Q" bytes)\n",
3435 stream.n_scpy, stream.l_scpy); 3440 stream.n_scpy, stream.l_scpy);
3436 XPR(NT "target copies: %"Q"u (%"Q"u bytes)\n", 3441 XPR(NT "target copies: %"Q" (%"Q" bytes)\n",
3437 stream.n_tcpy, stream.l_tcpy); 3442 stream.n_tcpy, stream.l_tcpy);
3438 XPR(NT "adds: %"Q"u (%"Q"u bytes)\n", stream.n_add, stream.l_add); 3443 XPR(NT "adds: %"Q" (%"Q" bytes)\n", stream.n_add, stream.l_add);
3439 XPR(NT "runs: %"Q"u (%"Q"u bytes)\n", stream.n_run, stream.l_run); 3444 XPR(NT "runs: %"Q" (%"Q" bytes)\n", stream.n_run, stream.l_run);
3440 } 3445 }
3441#endif 3446#endif
3442 3447
@@ -3448,7 +3453,7 @@ done:
3448 long end_time = get_millisecs_now (); 3453 long end_time = get_millisecs_now ();
3449 xoff_t nwrite = ofile != NULL ? ofile->nwrite : 0; 3454 xoff_t nwrite = ofile != NULL ? ofile->nwrite : 0;
3450 3455
3451 XPR(NT "finished in %s; input %"Q"u output %"Q"u bytes (%0.2f%%)\n", 3456 XPR(NT "finished in %s; input %"Q" output %"Q" bytes (%0.2f%%)\n",
3452 main_format_millis (end_time - start_time, &tm), 3457 main_format_millis (end_time - start_time, &tm),
3453 ifile->nread, nwrite, 100.0 * nwrite / ifile->nread); 3458 ifile->nread, nwrite, 100.0 * nwrite / ifile->nread);
3454 } 3459 }