diff options
author | josh.macdonald <jmacd@users.noreply.github.com> | 2009-10-26 02:33:06 +0000 |
---|---|---|
committer | josh.macdonald <jmacd@users.noreply.github.com> | 2009-10-26 02:33:06 +0000 |
commit | 0fef30425e5fd7151a71dc3e63a9687caada1c96 (patch) | |
tree | 8a5e9e0192dc68d4b514cfd178fa1fb0b9b1eb43 /xdelta3 | |
parent | 683ae8877b23b63a16bad3bdcb4dd612d08d73ce (diff) |
Fix the source_decompression test, which tests that appheader overrides compression magic number.
Diffstat (limited to 'xdelta3')
-rw-r--r-- | xdelta3/xdelta3-main.h | 74 | ||||
-rw-r--r-- | xdelta3/xdelta3-test.h | 22 | ||||
-rw-r--r-- | xdelta3/xdelta3.c | 19 |
3 files changed, 76 insertions, 39 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index 0babbf1..1aaef4f 100644 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h | |||
@@ -373,6 +373,9 @@ static int main_input (xd3_cmd cmd, main_file *ifile, | |||
373 | static void main_get_appheader (xd3_stream *stream, main_file *ifile, | 373 | static void main_get_appheader (xd3_stream *stream, main_file *ifile, |
374 | main_file *output, main_file *sfile); | 374 | main_file *output, main_file *sfile); |
375 | 375 | ||
376 | static int main_getblk_func (xd3_stream *stream, | ||
377 | xd3_source *source, | ||
378 | xoff_t blkno); | ||
376 | static int main_help (void); | 379 | static int main_help (void); |
377 | 380 | ||
378 | static int | 381 | static int |
@@ -2665,14 +2668,22 @@ static int | |||
2665 | main_read_primary_input (main_file *ifile, | 2668 | main_read_primary_input (main_file *ifile, |
2666 | uint8_t *buf, | 2669 | uint8_t *buf, |
2667 | usize_t size, | 2670 | usize_t size, |
2668 | usize_t *nread) | 2671 | usize_t *nread, |
2672 | int is_source) | ||
2669 | { | 2673 | { |
2670 | #if EXTERNAL_COMPRESSION | 2674 | #if EXTERNAL_COMPRESSION |
2671 | if (option_decompress_inputs && ifile->flags & RD_FIRST) | 2675 | if (option_decompress_inputs && ifile->flags & RD_FIRST) |
2672 | { | 2676 | { |
2673 | ifile->flags &= ~RD_FIRST; | 2677 | ifile->flags &= ~RD_FIRST; |
2674 | 2678 | ||
2675 | return main_decompress_input_check (ifile, buf, size, nread); | 2679 | if (is_source && ifile->compressor == NULL) |
2680 | { | ||
2681 | /* Application header overrides magic number. */ | ||
2682 | } | ||
2683 | else | ||
2684 | { | ||
2685 | return main_decompress_input_check (ifile, buf, size, nread); | ||
2686 | } | ||
2676 | } | 2687 | } |
2677 | #endif | 2688 | #endif |
2678 | 2689 | ||
@@ -2755,21 +2766,17 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd, | |||
2755 | usize_t i; | 2766 | usize_t i; |
2756 | uint8_t *tmp_buf = NULL; | 2767 | uint8_t *tmp_buf = NULL; |
2757 | xoff_t source_size = 0; | 2768 | xoff_t source_size = 0; |
2758 | int seekable = 0; | ||
2759 | int source_size_known = 0; | 2769 | int source_size_known = 0; |
2760 | 2770 | ||
2761 | main_blklru_list_init (& lru_list); | 2771 | main_blklru_list_init (& lru_list); |
2762 | main_blklru_list_init (& lru_free); | 2772 | main_blklru_list_init (& lru_free); |
2763 | 2773 | ||
2764 | IF_DEBUG1 (DP(RINT "[main_set_source] %s\n", sfile->filename)); | ||
2765 | |||
2766 | /* Open it, check for seekability, set required xd3_source fields. */ | 2774 | /* Open it, check for seekability, set required xd3_source fields. */ |
2767 | if (allow_fake_source) | 2775 | if (allow_fake_source) |
2768 | { | 2776 | { |
2769 | sfile->mode = XO_READ; | 2777 | sfile->mode = XO_READ; |
2770 | sfile->realname = sfile->filename; | 2778 | sfile->realname = sfile->filename; |
2771 | sfile->nread = 0; | 2779 | sfile->nread = 0; |
2772 | seekable = 1; | ||
2773 | source_size_known = 1; | 2780 | source_size_known = 1; |
2774 | } | 2781 | } |
2775 | else | 2782 | else |
@@ -2784,7 +2791,6 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd, | |||
2784 | stat_val = main_file_stat (sfile, &source_size); | 2791 | stat_val = main_file_stat (sfile, &source_size); |
2785 | if (stat_val == 0) | 2792 | if (stat_val == 0) |
2786 | { | 2793 | { |
2787 | seekable = 1; | ||
2788 | source_size_known = 1; | 2794 | source_size_known = 1; |
2789 | 2795 | ||
2790 | if (option_verbose > 1) | 2796 | if (option_verbose > 1) |
@@ -2794,7 +2800,6 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd, | |||
2794 | } | 2800 | } |
2795 | else | 2801 | else |
2796 | { | 2802 | { |
2797 | seekable = 0; | ||
2798 | source_size_known = 0; | 2803 | source_size_known = 0; |
2799 | 2804 | ||
2800 | if (option_verbose > 1) | 2805 | if (option_verbose > 1) |
@@ -2816,6 +2821,18 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd, | |||
2816 | source->blksize = (option_srcwinsz / LRU_SIZE); | 2821 | source->blksize = (option_srcwinsz / LRU_SIZE); |
2817 | } | 2822 | } |
2818 | 2823 | ||
2824 | if (source_size_known) | ||
2825 | { | ||
2826 | IF_DEBUG2 (DP(RINT "[main_set_source] %s size %"Q"u\n", | ||
2827 | sfile->filename, source_size)); | ||
2828 | } | ||
2829 | else | ||
2830 | { | ||
2831 | IF_DEBUG2 (DP(RINT "[main_set_source] %s size not known\n", | ||
2832 | sfile->filename, source_size)); | ||
2833 | } | ||
2834 | |||
2835 | |||
2819 | source->name = sfile->filename; | 2836 | source->name = sfile->filename; |
2820 | source->ioh = sfile; | 2837 | source->ioh = sfile; |
2821 | source->curblkno = 0; | 2838 | source->curblkno = 0; |
@@ -2867,10 +2884,16 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd, | |||
2867 | main_blklru_list_push_back (& lru_free, & lru[i]); | 2884 | main_blklru_list_push_back (& lru_free, & lru[i]); |
2868 | } | 2885 | } |
2869 | 2886 | ||
2887 | if ((ret = main_getblk_func (stream, source, 0))) | ||
2888 | { | ||
2889 | XPR(NT "error reading first block: %s\n", xd3_mainerror (ret)); | ||
2890 | return ret; | ||
2891 | } | ||
2892 | |||
2870 | return 0; | 2893 | return 0; |
2871 | 2894 | ||
2872 | error: | 2895 | error: |
2873 | IF_DEBUG1 (DP(RINT "[main_set_source] error %s\n", xd3_strerror (ret))); | 2896 | IF_DEBUG2 (DP(RINT "[main_set_source] error %s\n", xd3_strerror (ret))); |
2874 | if (tmp_buf != NULL) | 2897 | if (tmp_buf != NULL) |
2875 | { | 2898 | { |
2876 | main_free (tmp_buf); | 2899 | main_free (tmp_buf); |
@@ -3020,7 +3043,8 @@ main_getblk_func (xd3_stream *stream, | |||
3020 | if ((ret = main_read_primary_input (sfile, | 3043 | if ((ret = main_read_primary_input (sfile, |
3021 | (uint8_t*) blru->blk, | 3044 | (uint8_t*) blru->blk, |
3022 | source->blksize, | 3045 | source->blksize, |
3023 | & nread))) | 3046 | & nread, |
3047 | 1 /* source */))) | ||
3024 | { | 3048 | { |
3025 | return ret; | 3049 | return ret; |
3026 | } | 3050 | } |
@@ -3039,7 +3063,8 @@ main_getblk_func (xd3_stream *stream, | |||
3039 | if ((ret = main_read_primary_input (sfile, | 3063 | if ((ret = main_read_primary_input (sfile, |
3040 | (uint8_t*) blru->blk, | 3064 | (uint8_t*) blru->blk, |
3041 | source->blksize, | 3065 | source->blksize, |
3042 | & nread))) | 3066 | & nread, |
3067 | 1 /* source */))) | ||
3043 | { | 3068 | { |
3044 | return ret; | 3069 | return ret; |
3045 | } | 3070 | } |
@@ -3049,7 +3074,7 @@ main_getblk_func (xd3_stream *stream, | |||
3049 | 3074 | ||
3050 | main_blklru_list_push_back (& lru_list, blru); | 3075 | main_blklru_list_push_back (& lru_list, blru); |
3051 | 3076 | ||
3052 | if (option_verbose > 3) | 3077 | if (option_verbose > 2) |
3053 | { | 3078 | { |
3054 | if (blru->blkno != (xoff_t)-1) | 3079 | if (blru->blkno != (xoff_t)-1) |
3055 | { | 3080 | { |
@@ -3070,6 +3095,9 @@ main_getblk_func (xd3_stream *stream, | |||
3070 | source->onblk = nread; | 3095 | source->onblk = nread; |
3071 | blru->size = nread; | 3096 | blru->size = nread; |
3072 | 3097 | ||
3098 | IF_DEBUG1 (DP(RINT "[main_getblk] blkno %"Q"u onblk %u\n", | ||
3099 | blkno, nread)); | ||
3100 | |||
3073 | return 0; | 3101 | return 0; |
3074 | } | 3102 | } |
3075 | 3103 | ||
@@ -3255,7 +3283,7 @@ main_input (xd3_cmd cmd, | |||
3255 | { | 3283 | { |
3256 | /* When not decoding, set source now. The decoder delays this | 3284 | /* When not decoding, set source now. The decoder delays this |
3257 | * step until XD3_GOTHEADER. */ | 3285 | * step until XD3_GOTHEADER. */ |
3258 | if (sfile->filename != NULL) | 3286 | if (sfile && sfile->filename != NULL) |
3259 | { | 3287 | { |
3260 | if ((ret = main_set_source (& stream, cmd, sfile, & source))) | 3288 | if ((ret = main_set_source (& stream, cmd, sfile, & source))) |
3261 | { | 3289 | { |
@@ -3265,6 +3293,19 @@ main_input (xd3_cmd cmd, | |||
3265 | XD3_ASSERT(stream.src != NULL); | 3293 | XD3_ASSERT(stream.src != NULL); |
3266 | } | 3294 | } |
3267 | } | 3295 | } |
3296 | |||
3297 | if (cmd == CMD_PRINTHDR || | ||
3298 | cmd == CMD_PRINTHDRS || | ||
3299 | cmd == CMD_PRINTDELTA || | ||
3300 | cmd == CMD_RECODE) | ||
3301 | { | ||
3302 | if (sfile->filename == NULL) | ||
3303 | { | ||
3304 | allow_fake_source = 1; | ||
3305 | sfile->filename = "<placeholder>"; | ||
3306 | main_set_source (& stream, cmd, sfile, & source); | ||
3307 | } | ||
3308 | } | ||
3268 | 3309 | ||
3269 | /* This times each window. */ | 3310 | /* This times each window. */ |
3270 | get_millisecs_since (); | 3311 | get_millisecs_since (); |
@@ -3283,7 +3324,8 @@ main_input (xd3_cmd cmd, | |||
3283 | try_read = (usize_t) min ((xoff_t) config.winsize, input_remain); | 3324 | try_read = (usize_t) min ((xoff_t) config.winsize, input_remain); |
3284 | 3325 | ||
3285 | if ((ret = main_read_primary_input (ifile, main_bdata, | 3326 | if ((ret = main_read_primary_input (ifile, main_bdata, |
3286 | try_read, & nread))) | 3327 | try_read, & nread, |
3328 | 0 /* !source */))) | ||
3287 | { | 3329 | { |
3288 | return EXIT_FAILURE; | 3330 | return EXIT_FAILURE; |
3289 | } | 3331 | } |
@@ -3914,7 +3956,7 @@ main (int argc, char **argv) | |||
3914 | if (option_verbose > 0) | 3956 | if (option_verbose > 0) |
3915 | { | 3957 | { |
3916 | XPR(NT "warning: -D option ignored, " | 3958 | XPR(NT "warning: -D option ignored, " |
3917 | "external compression support was not compiled\n"); | 3959 | "external compression support was not compiled\n"); |
3918 | } | 3960 | } |
3919 | #else | 3961 | #else |
3920 | option_decompress_inputs = 0; | 3962 | option_decompress_inputs = 0; |
@@ -3925,7 +3967,7 @@ main (int argc, char **argv) | |||
3925 | if (option_verbose > 0) | 3967 | if (option_verbose > 0) |
3926 | { | 3968 | { |
3927 | XPR(NT "warning: -R option ignored, " | 3969 | XPR(NT "warning: -R option ignored, " |
3928 | "external compression support was not compiled\n"); | 3970 | "external compression support was not compiled\n"); |
3929 | } | 3971 | } |
3930 | #else | 3972 | #else |
3931 | option_recompress_outputs = 0; | 3973 | option_recompress_outputs = 0; |
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index d60bf2d..21d7283 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h | |||
@@ -144,6 +144,7 @@ static int do_cmd (xd3_stream *stream, const char *buf) | |||
144 | if (WIFEXITED (ret)) | 144 | if (WIFEXITED (ret)) |
145 | { | 145 | { |
146 | stream->msg = "command exited non-zero"; | 146 | stream->msg = "command exited non-zero"; |
147 | IF_DEBUG1 (DP(RINT "command was: %s\n", buf)); | ||
147 | } | 148 | } |
148 | else | 149 | else |
149 | { | 150 | { |
@@ -1894,15 +1895,11 @@ test_recode_command2 (xd3_stream *stream, int has_source, | |||
1894 | 1895 | ||
1895 | /* Check recode changes. */ | 1896 | /* Check recode changes. */ |
1896 | 1897 | ||
1897 | /* TODO! This test is broken! */ | ||
1898 | if ((ret = check_vcdiff_header (stream, | 1898 | if ((ret = check_vcdiff_header (stream, |
1899 | TEST_COPY_FILE, | 1899 | TEST_COPY_FILE, |
1900 | "VCDIFF window indicator", | 1900 | "VCDIFF window indicator", |
1901 | "VCD_SOURCE", | 1901 | "VCD_SOURCE", |
1902 | has_source))) | 1902 | has_source))) { return ret; } |
1903 | { | ||
1904 | DP(RINT "TEST IS BROKEN: %s\n", xd3_strerror (ret)); | ||
1905 | } | ||
1906 | 1903 | ||
1907 | if ((ret = check_vcdiff_header (stream, | 1904 | if ((ret = check_vcdiff_header (stream, |
1908 | TEST_COPY_FILE, | 1905 | TEST_COPY_FILE, |
@@ -2172,35 +2169,35 @@ test_source_decompression (xd3_stream *stream, int ignore) | |||
2172 | 2169 | ||
2173 | /* Now the two identical files are compressed. Delta-encode the target, | 2170 | /* Now the two identical files are compressed. Delta-encode the target, |
2174 | * with decompression. */ | 2171 | * with decompression. */ |
2175 | sprintf (buf, "%s -eq -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); | 2172 | sprintf (buf, "%s -v -eq -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); |
2176 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2173 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2177 | 2174 | ||
2178 | /* Decode the delta file with recompression disabled, should get an | 2175 | /* Decode the delta file with recompression disabled, should get an |
2179 | * uncompressed file out. */ | 2176 | * uncompressed file out. */ |
2180 | sprintf (buf, "%s -dq -R -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); | 2177 | sprintf (buf, "%s -v -dq -R -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); |
2181 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2178 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2182 | if ((ret = compare_files (stream, TEST_COPY_FILE, TEST_RECON_FILE))) { return ret; } | 2179 | if ((ret = compare_files (stream, TEST_COPY_FILE, TEST_RECON_FILE))) { return ret; } |
2183 | 2180 | ||
2184 | /* Decode the delta file with recompression, should get a compressed file | 2181 | /* Decode the delta file with recompression, should get a compressed file |
2185 | * out. But we can't compare compressed files directly. */ | 2182 | * out. But we can't compare compressed files directly. */ |
2186 | sprintf (buf, "%s -dqf -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); | 2183 | sprintf (buf, "%s -v -dqf -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); |
2187 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2184 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2188 | sprintf (buf, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options, TEST_RECON_FILE, TEST_RECON2_FILE); | 2185 | sprintf (buf, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options, TEST_RECON_FILE, TEST_RECON2_FILE); |
2189 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2186 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2190 | if ((ret = compare_files (stream, TEST_COPY_FILE, TEST_RECON2_FILE))) { return ret; } | 2187 | if ((ret = compare_files (stream, TEST_COPY_FILE, TEST_RECON2_FILE))) { return ret; } |
2191 | 2188 | ||
2192 | /* Encode with decompression disabled */ | 2189 | /* Encode with decompression disabled */ |
2193 | sprintf (buf, "%s -feqD -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); | 2190 | sprintf (buf, "%s -v -feqD -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); |
2194 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2191 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2195 | 2192 | ||
2196 | /* Decode the delta file with recompression enabled, it doesn't matter, | 2193 | /* Decode the delta file with recompression enabled, it doesn't matter, |
2197 | * should get the compressed file out. */ | 2194 | * should get the compressed file out. */ |
2198 | sprintf (buf, "%s -fdq -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); | 2195 | sprintf (buf, "%s -v -fdq -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); |
2199 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2196 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2200 | if ((ret = compare_files (stream, TEST_TARGET_FILE, TEST_RECON_FILE))) { return ret; } | 2197 | if ((ret = compare_files (stream, TEST_TARGET_FILE, TEST_RECON_FILE))) { return ret; } |
2201 | 2198 | ||
2202 | /* Try again with recompression disabled, it doesn't make a difference. */ | 2199 | /* Try again with recompression disabled, it doesn't make a difference. */ |
2203 | sprintf (buf, "%s -fqRd -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); | 2200 | sprintf (buf, "%s -v -fqRd -s%s %s %s", program_name, TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); |
2204 | if ((ret = do_cmd (stream, buf))) { return ret; } | 2201 | if ((ret = do_cmd (stream, buf))) { return ret; } |
2205 | if ((ret = compare_files (stream, TEST_TARGET_FILE, TEST_RECON_FILE))) { return ret; } | 2202 | if ((ret = compare_files (stream, TEST_TARGET_FILE, TEST_RECON_FILE))) { return ret; } |
2206 | test_cleanup(); | 2203 | test_cleanup(); |
@@ -2813,14 +2810,13 @@ xd3_selftest (void) | |||
2813 | DO_TEST (stdout_behavior, 0, 0); | 2810 | DO_TEST (stdout_behavior, 0, 0); |
2814 | DO_TEST (no_output, 0, 0); | 2811 | DO_TEST (no_output, 0, 0); |
2815 | DO_TEST (command_line_arguments, 0, 0); | 2812 | DO_TEST (command_line_arguments, 0, 0); |
2816 | // TODO BROKEN!! | ||
2817 | //DO_TEST (recode_command, 0, 0); | ||
2818 | 2813 | ||
2819 | #if EXTERNAL_COMPRESSION | 2814 | #if EXTERNAL_COMPRESSION |
2820 | DO_TEST (source_decompression, 0, 0); | 2815 | DO_TEST (source_decompression, 0, 0); |
2821 | DO_TEST (externally_compressed_io, 0, 0); | 2816 | DO_TEST (externally_compressed_io, 0, 0); |
2822 | #endif | 2817 | #endif |
2823 | 2818 | ||
2819 | DO_TEST (recode_command, 0, 0); | ||
2824 | #endif /* WIN32 */ | 2820 | #endif /* WIN32 */ |
2825 | 2821 | ||
2826 | IF_DJW (DO_TEST (secondary_huff, 0, DJW_MAX_GROUPS)); | 2822 | IF_DJW (DO_TEST (secondary_huff, 0, DJW_MAX_GROUPS)); |
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 515b083..0bbf338 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -2516,7 +2516,6 @@ xd3_getblk (xd3_stream *stream, xoff_t blkno) | |||
2516 | } | 2516 | } |
2517 | 2517 | ||
2518 | ret = stream->getblk (stream, source, blkno); | 2518 | ret = stream->getblk (stream, source, blkno); |
2519 | IF_DEBUG1 (DP(RINT "[getblk] func ret %d\n", ret)); | ||
2520 | if (ret != 0) | 2519 | if (ret != 0) |
2521 | { | 2520 | { |
2522 | stream->msg = "getblk failed"; | 2521 | stream->msg = "getblk failed"; |
@@ -2541,7 +2540,7 @@ xd3_getblk (xd3_stream *stream, xoff_t blkno) | |||
2541 | { | 2540 | { |
2542 | if (!source->eof_known) | 2541 | if (!source->eof_known) |
2543 | { | 2542 | { |
2544 | IF_DEBUG1 (DP(RINT "[getblk] eof block has %d bytes; source length known %"Q"u\n", | 2543 | IF_DEBUG2 (DP(RINT "[getblk] eof block has %d bytes; source length known %"Q"u\n", |
2545 | xd3_bytes_on_srcblk (source, blkno), | 2544 | xd3_bytes_on_srcblk (source, blkno), |
2546 | xd3_source_eof (source))); | 2545 | xd3_source_eof (source))); |
2547 | source->eof_known = 1; | 2546 | source->eof_known = 1; |
@@ -2552,7 +2551,7 @@ xd3_getblk (xd3_stream *stream, xoff_t blkno) | |||
2552 | } | 2551 | } |
2553 | 2552 | ||
2554 | XD3_ASSERT (source->curblk != NULL); | 2553 | XD3_ASSERT (source->curblk != NULL); |
2555 | IF_DEBUG1 (DP(RINT "[getblk] read source block %"Q"u onblk %u blksize %u\n", | 2554 | IF_DEBUG2 (DP(RINT "[getblk] read source block %"Q"u onblk %u blksize %u\n", |
2556 | blkno, source->onblk, source->blksize)); | 2555 | blkno, source->onblk, source->blksize)); |
2557 | 2556 | ||
2558 | if (blkno == source->max_blkno) | 2557 | if (blkno == source->max_blkno) |
@@ -3773,7 +3772,7 @@ xd3_encode_input (xd3_stream *stream) | |||
3773 | return XD3_WINSTART; | 3772 | return XD3_WINSTART; |
3774 | 3773 | ||
3775 | case ENC_SEARCH: | 3774 | case ENC_SEARCH: |
3776 | IF_DEBUG1 (DP(RINT "[SEARCH] match_state %d avail_in %u %s\n", | 3775 | IF_DEBUG2 (DP(RINT "[SEARCH] match_state %d avail_in %u %s\n", |
3777 | stream->match_state, stream->avail_in, stream->src ? "source" : "no source")); | 3776 | stream->match_state, stream->avail_in, stream->src ? "source" : "no source")); |
3778 | 3777 | ||
3779 | /* Reentrant matching. */ | 3778 | /* Reentrant matching. */ |
@@ -4080,7 +4079,7 @@ xd3_process_memory (int is_encode, | |||
4080 | exit: | 4079 | exit: |
4081 | if (ret != 0) | 4080 | if (ret != 0) |
4082 | { | 4081 | { |
4083 | IF_DEBUG1 (DP(RINT "process_memory: %d: %s\n", ret, stream.msg)); | 4082 | IF_DEBUG2 (DP(RINT "process_memory: %d: %s\n", ret, stream.msg)); |
4084 | } | 4083 | } |
4085 | xd3_free_stream(&stream); | 4084 | xd3_free_stream(&stream); |
4086 | return ret; | 4085 | return ret; |
@@ -4335,7 +4334,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
4335 | * TestNonBlockingProgress test! */ | 4334 | * TestNonBlockingProgress test! */ |
4336 | if (srcpos != 0 && srcpos == stream->match_last_srcpos) | 4335 | if (srcpos != 0 && srcpos == stream->match_last_srcpos) |
4337 | { | 4336 | { |
4338 | IF_DEBUG1(DP(RINT "[match_setup] looping failure\n")); | 4337 | IF_DEBUG2(DP(RINT "[match_setup] looping failure\n")); |
4339 | goto bad; | 4338 | goto bad; |
4340 | } | 4339 | } |
4341 | 4340 | ||
@@ -4389,7 +4388,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
4389 | } | 4388 | } |
4390 | } | 4389 | } |
4391 | 4390 | ||
4392 | IF_DEBUG1(DP(RINT "[match_setup] srcpos %"Q"u unrestricted back %u fwd %u\n", | 4391 | IF_DEBUG2(DP(RINT "[match_setup] srcpos %"Q"u unrestricted back %u fwd %u\n", |
4393 | srcpos, | 4392 | srcpos, |
4394 | stream->match_maxback, | 4393 | stream->match_maxback, |
4395 | stream->match_maxfwd)); | 4394 | stream->match_maxfwd)); |
@@ -4402,7 +4401,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
4402 | /* Restricted case: fail if the srcpos lies outside the source window */ | 4401 | /* Restricted case: fail if the srcpos lies outside the source window */ |
4403 | if ((srcpos < src->srcbase) || (srcpos > (src->srcbase + (xoff_t) src->srclen))) | 4402 | if ((srcpos < src->srcbase) || (srcpos > (src->srcbase + (xoff_t) src->srclen))) |
4404 | { | 4403 | { |
4405 | IF_DEBUG1(DP(RINT "[match_setup] restricted source window failure\n")); | 4404 | IF_DEBUG2(DP(RINT "[match_setup] restricted source window failure\n")); |
4406 | goto bad; | 4405 | goto bad; |
4407 | } | 4406 | } |
4408 | else | 4407 | else |
@@ -4421,7 +4420,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
4421 | stream->match_maxfwd = srcavail; | 4420 | stream->match_maxfwd = srcavail; |
4422 | } | 4421 | } |
4423 | 4422 | ||
4424 | IF_DEBUG1(DP(RINT "[match_setup] srcpos %"Q"u restricted back %u fwd %u\n", | 4423 | IF_DEBUG2(DP(RINT "[match_setup] srcpos %"Q"u restricted back %u fwd %u\n", |
4425 | srcpos, | 4424 | srcpos, |
4426 | stream->match_maxback, | 4425 | stream->match_maxback, |
4427 | stream->match_maxfwd)); | 4426 | stream->match_maxfwd)); |
@@ -4514,7 +4513,7 @@ xd3_source_extend_match (xd3_stream *stream) | |||
4514 | usize_t tryrem; /* tryrem is the number of matchable bytes */ | 4513 | usize_t tryrem; /* tryrem is the number of matchable bytes */ |
4515 | usize_t matched; | 4514 | usize_t matched; |
4516 | 4515 | ||
4517 | IF_DEBUG1(DP(RINT "[extend match] srcpos %"Q"u\n", | 4516 | IF_DEBUG2(DP(RINT "[extend match] srcpos %"Q"u\n", |
4518 | stream->match_srcpos)); | 4517 | stream->match_srcpos)); |
4519 | 4518 | ||
4520 | XD3_ASSERT (src != NULL); | 4519 | XD3_ASSERT (src != NULL); |