I'm checking Squid-3 and, aside from other issues related to that software, I noticed that cppunit/TestAssert.h:82 fresh out of CVS fails because sprintf(3) is (correctly) not defined. snprintf(3) should be used instead, much like sprintf_s(3) is used two lines above with Visual Studio. Applying the patch
RCS file: /cvsroot/cppunit/cppunit/include/cppunit/TestAssert.h,v
retrieving revision 1.30
diff -u -r1.30 TestAssert.h
--- include/cppunit/TestAssert.h 24 Feb 2007 21:13:04 -0000 1.30
+++ include/cppunit/TestAssert.h 3 Sep 2007 17:46:48 -0000
@@ -79,7 +79,7 @@
#ifdef __STDC_SECURE_LIB__ // Use secure version with visual studio 2005 to avoid warning.
sprintf_s(buffer, sizeof(buffer), "%.*g", precision, x);
- sprintf(buffer, "%.*g", precision, x);
+ snprintf(buffer, sizeof(buffer), "%.*g", precision, x);
solves the problem.
I suggest availability of snprintf() and sprintf() be checked at configure time, and the former preferred over the latter if both are available. Please let me know if you want me to submit a complete patch.