summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjosh.macdonald@gmail.com <josh.macdonald@gmail.com@a3eca27d-f21b-0410-9b4a-6511e771f64e>2012-06-27 09:32:08 +0000
committerjosh.macdonald@gmail.com <josh.macdonald@gmail.com@a3eca27d-f21b-0410-9b4a-6511e771f64e>2012-06-27 09:32:08 +0000
commitcfb1068766390147371c14211da6d8cfac47db5c (patch)
treef0c678831f846758d0daf672a54565ed0853599a
parentdf30203f7af37f3a81033300f4a4790cd330d784 (diff)
Fix a few more string shenanigans. Basic tests in WIN32, builds in cygwin too.
Comments out Python/Swig, will make them conditional later (I can't figure this out).
-rw-r--r--xdelta3/Makefile.am20
-rw-r--r--xdelta3/config.h.in56
-rw-r--r--xdelta3/configure.ac11
-rw-r--r--xdelta3/xdelta3-internal.h8
-rw-r--r--xdelta3/xdelta3-main.h4
-rw-r--r--xdelta3/xdelta3-test.h98
6 files changed, 131 insertions, 66 deletions
diff --git a/xdelta3/Makefile.am b/xdelta3/Makefile.am
index 184c0c7..d91572a 100644
--- a/xdelta3/Makefile.am
+++ b/xdelta3/Makefile.am
@@ -86,17 +86,21 @@ EXTRA_DIST = \
86 xdelta3.wxs \ 86 xdelta3.wxs \
87 xdelta3_pywrap.c 87 xdelta3_pywrap.c
88 88
89BUILT_SOURCES = xdelta3_pywrap.c xdelta3.py 89#PYFILES = xdelta3_pywrap.c xdelta3.py
90#XDELTA3PY = xdelta3.py
91#XDELTA3PYLIB = xdelta3.la
90 92
91xdelta3_pywrap.c xdelta3.py : xdelta3.i 93#BUILT_SOURCES = $(PYFILES)
92 $(SWIG) -python -o xdelta3_pywrap.c xdelta3.i 94
95#xdelta3_pywrap.c xdelta3.py : xdelta3.i
96# $(SWIG) -python -o xdelta3_pywrap.c xdelta3.i
93 97
94# OS X for some reason requires: 98# OS X for some reason requires:
95# pythondir = $(PYTHON_SITE_PKG) 99# pythondir = $(PYTHON_SITE_PKG)
96# pyexecdir = $(PYTHON_SITE_PKG) 100# pyexecdir = $(PYTHON_SITE_PKG)
97 101
98python_PYTHON = xdelta3.py 102#python_PYTHON = $(XDELTA3PY)
99pyexec_LTLIBRARIES = _xdelta3.la 103#pyexec_LTLIBRARIES = $(XDELTA3PYLIB)
100_xdelta3_la_SOURCES = $(srcdir)/xdelta3_pywrap.c $(xdelta3_SOURCES) 104#_xdelta3_la_SOURCES = $(srcdir)/xdelta3_pywrap.c $(xdelta3_SOURCES)
101_xdelta3_la_CFLAGS = $(common_CFLAGS) -DNOT_MAIN=1 $(PYTHON_CPPFLAGS) 105#_xdelta3_la_CFLAGS = $(common_CFLAGS) -DNOT_MAIN=1 $(PYTHON_CPPFLAGS)
102_xdelta3_la_LDFLAGS = -module 106#_xdelta3_la_LDFLAGS = -module
diff --git a/xdelta3/config.h.in b/xdelta3/config.h.in
new file mode 100644
index 0000000..19266b3
--- /dev/null
+++ b/xdelta3/config.h.in
@@ -0,0 +1,56 @@
1/* config.h.in. Generated from configure.ac by autoheader. */
2
3/* Define to 1 if you have the <dlfcn.h> header file. */
4#undef HAVE_DLFCN_H
5
6/* Define to 1 if you have the <inttypes.h> header file. */
7#undef HAVE_INTTYPES_H
8
9/* Define to 1 if you have the <memory.h> header file. */
10#undef HAVE_MEMORY_H
11
12/* Define to 1 if you have the <stdint.h> header file. */
13#undef HAVE_STDINT_H
14
15/* Define to 1 if you have the <stdlib.h> header file. */
16#undef HAVE_STDLIB_H
17
18/* Define to 1 if you have the <strings.h> header file. */
19#undef HAVE_STRINGS_H
20
21/* Define to 1 if you have the <string.h> header file. */
22#undef HAVE_STRING_H
23
24/* Define to 1 if you have the <sys/stat.h> header file. */
25#undef HAVE_SYS_STAT_H
26
27/* Define to 1 if you have the <sys/types.h> header file. */
28#undef HAVE_SYS_TYPES_H
29
30/* Define to 1 if you have the <unistd.h> header file. */
31#undef HAVE_UNISTD_H
32
33/* Define to the sub-directory in which libtool stores uninstalled libraries.
34 */
35#undef LT_OBJDIR
36
37/* Define to the address where bug reports for this package should be sent. */
38#undef PACKAGE_BUGREPORT
39
40/* Define to the full name of this package. */
41#undef PACKAGE_NAME
42
43/* Define to the full name and version of this package. */
44#undef PACKAGE_STRING
45
46/* Define to the one symbol short name of this package. */
47#undef PACKAGE_TARNAME
48
49/* Define to the home page for this package. */
50#undef PACKAGE_URL
51
52/* Define to the version of this package. */
53#undef PACKAGE_VERSION
54
55/* Define to 1 if you have the ANSI C header files. */
56#undef STDC_HEADERS
diff --git a/xdelta3/configure.ac b/xdelta3/configure.ac
index ae1f765..c537f41 100644
--- a/xdelta3/configure.ac
+++ b/xdelta3/configure.ac
@@ -3,14 +3,15 @@ AC_INIT([Xdelta3], [3.0.1], [josh.macdonald@gmail.com],
3AC_PREREQ([2.68]) 3AC_PREREQ([2.68])
4AC_CONFIG_MACRO_DIR([m4]) 4AC_CONFIG_MACRO_DIR([m4])
5LT_INIT 5LT_INIT
6AM_INIT_AUTOMAKE([1.11 no-define foreign tar-ustar]) 6AM_INIT_AUTOMAKE([1.9 no-define foreign tar-ustar])
7AC_DISABLE_STATIC 7AC_DISABLE_STATIC
8AC_PROG_CC 8AC_PROG_CC
9AC_PROG_CXX 9AC_PROG_CXX
10AM_PATH_PYTHON([]) 10#AM_PATH_PYTHON(,, [:])
11AX_PYTHON_DEVEL([]) 11AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
12AX_PKG_SWIG([]) 12#AX_PYTHON_DEVEL()
13AX_SWIG_PYTHON 13#AX_PKG_SWIG(2.0.0,,)
14#AX_SWIG_PYTHON
14AC_CONFIG_HEADERS([config.h]) 15AC_CONFIG_HEADERS([config.h])
15AC_CONFIG_FILES([Makefile]) 16AC_CONFIG_FILES([Makefile])
16AC_OUTPUT 17AC_OUTPUT
diff --git a/xdelta3/xdelta3-internal.h b/xdelta3/xdelta3-internal.h
index 871bcfb..9a728ff 100644
--- a/xdelta3/xdelta3-internal.h
+++ b/xdelta3/xdelta3-internal.h
@@ -19,6 +19,7 @@
19#define XDELTA3_INTERNAL_H__ 19#define XDELTA3_INTERNAL_H__
20 20
21#include <stdio.h> 21#include <stdio.h>
22#include <stdlib.h>
22#include <stdarg.h> 23#include <stdarg.h>
23 24
24#ifndef _XDELTA3_INTERNAL_H_ 25#ifndef _XDELTA3_INTERNAL_H_
@@ -97,11 +98,14 @@ struct _main_file
97#ifdef _WIN32 98#ifdef _WIN32
98#define vsnprintf_func(str,size,fmt,args) \ 99#define vsnprintf_func(str,size,fmt,args) \
99 _vsnprintf_s(str,size,size-1,fmt,args) 100 _vsnprintf_s(str,size,size-1,fmt,args)
101#define snprintf_func(str,size,fmt,...) \
102 _snprintf_s(str,size,size-1,fmt,__VA_ARGS__)
100#else 103#else
101#define vsnprintf_func vsnprintf 104#define vsnprintf_func vsnprintf
102#define short_sprintf(sb,fmt,...) \ 105#define snprintf_func snprintf
103 snprintf((sb).buf,sizeof((sb).buf),fmt,__VA_ARGS__)
104#endif 106#endif
107#define short_sprintf(sb,fmt,...) \
108 snprintf_func((sb).buf,sizeof((sb).buf),fmt,__VA_ARGS__)
105 109
106/* Type used for short snprintf calls. */ 110/* Type used for short snprintf calls. */
107typedef struct { 111typedef struct {
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 6ba18b7..eac6ca5 100644
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -2691,11 +2691,11 @@ main_set_appheader (xd3_stream *stream, main_file *input, main_file *sfile)
2691 2691
2692 if (sfile->filename == NULL) 2692 if (sfile->filename == NULL)
2693 { 2693 {
2694 snprintf ((char*)appheader_used, len, "%s/%s", iname, icomp); 2694 snprintf_func ((char*)appheader_used, len, "%s/%s", iname, icomp);
2695 } 2695 }
2696 else 2696 else
2697 { 2697 {
2698 snprintf ((char*)appheader_used, len, "%s/%s/%s/%s", 2698 snprintf_func ((char*)appheader_used, len, "%s/%s/%s/%s",
2699 iname, icomp, sname, scomp); 2699 iname, icomp, sname, scomp);
2700 } 2700 }
2701 } 2701 }
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h
index 7cb9419..63b7978 100644
--- a/xdelta3/xdelta3-test.h
+++ b/xdelta3/xdelta3-test.h
@@ -225,7 +225,7 @@ test_unlink (char* file)
225 { 225 {
226 break; 226 break;
227 } 227 }
228 snprintf (buf, sizeof(buf), "rm -f %s", file); 228 snprintf_func (buf, sizeof(buf), "rm -f %s", file);
229 system (buf); 229 system (buf);
230 } 230 }
231} 231}
@@ -248,13 +248,13 @@ int test_setup (void)
248{ 248{
249 static int x = 0; 249 static int x = 0;
250 x++; 250 x++;
251 snprintf (TEST_TARGET_FILE, TESTFILESIZE, "/tmp/xdtest.target.%d", x); 251 snprintf_func (TEST_TARGET_FILE, TESTFILESIZE, "/tmp/xdtest.target.%d", x);
252 snprintf (TEST_SOURCE_FILE, TESTFILESIZE, "/tmp/xdtest.source.%d", x); 252 snprintf_func (TEST_SOURCE_FILE, TESTFILESIZE, "/tmp/xdtest.source.%d", x);
253 snprintf (TEST_DELTA_FILE, TESTFILESIZE, "/tmp/xdtest.delta.%d", x); 253 snprintf_func (TEST_DELTA_FILE, TESTFILESIZE, "/tmp/xdtest.delta.%d", x);
254 snprintf (TEST_RECON_FILE, TESTFILESIZE, "/tmp/xdtest.recon.%d", x); 254 snprintf_func (TEST_RECON_FILE, TESTFILESIZE, "/tmp/xdtest.recon.%d", x);
255 snprintf (TEST_RECON2_FILE, TESTFILESIZE, "/tmp/xdtest.recon2.%d", x); 255 snprintf_func (TEST_RECON2_FILE, TESTFILESIZE, "/tmp/xdtest.recon2.%d", x);
256 snprintf (TEST_COPY_FILE, TESTFILESIZE, "/tmp/xdtest.copy.%d", x); 256 snprintf_func (TEST_COPY_FILE, TESTFILESIZE, "/tmp/xdtest.copy.%d", x);
257 snprintf (TEST_NOPERM_FILE, TESTFILESIZE, "/tmp/xdtest.noperm.%d", x); 257 snprintf_func (TEST_NOPERM_FILE, TESTFILESIZE, "/tmp/xdtest.noperm.%d", x);
258 test_cleanup(); 258 test_cleanup();
259 return 0; 259 return 0;
260} 260}
@@ -413,9 +413,9 @@ compare_files (const char* tgt, const char *rec)
413 for (i = 0; i < oc; i += 1) 413 for (i = 0; i < oc; i += 1)
414 { 414 {
415 if (obuf[i] != rbuf[i]) 415 if (obuf[i] != rbuf[i])
416 { 416 {
417 XPR(NT "byte %lu (read %lu @ %"Q"u) %d != %d\n", 417 XPR(NT "byte %u (read %u @ %"Q"u) %d != %d\n",
418 i, oc, offset, obuf[i], rbuf[i]); 418 (int)i, (int)oc, offset, obuf[i], rbuf[i]);
419 diffs++; 419 diffs++;
420 return XD3_INTERNAL; 420 return XD3_INTERNAL;
421 } 421 }
@@ -439,7 +439,7 @@ test_save_copy (const char *origname)
439 char buf[TESTBUFSIZE]; 439 char buf[TESTBUFSIZE];
440 int ret; 440 int ret;
441 441
442 snprintf (buf, TESTBUFSIZE, "cp -f %s %s", origname, TEST_COPY_FILE); 442 snprintf_func (buf, TESTBUFSIZE, "cp -f %s %s", origname, TEST_COPY_FILE);
443 443
444 if ((ret = system (buf)) != 0) 444 if ((ret = system (buf)) != 0)
445 { 445 {
@@ -982,7 +982,7 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures)
982 { 982 {
983 char buf[TESTBUFSIZE]; 983 char buf[TESTBUFSIZE];
984 FILE *f; 984 FILE *f;
985 snprintf (buf, TESTBUFSIZE, "test_text"); 985 snprintf_func (buf, TESTBUFSIZE, "test_text");
986 f = fopen (buf, "w"); 986 f = fopen (buf, "w");
987 fwrite (test_text,1,sizeof (test_text),f); 987 fwrite (test_text,1,sizeof (test_text),f);
988 fclose (f); 988 fclose (f);
@@ -991,7 +991,7 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures)
991 do { \ 991 do { \
992 char buf[TESTBUFSIZE]; \ 992 char buf[TESTBUFSIZE]; \
993 FILE *f; \ 993 FILE *f; \
994 snprintf (buf, TESTBUFSIZE, "test_text.xz.%d", non_failures); \ 994 snprintf_func (buf, TESTBUFSIZE, "test_text.xz.%d", non_failures); \
995 f = fopen (buf, "w"); \ 995 f = fopen (buf, "w"); \
996 fwrite (encoded,1,encoded_size,f); \ 996 fwrite (encoded,1,encoded_size,f); \
997 fclose (f); \ 997 fclose (f); \
@@ -1734,9 +1734,9 @@ test_command_line_arguments (xd3_stream *stream, int ignore)
1734 test_setup (); 1734 test_setup ();
1735 if ((ret = test_make_inputs (stream, NULL, & tsize))) { return ret; } 1735 if ((ret = test_make_inputs (stream, NULL, & tsize))) { return ret; }
1736 1736
1737 snprintf (ecmd, TESTBUFSIZE, cmdpairs[2*i], program_name, 1737 snprintf_func (ecmd, TESTBUFSIZE, cmdpairs[2*i], program_name,
1738 test_softcfg_str, TEST_TARGET_FILE, TEST_DELTA_FILE); 1738 test_softcfg_str, TEST_TARGET_FILE, TEST_DELTA_FILE);
1739 snprintf (dcmd, TESTBUFSIZE, cmdpairs[2*i+1], program_name, 1739 snprintf_func (dcmd, TESTBUFSIZE, cmdpairs[2*i+1], program_name,
1740 TEST_DELTA_FILE, TEST_RECON_FILE); 1740 TEST_DELTA_FILE, TEST_RECON_FILE);
1741 1741
1742 /* Encode and decode. */ 1742 /* Encode and decode. */
@@ -1812,7 +1812,7 @@ check_vcdiff_header (xd3_stream *stream,
1812 int ret; 1812 int ret;
1813 char vcmd[TESTBUFSIZE], gcmd[TESTBUFSIZE]; 1813 char vcmd[TESTBUFSIZE], gcmd[TESTBUFSIZE];
1814 1814
1815 snprintf (vcmd, TESTBUFSIZE, "%s printhdr -f %s %s", 1815 snprintf_func (vcmd, TESTBUFSIZE, "%s printhdr -f %s %s",
1816 program_name, input, TEST_RECON2_FILE); 1816 program_name, input, TEST_RECON2_FILE);
1817 1817
1818 if ((ret = system (vcmd)) != 0) 1818 if ((ret = system (vcmd)) != 0)
@@ -1822,7 +1822,7 @@ check_vcdiff_header (xd3_stream *stream,
1822 return XD3_INTERNAL; 1822 return XD3_INTERNAL;
1823 } 1823 }
1824 1824
1825 snprintf (gcmd, TESTBUFSIZE, "grep \"%s.*%s.*\" %s > /dev/null", 1825 snprintf_func (gcmd, TESTBUFSIZE, "grep \"%s.*%s.*\" %s > /dev/null",
1826 line_start, matches, TEST_RECON2_FILE); 1826 line_start, matches, TEST_RECON2_FILE);
1827 1827
1828 if (yes_or_no) 1828 if (yes_or_no)
@@ -1873,7 +1873,7 @@ test_recode_command2 (xd3_stream *stream, int has_source,
1873 } 1873 }
1874 1874
1875 /* First encode */ 1875 /* First encode */
1876 snprintf (ecmd, TESTBUFSIZE, "%s %s -f %s %s %s %s %s %s %s", 1876 snprintf_func (ecmd, TESTBUFSIZE, "%s %s -f %s %s %s %s %s %s %s",
1877 program_name, test_softcfg_str, 1877 program_name, test_softcfg_str,
1878 has_adler32 ? "" : "-n ", 1878 has_adler32 ? "" : "-n ",
1879 has_apphead ? "-A=encode_apphead " : "-A= ", 1879 has_apphead ? "-A=encode_apphead " : "-A= ",
@@ -1891,7 +1891,7 @@ test_recode_command2 (xd3_stream *stream, int has_source,
1891 } 1891 }
1892 1892
1893 /* Now recode */ 1893 /* Now recode */
1894 snprintf (recmd, TESTBUFSIZE, 1894 snprintf_func (recmd, TESTBUFSIZE,
1895 "%s recode %s -f %s %s %s %s %s", program_name, test_softcfg_str, 1895 "%s recode %s -f %s %s %s %s %s", program_name, test_softcfg_str,
1896 recoded_adler32 ? "" : "-n ", 1896 recoded_adler32 ? "" : "-n ",
1897 !change_apphead ? "" : 1897 !change_apphead ? "" :
@@ -1974,7 +1974,7 @@ test_recode_command2 (xd3_stream *stream, int has_source,
1974 } 1974 }
1975 1975
1976 /* Now decode */ 1976 /* Now decode */
1977 snprintf (dcmd, TESTBUFSIZE, "%s -fd %s %s %s %s ", program_name, 1977 snprintf_func (dcmd, TESTBUFSIZE, "%s -fd %s %s %s %s ", program_name,
1978 has_source ? "-s " : "", 1978 has_source ? "-s " : "",
1979 has_source ? TEST_SOURCE_FILE : "", 1979 has_source ? TEST_SOURCE_FILE : "",
1980 TEST_COPY_FILE, 1980 TEST_COPY_FILE,
@@ -2051,7 +2051,7 @@ test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf,
2051 2051
2052 if (do_ext_recomp) 2052 if (do_ext_recomp)
2053 { 2053 {
2054 snprintf (decomp_buf, TESTBUFSIZE, 2054 snprintf_func (decomp_buf, TESTBUFSIZE,
2055 " | %s %s", ext->decomp_cmdname, ext->decomp_options); 2055 " | %s %s", ext->decomp_cmdname, ext->decomp_options);
2056 } 2056 }
2057 else 2057 else
@@ -2059,7 +2059,7 @@ test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf,
2059 decomp_buf[0] = 0; 2059 decomp_buf[0] = 0;
2060 } 2060 }
2061 2061
2062 snprintf (buf, TESTBUFSIZE, "%s %s < %s | %s %s | %s %s%s > %s", 2062 snprintf_func (buf, TESTBUFSIZE, "%s %s < %s | %s %s | %s %s%s > %s",
2063 ext->recomp_cmdname, ext->recomp_options, 2063 ext->recomp_cmdname, ext->recomp_options,
2064 TEST_TARGET_FILE, 2064 TEST_TARGET_FILE,
2065 program_name, comp_options, 2065 program_name, comp_options,
@@ -2115,7 +2115,7 @@ test_externally_compressed_io (xd3_stream *stream, int ignore)
2115 main_extcomp *ext = & extcomp_types[i]; 2115 main_extcomp *ext = & extcomp_types[i];
2116 2116
2117 /* Test for the existence of the external command first, if not skip. */ 2117 /* Test for the existence of the external command first, if not skip. */
2118 snprintf (buf, TESTBUFSIZE, "%s %s < /dev/null > /dev/null", ext->recomp_cmdname, ext->recomp_options); 2118 snprintf_func (buf, TESTBUFSIZE, "%s %s < /dev/null > /dev/null", ext->recomp_cmdname, ext->recomp_options);
2119 2119
2120 if ((ret = system (buf)) != 0) 2120 if ((ret = system (buf)) != 0)
2121 { 2121 {
@@ -2173,17 +2173,17 @@ test_source_decompression (xd3_stream *stream, int ignore)
2173 if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; } 2173 if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; }
2174 2174
2175 /* Compress the source. */ 2175 /* Compress the source. */
2176 snprintf (buf, TESTBUFSIZE, "%s -1 %s < %s > %s", ext->recomp_cmdname, 2176 snprintf_func (buf, TESTBUFSIZE, "%s -1 %s < %s > %s", ext->recomp_cmdname,
2177 ext->recomp_options, TEST_COPY_FILE, TEST_SOURCE_FILE); 2177 ext->recomp_options, TEST_COPY_FILE, TEST_SOURCE_FILE);
2178 if ((ret = do_cmd (stream, buf))) { return ret; } 2178 if ((ret = do_cmd (stream, buf))) { return ret; }
2179 /* Compress the target. */ 2179 /* Compress the target. */
2180 snprintf (buf, TESTBUFSIZE, "%s -9 %s < %s > %s", ext->recomp_cmdname, 2180 snprintf_func (buf, TESTBUFSIZE, "%s -9 %s < %s > %s", ext->recomp_cmdname,
2181 ext->recomp_options, TEST_COPY_FILE, TEST_TARGET_FILE); 2181 ext->recomp_options, TEST_COPY_FILE, TEST_TARGET_FILE);
2182 if ((ret = do_cmd (stream, buf))) { return ret; } 2182 if ((ret = do_cmd (stream, buf))) { return ret; }
2183 2183
2184 /* Now the two identical files are compressed. Delta-encode the target, 2184 /* Now the two identical files are compressed. Delta-encode the target,
2185 * with decompression. */ 2185 * with decompression. */
2186 snprintf (buf, TESTBUFSIZE, "%s -e -vfq -s%s %s %s", program_name, TEST_SOURCE_FILE, 2186 snprintf_func (buf, TESTBUFSIZE, "%s -e -vfq -s%s %s %s", program_name, TEST_SOURCE_FILE,
2187 TEST_TARGET_FILE, TEST_DELTA_FILE); 2187 TEST_TARGET_FILE, TEST_DELTA_FILE);
2188 if ((ret = do_cmd (stream, buf))) { return ret; } 2188 if ((ret = do_cmd (stream, buf))) { return ret; }
2189 2189
@@ -2200,7 +2200,7 @@ test_source_decompression (xd3_stream *stream, int ignore)
2200 2200
2201 /* Decode the delta file with recompression disabled, should get an 2201 /* Decode the delta file with recompression disabled, should get an
2202 * uncompressed file out. */ 2202 * uncompressed file out. */
2203 snprintf (buf, TESTBUFSIZE, "%s -v -dq -R -s%s %s %s", program_name, 2203 snprintf_func (buf, TESTBUFSIZE, "%s -v -dq -R -s%s %s %s", program_name,
2204 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); 2204 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE);
2205 if ((ret = do_cmd (stream, buf))) { return ret; } 2205 if ((ret = do_cmd (stream, buf))) { return ret; }
2206 if ((ret = compare_files (TEST_COPY_FILE, 2206 if ((ret = compare_files (TEST_COPY_FILE,
@@ -2208,23 +2208,23 @@ test_source_decompression (xd3_stream *stream, int ignore)
2208 2208
2209 /* Decode the delta file with recompression, should get a compressed file 2209 /* Decode the delta file with recompression, should get a compressed file
2210 * out. But we can't compare compressed files directly. */ 2210 * out. But we can't compare compressed files directly. */
2211 snprintf (buf, TESTBUFSIZE, "%s -v -dqf -s%s %s %s", program_name, 2211 snprintf_func (buf, TESTBUFSIZE, "%s -v -dqf -s%s %s %s", program_name,
2212 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); 2212 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE);
2213 if ((ret = do_cmd (stream, buf))) { return ret; } 2213 if ((ret = do_cmd (stream, buf))) { return ret; }
2214 snprintf (buf, TESTBUFSIZE, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options, 2214 snprintf_func (buf, TESTBUFSIZE, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options,
2215 TEST_RECON_FILE, TEST_RECON2_FILE); 2215 TEST_RECON_FILE, TEST_RECON2_FILE);
2216 if ((ret = do_cmd (stream, buf))) { return ret; } 2216 if ((ret = do_cmd (stream, buf))) { return ret; }
2217 if ((ret = compare_files (TEST_COPY_FILE, 2217 if ((ret = compare_files (TEST_COPY_FILE,
2218 TEST_RECON2_FILE))) { return ret; } 2218 TEST_RECON2_FILE))) { return ret; }
2219 2219
2220 /* Encode with decompression disabled */ 2220 /* Encode with decompression disabled */
2221 snprintf (buf, TESTBUFSIZE, "%s -e -D -vfq -s%s %s %s", program_name, 2221 snprintf_func (buf, TESTBUFSIZE, "%s -e -D -vfq -s%s %s %s", program_name,
2222 TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); 2222 TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE);
2223 if ((ret = do_cmd (stream, buf))) { return ret; } 2223 if ((ret = do_cmd (stream, buf))) { return ret; }
2224 2224
2225 /* Decode the delta file with decompression disabled, should get the 2225 /* Decode the delta file with decompression disabled, should get the
2226 * identical compressed file out. */ 2226 * identical compressed file out. */
2227 snprintf (buf, TESTBUFSIZE, "%s -d -D -vfq -s%s %s %s", program_name, 2227 snprintf_func (buf, TESTBUFSIZE, "%s -d -D -vfq -s%s %s %s", program_name,
2228 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); 2228 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE);
2229 if ((ret = do_cmd (stream, buf))) { return ret; } 2229 if ((ret = do_cmd (stream, buf))) { return ret; }
2230 if ((ret = compare_files (TEST_TARGET_FILE, 2230 if ((ret = compare_files (TEST_TARGET_FILE,
@@ -2250,21 +2250,21 @@ test_force_behavior (xd3_stream *stream, int ignore)
2250 2250
2251 /* Create empty target file */ 2251 /* Create empty target file */
2252 test_setup (); 2252 test_setup ();
2253 snprintf (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE); 2253 snprintf_func (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE);
2254 if ((ret = do_cmd (stream, buf))) { return ret; } 2254 if ((ret = do_cmd (stream, buf))) { return ret; }
2255 2255
2256 /* Encode to delta file */ 2256 /* Encode to delta file */
2257 snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name, 2257 snprintf_func (buf, TESTBUFSIZE, "%s -e %s %s", program_name,
2258 TEST_TARGET_FILE, TEST_DELTA_FILE); 2258 TEST_TARGET_FILE, TEST_DELTA_FILE);
2259 if ((ret = do_cmd (stream, buf))) { return ret; } 2259 if ((ret = do_cmd (stream, buf))) { return ret; }
2260 2260
2261 /* Encode again, should fail. */ 2261 /* Encode again, should fail. */
2262 snprintf (buf, TESTBUFSIZE, "%s -q -e %s %s ", program_name, 2262 snprintf_func (buf, TESTBUFSIZE, "%s -q -e %s %s ", program_name,
2263 TEST_TARGET_FILE, TEST_DELTA_FILE); 2263 TEST_TARGET_FILE, TEST_DELTA_FILE);
2264 if ((ret = do_fail (stream, buf))) { return ret; } 2264 if ((ret = do_fail (stream, buf))) { return ret; }
2265 2265
2266 /* Force it, should succeed. */ 2266 /* Force it, should succeed. */
2267 snprintf (buf, TESTBUFSIZE, "%s -f -e %s %s", program_name, 2267 snprintf_func (buf, TESTBUFSIZE, "%s -f -e %s %s", program_name,
2268 TEST_TARGET_FILE, TEST_DELTA_FILE); 2268 TEST_TARGET_FILE, TEST_DELTA_FILE);
2269 if ((ret = do_cmd (stream, buf))) { return ret; } 2269 if ((ret = do_cmd (stream, buf))) { return ret; }
2270 test_cleanup(); 2270 test_cleanup();
@@ -2281,26 +2281,26 @@ test_stdout_behavior (xd3_stream *stream, int ignore)
2281 char buf[TESTBUFSIZE]; 2281 char buf[TESTBUFSIZE];
2282 2282
2283 test_setup(); 2283 test_setup();
2284 snprintf (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE); 2284 snprintf_func (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE);
2285 if ((ret = do_cmd (stream, buf))) { return ret; } 2285 if ((ret = do_cmd (stream, buf))) { return ret; }
2286 2286
2287 /* Without -c, encode writes to delta file */ 2287 /* Without -c, encode writes to delta file */
2288 snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name, 2288 snprintf_func (buf, TESTBUFSIZE, "%s -e %s %s", program_name,
2289 TEST_TARGET_FILE, TEST_DELTA_FILE); 2289 TEST_TARGET_FILE, TEST_DELTA_FILE);
2290 if ((ret = do_cmd (stream, buf))) { return ret; } 2290 if ((ret = do_cmd (stream, buf))) { return ret; }
2291 2291
2292 /* With -c, encode writes to stdout */ 2292 /* With -c, encode writes to stdout */
2293 snprintf (buf, TESTBUFSIZE, "%s -e -c %s > %s", program_name, 2293 snprintf_func (buf, TESTBUFSIZE, "%s -e -c %s > %s", program_name,
2294 TEST_TARGET_FILE, TEST_DELTA_FILE); 2294 TEST_TARGET_FILE, TEST_DELTA_FILE);
2295 if ((ret = do_cmd (stream, buf))) { return ret; } 2295 if ((ret = do_cmd (stream, buf))) { return ret; }
2296 2296
2297 /* Without -c, decode writes to target file name, but it fails because the 2297 /* Without -c, decode writes to target file name, but it fails because the
2298 * file exists. */ 2298 * file exists. */
2299 snprintf (buf, TESTBUFSIZE, "%s -q -d %s ", program_name, TEST_DELTA_FILE); 2299 snprintf_func (buf, TESTBUFSIZE, "%s -q -d %s ", program_name, TEST_DELTA_FILE);
2300 if ((ret = do_fail (stream, buf))) { return ret; } 2300 if ((ret = do_fail (stream, buf))) { return ret; }
2301 2301
2302 /* With -c, decode writes to stdout */ 2302 /* With -c, decode writes to stdout */
2303 snprintf (buf, TESTBUFSIZE, "%s -d -c %s > /dev/null", program_name, TEST_DELTA_FILE); 2303 snprintf_func (buf, TESTBUFSIZE, "%s -d -c %s > /dev/null", program_name, TEST_DELTA_FILE);
2304 if ((ret = do_cmd (stream, buf))) { return ret; } 2304 if ((ret = do_cmd (stream, buf))) { return ret; }
2305 test_cleanup(); 2305 test_cleanup();
2306 2306
@@ -2316,29 +2316,29 @@ test_no_output (xd3_stream *stream, int ignore)
2316 2316
2317 test_setup (); 2317 test_setup ();
2318 2318
2319 snprintf (buf, TESTBUFSIZE, "touch %s && chmod 0000 %s", 2319 snprintf_func (buf, TESTBUFSIZE, "touch %s && chmod 0000 %s",
2320 TEST_NOPERM_FILE, TEST_NOPERM_FILE); 2320 TEST_NOPERM_FILE, TEST_NOPERM_FILE);
2321 if ((ret = do_cmd (stream, buf))) { return ret; } 2321 if ((ret = do_cmd (stream, buf))) { return ret; }
2322 2322
2323 if ((ret = test_make_inputs (stream, NULL, NULL))) { return ret; } 2323 if ((ret = test_make_inputs (stream, NULL, NULL))) { return ret; }
2324 2324
2325 /* Try no_output encode w/out unwritable output file */ 2325 /* Try no_output encode w/out unwritable output file */
2326 snprintf (buf, TESTBUFSIZE, "%s -q -f -e %s %s", program_name, 2326 snprintf_func (buf, TESTBUFSIZE, "%s -q -f -e %s %s", program_name,
2327 TEST_TARGET_FILE, TEST_NOPERM_FILE); 2327 TEST_TARGET_FILE, TEST_NOPERM_FILE);
2328 if ((ret = do_fail (stream, buf))) { return ret; } 2328 if ((ret = do_fail (stream, buf))) { return ret; }
2329 snprintf (buf, TESTBUFSIZE, "%s -J -e %s %s", program_name, 2329 snprintf_func (buf, TESTBUFSIZE, "%s -J -e %s %s", program_name,
2330 TEST_TARGET_FILE, TEST_NOPERM_FILE); 2330 TEST_TARGET_FILE, TEST_NOPERM_FILE);
2331 if ((ret = do_cmd (stream, buf))) { return ret; } 2331 if ((ret = do_cmd (stream, buf))) { return ret; }
2332 2332
2333 /* Now really write the delta to test decode no-output */ 2333 /* Now really write the delta to test decode no-output */
2334 snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name, 2334 snprintf_func (buf, TESTBUFSIZE, "%s -e %s %s", program_name,
2335 TEST_TARGET_FILE, TEST_DELTA_FILE); 2335 TEST_TARGET_FILE, TEST_DELTA_FILE);
2336 if ((ret = do_cmd (stream, buf))) { return ret; } 2336 if ((ret = do_cmd (stream, buf))) { return ret; }
2337 2337
2338 snprintf (buf, TESTBUFSIZE, "%s -q -f -d %s %s", program_name, 2338 snprintf_func (buf, TESTBUFSIZE, "%s -q -f -d %s %s", program_name,
2339 TEST_DELTA_FILE, TEST_NOPERM_FILE); 2339 TEST_DELTA_FILE, TEST_NOPERM_FILE);
2340 if ((ret = do_fail (stream, buf))) { return ret; } 2340 if ((ret = do_fail (stream, buf))) { return ret; }
2341 snprintf (buf, TESTBUFSIZE, "%s -J -d %s %s", program_name, 2341 snprintf_func (buf, TESTBUFSIZE, "%s -J -d %s %s", program_name,
2342 TEST_DELTA_FILE, TEST_NOPERM_FILE); 2342 TEST_DELTA_FILE, TEST_NOPERM_FILE);
2343 if ((ret = do_cmd (stream, buf))) { return ret; } 2343 if ((ret = do_cmd (stream, buf))) { return ret; }
2344 test_cleanup (); 2344 test_cleanup ();
@@ -2589,13 +2589,13 @@ test_string_matching (xd3_stream *stream, int ignore)
2589 default: CHECK(0); 2589 default: CHECK(0);
2590 } 2590 }
2591 2591
2592 snprintf (rptr, TESTBUFSIZE, "%d/%d", inst->pos, inst->size); 2592 snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%d/%d", inst->pos, inst->size);
2593 rptr += strlen (rptr); 2593 rptr += strlen (rptr);
2594 2594
2595 if (inst->type == XD3_CPY) 2595 if (inst->type == XD3_CPY)
2596 { 2596 {
2597 *rptr++ = '@'; 2597 *rptr++ = '@';
2598 snprintf (rptr, TESTBUFSIZE, "%"Q"d", inst->addr); 2598 snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Q"d", inst->addr);
2599 rptr += strlen (rptr); 2599 rptr += strlen (rptr);
2600 } 2600 }
2601 2601