summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-main.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3-main.h')
-rwxr-xr-xxdelta3/xdelta3-main.h40
1 files changed, 30 insertions, 10 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index cada82b..44bd6e5 100755
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -248,7 +248,7 @@ static int option_quiet = 0;
248static int option_level = 5; 248static int option_level = 5;
249static int option_use_appheader = 1; 249static int option_use_appheader = 1;
250static uint8_t* option_appheader = NULL; 250static uint8_t* option_appheader = NULL;
251static int option_use_secondary = /* until-standardized, leave this off */ 0; 251static int option_use_secondary = 0;
252static char* option_secondary = NULL; 252static char* option_secondary = NULL;
253static int option_use_checksum = 1; 253static int option_use_checksum = 1;
254static int option_use_altcodetable = 0; 254static int option_use_altcodetable = 0;
@@ -257,6 +257,7 @@ static int option_no_compress = 0;
257static int option_no_output = 0; /* go through the motions, but do not open or write output */ 257static int option_no_output = 0; /* go through the motions, but do not open or write output */
258static const char *option_source_filename = NULL; 258static const char *option_source_filename = NULL;
259 259
260static int option_iopt_size = XD3_DEFAULT_IOPT_SIZE;
260static usize_t option_winsize = XD3_DEFAULT_WINSIZE; 261static usize_t option_winsize = XD3_DEFAULT_WINSIZE;
261static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ; 262static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ;
262static int option_srcwinsz_set = 0; 263static int option_srcwinsz_set = 0;
@@ -2267,6 +2268,7 @@ main_input (xd3_cmd cmd,
2267 config.sec_data.ngroups = 1; 2268 config.sec_data.ngroups = 1;
2268 config.sec_addr.ngroups = 1; 2269 config.sec_addr.ngroups = 1;
2269 config.sec_inst.ngroups = 1; 2270 config.sec_inst.ngroups = 1;
2271 config.iopt_size = option_iopt_size;
2270 2272
2271 /* TODO: eliminate static variables. */ 2273 /* TODO: eliminate static variables. */
2272 do_not_lru = 0; 2274 do_not_lru = 0;
@@ -2553,12 +2555,22 @@ main_input (xd3_cmd cmd,
2553 { 2555 {
2554 if (IS_ENCODE (cmd) || cmd == CMD_DECODE) 2556 if (IS_ENCODE (cmd) || cmd == CMD_DECODE)
2555 { 2557 {
2556 int used_source = xd3_encoder_used_source (& stream); 2558 if (! option_quiet && IS_ENCODE (cmd))
2557
2558 if (! option_quiet && IS_ENCODE (cmd) && main_file_isopen (sfile) && ! used_source)
2559 { 2559 {
2560 XPR(NT "warning: input position %"Q"u no source copies\n", 2560 /* Warn when no source copies are found */
2561 stream.current_window * option_winsize); 2561 if (main_file_isopen (sfile) && ! xd3_encoder_used_source (& stream))
2562 {
2563 XPR(NT "warning: input position %"Q"u no source copies\n",
2564 stream.current_window * option_winsize);
2565 }
2566
2567 /* Warn about bad compression due to limited instruction buffer */
2568 if (stream.i_slots_used > stream.iopt_size)
2569 {
2570 XPR(NT "warning: input position %"Q"u overflowed instruction buffer, "
2571 "needed %u (vs. %u)\n",
2572 stream.current_window * option_winsize, stream.i_slots_used, stream.iopt_size);
2573 }
2562 } 2574 }
2563 2575
2564 if (option_verbose) 2576 if (option_verbose)
@@ -2723,7 +2735,7 @@ main (int argc, char **argv)
2723 main_file ifile; 2735 main_file ifile;
2724 main_file ofile; 2736 main_file ofile;
2725 main_file sfile; 2737 main_file sfile;
2726 static char *flags = "0123456789cdefhnqvDJNORTVs:B:C:E:F:L:O:P:M:W:A::S::"; 2738 static char *flags = "0123456789cdefhnqvDJNORTVs:B:C:E:F:I:L:O:P:M:W:A::S::";
2727 int my_optind; 2739 int my_optind;
2728 char *my_optarg; 2740 char *my_optarg;
2729 char *my_optstr; 2741 char *my_optstr;
@@ -2925,6 +2937,13 @@ main (int argc, char **argv)
2925 goto exit; 2937 goto exit;
2926 } 2938 }
2927 break; 2939 break;
2940 case 'I':
2941 if ((ret = main_atou (my_optarg, & option_iopt_size, 0,
2942 0, 'I')))
2943 {
2944 goto exit;
2945 }
2946 break;
2928 case 'W': 2947 case 'W':
2929 if ((ret = main_atou (my_optarg, & option_winsize, XD3_ALLOCSIZE, 2948 if ((ret = main_atou (my_optarg, & option_winsize, XD3_ALLOCSIZE,
2930 XD3_HARDMAXWINSIZE, 'W'))) 2949 XD3_HARDMAXWINSIZE, 'W')))
@@ -3126,6 +3145,7 @@ main_help (void)
3126 P(RINT "memory options:\n"); 3145 P(RINT "memory options:\n");
3127 P(RINT " -B bytes source window size\n"); 3146 P(RINT " -B bytes source window size\n");
3128 P(RINT " -W bytes input window size\n"); 3147 P(RINT " -W bytes input window size\n");
3148 P(RINT " -I size instruction buffer size (0 = unlimited)\n");
3129 3149
3130 P(RINT "compression options:\n"); 3150 P(RINT "compression options:\n");
3131 P(RINT " -s source source file to copy from (if any)\n"); 3151 P(RINT " -s source source file to copy from (if any)\n");
@@ -3133,15 +3153,15 @@ main_help (void)
3133 P(RINT " -N disable small string-matching compression\n"); 3153 P(RINT " -N disable small string-matching compression\n");
3134 P(RINT " -D disable external decompression (encode/decode)\n"); 3154 P(RINT " -D disable external decompression (encode/decode)\n");
3135 P(RINT " -R disable external recompression (decode)\n"); 3155 P(RINT " -R disable external recompression (decode)\n");
3156 P(RINT " -n disable checksum (encode/decode)\n");
3157 P(RINT " -C soft config (encode, undocumented)\n");
3158 P(RINT " -A [apphead] disable/provide application header (encode)\n");
3136 3159
3137#if XD3_DEBUG > 0 3160#if XD3_DEBUG > 0
3138 P(RINT "developer options:\n"); 3161 P(RINT "developer options:\n");
3139 P(RINT " -A [apphead] disable/provide application header\n");
3140 P(RINT " -C soft config (see xdelta3-cfgs.h)\n");
3141 P(RINT " -J disable output (check/compute only)\n"); 3162 P(RINT " -J disable output (check/compute only)\n");
3142 P(RINT " -P repeat count (for profiling)\n"); 3163 P(RINT " -P repeat count (for profiling)\n");
3143 P(RINT " -T use alternate code table\n"); 3164 P(RINT " -T use alternate code table\n");
3144 P(RINT " -n disable checksum (encode/decode)\n");
3145#endif 3165#endif
3146 return EXIT_FAILURE; 3166 return EXIT_FAILURE;
3147} 3167}