summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2012-06-27 06:34:27 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2012-06-27 06:34:27 +0000
commit65aa190617d32e4778c2b553e0f069028cf975d9 (patch)
tree62444b28932769046054f1c2733b43f1f0e6d009
parent682e6c256ce25420951faf89ec104abb856deea8 (diff)
remove strcat, sprintf
-rw-r--r--xdelta3/badcopy.vcproj218
-rw-r--r--xdelta3/xdelta3-blkcache.h30
-rw-r--r--xdelta3/xdelta3-internal.h10
-rw-r--r--xdelta3/xdelta3-main.h105
-rw-r--r--xdelta3/xdelta3-test.h148
-rw-r--r--xdelta3/xdelta3.vcproj388
6 files changed, 149 insertions, 750 deletions
diff --git a/xdelta3/badcopy.vcproj b/xdelta3/badcopy.vcproj
deleted file mode 100644
index cd5d189..0000000
--- a/xdelta3/badcopy.vcproj
+++ /dev/null
@@ -1,218 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8.00"
5 Name="badcopy"
6 ProjectGUID="{FED2964C-7114-41AC-81EE-68A4D2B67503}"
7 RootNamespace="badcopy"
8 Keyword="Win32Proj"
9 >
10 <Platforms>
11 <Platform
12 Name="Win32"
13 />
14 </Platforms>
15 <ToolFiles>
16 </ToolFiles>
17 <Configurations>
18 <Configuration
19 Name="Debug|Win32"
20 OutputDirectory="Debug"
21 IntermediateDirectory="Debug"
22 ConfigurationType="1"
23 >
24 <Tool
25 Name="VCPreBuildEventTool"
26 />
27 <Tool
28 Name="VCCustomBuildTool"
29 />
30 <Tool
31 Name="VCXMLDataGeneratorTool"
32 />
33 <Tool
34 Name="VCWebServiceProxyGeneratorTool"
35 />
36 <Tool
37 Name="VCMIDLTool"
38 />
39 <Tool
40 Name="VCCLCompilerTool"
41 Optimization="0"
42 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
43 MinimalRebuild="true"
44 BasicRuntimeChecks="3"
45 RuntimeLibrary="3"
46 UsePrecompiledHeader="0"
47 WarningLevel="3"
48 Detect64BitPortabilityProblems="true"
49 DebugInformationFormat="4"
50 />
51 <Tool
52 Name="VCManagedResourceCompilerTool"
53 />
54 <Tool
55 Name="VCResourceCompilerTool"
56 />
57 <Tool
58 Name="VCPreLinkEventTool"
59 />
60 <Tool
61 Name="VCLinkerTool"
62 LinkIncremental="2"
63 GenerateDebugInformation="true"
64 SubSystem="1"
65 TargetMachine="1"
66 />
67 <Tool
68 Name="VCALinkTool"
69 />
70 <Tool
71 Name="VCManifestTool"
72 />
73 <Tool
74 Name="VCXDCMakeTool"
75 />
76 <Tool
77 Name="VCBscMakeTool"
78 />
79 <Tool
80 Name="VCFxCopTool"
81 />
82 <Tool
83 Name="VCAppVerifierTool"
84 />
85 <Tool
86 Name="VCWebDeploymentTool"
87 />
88 <Tool
89 Name="VCPostBuildEventTool"
90 />
91 </Configuration>
92 <Configuration
93 Name="Release|Win32"
94 OutputDirectory="Release"
95 IntermediateDirectory="Release"
96 ConfigurationType="1"
97 >
98 <Tool
99 Name="VCPreBuildEventTool"
100 />
101 <Tool
102 Name="VCCustomBuildTool"
103 />
104 <Tool
105 Name="VCXMLDataGeneratorTool"
106 />
107 <Tool
108 Name="VCWebServiceProxyGeneratorTool"
109 />
110 <Tool
111 Name="VCMIDLTool"
112 />
113 <Tool
114 Name="VCCLCompilerTool"
115 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
116 RuntimeLibrary="2"
117 UsePrecompiledHeader="0"
118 WarningLevel="3"
119 Detect64BitPortabilityProblems="true"
120 DebugInformationFormat="3"
121 />
122 <Tool
123 Name="VCManagedResourceCompilerTool"
124 />
125 <Tool
126 Name="VCResourceCompilerTool"
127 />
128 <Tool
129 Name="VCPreLinkEventTool"
130 />
131 <Tool
132 Name="VCLinkerTool"
133 LinkIncremental="2"
134 GenerateDebugInformation="true"
135 SubSystem="1"
136 OptimizeReferences="2"
137 EnableCOMDATFolding="2"
138 TargetMachine="1"
139 />
140 <Tool
141 Name="VCALinkTool"
142 />
143 <Tool
144 Name="VCManifestTool"
145 />
146 <Tool
147 Name="VCXDCMakeTool"
148 />
149 <Tool
150 Name="VCBscMakeTool"
151 />
152 <Tool
153 Name="VCFxCopTool"
154 />
155 <Tool
156 Name="VCAppVerifierTool"
157 />
158 <Tool
159 Name="VCWebDeploymentTool"
160 />
161 <Tool
162 Name="VCPostBuildEventTool"
163 />
164 </Configuration>
165 </Configurations>
166 <References>
167 </References>
168 <Files>
169 <Filter
170 Name="Header Files"
171 Filter="h;hpp;hxx;hm;inl;inc;xsd"
172 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
173 >
174 </Filter>
175 <Filter
176 Name="Resource Files"
177 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
178 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
179 >
180 <File
181 RelativePath=".\releases\xdelta30h.ppc-osx.bin"
182 >
183 </File>
184 </Filter>
185 <Filter
186 Name="Source Files"
187 Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
188 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
189 >
190 <File
191 RelativePath=".\badcopy.c"
192 >
193 </File>
194 </Filter>
195 <File
196 RelativePath=".\release\BuildLog.htm"
197 >
198 </File>
199 <File
200 RelativePath=".\debug\BuildLog.htm"
201 >
202 </File>
203 <File
204 RelativePath=".\www\xdelta3-api-guide.html"
205 >
206 </File>
207 <File
208 RelativePath=".\www\xdelta3-cmdline.html"
209 >
210 </File>
211 <File
212 RelativePath=".\www\xdelta3.html"
213 >
214 </File>
215 </Files>
216 <Globals>
217 </Globals>
218</VisualStudioProject>
diff --git a/xdelta3/xdelta3-blkcache.h b/xdelta3/xdelta3-blkcache.h
index 6afa012..dcd4c06 100644
--- a/xdelta3/xdelta3-blkcache.h
+++ b/xdelta3/xdelta3-blkcache.h
@@ -233,36 +233,36 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd,
233 233
234 if (option_verbose) 234 if (option_verbose)
235 { 235 {
236 static char srcszbuf[32]; 236 static shortbuf srcszbuf;
237 static char srccntbuf[32]; 237 static shortbuf srccntbuf;
238 static char winszbuf[32]; 238 static shortbuf winszbuf;
239 static char blkszbuf[32]; 239 static shortbuf blkszbuf;
240 static char nbufs[32]; 240 static shortbuf nbufs;
241 241
242 if (sfile->size_known) 242 if (sfile->size_known)
243 { 243 {
244 sprintf (srcszbuf, "source size %s [%"Q"u]", 244 short_sprintf (srcszbuf, "source size %s [%"Q"u]",
245 main_format_bcnt (source_size, srccntbuf), 245 main_format_bcnt (source_size, &srccntbuf),
246 source_size); 246 source_size);
247 } 247 }
248 else 248 else
249 { 249 {
250 strcpy(srcszbuf, "source size unknown"); 250 short_sprintf (srcszbuf, "%s", "source size unknown");
251 } 251 }
252 252
253 nbufs[0] = 0; 253 nbufs.buf[0] = 0;
254 254
255 if (option_verbose > 1) 255 if (option_verbose > 1)
256 { 256 {
257 sprintf(nbufs, " #bufs %u", lru_size); 257 short_sprintf (nbufs, " #bufs %u", lru_size);
258 } 258 }
259 259
260 XPR(NT "source %s %s blksize %s window %s%s%s\n", 260 XPR(NT "source %s %s blksize %s window %s%s%s\n",
261 sfile->filename, 261 sfile->filename,
262 srcszbuf, 262 srcszbuf.buf,
263 main_format_bcnt (blksize, blkszbuf), 263 main_format_bcnt (blksize, &blkszbuf),
264 main_format_bcnt (option_srcwinsz, winszbuf), 264 main_format_bcnt (option_srcwinsz, &winszbuf),
265 nbufs, 265 nbufs.buf,
266 do_src_fifo ? " (FIFO)" : ""); 266 do_src_fifo ? " (FIFO)" : "");
267 } 267 }
268 268
diff --git a/xdelta3/xdelta3-internal.h b/xdelta3/xdelta3-internal.h
index fd01208..871bcfb 100644
--- a/xdelta3/xdelta3-internal.h
+++ b/xdelta3/xdelta3-internal.h
@@ -95,11 +95,19 @@ struct _main_file
95 * absence of the '_' prefix) but they were initially buggy. So, 95 * absence of the '_' prefix) but they were initially buggy. So,
96 * always use the native '_'-prefixed version with Win32. */ 96 * always use the native '_'-prefixed version with Win32. */
97#ifdef _WIN32 97#ifdef _WIN32
98#define vsnprintf_func _vsnprintf 98#define vsnprintf_func(str,size,fmt,args) \
99 _vsnprintf_s(str,size,size-1,fmt,args)
99#else 100#else
100#define vsnprintf_func vsnprintf 101#define vsnprintf_func vsnprintf
102#define short_sprintf(sb,fmt,...) \
103 snprintf((sb).buf,sizeof((sb).buf),fmt,__VA_ARGS__)
101#endif 104#endif
102 105
106/* Type used for short snprintf calls. */
107typedef struct {
108 char buf[48];
109} shortbuf;
110
103/* Prior to SVN 303 this function was only defined in DJGPP and WIN32 111/* Prior to SVN 303 this function was only defined in DJGPP and WIN32
104 * environments and other platforms would use the builtin snprintf() 112 * environments and other platforms would use the builtin snprintf()
105 * with an arrangement of macros below. In OS X 10.6, Apply made 113 * with an arrangement of macros below. In OS X 10.6, Apply made
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 986165b..6ba18b7 100644
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -318,7 +318,7 @@ static int main_read_primary_input (main_file *file,
318 usize_t size, 318 usize_t size,
319 usize_t *nread); 319 usize_t *nread);
320 320
321static const char* main_format_bcnt (xoff_t r, char *buf); 321static const char* main_format_bcnt (xoff_t r, shortbuf *buf);
322static int main_help (void); 322static int main_help (void);
323 323
324static int xd3_merge_input_output (xd3_stream *stream, 324static int xd3_merge_input_output (xd3_stream *stream,
@@ -567,7 +567,7 @@ get_millisecs_since (void)
567} 567}
568 568
569static const char* 569static const char*
570main_format_bcnt (xoff_t r, char *buf) 570main_format_bcnt (xoff_t r, shortbuf *buf)
571{ 571{
572 static const char* fmts[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" }; 572 static const char* fmts[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
573 usize_t i; 573 usize_t i;
@@ -578,40 +578,40 @@ main_format_bcnt (xoff_t r, char *buf)
578 578
579 if (r == 0) 579 if (r == 0)
580 { 580 {
581 sprintf (buf, "0 %s", fmts[i]); 581 short_sprintf (*buf, "0 %s", fmts[i]);
582 return buf; 582 return buf->buf;
583 } 583 }
584 584
585 if (r >= 1 && r < 10) 585 if (r >= 1 && r < 10)
586 { 586 {
587 sprintf (buf, "%.2f %s", (double) r, fmts[i]); 587 short_sprintf (*buf, "%.2f %s", (double) r, fmts[i]);
588 return buf; 588 return buf->buf;
589 } 589 }
590 590
591 if (r >= 10 && r < 100) 591 if (r >= 10 && r < 100)
592 { 592 {
593 sprintf (buf, "%.1f %s", (double) r, fmts[i]); 593 short_sprintf (*buf, "%.1f %s", (double) r, fmts[i]);
594 return buf; 594 return buf->buf;
595 } 595 }
596 596
597 if (r >= 100 && r < 1000) 597 if (r >= 100 && r < 1000)
598 { 598 {
599 sprintf (buf, "%"Q"u %s", r, fmts[i]); 599 short_sprintf (*buf, "%"Q"u %s", r, fmts[i]);
600 return buf; 600 return buf->buf;
601 } 601 }
602 602
603 new_r = r / 1024; 603 new_r = r / 1024;
604 604
605 if (new_r < 10) 605 if (new_r < 10)
606 { 606 {
607 sprintf (buf, "%.2f %s", (double) r / 1024.0, fmts[i + 1]); 607 short_sprintf (*buf, "%.2f %s", (double) r / 1024.0, fmts[i + 1]);
608 return buf; 608 return buf->buf;
609 } 609 }
610 610
611 if (new_r < 100) 611 if (new_r < 100)
612 { 612 {
613 sprintf (buf, "%.1f %s", (double) r / 1024.0, fmts[i + 1]); 613 short_sprintf (*buf, "%.1f %s", (double) r / 1024.0, fmts[i + 1]);
614 return buf; 614 return buf->buf;
615 } 615 }
616 616
617 r = new_r; 617 r = new_r;
@@ -621,23 +621,32 @@ main_format_bcnt (xoff_t r, char *buf)
621} 621}
622 622
623static char* 623static char*
624main_format_rate (xoff_t bytes, long millis, char *buf) 624main_format_rate (xoff_t bytes, long millis, shortbuf *buf)
625{ 625{
626 xoff_t r = (xoff_t)(1.0 * bytes / (1.0 * millis / 1000.0)); 626 xoff_t r = (xoff_t)(1.0 * bytes / (1.0 * millis / 1000.0));
627 static char lbuf[32]; 627 static shortbuf lbuf;
628 628
629 main_format_bcnt (r, lbuf); 629 main_format_bcnt (r, &lbuf);
630 sprintf (buf, "%s/s", lbuf); 630 short_sprintf (*buf, "%s/s", lbuf.buf);
631 return buf; 631 return buf->buf;
632} 632}
633 633
634static char* 634static char*
635main_format_millis (long millis, char *buf) 635main_format_millis (long millis, shortbuf *buf)
636{ 636{
637 if (millis < 1000) { sprintf (buf, "%lu ms", millis); } 637 if (millis < 1000)
638 else if (millis < 10000) { sprintf (buf, "%.1f sec", millis / 1000.0); } 638 {
639 else { sprintf (buf, "%lu sec", millis / 1000L); } 639 short_sprintf (*buf, "%lu ms", millis);
640 return buf; 640 }
641 else if (millis < 10000)
642 {
643 short_sprintf (*buf, "%.1f sec", millis / 1000.0);
644 }
645 else
646 {
647 short_sprintf (*buf, "%lu sec", millis / 1000L);
648 }
649 return buf->buf;
641} 650}
642 651
643/* A safe version of strtol for xoff_t. */ 652/* A safe version of strtol for xoff_t. */
@@ -2682,12 +2691,12 @@ main_set_appheader (xd3_stream *stream, main_file *input, main_file *sfile)
2682 2691
2683 if (sfile->filename == NULL) 2692 if (sfile->filename == NULL)
2684 { 2693 {
2685 sprintf ((char*)appheader_used, "%s/%s", iname, icomp); 2694 snprintf ((char*)appheader_used, len, "%s/%s", iname, icomp);
2686 } 2695 }
2687 else 2696 else
2688 { 2697 {
2689 sprintf ((char*)appheader_used, "%s/%s/%s/%s", 2698 snprintf ((char*)appheader_used, len, "%s/%s/%s/%s",
2690 iname, icomp, sname, scomp); 2699 iname, icomp, sname, scomp);
2691 } 2700 }
2692 } 2701 }
2693 2702
@@ -2897,7 +2906,7 @@ static usize_t
2897main_get_winsize (main_file *ifile) { 2906main_get_winsize (main_file *ifile) {
2898 xoff_t file_size = 0; 2907 xoff_t file_size = 0;
2899 usize_t size = option_winsize; 2908 usize_t size = option_winsize;
2900 static char iszbuf[32]; 2909 static shortbuf iszbuf;
2901 2910
2902 if (main_file_stat (ifile, &file_size) == 0) 2911 if (main_file_stat (ifile, &file_size) == 0)
2903 { 2912 {
@@ -2910,7 +2919,7 @@ main_get_winsize (main_file *ifile) {
2910 { 2919 {
2911 XPR(NT "input %s window size %s\n", 2920 XPR(NT "input %s window size %s\n",
2912 ifile->filename, 2921 ifile->filename,
2913 main_format_bcnt (size, iszbuf)); 2922 main_format_bcnt (size, &iszbuf));
2914 } 2923 }
2915 2924
2916 return size; 2925 return size;
@@ -3271,10 +3280,10 @@ main_input (xd3_cmd cmd,
3271 3280
3272 if (option_verbose) 3281 if (option_verbose)
3273 { 3282 {
3274 char rrateavg[32], wrateavg[32], tm[32]; 3283 shortbuf rrateavg, wrateavg, tm;
3275 char rdb[32], wdb[32]; 3284 shortbuf rdb, wdb;
3276 char trdb[32], twdb[32]; 3285 shortbuf trdb, twdb;
3277 char srcpos[32]; 3286 shortbuf srcpos;
3278 long millis = get_millisecs_since (); 3287 long millis = get_millisecs_since ();
3279 usize_t this_read = (usize_t)(stream.total_in - 3288 usize_t this_read = (usize_t)(stream.total_in -
3280 last_total_in); 3289 last_total_in);
@@ -3288,25 +3297,25 @@ main_input (xd3_cmd cmd,
3288 XPR(NT "%"Q"u: in %s (%s): out %s (%s): " 3297 XPR(NT "%"Q"u: in %s (%s): out %s (%s): "
3289 "total in %s: out %s: %s: srcpos %s\n", 3298 "total in %s: out %s: %s: srcpos %s\n",
3290 stream.current_window, 3299 stream.current_window,
3291 main_format_bcnt (this_read, rdb), 3300 main_format_bcnt (this_read, &rdb),
3292 main_format_rate (this_read, millis, rrateavg), 3301 main_format_rate (this_read, millis, &rrateavg),
3293 main_format_bcnt (this_write, wdb), 3302 main_format_bcnt (this_write, &wdb),
3294 main_format_rate (this_write, millis, wrateavg), 3303 main_format_rate (this_write, millis, &wrateavg),
3295 main_format_bcnt (stream.total_in, trdb), 3304 main_format_bcnt (stream.total_in, &trdb),
3296 main_format_bcnt (stream.total_out, twdb), 3305 main_format_bcnt (stream.total_out, &twdb),
3297 main_format_millis (millis, tm), 3306 main_format_millis (millis, &tm),
3298 main_format_bcnt (sfile->source_position, srcpos)); 3307 main_format_bcnt (sfile->source_position, &srcpos));
3299 } 3308 }
3300 else 3309 else
3301 { 3310 {
3302 XPR(NT "%"Q"u: in %s: out %s: total in %s: " 3311 XPR(NT "%"Q"u: in %s: out %s: total in %s: "
3303 "out %s: %s\n", 3312 "out %s: %s\n",
3304 stream.current_window, 3313 stream.current_window,
3305 main_format_bcnt (this_read, rdb), 3314 main_format_bcnt (this_read, &rdb),
3306 main_format_bcnt (this_write, wdb), 3315 main_format_bcnt (this_write, &wdb),
3307 main_format_bcnt (stream.total_in, trdb), 3316 main_format_bcnt (stream.total_in, &trdb),
3308 main_format_bcnt (stream.total_out, twdb), 3317 main_format_bcnt (stream.total_out, &twdb),
3309 main_format_millis (millis, tm)); 3318 main_format_millis (millis, &tm));
3310 } 3319 }
3311 } 3320 }
3312 } 3321 }
@@ -3408,12 +3417,12 @@ done:
3408 3417
3409 if (option_verbose) 3418 if (option_verbose)
3410 { 3419 {
3411 char tm[32]; 3420 shortbuf tm;
3412 long end_time = get_millisecs_now (); 3421 long end_time = get_millisecs_now ();
3413 xoff_t nwrite = ofile != NULL ? ofile->nwrite : 0; 3422 xoff_t nwrite = ofile != NULL ? ofile->nwrite : 0;
3414 3423
3415 XPR(NT "finished in %s; input %"Q"u output %"Q"u bytes (%0.2f%%)\n", 3424 XPR(NT "finished in %s; input %"Q"u output %"Q"u bytes (%0.2f%%)\n",
3416 main_format_millis (end_time - start_time, tm), 3425 main_format_millis (end_time - start_time, &tm),
3417 ifile->nread, nwrite, 100.0 * nwrite / ifile->nread); 3426 ifile->nread, nwrite, 100.0 * nwrite / ifile->nread);
3418 } 3427 }
3419 3428
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h
index e346a63..7cb9419 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 sprintf (buf, "rm -f %s", file); 228 snprintf (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 sprintf (TEST_TARGET_FILE, "/tmp/xdtest.target.%d", x); 251 snprintf (TEST_TARGET_FILE, TESTFILESIZE, "/tmp/xdtest.target.%d", x);
252 sprintf (TEST_SOURCE_FILE, "/tmp/xdtest.source.%d", x); 252 snprintf (TEST_SOURCE_FILE, TESTFILESIZE, "/tmp/xdtest.source.%d", x);
253 sprintf (TEST_DELTA_FILE, "/tmp/xdtest.delta.%d", x); 253 snprintf (TEST_DELTA_FILE, TESTFILESIZE, "/tmp/xdtest.delta.%d", x);
254 sprintf (TEST_RECON_FILE, "/tmp/xdtest.recon.%d", x); 254 snprintf (TEST_RECON_FILE, TESTFILESIZE, "/tmp/xdtest.recon.%d", x);
255 sprintf (TEST_RECON2_FILE, "/tmp/xdtest.recon2.%d", x); 255 snprintf (TEST_RECON2_FILE, TESTFILESIZE, "/tmp/xdtest.recon2.%d", x);
256 sprintf (TEST_COPY_FILE, "/tmp/xdtest.copy.%d", x); 256 snprintf (TEST_COPY_FILE, TESTFILESIZE, "/tmp/xdtest.copy.%d", x);
257 sprintf (TEST_NOPERM_FILE, "/tmp/xdtest.noperm.%d", x); 257 snprintf (TEST_NOPERM_FILE, TESTFILESIZE, "/tmp/xdtest.noperm.%d", x);
258 test_cleanup(); 258 test_cleanup();
259 return 0; 259 return 0;
260} 260}
@@ -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 sprintf (buf, "cp -f %s %s", origname, TEST_COPY_FILE); 442 snprintf (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 sprintf (buf, "test_text"); 985 snprintf (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 sprintf (buf, "test_text.xz.%d", non_failures); \ 994 snprintf (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 sprintf (ecmd, cmdpairs[2*i], program_name, 1737 snprintf (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 sprintf (dcmd, cmdpairs[2*i+1], program_name, 1739 snprintf (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,8 +1812,8 @@ 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 sprintf (vcmd, "%s printhdr -f %s %s", 1815 snprintf (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)
1819 { 1819 {
@@ -1822,8 +1822,8 @@ check_vcdiff_header (xd3_stream *stream,
1822 return XD3_INTERNAL; 1822 return XD3_INTERNAL;
1823 } 1823 }
1824 1824
1825 sprintf (gcmd, "grep \"%s.*%s.*\" %s > /dev/null", 1825 snprintf (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)
1829 { 1829 {
@@ -1873,21 +1873,15 @@ test_recode_command2 (xd3_stream *stream, int has_source,
1873 } 1873 }
1874 1874
1875 /* First encode */ 1875 /* First encode */
1876 sprintf (ecmd, "%s %s -f ", program_name, test_softcfg_str); 1876 snprintf (ecmd, TESTBUFSIZE, "%s %s -f %s %s %s %s %s %s %s",
1877 strcat (ecmd, has_adler32 ? "" : "-n "); 1877 program_name, test_softcfg_str,
1878 strcat (ecmd, has_apphead ? "-A=encode_apphead " : "-A= "); 1878 has_adler32 ? "" : "-n ",
1879 strcat (ecmd, has_secondary ? "-S djw " : "-S none "); 1879 has_apphead ? "-A=encode_apphead " : "-A= ",
1880 1880 has_secondary ? "-S djw " : "-S none ",
1881 if (has_source) 1881 has_source ? "-s " : "",
1882 { 1882 has_source ? TEST_SOURCE_FILE : "",
1883 strcat (ecmd, "-s "); 1883 TEST_TARGET_FILE,
1884 strcat (ecmd, TEST_SOURCE_FILE); 1884 TEST_DELTA_FILE);
1885 strcat (ecmd, " ");
1886 }
1887
1888 strcat (ecmd, TEST_TARGET_FILE);
1889 strcat (ecmd, " ");
1890 strcat (ecmd, TEST_DELTA_FILE);
1891 1885
1892 if ((ret = system (ecmd)) != 0) 1886 if ((ret = system (ecmd)) != 0)
1893 { 1887 {
@@ -1897,14 +1891,14 @@ test_recode_command2 (xd3_stream *stream, int has_source,
1897 } 1891 }
1898 1892
1899 /* Now recode */ 1893 /* Now recode */
1900 sprintf (recmd, "%s recode %s -f ", program_name, test_softcfg_str); 1894 snprintf (recmd, TESTBUFSIZE,
1901 strcat (recmd, recoded_adler32 ? "" : "-n "); 1895 "%s recode %s -f %s %s %s %s %s", program_name, test_softcfg_str,
1902 strcat (recmd, !change_apphead ? "" : 1896 recoded_adler32 ? "" : "-n ",
1903 (recoded_apphead ? "-A=recode_apphead " : "-A= ")); 1897 !change_apphead ? "" :
1904 strcat (recmd, recoded_secondary ? "-S djw " : "-S none "); 1898 (recoded_apphead ? "-A=recode_apphead " : "-A= "),
1905 strcat (recmd, TEST_DELTA_FILE); 1899 recoded_secondary ? "-S djw " : "-S none ",
1906 strcat (recmd, " "); 1900 TEST_DELTA_FILE,
1907 strcat (recmd, TEST_COPY_FILE); 1901 TEST_COPY_FILE);
1908 1902
1909 if ((ret = system (recmd)) != 0) 1903 if ((ret = system (recmd)) != 0)
1910 { 1904 {
@@ -1980,18 +1974,11 @@ test_recode_command2 (xd3_stream *stream, int has_source,
1980 } 1974 }
1981 1975
1982 /* Now decode */ 1976 /* Now decode */
1983 sprintf (dcmd, "%s -fd ", program_name); 1977 snprintf (dcmd, TESTBUFSIZE, "%s -fd %s %s %s %s ", program_name,
1984 1978 has_source ? "-s " : "",
1985 if (has_source) 1979 has_source ? TEST_SOURCE_FILE : "",
1986 { 1980 TEST_COPY_FILE,
1987 strcat (dcmd, "-s "); 1981 TEST_RECON_FILE);
1988 strcat (dcmd, TEST_SOURCE_FILE);
1989 strcat (dcmd, " ");
1990 }
1991
1992 strcat (dcmd, TEST_COPY_FILE);
1993 strcat (dcmd, " ");
1994 strcat (dcmd, TEST_RECON_FILE);
1995 1982
1996 if ((ret = system (dcmd)) != 0) 1983 if ((ret = system (dcmd)) != 0)
1997 { 1984 {
@@ -2064,14 +2051,15 @@ test_compressed_pipe (xd3_stream *stream, main_extcomp *ext, char* buf,
2064 2051
2065 if (do_ext_recomp) 2052 if (do_ext_recomp)
2066 { 2053 {
2067 sprintf (decomp_buf, " | %s %s", ext->decomp_cmdname, ext->decomp_options); 2054 snprintf (decomp_buf, TESTBUFSIZE,
2055 " | %s %s", ext->decomp_cmdname, ext->decomp_options);
2068 } 2056 }
2069 else 2057 else
2070 { 2058 {
2071 decomp_buf[0] = 0; 2059 decomp_buf[0] = 0;
2072 } 2060 }
2073 2061
2074 sprintf (buf, "%s %s < %s | %s %s | %s %s%s > %s", 2062 snprintf (buf, TESTBUFSIZE, "%s %s < %s | %s %s | %s %s%s > %s",
2075 ext->recomp_cmdname, ext->recomp_options, 2063 ext->recomp_cmdname, ext->recomp_options,
2076 TEST_TARGET_FILE, 2064 TEST_TARGET_FILE,
2077 program_name, comp_options, 2065 program_name, comp_options,
@@ -2127,7 +2115,7 @@ test_externally_compressed_io (xd3_stream *stream, int ignore)
2127 main_extcomp *ext = & extcomp_types[i]; 2115 main_extcomp *ext = & extcomp_types[i];
2128 2116
2129 /* 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. */
2130 sprintf (buf, "%s %s < /dev/null > /dev/null", ext->recomp_cmdname, ext->recomp_options); 2118 snprintf (buf, TESTBUFSIZE, "%s %s < /dev/null > /dev/null", ext->recomp_cmdname, ext->recomp_options);
2131 2119
2132 if ((ret = system (buf)) != 0) 2120 if ((ret = system (buf)) != 0)
2133 { 2121 {
@@ -2185,17 +2173,17 @@ test_source_decompression (xd3_stream *stream, int ignore)
2185 if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; } 2173 if ((ret = test_save_copy (TEST_TARGET_FILE))) { return ret; }
2186 2174
2187 /* Compress the source. */ 2175 /* Compress the source. */
2188 sprintf (buf, "%s -1 %s < %s > %s", ext->recomp_cmdname, 2176 snprintf (buf, TESTBUFSIZE, "%s -1 %s < %s > %s", ext->recomp_cmdname,
2189 ext->recomp_options, TEST_COPY_FILE, TEST_SOURCE_FILE); 2177 ext->recomp_options, TEST_COPY_FILE, TEST_SOURCE_FILE);
2190 if ((ret = do_cmd (stream, buf))) { return ret; } 2178 if ((ret = do_cmd (stream, buf))) { return ret; }
2191 /* Compress the target. */ 2179 /* Compress the target. */
2192 sprintf (buf, "%s -9 %s < %s > %s", ext->recomp_cmdname, 2180 snprintf (buf, TESTBUFSIZE, "%s -9 %s < %s > %s", ext->recomp_cmdname,
2193 ext->recomp_options, TEST_COPY_FILE, TEST_TARGET_FILE); 2181 ext->recomp_options, TEST_COPY_FILE, TEST_TARGET_FILE);
2194 if ((ret = do_cmd (stream, buf))) { return ret; } 2182 if ((ret = do_cmd (stream, buf))) { return ret; }
2195 2183
2196 /* Now the two identical files are compressed. Delta-encode the target, 2184 /* Now the two identical files are compressed. Delta-encode the target,
2197 * with decompression. */ 2185 * with decompression. */
2198 sprintf (buf, "%s -e -vfq -s%s %s %s", program_name, TEST_SOURCE_FILE, 2186 snprintf (buf, TESTBUFSIZE, "%s -e -vfq -s%s %s %s", program_name, TEST_SOURCE_FILE,
2199 TEST_TARGET_FILE, TEST_DELTA_FILE); 2187 TEST_TARGET_FILE, TEST_DELTA_FILE);
2200 if ((ret = do_cmd (stream, buf))) { return ret; } 2188 if ((ret = do_cmd (stream, buf))) { return ret; }
2201 2189
@@ -2212,7 +2200,7 @@ test_source_decompression (xd3_stream *stream, int ignore)
2212 2200
2213 /* Decode the delta file with recompression disabled, should get an 2201 /* Decode the delta file with recompression disabled, should get an
2214 * uncompressed file out. */ 2202 * uncompressed file out. */
2215 sprintf (buf, "%s -v -dq -R -s%s %s %s", program_name, 2203 snprintf (buf, TESTBUFSIZE, "%s -v -dq -R -s%s %s %s", program_name,
2216 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); 2204 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE);
2217 if ((ret = do_cmd (stream, buf))) { return ret; } 2205 if ((ret = do_cmd (stream, buf))) { return ret; }
2218 if ((ret = compare_files (TEST_COPY_FILE, 2206 if ((ret = compare_files (TEST_COPY_FILE,
@@ -2220,23 +2208,23 @@ test_source_decompression (xd3_stream *stream, int ignore)
2220 2208
2221 /* Decode the delta file with recompression, should get a compressed file 2209 /* Decode the delta file with recompression, should get a compressed file
2222 * out. But we can't compare compressed files directly. */ 2210 * out. But we can't compare compressed files directly. */
2223 sprintf (buf, "%s -v -dqf -s%s %s %s", program_name, 2211 snprintf (buf, TESTBUFSIZE, "%s -v -dqf -s%s %s %s", program_name,
2224 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); 2212 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE);
2225 if ((ret = do_cmd (stream, buf))) { return ret; } 2213 if ((ret = do_cmd (stream, buf))) { return ret; }
2226 sprintf (buf, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options, 2214 snprintf (buf, TESTBUFSIZE, "%s %s < %s > %s", ext->decomp_cmdname, ext->decomp_options,
2227 TEST_RECON_FILE, TEST_RECON2_FILE); 2215 TEST_RECON_FILE, TEST_RECON2_FILE);
2228 if ((ret = do_cmd (stream, buf))) { return ret; } 2216 if ((ret = do_cmd (stream, buf))) { return ret; }
2229 if ((ret = compare_files (TEST_COPY_FILE, 2217 if ((ret = compare_files (TEST_COPY_FILE,
2230 TEST_RECON2_FILE))) { return ret; } 2218 TEST_RECON2_FILE))) { return ret; }
2231 2219
2232 /* Encode with decompression disabled */ 2220 /* Encode with decompression disabled */
2233 sprintf (buf, "%s -e -D -vfq -s%s %s %s", program_name, 2221 snprintf (buf, TESTBUFSIZE, "%s -e -D -vfq -s%s %s %s", program_name,
2234 TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE); 2222 TEST_SOURCE_FILE, TEST_TARGET_FILE, TEST_DELTA_FILE);
2235 if ((ret = do_cmd (stream, buf))) { return ret; } 2223 if ((ret = do_cmd (stream, buf))) { return ret; }
2236 2224
2237 /* Decode the delta file with decompression disabled, should get the 2225 /* Decode the delta file with decompression disabled, should get the
2238 * identical compressed file out. */ 2226 * identical compressed file out. */
2239 sprintf (buf, "%s -d -D -vfq -s%s %s %s", program_name, 2227 snprintf (buf, TESTBUFSIZE, "%s -d -D -vfq -s%s %s %s", program_name,
2240 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE); 2228 TEST_SOURCE_FILE, TEST_DELTA_FILE, TEST_RECON_FILE);
2241 if ((ret = do_cmd (stream, buf))) { return ret; } 2229 if ((ret = do_cmd (stream, buf))) { return ret; }
2242 if ((ret = compare_files (TEST_TARGET_FILE, 2230 if ((ret = compare_files (TEST_TARGET_FILE,
@@ -2262,21 +2250,21 @@ test_force_behavior (xd3_stream *stream, int ignore)
2262 2250
2263 /* Create empty target file */ 2251 /* Create empty target file */
2264 test_setup (); 2252 test_setup ();
2265 sprintf (buf, "cp /dev/null %s", TEST_TARGET_FILE); 2253 snprintf (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE);
2266 if ((ret = do_cmd (stream, buf))) { return ret; } 2254 if ((ret = do_cmd (stream, buf))) { return ret; }
2267 2255
2268 /* Encode to delta file */ 2256 /* Encode to delta file */
2269 sprintf (buf, "%s -e %s %s", program_name, 2257 snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name,
2270 TEST_TARGET_FILE, TEST_DELTA_FILE); 2258 TEST_TARGET_FILE, TEST_DELTA_FILE);
2271 if ((ret = do_cmd (stream, buf))) { return ret; } 2259 if ((ret = do_cmd (stream, buf))) { return ret; }
2272 2260
2273 /* Encode again, should fail. */ 2261 /* Encode again, should fail. */
2274 sprintf (buf, "%s -q -e %s %s ", program_name, 2262 snprintf (buf, TESTBUFSIZE, "%s -q -e %s %s ", program_name,
2275 TEST_TARGET_FILE, TEST_DELTA_FILE); 2263 TEST_TARGET_FILE, TEST_DELTA_FILE);
2276 if ((ret = do_fail (stream, buf))) { return ret; } 2264 if ((ret = do_fail (stream, buf))) { return ret; }
2277 2265
2278 /* Force it, should succeed. */ 2266 /* Force it, should succeed. */
2279 sprintf (buf, "%s -f -e %s %s", program_name, 2267 snprintf (buf, TESTBUFSIZE, "%s -f -e %s %s", program_name,
2280 TEST_TARGET_FILE, TEST_DELTA_FILE); 2268 TEST_TARGET_FILE, TEST_DELTA_FILE);
2281 if ((ret = do_cmd (stream, buf))) { return ret; } 2269 if ((ret = do_cmd (stream, buf))) { return ret; }
2282 test_cleanup(); 2270 test_cleanup();
@@ -2293,26 +2281,26 @@ test_stdout_behavior (xd3_stream *stream, int ignore)
2293 char buf[TESTBUFSIZE]; 2281 char buf[TESTBUFSIZE];
2294 2282
2295 test_setup(); 2283 test_setup();
2296 sprintf (buf, "cp /dev/null %s", TEST_TARGET_FILE); 2284 snprintf (buf, TESTBUFSIZE, "cp /dev/null %s", TEST_TARGET_FILE);
2297 if ((ret = do_cmd (stream, buf))) { return ret; } 2285 if ((ret = do_cmd (stream, buf))) { return ret; }
2298 2286
2299 /* Without -c, encode writes to delta file */ 2287 /* Without -c, encode writes to delta file */
2300 sprintf (buf, "%s -e %s %s", program_name, 2288 snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name,
2301 TEST_TARGET_FILE, TEST_DELTA_FILE); 2289 TEST_TARGET_FILE, TEST_DELTA_FILE);
2302 if ((ret = do_cmd (stream, buf))) { return ret; } 2290 if ((ret = do_cmd (stream, buf))) { return ret; }
2303 2291
2304 /* With -c, encode writes to stdout */ 2292 /* With -c, encode writes to stdout */
2305 sprintf (buf, "%s -e -c %s > %s", program_name, 2293 snprintf (buf, TESTBUFSIZE, "%s -e -c %s > %s", program_name,
2306 TEST_TARGET_FILE, TEST_DELTA_FILE); 2294 TEST_TARGET_FILE, TEST_DELTA_FILE);
2307 if ((ret = do_cmd (stream, buf))) { return ret; } 2295 if ((ret = do_cmd (stream, buf))) { return ret; }
2308 2296
2309 /* 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
2310 * file exists. */ 2298 * file exists. */
2311 sprintf (buf, "%s -q -d %s ", program_name, TEST_DELTA_FILE); 2299 snprintf (buf, TESTBUFSIZE, "%s -q -d %s ", program_name, TEST_DELTA_FILE);
2312 if ((ret = do_fail (stream, buf))) { return ret; } 2300 if ((ret = do_fail (stream, buf))) { return ret; }
2313 2301
2314 /* With -c, decode writes to stdout */ 2302 /* With -c, decode writes to stdout */
2315 sprintf (buf, "%s -d -c %s > /dev/null", program_name, TEST_DELTA_FILE); 2303 snprintf (buf, TESTBUFSIZE, "%s -d -c %s > /dev/null", program_name, TEST_DELTA_FILE);
2316 if ((ret = do_cmd (stream, buf))) { return ret; } 2304 if ((ret = do_cmd (stream, buf))) { return ret; }
2317 test_cleanup(); 2305 test_cleanup();
2318 2306
@@ -2328,29 +2316,29 @@ test_no_output (xd3_stream *stream, int ignore)
2328 2316
2329 test_setup (); 2317 test_setup ();
2330 2318
2331 sprintf (buf, "touch %s && chmod 0000 %s", 2319 snprintf (buf, TESTBUFSIZE, "touch %s && chmod 0000 %s",
2332 TEST_NOPERM_FILE, TEST_NOPERM_FILE); 2320 TEST_NOPERM_FILE, TEST_NOPERM_FILE);
2333 if ((ret = do_cmd (stream, buf))) { return ret; } 2321 if ((ret = do_cmd (stream, buf))) { return ret; }
2334 2322
2335 if ((ret = test_make_inputs (stream, NULL, NULL))) { return ret; } 2323 if ((ret = test_make_inputs (stream, NULL, NULL))) { return ret; }
2336 2324
2337 /* Try no_output encode w/out unwritable output file */ 2325 /* Try no_output encode w/out unwritable output file */
2338 sprintf (buf, "%s -q -f -e %s %s", program_name, 2326 snprintf (buf, TESTBUFSIZE, "%s -q -f -e %s %s", program_name,
2339 TEST_TARGET_FILE, TEST_NOPERM_FILE); 2327 TEST_TARGET_FILE, TEST_NOPERM_FILE);
2340 if ((ret = do_fail (stream, buf))) { return ret; } 2328 if ((ret = do_fail (stream, buf))) { return ret; }
2341 sprintf (buf, "%s -J -e %s %s", program_name, 2329 snprintf (buf, TESTBUFSIZE, "%s -J -e %s %s", program_name,
2342 TEST_TARGET_FILE, TEST_NOPERM_FILE); 2330 TEST_TARGET_FILE, TEST_NOPERM_FILE);
2343 if ((ret = do_cmd (stream, buf))) { return ret; } 2331 if ((ret = do_cmd (stream, buf))) { return ret; }
2344 2332
2345 /* Now really write the delta to test decode no-output */ 2333 /* Now really write the delta to test decode no-output */
2346 sprintf (buf, "%s -e %s %s", program_name, 2334 snprintf (buf, TESTBUFSIZE, "%s -e %s %s", program_name,
2347 TEST_TARGET_FILE, TEST_DELTA_FILE); 2335 TEST_TARGET_FILE, TEST_DELTA_FILE);
2348 if ((ret = do_cmd (stream, buf))) { return ret; } 2336 if ((ret = do_cmd (stream, buf))) { return ret; }
2349 2337
2350 sprintf (buf, "%s -q -f -d %s %s", program_name, 2338 snprintf (buf, TESTBUFSIZE, "%s -q -f -d %s %s", program_name,
2351 TEST_DELTA_FILE, TEST_NOPERM_FILE); 2339 TEST_DELTA_FILE, TEST_NOPERM_FILE);
2352 if ((ret = do_fail (stream, buf))) { return ret; } 2340 if ((ret = do_fail (stream, buf))) { return ret; }
2353 sprintf (buf, "%s -J -d %s %s", program_name, 2341 snprintf (buf, TESTBUFSIZE, "%s -J -d %s %s", program_name,
2354 TEST_DELTA_FILE, TEST_NOPERM_FILE); 2342 TEST_DELTA_FILE, TEST_NOPERM_FILE);
2355 if ((ret = do_cmd (stream, buf))) { return ret; } 2343 if ((ret = do_cmd (stream, buf))) { return ret; }
2356 test_cleanup (); 2344 test_cleanup ();
@@ -2601,13 +2589,13 @@ test_string_matching (xd3_stream *stream, int ignore)
2601 default: CHECK(0); 2589 default: CHECK(0);
2602 } 2590 }
2603 2591
2604 sprintf (rptr, "%d/%d", inst->pos, inst->size); 2592 snprintf (rptr, TESTBUFSIZE, "%d/%d", inst->pos, inst->size);
2605 rptr += strlen (rptr); 2593 rptr += strlen (rptr);
2606 2594
2607 if (inst->type == XD3_CPY) 2595 if (inst->type == XD3_CPY)
2608 { 2596 {
2609 *rptr++ = '@'; 2597 *rptr++ = '@';
2610 sprintf (rptr, "%"Q"d", inst->addr); 2598 snprintf (rptr, TESTBUFSIZE, "%"Q"d", inst->addr);
2611 rptr += strlen (rptr); 2599 rptr += strlen (rptr);
2612 } 2600 }
2613 2601
diff --git a/xdelta3/xdelta3.vcproj b/xdelta3/xdelta3.vcproj
deleted file mode 100644
index dd4d6a2..0000000
--- a/xdelta3/xdelta3.vcproj
+++ /dev/null
@@ -1,388 +0,0 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="9.00"
5 Name="xdelta3"
6 ProjectGUID="{7F30EDF1-4493-4E47-8664-0661516BC9E4}"
7 Keyword="Win32Proj"
8 TargetFrameworkVersion="131072"
9 >
10 <Platforms>
11 <Platform
12 Name="Win32"
13 />
14 <Platform
15 Name="x64"
16 />
17 </Platforms>
18 <ToolFiles>
19 </ToolFiles>
20 <Configurations>
21 <Configuration
22 Name="Debug|Win32"
23 OutputDirectory="Debug"
24 IntermediateDirectory="Debug"
25 ConfigurationType="1"
26 >
27 <Tool
28 Name="VCPreBuildEventTool"
29 />
30 <Tool
31 Name="VCCustomBuildTool"
32 />
33 <Tool
34 Name="VCXMLDataGeneratorTool"
35 />
36 <Tool
37 Name="VCWebServiceProxyGeneratorTool"
38 />
39 <Tool
40 Name="VCMIDLTool"
41 />
42 <Tool
43 Name="VCCLCompilerTool"
44 AdditionalOptions="/DXD3_DEBUG=0 /DXD3_USE_LARGEFILE64=1 /DREGRESSION_TEST=1 /DSECONDARY_DJW=1 /DSECONDARY_FGK=1 /DXD3_MAIN=1 /DXD3_WIN32=1 /DEXTERNAL_COMPRESSION=0 /DXD3_STDIO=0 /DXD3_POSIX=0 /D_CRT_SECURE_NO_DEPRECATE"
45 Optimization="0"
46 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
47 MinimalRebuild="true"
48 BasicRuntimeChecks="3"
49 RuntimeLibrary="3"
50 UsePrecompiledHeader="0"
51 WarningLevel="3"
52 Detect64BitPortabilityProblems="true"
53 DebugInformationFormat="4"
54 />
55 <Tool
56 Name="VCManagedResourceCompilerTool"
57 />
58 <Tool
59 Name="VCResourceCompilerTool"
60 />
61 <Tool
62 Name="VCPreLinkEventTool"
63 />
64 <Tool
65 Name="VCLinkerTool"
66 LinkIncremental="2"
67 GenerateDebugInformation="true"
68 SubSystem="1"
69 RandomizedBaseAddress="1"
70 DataExecutionPrevention="0"
71 TargetMachine="1"
72 />
73 <Tool
74 Name="VCALinkTool"
75 />
76 <Tool
77 Name="VCManifestTool"
78 />
79 <Tool
80 Name="VCXDCMakeTool"
81 />
82 <Tool
83 Name="VCBscMakeTool"
84 />
85 <Tool
86 Name="VCFxCopTool"
87 />
88 <Tool
89 Name="VCAppVerifierTool"
90 />
91 <Tool
92 Name="VCPostBuildEventTool"
93 />
94 </Configuration>
95 <Configuration
96 Name="Release|Win32"
97 OutputDirectory="Release"
98 IntermediateDirectory="Release"
99 ConfigurationType="1"
100 WholeProgramOptimization="1"
101 >
102 <Tool
103 Name="VCPreBuildEventTool"
104 />
105 <Tool
106 Name="VCCustomBuildTool"
107 />
108 <Tool
109 Name="VCXMLDataGeneratorTool"
110 />
111 <Tool
112 Name="VCWebServiceProxyGeneratorTool"
113 />
114 <Tool
115 Name="VCMIDLTool"
116 />
117 <Tool
118 Name="VCCLCompilerTool"
119 AdditionalOptions="/DXD3_DEBUG=0 /DXD3_USE_LARGEFILE64=1 /DREGRESSION_TEST=1 /DSECONDARY_DJW=1 /DSECONDARY_FGK=1 /DXD3_MAIN=1 /DXD3_WIN32=1 /DEXTERNAL_COMPRESSION=0 /DXD3_STDIO=0 /DXD3_POSIX=0 /D_CRT_SECURE_NO_DEPRECATE"
120 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
121 RuntimeLibrary="0"
122 BufferSecurityCheck="false"
123 UsePrecompiledHeader="0"
124 WarningLevel="3"
125 Detect64BitPortabilityProblems="true"
126 DebugInformationFormat="3"
127 />
128 <Tool
129 Name="VCManagedResourceCompilerTool"
130 />
131 <Tool
132 Name="VCResourceCompilerTool"
133 />
134 <Tool
135 Name="VCPreLinkEventTool"
136 />
137 <Tool
138 Name="VCLinkerTool"
139 LinkIncremental="2"
140 GenerateDebugInformation="true"
141 SubSystem="1"
142 OptimizeReferences="2"
143 EnableCOMDATFolding="2"
144 RandomizedBaseAddress="1"
145 DataExecutionPrevention="0"
146 TargetMachine="1"
147 />
148 <Tool
149 Name="VCALinkTool"
150 />
151 <Tool
152 Name="VCManifestTool"
153 />
154 <Tool
155 Name="VCXDCMakeTool"
156 />
157 <Tool
158 Name="VCBscMakeTool"
159 />
160 <Tool
161 Name="VCFxCopTool"
162 />
163 <Tool
164 Name="VCAppVerifierTool"
165 />
166 <Tool
167 Name="VCPostBuildEventTool"
168 />
169 </Configuration>
170 <Configuration
171 Name="Debug|x64"
172 OutputDirectory="Debug"
173 IntermediateDirectory="Debug"
174 ConfigurationType="1"
175 >
176 <Tool
177 Name="VCPreBuildEventTool"
178 />
179 <Tool
180 Name="VCCustomBuildTool"
181 />
182 <Tool
183 Name="VCXMLDataGeneratorTool"
184 />
185 <Tool
186 Name="VCWebServiceProxyGeneratorTool"
187 />
188 <Tool
189 Name="VCMIDLTool"
190 />
191 <Tool
192 Name="VCCLCompilerTool"
193 AdditionalOptions="/DXD3_DEBUG=0 /DXD3_USE_LARGEFILE64=1 /DREGRESSION_TEST=1 /DSECONDARY_DJW=1 /DSECONDARY_FGK=1 /DXD3_MAIN=1 /DXD3_WIN32=1 /DEXTERNAL_COMPRESSION=0 /DXD3_STDIO=0 /DXD3_POSIX=0 /D_CRT_SECURE_NO_DEPRECATE"
194 Optimization="0"
195 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
196 MinimalRebuild="true"
197 BasicRuntimeChecks="3"
198 RuntimeLibrary="3"
199 UsePrecompiledHeader="0"
200 WarningLevel="3"
201 Detect64BitPortabilityProblems="true"
202 DebugInformationFormat="4"
203 />
204 <Tool
205 Name="VCManagedResourceCompilerTool"
206 />
207 <Tool
208 Name="VCResourceCompilerTool"
209 />
210 <Tool
211 Name="VCPreLinkEventTool"
212 />
213 <Tool
214 Name="VCLinkerTool"
215 LinkIncremental="2"
216 GenerateDebugInformation="true"
217 SubSystem="1"
218 RandomizedBaseAddress="1"
219 DataExecutionPrevention="0"
220 TargetMachine="x64"
221 />
222 <Tool
223 Name="VCALinkTool"
224 />
225 <Tool
226 Name="VCManifestTool"
227 />
228 <Tool
229 Name="VCXDCMakeTool"
230 />
231 <Tool
232 Name="VCBscMakeTool"
233 />
234 <Tool
235 Name="VCFxCopTool"
236 />
237 <Tool
238 Name="VCAppVerifierTool"
239 />
240 <Tool
241 Name="VCPostBuildEventTool"
242 />
243 </Configuration>
244 <Configuration
245 Name="Release|x64"
246 OutputDirectory="Release"
247 IntermediateDirectory="Release"
248 ConfigurationType="1"
249 WholeProgramOptimization="1"
250 >
251 <Tool
252 Name="VCPreBuildEventTool"
253 />
254 <Tool
255 Name="VCCustomBuildTool"
256 />
257 <Tool
258 Name="VCXMLDataGeneratorTool"
259 />
260 <Tool
261 Name="VCWebServiceProxyGeneratorTool"
262 />
263 <Tool
264 Name="VCMIDLTool"
265 />
266 <Tool
267 Name="VCCLCompilerTool"
268 AdditionalOptions="/DXD3_DEBUG=0 /DXD3_USE_LARGEFILE64=1 /DREGRESSION_TEST=1 /DSECONDARY_DJW=1 /DSECONDARY_FGK=1 /DXD3_MAIN=1 /DXD3_WIN32=1 /DEXTERNAL_COMPRESSION=0 /DXD3_STDIO=0 /DXD3_POSIX=0 /D_CRT_SECURE_NO_DEPRECATE"
269 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
270 RuntimeLibrary="0"
271 BufferSecurityCheck="false"
272 UsePrecompiledHeader="0"
273 WarningLevel="3"
274 Detect64BitPortabilityProblems="true"
275 DebugInformationFormat="3"
276 />
277 <Tool
278 Name="VCManagedResourceCompilerTool"
279 />
280 <Tool
281 Name="VCResourceCompilerTool"
282 />
283 <Tool
284 Name="VCPreLinkEventTool"
285 />
286 <Tool
287 Name="VCLinkerTool"
288 LinkIncremental="2"
289 GenerateDebugInformation="true"
290 SubSystem="1"
291 OptimizeReferences="2"
292 EnableCOMDATFolding="2"
293 RandomizedBaseAddress="1"
294 DataExecutionPrevention="0"
295 TargetMachine="x64"
296 />
297 <Tool
298 Name="VCALinkTool"
299 />
300 <Tool
301 Name="VCManifestTool"
302 />
303 <Tool
304 Name="VCXDCMakeTool"
305 />
306 <Tool
307 Name="VCBscMakeTool"
308 />
309 <Tool
310 Name="VCFxCopTool"
311 />
312 <Tool
313 Name="VCAppVerifierTool"
314 />
315 <Tool
316 Name="VCPostBuildEventTool"
317 />
318 </Configuration>
319 </Configurations>
320 <References>
321 </References>
322 <Files>
323 <Filter
324 Name="Header Files"
325 Filter="h;hpp;hxx;hm;inl;inc;xsd"
326 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
327 >
328 <File
329 RelativePath=".\xdelta3-cfgs.h"
330 >
331 </File>
332 <File
333 RelativePath=".\xdelta3-decode.h"
334 >
335 </File>
336 <File
337 RelativePath=".\xdelta3-djw.h"
338 >
339 </File>
340 <File
341 RelativePath=".\xdelta3-fgk.h"
342 >
343 </File>
344 <File
345 RelativePath=".\xdelta3-list.h"
346 >
347 </File>
348 <File
349 RelativePath=".\xdelta3-main.h"
350 >
351 </File>
352 <File
353 RelativePath=".\xdelta3-python.h"
354 >
355 </File>
356 <File
357 RelativePath=".\xdelta3-second.h"
358 >
359 </File>
360 <File
361 RelativePath=".\xdelta3-test.h"
362 >
363 </File>
364 <File
365 RelativePath=".\xdelta3.h"
366 >
367 </File>
368 </Filter>
369 <Filter
370 Name="Resource Files"
371 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
372 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
373 >
374 </Filter>
375 <Filter
376 Name="Source Files"
377 Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
378 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
379 >
380 <File
381 RelativePath=".\xdelta3.c"
382 >
383 </File>
384 </Filter>
385 </Files>
386 <Globals>
387 </Globals>
388</VisualStudioProject>