[Cppunit-cvs] cppunit2/src/opentest serializer.cpp,1.12,1.13 sharedmemorytransport.cpp,1.5,1.6
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2006-02-01 18:26:31
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10035/src/opentest Modified Files: serializer.cpp sharedmemorytransport.cpp Log Message: * worked-around security deprecation warning on VC++ 2005. Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** serializer.cpp 9 Nov 2005 22:59:09 -0000 1.12 --- serializer.cpp 1 Feb 2006 18:26:17 -0000 1.13 *************** *** 407,411 **** --- 407,415 ---- #endif // #ifdef DBL_DIG char buffer[precision * 2 + 32]; + #ifdef __STDC_SECURE_LIB__ // Use secure version with visual studio 2005 to avoid warning. + int length = sprintf_s(buffer, sizeof(buffer), "%.*g", precision, value); + #else int length = sprintf(buffer, "%.*g", precision, value); + #endif if ( length == 0) return setError( "Failed to serialize double value (empty string)" ); Index: sharedmemorytransport.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/sharedmemorytransport.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sharedmemorytransport.cpp 31 Jan 2006 08:08:38 -0000 1.5 --- sharedmemorytransport.cpp 1 Feb 2006 18:26:17 -0000 1.6 *************** *** 382,388 **** --- 382,396 ---- throw SharedMemoryError( "Shared memory transport name too long." ); #ifdef _UNICODE // Use VC++ CRT extension to handle ansi->unicode conversion. + # ifdef __STDC_SECURE_LIB__ // Use secure version with visual studio 2005 to avoid warning. + nameLength_ = wprintf_s( nameBuffer_, sizeof(buffer), L"%S", transportName.c_str() ); + # else nameLength_ = wprintf( nameBuffer_, L"%S", transportName.c_str() ); + # endif #else + # ifdef __STDC_SECURE_LIB__ // Use secure version with visual studio 2005 to avoid warning. + nameLength_ = sprintf_s( nameBuffer_, sizeof(nameBuffer_), "%s", transportName.c_str() ); + # else nameLength_ = sprintf( nameBuffer_, "%s", transportName.c_str() ); + # endif #endif openSharedMemoryRegion(); |