Remove unsafe banned functions (#8162)
authorJan Vorlicek <janvorli@microsoft.com>
Mon, 21 Nov 2016 15:22:45 +0000 (16:22 +0100)
committerJan Kotas <jkotas@microsoft.com>
Mon, 21 Nov 2016 15:22:45 +0000 (07:22 -0800)
This change removes _snwprintf, _snprintf and _vsnwprintf usage from CoreCLR and
their implementations from PAL.
PAL exposes their secure variants instead and CoreCLR now uses those instead.
I have also removed the StringCchPrintfA/W, StringCchVPrintfA/W, StringCbVPrintfA/W,
StringCbPrintfA/W, StringCbPrintfExA/W, StringCchVPrintfExA/W, StringCbVPrintfExA/W
and StringCchPrintfExA/W replaced their usage by the secure variants of the sprintf
functions, since they were used at only few places and implementing all of the variants
using the secure sprintf variants would be a hassle.
I also needed to fix a missing support for size modifiers for %p formatting character
and for wide characters / strings in the secure sprintf functions that was revealed
by the PAL tests.
I have also removed a bunch of PAL tests that were using %n formatting character which
was not implemented since it is considered unsafe and translated PAL tests that were using
the removed functions to use the safe variants of those.

232 files changed:
src/ToolBox/SOS/Strike/stressLogDump.cpp
src/ToolBox/superpmi/superpmi-shared/logging.cpp
src/ToolBox/superpmi/superpmi/neardiffer.cpp
src/debug/daccess/daccess.cpp
src/dlls/mscordac/mscordac_unixexports.src
src/ilasm/main.cpp
src/nativeresources/resourcestring.cpp
src/pal/inc/mbusafecrt.h
src/pal/inc/pal.h
src/pal/inc/rt/palrt.h
src/pal/inc/rt/safecrt.h
src/pal/inc/strsafe.h
src/pal/src/config.h.in
src/pal/src/configure.cmake
src/pal/src/cruntime/printf.cpp
src/pal/src/include/pal/palinternal.h
src/pal/src/safecrt/mbusafecrt.cpp
src/pal/src/safecrt/output.inl
src/pal/src/safecrt/snprintf.cpp
src/pal/src/safecrt/sprintf.cpp
src/pal/src/safecrt/swprintf.cpp
src/pal/src/safecrt/vsprintf.cpp
src/pal/src/safecrt/vswprint.cpp
src/pal/src/thread/process.cpp
src/pal/tests/palsuite/c_runtime/CMakeLists.txt
src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt [deleted file]
src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.cpp [deleted file]
src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat [deleted file]
src/pal/tests/palsuite/c_runtime/_snprintf_s/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/_snprintf_s.h [moved from src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h with 87% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/test1.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.cpp with 76% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat with 71% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/test10.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/test11.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/test12.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat with 72% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/test13.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat with 72% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/test14.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat with 70% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/test15.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat with 70% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/test16.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat with 71% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/test17.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat with 70% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/test18.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat with 70% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/test19.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.cpp with 90% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat with 71% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/test2.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat with 75% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/test3.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.cpp with 97% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat with 75% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/test6.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat with 75% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/test7.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.cpp with 93% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/test8.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/test9.cpp [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt [deleted file]
src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.cpp [deleted file]
src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat [deleted file]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/_snwprintf_s.h [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h with 87% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/test1.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.cpp with 80% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat with 71% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/test10.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/test11.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat with 73% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/test12.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat with 72% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/test13.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat with 72% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/test14.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test14/testinfo.dat with 69% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/test15.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test15/testinfo.dat with 69% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/test16.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat with 71% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/test17.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat with 70% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/test18.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat with 70% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/test19.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.cpp with 91% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat with 71% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/test2.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat with 75% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/test3.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.cpp with 97% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat with 75% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/test6.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat with 74% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/test7.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat with 73% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/test8.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat with 73% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/test9.cpp [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat with 73% similarity]
src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat
src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.cpp [deleted file]
src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt [deleted file]
src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.cpp [deleted file]
src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat [deleted file]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt with 95% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/_vsnwprintf_s.h [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h with 85% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/test1.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.cpp with 81% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat with 63% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/test10.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat with 65% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/test11.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat with 64% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/test12.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat with 64% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/test13.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat with 64% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/test14.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat with 62% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat with 62% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/test16.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat with 63% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/test17.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat with 62% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/test18.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat with 62% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/test19.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.cpp with 96% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat with 63% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/test2.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat with 66% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/test3.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat with 65% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp [new file with mode: 0644]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat with 65% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/test6.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat with 65% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/test7.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.cpp with 94% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat with 65% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/test8.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat with 65% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/CMakeLists.txt [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt with 100% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/test9.cpp [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.cpp with 95% similarity]
src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/testinfo.dat [moved from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat with 65% similarity]
src/pal/tests/palsuite/paltestlist.txt
src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
src/pal/tests/palsuite/palverify.dat
src/pal/tests/palsuite/threading/OpenEventW/test3/test3.cpp
src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/helper.cpp
src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/test5.cpp
src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/child6.cpp
src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/test6.cpp
src/utilcode/sstring.cpp
src/vm/codeman.cpp

index f277f92..9dfbe1e 100644 (file)
@@ -34,7 +34,7 @@ static const WCHAR* getTime(const FILETIME* time, __out_ecount (buffLen) WCHAR*
         return badTime;
 
 #ifdef FEATURE_PAL
-    int length = _snwprintf(buff, buffLen, W("%02d:%02d:%02d"), systemTime.wHour, systemTime.wMinute, systemTime.wSecond);
+    int length = _snwprintf_s(buff, buffLen, _TRUNCATE, W("%02d:%02d:%02d"), systemTime.wHour, systemTime.wMinute, systemTime.wSecond);
     if (length <= 0)
         return badTime;
 #else // FEATURE_PAL
index 5f7aa48..69c321b 100644 (file)
@@ -262,9 +262,9 @@ void Logger::LogVprintf(const char *function, const char *file, int line,
             const char *timeStr = "";
 #endif // FEATURE_PAL
 
-            const char *logEntryFmtStr = "%s - %s [%s:%d] - %s - %s\r\n";
-            size_t logEntryBuffSize = _snprintf(nullptr, 0, logEntryFmtStr,
-                                                timeStr, function, file, line, logLevelStr, fullMsg) + 1;
+            const char logEntryFmtStr[] = "%s - %s [%s:%d] - %s - %s\r\n";
+            size_t logEntryBuffSize = sizeof(logEntryFmtStr) + strlen(timeStr) + strlen(function) +
+                                      strlen(file) + 10 + strlen(logLevelStr) + strlen(fullMsg);
 
             char *logEntry = new char[logEntryBuffSize];
             sprintf_s(logEntry, logEntryBuffSize, logEntryFmtStr,
index 5b2e3b1..3f2c4db 100644 (file)
@@ -154,7 +154,7 @@ void NearDiffer::DumpCodeBlock(unsigned char *block, ULONG blocksize, void *orig
 
         const size_t minInstrBytes = 7;
         size_t instrBytes = max(instrSize, minInstrBytes);
-        size_t buffSize = _snprintf(nullptr, 0, "%p %s\n", (void*)((size_t)originalAddr+offset), instrMnemonic) + 3 * instrBytes + 1;
+        size_t buffSize = sizeof("%p %s\n") + 10 + count + 3 * instrBytes + 1;
         char *buff = new char[buffSize];
         int written = 0;
         written += sprintf_s(buff, buffSize, "%p ", (void*)((size_t)originalAddr+offset));
index aebfa43..99067df 100644 (file)
@@ -5888,14 +5888,15 @@ ClrDataAccess::RawGetMethodName(
         LPCWSTR wszStubManagerName = pStubManager->GetStubManagerName(TO_TADDR(address));
         _ASSERTE(wszStubManagerName != NULL);
 
-        HRESULT hr = StringCchPrintfW(
+        int result = _snwprintf_s(
             symbolBuf, 
             bufLen, 
+            _TRUNCATE,
             s_wszFormatNameWithStubManager,
             wszStubManagerName,                                         // Arg 1 = stub name
             TO_TADDR(address));                                         // Arg 2 = stub hex address
 
-        if (hr == S_OK)
+        if (result != -1)
         {
             // Printf succeeded, so we have an exact char count to return
             if (symbolLen)
@@ -5951,13 +5952,14 @@ NameFromMethodDesc:
         // XXX Microsoft - Should this case have a more specific name?
         static WCHAR s_wszFormatNameAddressOnly[] = W("CLRStub@%I64x");
 
-        HRESULT hr = StringCchPrintfW(
+        int result = _snwprintf_s(
             symbolBuf, 
             bufLen,
+            _TRUNCATE,
             s_wszFormatNameAddressOnly,
             TO_TADDR(address));
 
-        if (hr == S_OK)
+        if (result != -1)
         {
             // Printf succeeded, so we have an exact char count to return
             if (symbolLen)
index f213497..aa0b541 100644 (file)
@@ -49,9 +49,11 @@ PAL_wcsstr
 
 _wcsicmp
 _stricmp
-_snprintf
-_snwprintf
-_vsnwprintf
+sprintf_s
+swprintf_s
+_snwprintf_s
+_vsnprintf_s
+_vsnwprintf_s
 _itow_s
 _i64tow_s
 memcpy_s
@@ -171,4 +173,4 @@ _ZN25NativeExceptionHolderBase4PushEv
 _ZN25NativeExceptionHolderBaseC2Ev
 _ZN25NativeExceptionHolderBaseD2Ev
 _ZN28CatchHardwareExceptionHolderC1Ev
-_ZN28CatchHardwareExceptionHolderD1Ev
\ No newline at end of file
+_ZN28CatchHardwareExceptionHolderD1Ev
index 811c656..2bef40d 100644 (file)
@@ -768,7 +768,7 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
                                     for(iFile = 0; iFile < NumDeltaFiles; iFile++)
                                     {
                                         wcscpy_s(wzNewOutputFilename,MAX_FILENAME_LENGTH+16,wzOutputFilename);
-                                        exitval = (int)StringCchPrintfW(&wzNewOutputFilename[wcslen(wzNewOutputFilename)], 32,
+                                        exitval = _snwprintf_s(&wzNewOutputFilename[wcslen(wzNewOutputFilename)], 32, _TRUNCATE,
                                                  W(".%d"),iFile+1);
                                         MakeProperSourceFileName(pwzDeltaFiles[iFile], uCodePage, wzInputFilename, szInputFilename);
                                         if(pAsm->m_fReportProgress)
index 13d5aee..236a2a3 100644 (file)
@@ -42,11 +42,11 @@ int LoadNativeStringResource(const NativeStringResourceTable &nativeStringResour
         else
         {
             // The resource ID wasn't found in our array. Fall back on returning the ID as a string.
-            len = _snwprintf(szBuffer, iMax - 1, W("[Undefined resource string ID:0x%X]"), iResourceID);
-            if ((len < 0) || (len == (iMax - 1)))
-            {
-                // Add string terminator if the result of _snwprintf didn't fit the buffer.
-                szBuffer[iMax - 1] = W('\0');
+            len = _snwprintf_s(szBuffer, iMax, _TRUNCATE, W("[Undefined resource string ID:0x%X]"), iResourceID);
+            if (len < 0)
+            {   
+                // The only possible failure is that that string didn't fit the buffer. So the buffer contains 
+                // partial string terminated by '\0'
                 len = iMax - 1;
             }
         }
index 055abab..8cf050f 100644 (file)
@@ -86,10 +86,10 @@ extern int swprintf_s( WCHAR *string, size_t sizeInWords, const WCHAR *format, .
 extern int _snprintf_s( char *string, size_t sizeInBytes, size_t count, const char *format, ... );
 extern int _snwprintf_s( WCHAR *string, size_t sizeInWords, size_t count, const WCHAR *format, ... );
 
-extern int _vsprintf_s( char* string, size_t sizeInBytes, const char* format, va_list arglist );
+extern int vsprintf_s( char* string, size_t sizeInBytes, const char* format, va_list arglist );
 extern int _vsnprintf_s( char* string, size_t sizeInBytes, size_t count, const char* format, va_list arglist );
 
-extern int _vswprintf_s( WCHAR* string, size_t sizeInWords, const WCHAR* format, va_list arglist );
+extern int vswprintf_s( WCHAR* string, size_t sizeInWords, const WCHAR* format, va_list arglist );
 extern int _vsnwprintf_s( WCHAR* string, size_t sizeInWords, size_t count, const WCHAR* format, va_list arglist );
 
 extern int sscanf_s( const char *string, const char *format, ... );
index 7da8114..25aa9be 100644 (file)
@@ -5850,11 +5850,16 @@ PALIMPORT int __cdecl toupper(int);
 
 #endif // PAL_STDCPP_COMPAT
 
+/* _TRUNCATE */
+#if !defined(_TRUNCATE)
+#define _TRUNCATE ((size_t)-1)
+#endif
+
 PALIMPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t);
 PALIMPORT errno_t __cdecl memmove_s(void *, size_t, const void *, size_t);
 PALIMPORT char * __cdecl _strlwr(char *);
 PALIMPORT int __cdecl _stricmp(const char *, const char *);
-PALIMPORT int __cdecl _snprintf(char *, size_t, const char *, ...);
+PALIMPORT int __cdecl vsprintf_s(char *, size_t, const char *, va_list);
 PALIMPORT char * __cdecl _gcvt_s(char *, int, double, int);
 PALIMPORT char * __cdecl _ecvt(double, int, int *, int *);
 PALIMPORT int __cdecl __iscsym(int);
@@ -5864,7 +5869,14 @@ PALIMPORT unsigned char * __cdecl _mbsdec(const unsigned char *, const unsigned
 PALIMPORT int __cdecl _wcsicmp(const WCHAR *, const WCHAR*);
 PALIMPORT int __cdecl _wcsnicmp(const WCHAR *, const WCHAR *, size_t);
 PALIMPORT int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
-PALIMPORT int __cdecl _vsnwprintf(WCHAR *, size_t, const WCHAR *, va_list);
+PALIMPORT int __cdecl _vsnprintf_s(char *, size_t, size_t, const char *, va_list);
+PALIMPORT int __cdecl _vsnwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, va_list);
+PALIMPORT int __cdecl _snwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, ...);
+PALIMPORT int __cdecl _snprintf_s(char *, size_t, size_t, const char *, ...);
+PALIMPORT int __cdecl sprintf_s(char *, size_t, const char *, ... );
+PALIMPORT int __cdecl swprintf_s(WCHAR *, size_t, const WCHAR *, ... );
+PALIMPORT int __cdecl _snwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, ...);
+PALIMPORT int __cdecl vswprintf_s( WCHAR *, size_t, const WCHAR *, va_list);
 PALIMPORT errno_t __cdecl _itow_s(int, WCHAR *, size_t, int);
 
 PALIMPORT size_t __cdecl PAL_wcslen(const WCHAR *);
@@ -5883,7 +5895,6 @@ PALIMPORT size_t __cdecl PAL_wcscspn(const WCHAR *, const WCHAR *);
 PALIMPORT int __cdecl PAL_swprintf(WCHAR *, const WCHAR *, ...);
 PALIMPORT int __cdecl PAL_vswprintf(WCHAR *, const WCHAR *, va_list);
 PALIMPORT int __cdecl PAL__vsnprintf(LPSTR Buffer, size_t Count, LPCSTR Format, va_list ap);
-PALIMPORT int __cdecl _snwprintf(WCHAR *, size_t, const WCHAR *, ...);
 PALIMPORT int __cdecl PAL_swscanf(const WCHAR *, const WCHAR *, ...);
 PALIMPORT LONG __cdecl PAL_wcstol(const WCHAR *, WCHAR **, int);
 PALIMPORT ULONG __cdecl PAL_wcstoul(const WCHAR *, WCHAR **, int);
index be16289..6d75803 100644 (file)
@@ -849,8 +849,6 @@ STDAPI_(LPWSTR) StrCatBuffW(LPWSTR pszDest, LPCWSTR pszSrc, int cchDestBuffSize)
 
 #define lstrcmpW                PAL_wcscmp
 #define lstrcmpiW               _wcsicmp
-#define wnsprintfW              _snwprintf // note: not 100% compatible (wsprintf should be subset of sprintf...)
-#define wvnsprintfW             _vsnwprintf // note: not 100% compatible (wsprintf should be subset of sprintf...)
 
 #ifdef UNICODE
 #define StrCpy                  StrCpyW
@@ -869,7 +867,6 @@ STDAPI_(LPWSTR) StrCatBuffW(LPWSTR pszDest, LPCWSTR pszSrc, int cchDestBuffSize)
 
 #define lstrcmp                 lstrcmpW
 #define lstrcmpi                lstrcmpiW
-#define wnsprintf               wnsprintfW
 #endif
 
 
@@ -896,10 +893,7 @@ Remember to fix the errcode defintion in safecrt.h.
 */
 
 #define _wcslwr_s _wcslwr_unsafe
-#define _snwprintf_s _snwprintf_unsafe
-#define _vsnwprintf_s _vsnwprintf_unsafe
 #define _snprintf_s _snprintf_unsafe
-#define _vsnprintf_s _vsnprintf_unsafe
 #define swscanf_s swscanf
 #define sscanf_s sscanf
 
@@ -909,12 +903,8 @@ Remember to fix the errcode defintion in safecrt.h.
 #define _strlwr_s _strlwr_unsafe
 
 #define _vscprintf _vscprintf_unsafe
-#define _vscwprintf _vscwprintf_unsafe
 
-#define sprintf_s _snprintf
-#define swprintf_s _snwprintf
 #define vsprintf_s _vsnprintf
-#define vswprintf_s _vsnwprintf
 
 extern "C++" {
 
@@ -980,51 +970,6 @@ inline int __cdecl _vscprintf_unsafe(const char *_Format, va_list _ArgList)
     }
 }
 
-inline int __cdecl _vscwprintf_unsafe(const WCHAR *_Format, va_list _ArgList)
-{
-    int guess = 256;
-
-    for (;;)
-    {
-        WCHAR *buf = (WCHAR *)malloc(guess * sizeof(WCHAR));
-        if (buf == nullptr)
-            return 0;
-
-        va_list apcopy;
-        va_copy(apcopy, _ArgList);
-        int ret = _vsnwprintf(buf, guess, _Format, apcopy);
-        free(buf);
-        va_end(apcopy);
-
-        if ((ret != -1) && (ret < guess))
-            return ret;
-
-        guess *= 2;
-    }
-}
-
-inline int __cdecl _vsnwprintf_unsafe(WCHAR *_Dst, size_t _SizeInWords, size_t _Count, const WCHAR *_Format, va_list _ArgList)
-{
-    if (_Count == _TRUNCATE) _Count = _SizeInWords - 1;
-    int ret = _vsnwprintf(_Dst, _Count, _Format, _ArgList);
-    _Dst[_SizeInWords - 1] = L'\0';
-    if (ret < 0 && errno == 0)
-    {
-        errno = ERANGE;
-    }
-    return ret;
-}
-
-inline int __cdecl _snwprintf_unsafe(WCHAR *_Dst, size_t _SizeInWords, size_t _Count, const WCHAR *_Format, ...)
-{
-    int ret;
-    va_list _ArgList;
-    va_start(_ArgList, _Format);
-    ret = _vsnwprintf_unsafe(_Dst, _SizeInWords, _Count, _Format, _ArgList);
-    va_end(_ArgList);
-    return ret;
-}
-
 inline int __cdecl _vsnprintf_unsafe(char *_Dst, size_t _SizeInWords, size_t _Count, const char *_Format, va_list _ArgList)
 {
     if (_Count == _TRUNCATE) _Count = _SizeInWords - 1;
index 6b95e28..3cc10ce 100644 (file)
@@ -409,7 +409,6 @@ void __cdecl _invalid_parameter(const WCHAR *_Message, const WCHAR *_FunctionNam
 #define _tmakepath_s    _makepath_s
 #define _tsplitpath_s   _splitpath_s
 #define _stprintf_s     sprintf_s
-#define _vstprintf_s    vsprintf_s
 #define _sntprintf_s    _snprintf_s
 #define _vsntprintf_s   _vsnprintf_s
 #define _tscanf_s       scanf_s
@@ -428,8 +427,6 @@ void __cdecl _invalid_parameter(const WCHAR *_Message, const WCHAR *_FunctionNam
 #define _tmakepath_s    _wmakepath_s
 #define _tsplitpath_s   _wsplitpath_s
 #define _stprintf_s     swprintf_s
-#define _vstprintf_s    vswprintf_s
-#define _sntprintf_s    _snwprintf_s
 #define _vsntprintf_s   _vsnwprintf_s
 #define _tscanf_s       wscanf_s
 #define _tsscanf_s      swscanf_s
@@ -447,9 +444,7 @@ void __cdecl _invalid_parameter(const WCHAR *_Message, const WCHAR *_FunctionNam
 #define _tmakepath_s    _makepath_s
 #define _tsplitpath_s   _splitpath_s
 #define _stprintf_s     sprintf_s
-#define _vstprintf_s    vsprintf_s
 #define _sntprintf_s    _snprintf_s
-#define _vsntprintf_s   _vsnprintf_s
 #define _tscanf_s       scanf_s
 #define _tsscanf_s      sscanf_s
 #define _tsnscanf_s     _snscanf_s
@@ -3222,7 +3217,7 @@ int __cdecl vswprintf_s(WCHAR *_Dst, size_t _SizeInWords, const WCHAR *_Format,
 #if defined(__cplusplus) && _SAFECRT_USE_CPP_OVERLOADS
 template <size_t _SizeInWords>
 inline
-int __cdecl swprintf_s(char (&_Dst)[_SizeInWords], const char *_Format, ...)
+int __cdecl swprintf_s(WCHAR (&_Dst)[_SizeInWords], const WCHAR *_Format, ...)
 {
     int ret;
     va_list _ArgList;
@@ -3234,7 +3229,7 @@ int __cdecl swprintf_s(char (&_Dst)[_SizeInWords], const char *_Format, ...)
 
 template <size_t _SizeInWords>
 inline
-int __cdecl vswprintf_s(char (&_Dst)[_SizeInWords], const char *_Format, va_list _ArgList)
+int __cdecl vswprintf_s(WCHAR (&_Dst)[_SizeInWords], const WCHAR *_Format, va_list _ArgList)
 {
     return vswprintf_s(_Dst, _SizeInWords, _Format, _ArgList);
 }
@@ -3288,14 +3283,12 @@ int __cdecl _vsnprintf_s(char (&_Dst)[_SizeInBytes], size_t _Count, const char *
 
 /* _snwprintf_s, _vsnwprintf_s */
 _SAFECRT__EXTERN_C
-int __cdecl _snwprintf_s(WCHAR *_Dst, size_t _SizeInWords, size_t _Count, const WCHAR *_Format, ...);
-_SAFECRT__EXTERN_C
 int __cdecl _vsnwprintf_s(WCHAR *_Dst, size_t _SizeInWords, size_t _Count, const WCHAR *_Format, va_list _ArgList);
 
 #if defined(__cplusplus) && _SAFECRT_USE_CPP_OVERLOADS
 template <size_t _SizeInWords>
 inline
-int __cdecl _snwprintf_s(char (&_Dst)[_SizeInWords], size_t _Count, const char *_Format, ...)
+int __cdecl _snwprintf_s(WCHAR (&_Dst)[_SizeInWords], size_t _Count, const WCHAR *_Format, ...)
 {
     int ret;
     va_list _ArgList;
index 5a9f0ed..58749f2 100644 (file)
@@ -32,7 +32,7 @@
 #define _vsnprintf vsnprintf
 #endif // defined(PLATFORM_UNIX) && !defined (FEATURE_PAL)
 
-#include <stdio.h>      // for _vsnprintf, _vsnwprintf, getc, getwc
+#include <stdio.h>      // for _vsnprintf, getc, getwc
 #include <string.h>     // for memset
 #include <stdarg.h>     // for va_start, etc.
 
@@ -146,10 +146,6 @@ STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc,
 STRSAFEAPI StringCatNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend);
 STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags);
 STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchMaxAppend, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags);
-STRSAFEAPI StringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList);
-STRSAFEAPI StringVPrintfWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszFormat, va_list argList);
-STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList);
-STRSAFEAPI StringVPrintfExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const WCHAR* pszFormat, va_list argList);
 STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch);
 STRSAFEAPI StringLengthWorkerW(const WCHAR* psz, size_t cchMax, size_t* pcch);
 #endif  // STRSAFE_INLINE
@@ -2356,1124 +2352,6 @@ STRSAFEAPI StringCbCatNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, s
 #ifndef STRSAFE_NO_CCH_FUNCTIONS
 /*++
 
-STDAPI StringCchVPrintf(LPTSTR pszDest,
-                        size_t cchDest,
-                        LPCTSTR pszFormat,
-                        va_list argList);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'vsprintf'.
-    The size of the destination buffer (in characters) is a parameter and
-    this function will not write past the end of this buffer and it will
-    ALWAYS null terminate the destination buffer (unless it is zero length).
-
-    This function returns a hresult, and not a pointer.  It returns a S_OK
-    if the string was printed without truncation and null terminated, otherwise
-    it will return a failure code. In failure cases it will return a truncated
-    version of the ideal result.
-
-Arguments:
-
-    pszDest     -  destination string
-
-    cchDest     -  size of destination buffer in characters
-                   length must be sufficient to hold the resulting formatted
-                   string, including the null terminator.
-
-    pszFormat   -  format string which must be null terminated
-
-    argList     -  va_list from the variable arguments according to the
-                   stdarg.h convention
-
-Notes: 
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-   
-    pszDest and pszFormat should not be NULL.  See StringCchVPrintfEx if you
-    require the handling of NULL values.
-
-Return Value:
-
-    S_OK        -   if there was sufficient space in the dest buffer for
-                    the resultant string and it was null terminated.
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCchVPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList);
-STRSAFEAPI StringCchVPrintfW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszFormat, va_list argList);
-#ifdef UNICODE
-#define StringCchVPrintf  StringCchVPrintfW
-#else
-#define StringCchVPrintf  StringCchVPrintfA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCchVPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCchVPrintfW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszFormat, va_list argList)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CCH_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CB_FUNCTIONS
-/*++
-
-STDAPI StringCbVPrintf(LPTSTR pszDest,
-                       size_t cbDest,
-                       LPCTSTR pszFormat,
-                       va_list argList);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'vsprintf'.
-    The size of the destination buffer (in bytes) is a parameter and
-    this function will not write past the end of this buffer and it will
-    ALWAYS null terminate the destination buffer (unless it is zero length).
-
-    This function returns a hresult, and not a pointer.  It returns a S_OK
-    if the string was printed without truncation and null terminated, otherwise
-    it will return a failure code. In failure cases it will return a truncated
-    version of the ideal result.
-
-Arguments:
-
-    pszDest     -  destination string
-
-    cbDest      -  size of destination buffer in bytes
-                   length must be sufficient to hold the resulting formatted
-                   string, including the null terminator.
-
-    pszFormat   -  format string which must be null terminated
-
-    argList     -  va_list from the variable arguments according to the
-                   stdarg.h convention
-
-Notes: 
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-   
-    pszDest and pszFormat should not be NULL.  See StringCbVPrintfEx if you
-    require the handling of NULL values.
-
-
-Return Value:
-
-    S_OK        -   if there was sufficient space in the dest buffer for
-                    the resultant string and it was null terminated.
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCbVPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, va_list argList);
-STRSAFEAPI StringCbVPrintfW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszFormat, va_list argList);
-#ifdef UNICODE
-#define StringCbVPrintf  StringCbVPrintfW
-#else
-#define StringCbVPrintf  StringCbVPrintfA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCbVPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, va_list argList)
-{
-    HRESULT hr;
-    size_t cchDest;
-
-    cchDest = cbDest / sizeof(char);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCbVPrintfW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszFormat, va_list argList)
-{
-    HRESULT hr;
-    size_t cchDest;
-
-    cchDest = cbDest / sizeof(WCHAR);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CB_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CCH_FUNCTIONS
-/*++
-
-STDAPI StringCchPrintf(LPTSTR pszDest,
-                       size_t cchDest,
-                       LPCTSTR pszFormat,
-                       ...);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'sprintf'.
-    The size of the destination buffer (in characters) is a parameter and
-    this function will not write past the end of this buffer and it will
-    ALWAYS null terminate the destination buffer (unless it is zero length).
-
-    This function returns a hresult, and not a pointer.  It returns a S_OK
-    if the string was printed without truncation and null terminated, otherwise
-    it will return a failure code. In failure cases it will return a truncated
-    version of the ideal result.
-
-Arguments:
-
-    pszDest     -  destination string
-
-    cchDest     -  size of destination buffer in characters
-                   length must be sufficient to hold the resulting formatted
-                   string, including the null terminator.
-
-    pszFormat   -  format string which must be null terminated
-
-    ...         -  additional parameters to be formatted according to
-                   the format string
-
-Notes: 
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-   
-    pszDest and pszFormat should not be NULL.  See StringCchPrintfEx if you
-    require the handling of NULL values.
-
-Return Value:
-
-    S_OK        -   if there was sufficient space in the dest buffer for
-                    the resultant string and it was null terminated.
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCchPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, ...);
-STRSAFEAPI StringCchPrintfW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszFormat, ...);
-#ifdef UNICODE
-#define StringCchPrintf  StringCchPrintfW
-#else
-#define StringCchPrintf  StringCchPrintfA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCchPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, ...)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        va_list argList;
-
-        va_start(argList, pszFormat);
-
-        hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
-        
-        va_end(argList);
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCchPrintfW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszFormat, ...)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        va_list argList;
-
-        va_start(argList, pszFormat);
-
-        hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
-    
-        va_end(argList);
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CCH_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CB_FUNCTIONS
-/*++
-
-STDAPI StringCbPrintf(LPTSTR pszDest,
-                      size_t cbDest,
-                      LPCTSTR pszFormat,
-                      ...);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'sprintf'.
-    The size of the destination buffer (in bytes) is a parameter and
-    this function will not write past the end of this buffer and it will
-    ALWAYS null terminate the destination buffer (unless it is zero length).
-
-    This function returns a hresult, and not a pointer.  It returns a S_OK
-    if the string was printed without truncation and null terminated, otherwise
-    it will return a failure code. In failure cases it will return a truncated
-    version of the ideal result.
-
-Arguments:
-
-    pszDest     -  destination string
-
-    cbDest      -  size of destination buffer in bytes
-                   length must be sufficient to hold the resulting formatted
-                   string, including the null terminator.
-
-    pszFormat   -  format string which must be null terminated
-
-    ...         -  additional parameters to be formatted according to
-                   the format string
-
-Notes: 
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-   
-    pszDest and pszFormat should not be NULL.  See StringCbPrintfEx if you
-    require the handling of NULL values.
-
-
-Return Value:
-
-    S_OK        -   if there was sufficient space in the dest buffer for
-                    the resultant string and it was null terminated.
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCbPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, ...);
-STRSAFEAPI StringCbPrintfW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszFormat, ...);
-#ifdef UNICODE
-#define StringCbPrintf  StringCbPrintfW
-#else
-#define StringCbPrintf  StringCbPrintfA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCbPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, ...)
-{
-    HRESULT hr;
-    size_t cchDest;
-    
-    cchDest = cbDest / sizeof(char);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        va_list argList;
-
-        va_start(argList, pszFormat);
-   
-        hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
-
-        va_end(argList);
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCbPrintfW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszFormat, ...)
-{
-    HRESULT hr;
-    size_t cchDest;
-    
-    cchDest = cbDest / sizeof(WCHAR);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        va_list argList;
-
-        va_start(argList, pszFormat);
-    
-        hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList);
-
-        va_end(argList);
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CB_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CCH_FUNCTIONS
-/*++
-
-STDAPI StringCchPrintfEx(LPTSTR pszDest,
-                         size_t cchDest,
-                         LPTSTR* ppszDestEnd,
-                         size_t* pcchRemaining,
-                         DWORD dwFlags,
-                         LPCTSTR pszFormat,
-                         ...);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'sprintf' with
-    some additional parameters.  In addition to functionality provided by
-    StringCchPrintf, this routine also returns a pointer to the end of the 
-    destination string and the number of characters left in the destination string
-    including the null terminator. The flags parameter allows additional controls.
-
-Arguments:
-
-    pszDest         -   destination string
-
-    cchDest         -   size of destination buffer in characters.
-                        length must be sufficient to contain the resulting
-                        formatted string plus the null terminator.
-
-    ppszDestEnd     -   if ppszDestEnd is non-null, the function will return a
-                        pointer to the end of the destination string.  If the
-                        function printed any data, the result will point to the
-                        null termination character
-
-    pcchRemaining   -   if pcchRemaining is non-null, the function will return 
-                        the number of characters left in the destination string,
-                        including the null terminator
-
-    dwFlags         -   controls some details of the string copy:
-
-        STRSAFE_FILL_BEHIND_NULL
-                    if the function succeeds, the low byte of dwFlags will be
-                    used to fill the uninitialize part of destination buffer
-                    behind the null terminator
-
-        STRSAFE_IGNORE_NULLS
-                    treat NULL string pointers like empty strings (TEXT(""))
-
-        STRSAFE_FILL_ON_FAILURE
-                    if the function fails, the low byte of dwFlags will be
-                    used to fill all of the destination buffer, and it will
-                    be null terminated. This will overwrite any truncated 
-                    string returned when the failure is
-                    STRSAFE_E_INSUFFICIENT_BUFFER
-
-        STRSAFE_NO_TRUNCATION /
-        STRSAFE_NULL_ON_FAILURE
-                    if the function fails, the destination buffer will be set
-                    to the empty string. This will overwrite any truncated string
-                    returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER.
-
-    pszFormat       -   format string which must be null terminated
-
-    ...             -   additional parameters to be formatted according to
-                        the format string
-
-Notes:
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-
-    pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS
-    flag is specified.  If STRSAFE_IGNORE_NULLS is passed, both pszDest and
-    pszFormat may be NULL.  An error may still be returned even though NULLS
-    are ignored due to insufficient space.
-
-Return Value:
-
-    S_OK        -   if there was source data and it was all concatenated and the
-                    resultant dest string was null terminated
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCchPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, ...);
-STRSAFEAPI StringCchPrintfExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const WCHAR* pszFormat, ...);
-#ifdef UNICODE
-#define StringCchPrintfEx  StringCchPrintfExW
-#else
-#define StringCchPrintfEx  StringCchPrintfExA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCchPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, ...)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        size_t cbDest;
-        va_list argList;
-
-        // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1
-        cbDest = cchDest * sizeof(char);
-        va_start(argList, pszFormat);
-
-        hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
-        
-        va_end(argList);
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCchPrintfExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const WCHAR* pszFormat, ...)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        size_t cbDest;
-        va_list argList;
-
-        // safe to multiply cchDest * sizeof(WCHAR) since cchDest < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
-        cbDest = cchDest * sizeof(WCHAR);
-        va_start(argList, pszFormat);
-
-        hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
-    
-        va_end(argList);
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CCH_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CB_FUNCTIONS
-/*++
-
-STDAPI StringCbPrintfEx(LPTSTR pszDest,
-                        size_t cbDest,
-                        LPTSTR* ppszDestEnd,
-                        size_t* pcbRemaining,
-                        DWORD dwFlags,
-                        LPCTSTR pszFormat,
-                        ...);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'sprintf' with
-    some additional parameters.  In addition to functionality provided by
-    StringCbPrintf, this routine also returns a pointer to the end of the 
-    destination string and the number of bytes left in the destination string
-    including the null terminator. The flags parameter allows additional controls.
-
-Arguments:
-
-    pszDest         -   destination string
-
-    cbDest          -   size of destination buffer in bytes.
-                        length must be sufficient to contain the resulting
-                        formatted string plus the null terminator.
-
-    ppszDestEnd     -   if ppszDestEnd is non-null, the function will return a
-                        pointer to the end of the destination string.  If the
-                        function printed any data, the result will point to the
-                        null termination character
-
-    pcbRemaining    -   if pcbRemaining is non-null, the function will return 
-                        the number of bytes left in the destination string,
-                        including the null terminator
-
-    dwFlags         -   controls some details of the string copy:
-
-        STRSAFE_FILL_BEHIND_NULL
-                    if the function succeeds, the low byte of dwFlags will be
-                    used to fill the uninitialize part of destination buffer
-                    behind the null terminator
-
-        STRSAFE_IGNORE_NULLS
-                    treat NULL string pointers like empty strings (TEXT(""))
-
-        STRSAFE_FILL_ON_FAILURE
-                    if the function fails, the low byte of dwFlags will be
-                    used to fill all of the destination buffer, and it will
-                    be null terminated. This will overwrite any truncated 
-                    string returned when the failure is
-                    STRSAFE_E_INSUFFICIENT_BUFFER
-
-        STRSAFE_NO_TRUNCATION /
-        STRSAFE_NULL_ON_FAILURE
-                    if the function fails, the destination buffer will be set
-                    to the empty string. This will overwrite any truncated string
-                    returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER.
-
-    pszFormat       -   format string which must be null terminated
-
-    ...             -   additional parameters to be formatted according to
-                        the format string
-
-Notes:
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-
-    pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS
-    flag is specified.  If STRSAFE_IGNORE_NULLS is passed, both pszDest and
-    pszFormat may be NULL.  An error may still be returned even though NULLS
-    are ignored due to insufficient space.
-
-Return Value:
-
-    S_OK        -   if there was source data and it was all concatenated and the
-                    resultant dest string was null terminated
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCbPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, ...);
-STRSAFEAPI StringCbPrintfExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const WCHAR* pszFormat, ...);
-#ifdef UNICODE
-#define StringCbPrintfEx  StringCbPrintfExW
-#else
-#define StringCbPrintfEx  StringCbPrintfExA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCbPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, ...)
-{
-    HRESULT hr;
-    size_t cchDest;
-    size_t cchRemaining = 0;
-
-    cchDest = cbDest / sizeof(char);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        va_list argList;
-
-        va_start(argList, pszFormat);
-
-        hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
-    
-        va_end(argList);
-    }
-
-    if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
-    {
-        if (pcbRemaining)
-        {
-            // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1
-            *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
-        }
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCbPrintfExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const WCHAR* pszFormat, ...)
-{
-    HRESULT hr;
-    size_t cchDest;
-    size_t cchRemaining = 0;
-
-    cchDest = cbDest / sizeof(WCHAR);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        va_list argList;
-
-        va_start(argList, pszFormat);
-
-        hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
-    
-        va_end(argList);
-    }
-
-    if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
-    {
-        if (pcbRemaining)
-        {
-            // safe to multiply cchRemaining * sizeof(WCHAR) since cchRemaining < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
-            *pcbRemaining = (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR));
-        }
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CB_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CCH_FUNCTIONS
-/*++
-
-STDAPI StringCchVPrintfEx(LPTSTR pszDest,
-                          size_t cchDest,
-                          LPTSTR* ppszDestEnd,
-                          size_t* pcchRemaining,
-                          DWORD dwFlags,
-                          LPCTSTR pszFormat,
-                          va_list argList);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'vsprintf' with
-    some additional parameters.  In addition to functionality provided by
-    StringCchVPrintf, this routine also returns a pointer to the end of the 
-    destination string and the number of characters left in the destination string
-    including the null terminator. The flags parameter allows additional controls.
-
-Arguments:
-
-    pszDest         -   destination string
-
-    cchDest         -   size of destination buffer in characters.
-                        length must be sufficient to contain the resulting
-                        formatted string plus the null terminator.
-
-    ppszDestEnd     -   if ppszDestEnd is non-null, the function will return a 
-                        pointer to the end of the destination string.  If the 
-                        function printed any data, the result will point to the 
-                        null termination character
-
-    pcchRemaining   -   if pcchRemaining is non-null, the function will return
-                        the number of characters left in the destination string,
-                        including the null terminator
-
-    dwFlags         -   controls some details of the string copy:
-
-        STRSAFE_FILL_BEHIND_NULL
-                    if the function succeeds, the low byte of dwFlags will be
-                    used to fill the uninitialize part of destination buffer
-                    behind the null terminator
-
-        STRSAFE_IGNORE_NULLS
-                    treat NULL string pointers like empty strings (TEXT(""))
-
-        STRSAFE_FILL_ON_FAILURE
-                    if the function fails, the low byte of dwFlags will be
-                    used to fill all of the destination buffer, and it will
-                    be null terminated. This will overwrite any truncated 
-                    string returned when the failure is
-                    STRSAFE_E_INSUFFICIENT_BUFFER
-
-        STRSAFE_NO_TRUNCATION /
-        STRSAFE_NULL_ON_FAILURE
-                    if the function fails, the destination buffer will be set
-                    to the empty string. This will overwrite any truncated string
-                    returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER.
-
-    pszFormat       -   format string which must be null terminated
-
-    argList         -   va_list from the variable arguments according to the
-                        stdarg.h convention
-
-Notes:
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-
-    pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS
-    flag is specified.  If STRSAFE_IGNORE_NULLS is passed, both pszDest and
-    pszFormat may be NULL.  An error may still be returned even though NULLS
-    are ignored due to insufficient space.
-
-Return Value:
-
-    S_OK        -   if there was source data and it was all concatenated and the
-                    resultant dest string was null terminated
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCchVPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList);
-STRSAFEAPI StringCchVPrintfExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const WCHAR* pszFormat, va_list argList);
-#ifdef UNICODE
-#define StringCchVPrintfEx  StringCchVPrintfExW
-#else
-#define StringCchVPrintfEx  StringCchVPrintfExA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCchVPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        size_t cbDest;
-
-        // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1
-        cbDest = cchDest * sizeof(char);
-        
-        hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCchVPrintfExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const WCHAR* pszFormat, va_list argList)
-{
-    HRESULT hr;
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        size_t cbDest;
-
-        // safe to multiply cchDest * sizeof(WCHAR) since cchDest < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
-        cbDest = cchDest * sizeof(WCHAR);
-
-        hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList);
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CCH_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CB_FUNCTIONS
-/*++
-
-STDAPI StringCbVPrintfEx(LPTSTR pszDest,
-                         size_t cbDest,
-                         LPTSTR* ppszDestEnd,
-                         size_t* pcbRemaining,
-                         DWORD dwFlags,
-                         LPCTSTR pszFormat,
-                         va_list argList);
-
-Routine Description:
-
-    This routine is a safer version of the C built-in function 'vsprintf' with
-    some additional parameters.  In addition to functionality provided by
-    StringCbVPrintf, this routine also returns a pointer to the end of the 
-    destination string and the number of characters left in the destination string
-    including the null terminator. The flags parameter allows additional controls.
-
-Arguments:
-
-    pszDest         -   destination string
-
-    cbDest          -   size of destination buffer in bytes.
-                        length must be sufficient to contain the resulting
-                        formatted string plus the null terminator.
-
-    ppszDestEnd     -   if ppszDestEnd is non-null, the function will return 
-                        a pointer to the end of the destination string.  If the
-                        function printed any data, the result will point to the
-                        null termination character
-
-    pcbRemaining    -   if pcbRemaining is non-null, the function will return
-                        the number of bytes left in the destination string,
-                        including the null terminator
-
-    dwFlags         -   controls some details of the string copy:
-
-        STRSAFE_FILL_BEHIND_NULL
-                    if the function succeeds, the low byte of dwFlags will be
-                    used to fill the uninitialize part of destination buffer
-                    behind the null terminator
-
-        STRSAFE_IGNORE_NULLS
-                    treat NULL string pointers like empty strings (TEXT(""))
-
-        STRSAFE_FILL_ON_FAILURE
-                    if the function fails, the low byte of dwFlags will be
-                    used to fill all of the destination buffer, and it will
-                    be null terminated. This will overwrite any truncated 
-                    string returned when the failure is
-                    STRSAFE_E_INSUFFICIENT_BUFFER
-
-        STRSAFE_NO_TRUNCATION /
-        STRSAFE_NULL_ON_FAILURE
-                    if the function fails, the destination buffer will be set
-                    to the empty string. This will overwrite any truncated string
-                    returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER.
-
-    pszFormat       -   format string which must be null terminated
-
-    argList         -   va_list from the variable arguments according to the
-                        stdarg.h convention
-
-Notes:
-    Behavior is undefined if destination, format strings or any arguments
-    strings overlap.
-
-    pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS
-    flag is specified.  If STRSAFE_IGNORE_NULLS is passed, both pszDest and
-    pszFormat may be NULL.  An error may still be returned even though NULLS
-    are ignored due to insufficient space.
-
-Return Value:
-
-    S_OK        -   if there was source data and it was all concatenated and the
-                    resultant dest string was null terminated
-
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all falure cases
-
-    STRSAFE_E_INSUFFICIENT_BUFFER / 
-    HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER
-                -   this return value is an indication that the print operation
-                    failed due to insufficient space. When this error occurs,
-                    the destination buffer is modified to contain a truncated
-                    version of the ideal result and is null terminated. This
-                    is useful for situations where truncation is ok.
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function
-
---*/
-
-STRSAFEAPI StringCbVPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList);
-STRSAFEAPI StringCbVPrintfExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const WCHAR* pszFormat, va_list argList);
-#ifdef UNICODE
-#define StringCbVPrintfEx  StringCbVPrintfExW
-#else
-#define StringCbVPrintfEx  StringCbVPrintfExA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCbVPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList)
-{
-    HRESULT hr;
-    size_t cchDest;
-    size_t cchRemaining = 0;
-
-    cchDest = cbDest / sizeof(char);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
-    }
-
-    if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
-    {
-        if (pcbRemaining)
-        {
-            // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1
-            *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
-        }
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCbVPrintfExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const WCHAR* pszFormat, va_list argList)
-{
-    HRESULT hr;
-    size_t cchDest;
-    size_t cchRemaining = 0;
-    
-    cchDest = cbDest / sizeof(WCHAR);
-
-    if (cchDest > STRSAFE_MAX_CCH)
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList);
-    }
-
-    if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
-    {
-        if (pcbRemaining)
-        {
-            // safe to multiply cchRemaining * sizeof(WCHAR) since cchRemaining < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
-            *pcbRemaining = (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR));
-        }
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CB_FUNCTIONS
-
-
-#ifndef STRSAFE_NO_CCH_FUNCTIONS
-/*++
-
 STDAPI StringCchGets(LPTSTR pszDest,
                      size_t cchDest);
 
@@ -4119,423 +2997,83 @@ Return Value:
     S_OK        -   psz is non-null and the length including the null terminator is
                     less than or equal to cbMax bytes
 
-    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
-                    code for all hresult falure cases
-
-    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
-    return value of this function.
-
---*/
-
-STRSAFEAPI StringCbLengthA(const char* psz, size_t cchMax, size_t* pcch);
-STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cchMax, size_t* pcch);
-#ifdef UNICODE
-#define StringCbLength  StringCbLengthW
-#else
-#define StringCbLength  StringCbLengthA
-#endif // !UNICODE
-
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCbLengthA(const char* psz, size_t cbMax, size_t* pcb)
-{
-    HRESULT hr;
-    size_t cchMax;
-    size_t cch = 0;
-
-    cchMax = cbMax / sizeof(char);
-
-    if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH))
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringLengthWorkerA(psz, cchMax, &cch);
-    }
-
-    if (SUCCEEDED(hr) && pcb)
-    {
-        // safe to multiply cch * sizeof(char) since cch < STRSAFE_MAX_CCH and sizeof(char) is 1
-        *pcb = cch * sizeof(char);
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cbMax, size_t* pcb)
-{
-    HRESULT hr;
-    size_t cchMax;
-    size_t cch = 0;
-
-    cchMax = cbMax / sizeof(WCHAR);
-
-    if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH))
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        hr = StringLengthWorkerW(psz, cchMax, &cch);
-    }
-
-    if (SUCCEEDED(hr) && pcb)
-    {
-        // safe to multiply cch * sizeof(WCHAR) since cch < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
-        *pcb = cch * sizeof(WCHAR);
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif  // STRSAFE_INLINE
-#endif  // !STRSAFE_NO_CB_FUNCTIONS
-
-
-// these are the worker functions that actually do the work
-#ifdef STRSAFE_INLINE
-STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc)
-{
-    HRESULT hr = S_OK;
-
-    if (cchDest == 0)
-    {
-        // can not null terminate a zero-byte dest buffer
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        while (cchDest && (*pszSrc != '\0'))
-        {
-            *pszDest++ = *pszSrc++;
-            cchDest--;
-        }
-
-        if (cchDest == 0)
-        {
-            // we are going to truncate pszDest
-            pszDest--;
-            hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-        }
-
-        *pszDest= '\0';
-    }
-
-    return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCopyWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
-{
-    HRESULT hr = S_OK;
-
-    if (cchDest == 0)
-    {
-        // can not null terminate a zero-byte dest buffer
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        while (cchDest && (*pszSrc != L'\0'))
-        {
-            *pszDest++ = *pszSrc++;
-            cchDest--;
-        }
-
-        if (cchDest == 0)
-        {
-            // we are going to truncate pszDest
-            pszDest--;
-            hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-        }
-
-        *pszDest= L'\0';
-    }
-
-    return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-
-STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
-{
-    HRESULT hr = S_OK;
-    char* pszDestEnd = pszDest;
-    size_t cchRemaining = 0;
-
-    // ASSERT(cbDest == (cchDest * sizeof(char))    ||
-    //        cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char)));
-    // only accept valid flags
-    if (dwFlags & (~STRSAFE_VALID_FLAGS))
-    {
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        if (dwFlags & STRSAFE_IGNORE_NULLS)
-        {
-            if (pszDest == NULL)
-            {
-                if ((cchDest != 0) || (cbDest != 0))
-                {
-                    // NULL pszDest and non-zero cchDest/cbDest is invalid
-                    hr = STRSAFE_E_INVALID_PARAMETER;
-                }
-            }
-
-            if (pszSrc == NULL)
-            {
-                pszSrc = "";
-            }
-        }
-
-        if (SUCCEEDED(hr))
-        {
-            if (cchDest == 0)
-            {
-                pszDestEnd = pszDest;
-                cchRemaining = 0;
-
-                // only fail if there was actually src data to copy
-                if (*pszSrc != '\0')
-                {
-                    if (pszDest == NULL)
-                    {
-                        hr = STRSAFE_E_INVALID_PARAMETER;
-                    }
-                    else
-                    {
-                        hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-                    }
-                }
-            }
-            else
-            {
-                pszDestEnd = pszDest;
-                cchRemaining = cchDest;
-
-                while (cchRemaining && (*pszSrc != '\0'))
-                {
-                    *pszDestEnd++= *pszSrc++;
-                    cchRemaining--;
-                }
-    
-                if (cchRemaining > 0)
-                {
-                    if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
-                    {
-                        memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
-                    }
-                }
-                else
-                {
-                    // we are going to truncate pszDest
-                    pszDestEnd--;
-                    cchRemaining++;
-
-                    hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-                }
-
-                *pszDestEnd = '\0';
-            }
-        }
-    }
-
-    if (FAILED(hr))
-    {
-        if (pszDest)
-        {
-            if (dwFlags & STRSAFE_FILL_ON_FAILURE)
-            {
-                memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
-            
-                if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
-                {
-                    pszDestEnd = pszDest;
-                    cchRemaining = cchDest;
-                }
-                else if (cchDest > 0)
-                {
-                    pszDestEnd = pszDest + cchDest - 1;
-                    cchRemaining = 1;
-
-                    // null terminate the end of the string
-                    *pszDestEnd = '\0';
-                }
-            }
-
-            if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
-            {
-                if (cchDest > 0)
-                {
-                    pszDestEnd = pszDest;
-                    cchRemaining = cchDest;
-
-                    // null terminate the beginning of the string
-                    *pszDestEnd = '\0';
-                }
-            }
-        }
-    }
+    failure     -   you can use the macro HRESULT_CODE() to get a win32 error
+                    code for all hresult falure cases
 
-    if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
-    {
-        if (ppszDestEnd) 
-        {
-            *ppszDestEnd = pszDestEnd;
-        }
+    It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the
+    return value of this function.
 
-        if (pcchRemaining)
-        {
-            *pcchRemaining = cchRemaining;
-        }
-    }
+--*/
 
-    return hr;
-}
+STRSAFEAPI StringCbLengthA(const char* psz, size_t cchMax, size_t* pcch);
+STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cchMax, size_t* pcch);
+#ifdef UNICODE
+#define StringCbLength  StringCbLengthW
+#else
+#define StringCbLength  StringCbLengthA
+#endif // !UNICODE
 
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCopyExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
+#ifdef STRSAFE_INLINE
+STRSAFEAPI StringCbLengthA(const char* psz, size_t cbMax, size_t* pcb)
 {
-    HRESULT hr = S_OK;
-    WCHAR* pszDestEnd = pszDest;
-    size_t cchRemaining = 0;
+    HRESULT hr;
+    size_t cchMax;
+    size_t cch = 0;
 
-    // ASSERT(cbDest == (cchDest * sizeof(WCHAR)) ||
-    //        cbDest == (cchDest * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
-    // only accept valid flags
-    if (dwFlags & (~STRSAFE_VALID_FLAGS))
+    cchMax = cbMax / sizeof(char);
+
+    if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH))
     {
         hr = STRSAFE_E_INVALID_PARAMETER;
     }
     else
     {
-        if (dwFlags & STRSAFE_IGNORE_NULLS)
-        {
-            if (pszDest == NULL)
-            {
-                if ((cchDest != 0) || (cbDest != 0))
-                {
-                    // NULL pszDest and non-zero cchDest/cbDest is invalid
-                    hr = STRSAFE_E_INVALID_PARAMETER;
-                }
-            }
-
-            if (pszSrc == NULL)
-            {
-                pszSrc = u"";
-            }
-        }
+        hr = StringLengthWorkerA(psz, cchMax, &cch);
+    }
 
-        if (SUCCEEDED(hr))
-        {
-            if (cchDest == 0)
-            {
-                pszDestEnd = pszDest;
-                cchRemaining = 0;
+    if (SUCCEEDED(hr) && pcb)
+    {
+        // safe to multiply cch * sizeof(char) since cch < STRSAFE_MAX_CCH and sizeof(char) is 1
+        *pcb = cch * sizeof(char);
+    }
 
-                // only fail if there was actually src data to copy
-                if (*pszSrc != u'\0')
-                {
-                    if (pszDest == NULL)
-                    {
-                        hr = STRSAFE_E_INVALID_PARAMETER;
-                    }
-                    else
-                    {
-                        hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-                    }
-                }
-            }
-            else
-            {
-                pszDestEnd = pszDest;
-                cchRemaining = cchDest;
+    return hr;
+}
 
-                while (cchRemaining && (*pszSrc != u'\0'))
-                {
-                    *pszDestEnd++= *pszSrc++;
-                    cchRemaining--;
-                }
-    
-                if (cchRemaining > 0)
-                {
-                    if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
-                    {
-                        memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
-                    }
-                }
-                else
-                {
-                    // we are going to truncate pszDest
-                    pszDestEnd--;
-                    cchRemaining++;
+#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
+STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cbMax, size_t* pcb)
+{
+    HRESULT hr;
+    size_t cchMax;
+    size_t cch = 0;
 
-                    hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-                }
+    cchMax = cbMax / sizeof(WCHAR);
 
-                *pszDestEnd = u'\0';
-            }
-        }
+    if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH))
+    {
+        hr = STRSAFE_E_INVALID_PARAMETER;
     }
-
-    if (FAILED(hr))
+    else
     {
-        if (pszDest)
-        {
-            if (dwFlags & STRSAFE_FILL_ON_FAILURE)
-            {
-                memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
-                           
-                if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
-                {
-                    pszDestEnd = pszDest;
-                    cchRemaining = cchDest;
-                }
-                else if (cchDest > 0)
-                {
-                    pszDestEnd = pszDest + cchDest - 1;
-                    cchRemaining = 1;
-
-                    // null terminate the end of the string
-                    *pszDestEnd = L'\0';
-                }
-            }
-
-            if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
-            {
-                if (cchDest > 0)
-                {
-                    pszDestEnd = pszDest;
-                    cchRemaining = cchDest;
-
-                    // null terminate the beginning of the string
-                    *pszDestEnd = L'\0';
-                }
-            }
-        }
+        hr = StringLengthWorkerW(psz, cchMax, &cch);
     }
 
-    if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
+    if (SUCCEEDED(hr) && pcb)
     {
-        if (ppszDestEnd) 
-        {
-            *ppszDestEnd = pszDestEnd;
-        }
-
-        if (pcchRemaining)
-        {
-            *pcchRemaining = cchRemaining;
-        }
+        // safe to multiply cch * sizeof(WCHAR) since cch < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
+        *pcb = cch * sizeof(WCHAR);
     }
 
     return hr;
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
+#endif  // STRSAFE_INLINE
+#endif  // !STRSAFE_NO_CB_FUNCTIONS
 
-STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc)
+
+// these are the worker functions that actually do the work
+#ifdef STRSAFE_INLINE
+STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc)
 {
     HRESULT hr = S_OK;
 
@@ -4546,11 +3084,10 @@ STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc,
     }
     else
     {
-        while (cchDest && cchSrc && (*pszSrc != '\0'))
+        while (cchDest && (*pszSrc != '\0'))
         {
-            *pszDest++= *pszSrc++;
+            *pszDest++ = *pszSrc++;
             cchDest--;
-            cchSrc--;
         }
 
         if (cchDest == 0)
@@ -4567,7 +3104,7 @@ STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc,
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc)
+STRSAFEAPI StringCopyWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
 {
     HRESULT hr = S_OK;
 
@@ -4578,11 +3115,10 @@ STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSr
     }
     else
     {
-        while (cchDest && cchSrc && (*pszSrc != L'\0'))
+        while (cchDest && (*pszSrc != L'\0'))
         {
-            *pszDest++= *pszSrc++;
+            *pszDest++ = *pszSrc++;
             cchDest--;
-            cchSrc--;
         }
 
         if (cchDest == 0)
@@ -4599,7 +3135,7 @@ STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSr
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
 
-STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
+STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     char* pszDestEnd = pszDest;
@@ -4657,11 +3193,10 @@ STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, co
                 pszDestEnd = pszDest;
                 cchRemaining = cchDest;
 
-                while (cchRemaining && cchSrc && (*pszSrc != '\0'))
+                while (cchRemaining && (*pszSrc != '\0'))
                 {
                     *pszDestEnd++= *pszSrc++;
                     cchRemaining--;
-                    cchSrc--;
                 }
     
                 if (cchRemaining > 0)
@@ -4739,7 +3274,7 @@ STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, co
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
+STRSAFEAPI StringCopyExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     WCHAR* pszDestEnd = pszDest;
@@ -4780,7 +3315,7 @@ STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, c
                 cchRemaining = 0;
 
                 // only fail if there was actually src data to copy
-                if (*pszSrc != L'\0')
+                if (*pszSrc != u'\0')
                 {
                     if (pszDest == NULL)
                     {
@@ -4797,11 +3332,10 @@ STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, c
                 pszDestEnd = pszDest;
                 cchRemaining = cchDest;
 
-                while (cchRemaining && cchSrc && (*pszSrc != L'\0'))
+                while (cchRemaining && (*pszSrc != u'\0'))
                 {
                     *pszDestEnd++= *pszSrc++;
                     cchRemaining--;
-                    cchSrc--;
                 }
     
                 if (cchRemaining > 0)
@@ -4820,7 +3354,7 @@ STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, c
                     hr = STRSAFE_E_INSUFFICIENT_BUFFER;
                 }
 
-                *pszDestEnd = L'\0';
+                *pszDestEnd = u'\0';
             }
         }
     }
@@ -4832,7 +3366,7 @@ STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, c
             if (dwFlags & STRSAFE_FILL_ON_FAILURE)
             {
                 memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
-            
+                           
                 if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
                 {
                     pszDestEnd = pszDest;
@@ -4879,43 +3413,71 @@ STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, c
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
 
-STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc)
+STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc)
 {
-   HRESULT hr;
-   size_t cchDestCurrent;
+    HRESULT hr = S_OK;
 
-   hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
+    if (cchDest == 0)
+    {
+        // can not null terminate a zero-byte dest buffer
+        hr = STRSAFE_E_INVALID_PARAMETER;
+    }
+    else
+    {
+        while (cchDest && cchSrc && (*pszSrc != '\0'))
+        {
+            *pszDest++= *pszSrc++;
+            cchDest--;
+            cchSrc--;
+        }
 
-   if (SUCCEEDED(hr))
-   {
-       hr = StringCopyWorkerA(pszDest + cchDestCurrent,
-                              cchDest - cchDestCurrent,
-                              pszSrc);
-   }
+        if (cchDest == 0)
+        {
+            // we are going to truncate pszDest
+            pszDest--;
+            hr = STRSAFE_E_INSUFFICIENT_BUFFER;
+        }
 
-   return hr;
+        *pszDest= '\0';
+    }
+
+    return hr;
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCatWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
-{
-   HRESULT hr;
-   size_t cchDestCurrent;
+STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc)
+{
+    HRESULT hr = S_OK;
 
-   hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
+    if (cchDest == 0)
+    {
+        // can not null terminate a zero-byte dest buffer
+        hr = STRSAFE_E_INVALID_PARAMETER;
+    }
+    else
+    {
+        while (cchDest && cchSrc && (*pszSrc != L'\0'))
+        {
+            *pszDest++= *pszSrc++;
+            cchDest--;
+            cchSrc--;
+        }
 
-   if (SUCCEEDED(hr))
-   {
-       hr = StringCopyWorkerW(pszDest + cchDestCurrent,
-                              cchDest - cchDestCurrent,
-                              pszSrc);
-   }
+        if (cchDest == 0)
+        {
+            // we are going to truncate pszDest
+            pszDest--;
+            hr = STRSAFE_E_INSUFFICIENT_BUFFER;
+        }
 
-   return hr;
+        *pszDest= L'\0';
+    }
+
+    return hr;
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
 
-STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
+STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     char* pszDestEnd = pszDest;
@@ -4923,7 +3485,7 @@ STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, cons
 
     // ASSERT(cbDest == (cchDest * sizeof(char))    ||
     //        cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char)));
-
     // only accept valid flags
     if (dwFlags & (~STRSAFE_VALID_FLAGS))
     {
@@ -4931,54 +3493,31 @@ STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, cons
     }
     else
     {
-        size_t cchDestCurrent;
-
         if (dwFlags & STRSAFE_IGNORE_NULLS)
         {
             if (pszDest == NULL)
             {
-                if ((cchDest == 0) && (cbDest == 0))
-                {
-                    cchDestCurrent = 0;
-                }
-                else
+                if ((cchDest != 0) || (cbDest != 0))
                 {
                     // NULL pszDest and non-zero cchDest/cbDest is invalid
                     hr = STRSAFE_E_INVALID_PARAMETER;
                 }
             }
-            else
-            {
-                hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
-
-                if (SUCCEEDED(hr))
-                {
-                    pszDestEnd = pszDest + cchDestCurrent;
-                    cchRemaining = cchDest - cchDestCurrent;
-                }
-            }
 
             if (pszSrc == NULL)
             {
                 pszSrc = "";
             }
         }
-        else
-        {
-            hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
-
-            if (SUCCEEDED(hr))
-            {
-                pszDestEnd = pszDest + cchDestCurrent;
-                cchRemaining = cchDest - cchDestCurrent;
-            }
-        }
 
         if (SUCCEEDED(hr))
         {
             if (cchDest == 0)
             {
-                // only fail if there was actually src data to append
+                pszDestEnd = pszDest;
+                cchRemaining = 0;
+
+                // only fail if there was actually src data to copy
                 if (*pszSrc != '\0')
                 {
                     if (pszDest == NULL)
@@ -4993,36 +3532,51 @@ STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, cons
             }
             else
             {
-                // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass
-                // those flags through
-                hr = StringCopyExWorkerA(pszDestEnd,
-                                         cchRemaining,
-                                         (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)),
-                                         pszSrc,
-                                         &pszDestEnd,
-                                         &cchRemaining,
-                                         dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+                pszDestEnd = pszDest;
+                cchRemaining = cchDest;
+
+                while (cchRemaining && cchSrc && (*pszSrc != '\0'))
+                {
+                    *pszDestEnd++= *pszSrc++;
+                    cchRemaining--;
+                    cchSrc--;
+                }
+    
+                if (cchRemaining > 0)
+                {
+                    if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
+                    {
+                        memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
+                    }
+                }
+                else
+                {
+                    // we are going to truncate pszDest
+                    pszDestEnd--;
+                    cchRemaining++;
+
+                    hr = STRSAFE_E_INSUFFICIENT_BUFFER;
+                }
+
+                *pszDestEnd = '\0';
             }
         }
     }
-    
+
     if (FAILED(hr))
     {
         if (pszDest)
         {
-            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerA()
-
             if (dwFlags & STRSAFE_FILL_ON_FAILURE)
             {
                 memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
-
+            
                 if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
                 {
                     pszDestEnd = pszDest;
                     cchRemaining = cchDest;
                 }
-                else
-                if (cchDest > 0)
+                else if (cchDest > 0)
                 {
                     pszDestEnd = pszDest + cchDest - 1;
                     cchRemaining = 1;
@@ -5032,7 +3586,7 @@ STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, cons
                 }
             }
 
-            if (dwFlags & STRSAFE_NULL_ON_FAILURE)
+            if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
             {
                 if (cchDest > 0)
                 {
@@ -5063,7 +3617,7 @@ STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, cons
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
+STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     WCHAR* pszDestEnd = pszDest;
@@ -5071,7 +3625,7 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con
 
     // ASSERT(cbDest == (cchDest * sizeof(WCHAR)) ||
     //        cbDest == (cchDest * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
-
     // only accept valid flags
     if (dwFlags & (~STRSAFE_VALID_FLAGS))
     {
@@ -5079,54 +3633,31 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con
     }
     else
     {
-        size_t cchDestCurrent;
-
         if (dwFlags & STRSAFE_IGNORE_NULLS)
         {
             if (pszDest == NULL)
             {
-                if ((cchDest == 0) && (cbDest == 0))
-                {
-                    cchDestCurrent = 0;
-                }
-                else
+                if ((cchDest != 0) || (cbDest != 0))
                 {
                     // NULL pszDest and non-zero cchDest/cbDest is invalid
                     hr = STRSAFE_E_INVALID_PARAMETER;
                 }
             }
-            else
-            {
-                hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
-
-                if (SUCCEEDED(hr))
-                {
-                    pszDestEnd = pszDest + cchDestCurrent;
-                    cchRemaining = cchDest - cchDestCurrent;
-                }
-            }
 
             if (pszSrc == NULL)
             {
                 pszSrc = u"";
             }
         }
-        else
-        {
-            hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
-
-            if (SUCCEEDED(hr))
-            {
-                pszDestEnd = pszDest + cchDestCurrent;
-                cchRemaining = cchDest - cchDestCurrent;
-            }
-        }
 
         if (SUCCEEDED(hr))
         {
             if (cchDest == 0)
             {
-                // only fail if there was actually src data to append
+                pszDestEnd = pszDest;
+                cchRemaining = 0;
+
+                // only fail if there was actually src data to copy
                 if (*pszSrc != L'\0')
                 {
                     if (pszDest == NULL)
@@ -5141,15 +3672,33 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con
             }
             else
             {
-                // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass
-                // those flags through
-                hr = StringCopyExWorkerW(pszDestEnd,
-                                         cchRemaining,
-                                         (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)),
-                                         pszSrc,
-                                         &pszDestEnd,
-                                         &cchRemaining,
-                                         dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));            
+                pszDestEnd = pszDest;
+                cchRemaining = cchDest;
+
+                while (cchRemaining && cchSrc && (*pszSrc != L'\0'))
+                {
+                    *pszDestEnd++= *pszSrc++;
+                    cchRemaining--;
+                    cchSrc--;
+                }
+    
+                if (cchRemaining > 0)
+                {
+                    if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
+                    {
+                        memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
+                    }
+                }
+                else
+                {
+                    // we are going to truncate pszDest
+                    pszDestEnd--;
+                    cchRemaining++;
+
+                    hr = STRSAFE_E_INSUFFICIENT_BUFFER;
+                }
+
+                *pszDestEnd = L'\0';
             }
         }
     }
@@ -5158,8 +3707,6 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con
     {
         if (pszDest)
         {
-            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerW()
-
             if (dwFlags & STRSAFE_FILL_ON_FAILURE)
             {
                 memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
@@ -5179,7 +3726,7 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con
                 }
             }
 
-            if (dwFlags & STRSAFE_NULL_ON_FAILURE)
+            if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
             {
                 if (cchDest > 0)
                 {
@@ -5210,50 +3757,47 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
 
-STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend)
+STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc)
 {
-    HRESULT hr;
-    size_t cchDestCurrent;
+   HRESULT hr;
+   size_t cchDestCurrent;
 
-    hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
+   hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
 
-    if (SUCCEEDED(hr))
-    {
-        hr = StringCopyNWorkerA(pszDest + cchDestCurrent,
-                                cchDest - cchDestCurrent,
-                                pszSrc,
-                                cchMaxAppend);
-    }    
+   if (SUCCEEDED(hr))
+   {
+       hr = StringCopyWorkerA(pszDest + cchDestCurrent,
+                              cchDest - cchDestCurrent,
+                              pszSrc);
+   }
 
-    return hr;
+   return hr;
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCatNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend)
+STRSAFEAPI StringCatWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
 {
-    HRESULT hr;
-    size_t cchDestCurrent;
+   HRESULT hr;
+   size_t cchDestCurrent;
 
-    hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
+   hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
 
-    if (SUCCEEDED(hr))
-    {
-        hr = StringCopyNWorkerW(pszDest + cchDestCurrent,
-                                cchDest - cchDestCurrent,
-                                pszSrc,
-                                cchMaxAppend);
-    }
+   if (SUCCEEDED(hr))
+   {
+       hr = StringCopyWorkerW(pszDest + cchDestCurrent,
+                              cchDest - cchDestCurrent,
+                              pszSrc);
+   }
 
-    return hr;
+   return hr;
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
 
-STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
+STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     char* pszDestEnd = pszDest;
     size_t cchRemaining = 0;
-    size_t cchDestCurrent = 0;
 
     // ASSERT(cbDest == (cchDest * sizeof(char))    ||
     //        cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char)));
@@ -5265,6 +3809,8 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
     }
     else
     {
+        size_t cchDestCurrent;
+
         if (dwFlags & STRSAFE_IGNORE_NULLS)
         {
             if (pszDest == NULL)
@@ -5324,26 +3870,25 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
                 }
             }
             else
-            {
-                // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass
-                // those flags through
-                hr = StringCopyNExWorkerA(pszDestEnd,
-                                          cchRemaining,
-                                          (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)),
-                                          pszSrc,
-                                          cchMaxAppend,
-                                          &pszDestEnd,
-                                          &cchRemaining,
-                                          dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+            {
+                // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass
+                // those flags through
+                hr = StringCopyExWorkerA(pszDestEnd,
+                                         cchRemaining,
+                                         (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)),
+                                         pszSrc,
+                                         &pszDestEnd,
+                                         &cchRemaining,
+                                         dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
             }
         }
     }
-
+    
     if (FAILED(hr))
     {
         if (pszDest)
         {
-            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerA()
+            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerA()
 
             if (dwFlags & STRSAFE_FILL_ON_FAILURE)
             {
@@ -5354,7 +3899,8 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
                     pszDestEnd = pszDest;
                     cchRemaining = cchDest;
                 }
-                else if (cchDest > 0)
+                else
+                if (cchDest > 0)
                 {
                     pszDestEnd = pszDest + cchDest - 1;
                     cchRemaining = 1;
@@ -5364,7 +3910,7 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
                 }
             }
 
-            if (dwFlags & (STRSAFE_NULL_ON_FAILURE))
+            if (dwFlags & STRSAFE_NULL_ON_FAILURE)
             {
                 if (cchDest > 0)
                 {
@@ -5380,7 +3926,7 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
 
     if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
     {
-        if (ppszDestEnd)
+        if (ppszDestEnd) 
         {
             *ppszDestEnd = pszDestEnd;
         }
@@ -5395,13 +3941,11 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchMaxAppend, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
+STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     WCHAR* pszDestEnd = pszDest;
     size_t cchRemaining = 0;
-    size_t cchDestCurrent = 0;
-
 
     // ASSERT(cbDest == (cchDest * sizeof(WCHAR)) ||
     //        cbDest == (cchDest * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
@@ -5413,6 +3957,8 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
     }
     else
     {
+        size_t cchDestCurrent;
+
         if (dwFlags & STRSAFE_IGNORE_NULLS)
         {
             if (pszDest == NULL)
@@ -5475,14 +4021,13 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
             {
                 // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass
                 // those flags through
-                hr = StringCopyNExWorkerW(pszDestEnd,
-                                          cchRemaining,
-                                          (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)),
-                                          pszSrc,
-                                          cchMaxAppend,
-                                          &pszDestEnd,
-                                          &cchRemaining,
-                                          dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
+                hr = StringCopyExWorkerW(pszDestEnd,
+                                         cchRemaining,
+                                         (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)),
+                                         pszSrc,
+                                         &pszDestEnd,
+                                         &cchRemaining,
+                                         dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));            
             }
         }
     }
@@ -5491,12 +4036,12 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
     {
         if (pszDest)
         {
-            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerW()
+            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerW()
 
             if (dwFlags & STRSAFE_FILL_ON_FAILURE)
             {
                 memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
-
+            
                 if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
                 {
                     pszDestEnd = pszDest;
@@ -5512,7 +4057,7 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
                 }
             }
 
-            if (dwFlags & (STRSAFE_NULL_ON_FAILURE))
+            if (dwFlags & STRSAFE_NULL_ON_FAILURE)
             {
                 if (cchDest > 0)
                 {
@@ -5528,7 +4073,7 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
 
     if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
     {
-        if (ppszDestEnd)
+        if (ppszDestEnd) 
         {
             *ppszDestEnd = pszDestEnd;
         }
@@ -5543,93 +4088,50 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
 
-STRSAFEAPI StringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList)
+STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend)
 {
-    HRESULT hr = S_OK;
-
-    if (cchDest == 0)
-    {
-        // can not null terminate a zero-byte dest buffer
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else
-    {
-        int iRet;
-        size_t cchMax;
-
-        // leave the last space for the null terminator
-        cchMax = cchDest - 1;
-
-        iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
-        // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax));
+    HRESULT hr;
+    size_t cchDestCurrent;
 
-        if ((iRet < 0) || (((size_t)iRet) > cchMax))
-        {
-            // need to null terminate the string
-            pszDest += cchMax;
-            *pszDest = '\0';
+    hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
 
-            // we have truncated pszDest
-            hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-        }
-        else if (((size_t)iRet) == cchMax)
-        {
-            // need to null terminate the string
-            pszDest += cchMax;
-            *pszDest = '\0';
-        }
-    }
+    if (SUCCEEDED(hr))
+    {
+        hr = StringCopyNWorkerA(pszDest + cchDestCurrent,
+                                cchDest - cchDestCurrent,
+                                pszSrc,
+                                cchMaxAppend);
+    }    
 
     return hr;
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringVPrintfWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszFormat, va_list argList)
+STRSAFEAPI StringCatNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend)
 {
-    HRESULT hr = S_OK;
-
-    if (cchDest == 0)
-    {
-        // can not null terminate a zero-byte dest buffer
-        hr = STRSAFE_E_INVALID_PARAMETER;
-    }
-    else    
-    {
-        int iRet;
-        size_t cchMax;
-
-        // leave the last space for the null terminator
-        cchMax = cchDest - 1;
-
-        iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList);
-        // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax));
+    HRESULT hr;
+    size_t cchDestCurrent;
 
-        if ((iRet < 0) || (((size_t)iRet) > cchMax))
-        {
-            // need to null terminate the string
-            pszDest += cchMax;
-            *pszDest = L'\0';
+    hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
 
-            // we have truncated pszDest
-            hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-        }
-        else if (((size_t)iRet) == cchMax)
-        {
-            // need to null terminate the string
-            pszDest += cchMax;
-            *pszDest = L'\0';
-        }
+    if (SUCCEEDED(hr))
+    {
+        hr = StringCopyNWorkerW(pszDest + cchDestCurrent,
+                                cchDest - cchDestCurrent,
+                                pszSrc,
+                                cchMaxAppend);
     }
 
     return hr;
 }
 #endif // FEATURE_PAL || !PLATFORM_UNIX
 
-STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList)
+STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     char* pszDestEnd = pszDest;
     size_t cchRemaining = 0;
+    size_t cchDestCurrent = 0;
 
     // ASSERT(cbDest == (cchDest * sizeof(char))    ||
     //        cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char)));
@@ -5645,28 +4147,49 @@ STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest,
         {
             if (pszDest == NULL)
             {
-                if ((cchDest != 0) || (cbDest != 0))
+                if ((cchDest == 0) && (cbDest == 0))
+                {
+                    cchDestCurrent = 0;
+                }
+                else
                 {
                     // NULL pszDest and non-zero cchDest/cbDest is invalid
                     hr = STRSAFE_E_INVALID_PARAMETER;
                 }
             }
+            else
+            {
+                hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
+
+                if (SUCCEEDED(hr))
+                {
+                    pszDestEnd = pszDest + cchDestCurrent;
+                    cchRemaining = cchDest - cchDestCurrent;
+                }
+            }
 
-            if (pszFormat == NULL)
+            if (pszSrc == NULL)
             {
-                pszFormat = "";
+                pszSrc = "";
             }
         }
-    
+        else
+        {
+            hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent);
+
+            if (SUCCEEDED(hr))
+            {
+                pszDestEnd = pszDest + cchDestCurrent;
+                cchRemaining = cchDest - cchDestCurrent;
+            }
+        }
+
         if (SUCCEEDED(hr))
         {
             if (cchDest == 0)
             {
-                pszDestEnd = pszDest;
-                cchRemaining = 0;
-
-                // only fail if there was actually a non-empty format string
-                if (*pszFormat != '\0')
+                // only fail if there was actually src data to append
+                if (*pszSrc != '\0')
                 {
                     if (pszDest == NULL)
                     {
@@ -5680,46 +4203,16 @@ STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest,
             }
             else
             {
-                int iRet;
-                size_t cchMax;
-
-                // leave the last space for the null terminator
-                cchMax = cchDest - 1;
-
-                iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
-                // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax));
-
-                if ((iRet < 0) || (((size_t)iRet) > cchMax))
-                {
-                    // we have truncated pszDest
-                    pszDestEnd = pszDest + cchMax;
-                    cchRemaining = 1;
-
-                    // need to null terminate the string
-                    *pszDestEnd = '\0';
-
-                    hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-                }
-                else if (((size_t)iRet) == cchMax)
-                {
-                    // string fit perfectly
-                    pszDestEnd = pszDest + cchMax;
-                    cchRemaining = 1;
-
-                    // need to null terminate the string
-                    *pszDestEnd = '\0';
-                }
-                else if (((size_t)iRet) < cchMax)
-                {
-                    // there is extra room
-                    pszDestEnd = pszDest + iRet;
-                    cchRemaining = cchDest - iRet;
-
-                    if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
-                    {
-                        memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
-                    }
-                }
+                // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass
+                // those flags through
+                hr = StringCopyNExWorkerA(pszDestEnd,
+                                          cchRemaining,
+                                          (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)),
+                                          pszSrc,
+                                          cchMaxAppend,
+                                          &pszDestEnd,
+                                          &cchRemaining,
+                                          dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
             }
         }
     }
@@ -5728,6 +4221,8 @@ STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest,
     {
         if (pszDest)
         {
+            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerA()
+
             if (dwFlags & STRSAFE_FILL_ON_FAILURE)
             {
                 memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
@@ -5747,7 +4242,7 @@ STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest,
                 }
             }
 
-            if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
+            if (dwFlags & (STRSAFE_NULL_ON_FAILURE))
             {
                 if (cchDest > 0)
                 {
@@ -5763,7 +4258,7 @@ STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest,
 
     if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
     {
-        if (ppszDestEnd) 
+        if (ppszDestEnd)
         {
             *ppszDestEnd = pszDestEnd;
         }
@@ -5778,11 +4273,13 @@ STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest,
 }
 
 #if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringVPrintfExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const WCHAR* pszFormat, va_list argList)
+STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchMaxAppend, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
 {
     HRESULT hr = S_OK;
     WCHAR* pszDestEnd = pszDest;
     size_t cchRemaining = 0;
+    size_t cchDestCurrent = 0;
+
 
     // ASSERT(cbDest == (cchDest * sizeof(WCHAR)) ||
     //        cbDest == (cchDest * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
@@ -5798,16 +4295,40 @@ STRSAFEAPI StringVPrintfExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest,
         {
             if (pszDest == NULL)
             {
-                if ((cchDest != 0) || (cbDest != 0))
+                if ((cchDest == 0) && (cbDest == 0))
+                {
+                    cchDestCurrent = 0;
+                }
+                else
                 {
                     // NULL pszDest and non-zero cchDest/cbDest is invalid
                     hr = STRSAFE_E_INVALID_PARAMETER;
                 }
             }
+            else
+            {
+                hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
+
+                if (SUCCEEDED(hr))
+                {
+                    pszDestEnd = pszDest + cchDestCurrent;
+                    cchRemaining = cchDest - cchDestCurrent;
+                }
+            }
+
+            if (pszSrc == NULL)
+            {
+                pszSrc = u"";
+            }
+        }
+        else
+        {
+            hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent);
 
-            if (pszFormat == NULL)
+            if (SUCCEEDED(hr))
             {
-                pszFormat = u"";
+                pszDestEnd = pszDest + cchDestCurrent;
+                cchRemaining = cchDest - cchDestCurrent;
             }
         }
 
@@ -5815,11 +4336,8 @@ STRSAFEAPI StringVPrintfExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest,
         {
             if (cchDest == 0)
             {
-                pszDestEnd = pszDest;
-                cchRemaining = 0;
-
-                // only fail if there was actually a non-empty format string
-                if (*pszFormat != L'\0')
+                // only fail if there was actually src data to append
+                if (*pszSrc != L'\0')
                 {
                     if (pszDest == NULL)
                     {
@@ -5833,54 +4351,26 @@ STRSAFEAPI StringVPrintfExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest,
             }
             else
             {
-                int iRet;
-                size_t cchMax;
-
-                // leave the last space for the null terminator
-                cchMax = cchDest - 1;
-
-                iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList);
-                // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax));
-
-                if ((iRet < 0) || (((size_t)iRet) > cchMax))
-                {
-                    // we have truncated pszDest
-                    pszDestEnd = pszDest + cchMax;
-                    cchRemaining = 1;
-
-                    // need to null terminate the string
-                    *pszDestEnd = L'\0';
-
-                    hr = STRSAFE_E_INSUFFICIENT_BUFFER;
-                }
-                else if (((size_t)iRet) == cchMax)
-                {
-                    // string fit perfectly
-                    pszDestEnd = pszDest + cchMax;
-                    cchRemaining = 1;
-
-                    // need to null terminate the string
-                    *pszDestEnd = L'\0';
-                }
-                else if (((size_t)iRet) < cchMax)
-                {
-                    // there is extra room
-                    pszDestEnd = pszDest + iRet;
-                    cchRemaining = cchDest - iRet;
-
-                    if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
-                    {
-                        memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
-                    }
-                }
+                // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass
+                // those flags through
+                hr = StringCopyNExWorkerW(pszDestEnd,
+                                          cchRemaining,
+                                          (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)),
+                                          pszSrc,
+                                          cchMaxAppend,
+                                          &pszDestEnd,
+                                          &cchRemaining,
+                                          dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE)));
             }
         }
     }
-    
+
     if (FAILED(hr))
     {
         if (pszDest)
         {
+            // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerW()
+
             if (dwFlags & STRSAFE_FILL_ON_FAILURE)
             {
                 memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
@@ -5900,7 +4390,7 @@ STRSAFEAPI StringVPrintfExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest,
                 }
             }
 
-            if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
+            if (dwFlags & (STRSAFE_NULL_ON_FAILURE))
             {
                 if (cchDest > 0)
                 {
@@ -5916,7 +4406,7 @@ STRSAFEAPI StringVPrintfExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest,
 
     if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
     {
-        if (ppszDestEnd) 
+        if (ppszDestEnd)
         {
             *ppszDestEnd = pszDestEnd;
         }
index 7a53c8c..4d21fb7 100644 (file)
@@ -43,7 +43,6 @@
 #cmakedefine01 HAVE_LOCALTIME_R
 #cmakedefine01 HAVE_GMTIME_R
 #cmakedefine01 HAVE_TIMEGM
-#cmakedefine01 HAVE__SNWPRINTF
 #cmakedefine01 HAVE_POLL
 #cmakedefine01 HAVE_STATVFS
 #cmakedefine01 HAVE_THREAD_SELF
index 82ae08a..f4b83bc 100644 (file)
@@ -62,7 +62,6 @@ check_function_exists(sysconf HAVE_SYSCONF)
 check_function_exists(localtime_r HAVE_LOCALTIME_R)
 check_function_exists(gmtime_r HAVE_GMTIME_R)
 check_function_exists(timegm HAVE_TIMEGM)
-check_function_exists(_snwprintf HAVE__SNWPRINTF)
 check_function_exists(poll HAVE_POLL)
 check_function_exists(statvfs HAVE_STATVFS)
 check_function_exists(thread_self HAVE_THREAD_SELF)
index dab0478..8396418 100644 (file)
@@ -277,67 +277,6 @@ PAL_vprintf(
 
 /*++
 Function:
-  _snprintf
-
-See MSDN doc.
---*/
-int
-__cdecl
-_snprintf(
-     char *buffer,
-     size_t count,
-     const char *format,
-     ...)
-{
-    LONG Length;
-    va_list ap;
-
-    PERF_ENTRY(_snprintf);
-    ENTRY("_snprintf (buffer=%p, count=%lu, format=%p (%s))\n",
-          buffer, (unsigned long) count, format, format);
-
-    va_start(ap, format);
-    Length = InternalVsnprintf(CorUnix::InternalGetCurrentThread(), buffer, count, format, ap);
-    va_end(ap);
-
-    LOGEXIT("_snprintf returns int %d\n", Length);
-    PERF_EXIT(_snprintf);
-    return Length;
-} 
-
-
-/*++
-Function:
-  _snwprintf
-
-See MSDN doc.
---*/
-int
-__cdecl
-_snwprintf(
-     wchar_16 *buffer,
-     size_t count,
-     const wchar_16 *format,
-     ...)
-{
-    LONG Length;
-    va_list ap;
-
-    PERF_ENTRY(_snwprintf);
-    ENTRY("_snwprintf (buffer=%p, count=%lu, format=%p (%S))\n",
-          buffer, (unsigned long) count, format, format);
-
-    va_start(ap, format);
-    Length = PAL__wvsnprintf(buffer, count, format, ap);
-    va_end(ap);
-
-    LOGEXIT("_snwprintf returns int %d\n", Length);
-    PERF_EXIT(_snwprintf);
-    return Length;
-}
-
-/*++
-Function:
   fwprintf
 
 See MSDN doc.
@@ -1592,33 +1531,6 @@ PAL_vswprintf(wchar_16 *buffer,
 }
 
 
-/*++
-Function:
-  _vsnwprintf
-
-See MSDN doc.
---*/
-int 
-__cdecl 
-_vsnwprintf(wchar_16 *buffer, 
-            size_t count, 
-            const wchar_16 *format, 
-            va_list argptr)
-{
-    LONG Length;
-
-    PERF_ENTRY(_vsnwprintf);
-    ENTRY("_vsnwprintf (buffer=%p, count=%lu, format=%p (%S), argptr=%p)\n", 
-          buffer, (unsigned long) count, format, format, argptr);
-       
-    Length = PAL__wvsnprintf(buffer, count, format, argptr);
-
-    LOGEXIT("_vsnwprintf returns int %d\n", Length);
-    PERF_EXIT(_vsnwprintf);
-
-    return Length;
-}
-
 #if SSCANF_CANNOT_HANDLE_MISSING_EXPONENT
 /*++
 Function:
index 218d40d..44f2528 100644 (file)
@@ -183,12 +183,6 @@ function_name() to call the system's implementation
 #define strpbrk DUMMY_strpbrk
 #define strtod DUMMY_strtod
 #define strspn DUMMY_strspn
-#if HAVE__SNPRINTF
-#define _snprintf DUMMY__snprintf
-#endif /* HAVE__SNPRINTF */
-#if HAVE__SNWPRINTF
-#define _snwprintf DUMMY__snwprintf
-#endif  /* HAVE__SNWPRINTF */
 #define tolower DUMMY_tolower
 #define toupper DUMMY_toupper
 #define islower DUMMY_islower
@@ -510,10 +504,6 @@ function_name() to call the system's implementation
 #undef wprintf
 #undef sprintf
 #undef swprintf
-#undef _snprintf
-#if HAVE__SNWPRINTF
-#undef _snwprintf
-#endif  /* HAVE__SNWPRINTF */
 #undef sscanf
 #undef wcstod
 #undef wcstol
@@ -540,7 +530,6 @@ function_name() to call the system's implementation
 #undef vsprintf
 #undef vswprintf
 #undef _vsnprintf
-#undef _vsnwprintf
 #undef vsnprintf
 #undef wvsnprintf
 
index ca853d9..9b3ffd5 100644 (file)
@@ -153,8 +153,6 @@ int _ungetwc_nolock( wchar_t inChar, miniFILE* inStream )
 /* routine used for floating-point output */
 #define FORMATSIZE 30
 
-#define _snprintf   snprintf
-
 // taken from output.inl
 #define FL_ALTERNATE  0x00080   /* alternate form requested */
 
@@ -181,7 +179,7 @@ errno_t _safecrt_cfltcvt(double *arg, char *buffer, size_t sizeInBytes, int type
     format[formatlen] = 0;
 
     buffer[sizeInBytes - 1] = 0;
-    retvalue = _snprintf(buffer, sizeInBytes, format, *arg);
+    retvalue = snprintf(buffer, sizeInBytes, format, *arg);
     if (buffer[sizeInBytes - 1] != 0 || retvalue <= 0)
     {
         buffer[0] = 0;
index ae0692e..5b86cf2 100644 (file)
@@ -857,6 +857,12 @@ int __cdecl _output (
                     flags |= FL_LONG;   /* 'l' => long int or wchar_t */
                 }
                 break;
+            case _T('L'):
+                if (*format == _T('p'))
+                {
+                    flags |= FL_LONG;   
+                }
+                break;
 
             case _T('I'):
                 /*
@@ -956,7 +962,11 @@ int __cdecl _output (
 #else  /* _UNICODE */
                 if (flags & (FL_LONG|FL_WIDECHAR)) {
                     wchar = (wchar_t) get_int_arg(&argptr);
-                    no_output = 1;
+                    textlen = snprintf(buffer.sz, BUFFERSIZE, "%lc", wchar);
+                    if (textlen == 0)
+                    {
+                        no_output = 1;
+                    }
                 } else {
                     /* format multibyte character */
                     /* this is an extension of ANSI */
@@ -1172,7 +1182,15 @@ int __cdecl _output (
 
                 precision = 2 * sizeof(void *);     /* number of hex digits needed */
 #if PTR_IS_INT64
-                flags |= FL_I64;                    /* assume we're converting an int64 */
+                if (flags & (FL_LONG | FL_SHORT))
+                {
+                    /* %lp, %Lp or %hp - these print 8 hex digits*/
+                    precision = 2 * sizeof(int32_t);
+                }
+                else
+                {
+                    flags |= FL_I64;                /* assume we're converting an int64 */
+                }
 #elif !PTR_IS_INT
                 flags |= FL_LONG;                   /* assume we're converting a long */
 #endif  /* !PTR_IS_INT */
@@ -1371,7 +1389,22 @@ int __cdecl _output (
                 /* write text */
 #ifndef _UNICODE
                 if (bufferiswide && (textlen > 0)) {
-                    charsout = -1;
+                    const WCHAR *p;
+                    int mbCharCount;
+                    int count;
+                    char mbStr[5];
+
+                    p = text.wz;
+                    count = textlen;
+                    while (count-- > 0) {
+                        mbCharCount = snprintf(mbStr, sizeof(mbStr), "%lc", *p);
+                        if (mbCharCount == 0) {
+                            charsout = -1;
+                            break;
+                        }
+                        WRITE_STRING(mbStr, mbCharCount, &charsout);
+                        p++;
+                    }
                 } else {
                     WRITE_STRING(text.sz, textlen, &charsout);
                 }
index c892d1a..dea8716 100644 (file)
@@ -8,7 +8,7 @@
 
 *
 *Purpose:
-*       The _snprintf() flavor takes a count argument that is
+*       The sprintf_s() flavor takes a count argument that is
 *       the max number of bytes that should be written to the
 *       user's buffer.
 *
index 5454179..8a51d26 100644 (file)
@@ -8,7 +8,7 @@
 
 *
 *Purpose:
-*       defines sprintf() and _snprintf() - print formatted data to string
+*       defines sprintf_s() and _snprintf_s() - print formatted data to string
 *
 *******************************************************************************/
 
@@ -22,9 +22,9 @@
 
 /***
 *ifndef _COUNT_
-*int sprintf(string, format, ...) - print formatted data to string
+*int sprintf_s(string, format, ...) - print formatted data to string
 *else
-*int _snprintf(string, cnt, format, ...) - print formatted data to string
+*int _snprintf_s(string, cnt, format, ...) - print formatted data to string
 *endif
 *
 *Purpose:
@@ -40,7 +40,7 @@
 *       entries are in are in DGROUP and, thus, are near.
 *
 *ifdef _COUNT_
-*       The _snprintf() flavor takes a count argument that is
+*       The _snprintf_s() flavor takes a count argument that is
 *       the max number of bytes that should be written to the
 *       user's buffer.
 *endif
@@ -76,7 +76,7 @@ int sprintf_s (
         int ret;
         va_list arglist;
         va_start(arglist, format);
-        ret = _vsprintf_s(string, sizeInBytes, format, arglist);
+        ret = vsprintf_s(string, sizeInBytes, format, arglist);
         va_end(arglist);
         return ret;
 }
index 75004ea..2fbfcfa 100644 (file)
@@ -92,7 +92,7 @@ int __cdecl swprintf_s (
 
     va_start(arglist, format);
 
-    ret = _vswprintf_s(string, sizeInWords, format, arglist);
+    ret = vswprintf_s(string, sizeInWords, format, arglist);
 
     va_end(arglist);
 
index 4f2bd9f..e1a94d0 100644 (file)
@@ -119,7 +119,7 @@ int __cdecl _vsnprintf_helper (
         return -1;
 }
 
-int __cdecl _vsprintf_s (
+int __cdecl vsprintf_s (
         char *string,
         size_t sizeInBytes,
         const char *format,
index 77c79b8..b9940a6 100644 (file)
@@ -6,7 +6,7 @@
 *vswprint.c - print formatted data into a string from var arg list
 *
 *Purpose:
-*       defines vswprintf(), _vswprintf_c and _vsnwprintf() - print formatted output to
+*       defines vswprintf_s() and _vsnwprintf_s() - print formatted output to
 *       a string, get the data from an argument ptr instead of explicit
 *       arguments.
 *
 typedef int (*WOUTPUTFN)(miniFILE *, const wchar_t *, va_list);
 
 static int _vswprintf_helper( WOUTPUTFN outfn, wchar_t *string, size_t count, const wchar_t *format, va_list ap );
-static int _vscwprintf_helper (WOUTPUTFN outfn, const wchar_t *format, va_list ap );
 
 /***
-*ifndef _COUNT_
-*int _vswprintf(string, format, ap) - print formatted data to string from arg ptr
-*else
-*ifndef _SWPRINTFS_ERROR_RETURN_FIX
-*int _vsnwprintf(string, cnt, format, ap) - print formatted data to string from arg ptr
-*else
-*int _vswprintf_c(string, cnt, format, ...) - print formatted data to string
-*endif
-*endif
-*
+*int vswprintf_s(string, sizeInWords, format, ap) - print formatted data to string from arg ptr
+*int _vsnwprintf_s(string, sizeInWords, cnt, format, ap) - print formatted data to string from arg ptr
 *Purpose:
 *       Prints formatted data, but to a string and gets data from an argument
 *       pointer.
@@ -47,21 +38,10 @@ static int _vscwprintf_helper (WOUTPUTFN outfn, const wchar_t *format, va_list a
 *       the stack so that other routines can assume that _iob[] entries are in
 *       are in DGROUP and, thus, are near.
 *
-*ifdef _COUNT_
-*ifndef _SWPRINTFS_ERROR_RETURN_FIX
-*       The _vsnwprintf() flavor takes a count argument that is
+*       The _vsnwprintf_s() flavor takes a count argument that is
 *       the max number of bytes that should be written to the
 *       user's buffer.
 *       We don't expose this function directly in the headers.
-*else
-*       The _vswprintf_c() flavor does the same thing as the _snwprintf
-*       above, but, it also fixes an issue in the return value in the case
-*       when there isn't enough space to write the null terminator
-*       We don't fix this issue in _vsnwprintf because of backward
-*       compatibility. In new code, however, _vsnwprintf is #defined to
-*       _vswprintf_c so users get the fix.
-*
-*endif
 *
 *       Multi-thread: (1) Since there is no stream, this routine must never try
 *       to get the stream lock (i.e., there is no stream lock either).  (2)
@@ -70,9 +50,8 @@ static int _vscwprintf_helper (WOUTPUTFN outfn, const wchar_t *format, va_list a
 *
 *Entry:
 *       wchar_t *string - place to put destination string
-*ifdef _COUNT_
+*       size_t sizeInWords - size of the string buffer in wchar_t units
 *       size_t count - max number of bytes to put in buffer
-*endif
 *       wchar_t *format - format string, describes format of data
 *       va_list ap - varargs argument pointer
 *
@@ -133,7 +112,7 @@ int __cdecl _vswprintf_helper (
         return -1;
 }
 
-int __cdecl _vswprintf_s (
+int __cdecl vswprintf_s (
         wchar_t *string,
         size_t sizeInWords,
         const wchar_t *format,
@@ -230,53 +209,3 @@ int __cdecl _vsnwprintf_s (
 
     return (retvalue < 0 ? -1 : retvalue);
 }
-
-/***
-* _vscwprintf() - counts the number of character needed to print the formatted
-* data
-*
-*Purpose:
-*       Counts the number of characters in the fotmatted data.
-*
-*Entry:
-*       wchar_t *format - format string, describes format of data
-*       va_list ap - varargs argument pointer
-*
-*Exit:
-*       returns number of characters needed to print formatted data.
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-#ifndef _COUNT_
-
-int __cdecl _vscwprintf_helper (
-        WOUTPUTFN woutfn,
-        const wchar_t *format,
-        va_list ap
-        )
-{
-        miniFILE str;
-        miniFILE *outfile = &str;
-        int retval;
-
-        _VALIDATE_RETURN( (format != NULL), EINVAL, -1);
-
-        outfile->_cnt = INT_MAX; //MAXSTR;
-        outfile->_flag = _IOWRT|_IOSTRG;
-        outfile->_ptr = outfile->_base = NULL;
-
-        retval = woutfn(outfile, format, ap);
-        return(retval);
-}
-
-int __cdecl _vscwprintf (
-        const wchar_t *format,
-        va_list ap
-        )
-{
-        return _vscwprintf_helper(_woutput_s, format, ap);
-}
-
-#endif  /* _COUNT_ */
index 315145d..c57d604 100644 (file)
@@ -2095,7 +2095,7 @@ PAL_GetTransportPipeName(char *name, DWORD id, const char *suffix)
     // also try to use 0 as the value.
     _ASSERTE(ret == TRUE || disambiguationKey == 0);
 
-    int chars = _snprintf(name, MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH, PipeNameFormat, id, disambiguationKey, suffix);
+    int chars = snprintf(name, MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH, PipeNameFormat, id, disambiguationKey, suffix);
     _ASSERTE(chars > 0 && chars < MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH);
 }
 
index c45dd60..d2da527 100644 (file)
@@ -160,13 +160,13 @@ add_subdirectory(_putenv)
 add_subdirectory(_putw)
 add_subdirectory(_rotl)
 add_subdirectory(_rotr)
-add_subdirectory(_snprintf)
-add_subdirectory(_snwprintf)
+add_subdirectory(_snprintf_s)
+add_subdirectory(_snwprintf_s)
 add_subdirectory(_stricmp)
 add_subdirectory(_strlwr)
 add_subdirectory(_strnicmp)
 add_subdirectory(_vsnprintf)
-add_subdirectory(_vsnwprintf)
+add_subdirectory(_vsnwprintf_s)
 add_subdirectory(_wcsicmp)
 add_subdirectory(_wcslwr)
 add_subdirectory(_wcsnicmp)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt
deleted file mode 100644 (file)
index 7319680..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
-  test5.cpp
-)
-
-add_executable(paltest_snprintf_test5
-  ${SOURCES}
-)
-
-add_dependencies(paltest_snprintf_test5 coreclrpal)
-
-target_link_libraries(paltest_snprintf_test5
-  pthread
-  m
-  coreclrpal
-)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.cpp
deleted file mode 100644 (file)
index 46ab1dd..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source:  test5.c
-**
-** Purpose: Tests _snprintf with the count specifier
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-#include "../_snprintf.h"
-
-/*
- * Notes: memcmp is used, as is strlen.
- */
-
-
-int __cdecl main(int argc, char *argv[])
-{
-    char *longStr =
- "really-long-string-that-just-keeps-going-on-and-on-and-on.."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        "%n bar";
-    char *longResult =
- "really-long-string-that-just-keeps-going-on-and-on-and-on.."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        " bar";
-
-    if (PAL_Initialize(argc, argv) != 0)
-    {
-        return FAIL;
-    }
-
-    DoCountTest("foo %n bar", 4, "foo  bar");
-    DoCountTest(longStr, 257, longResult);
-    DoCountTest("fo%n bar", 2, "fo bar");
-    DoCountTest("%n", 0, "");
-    DoCountTest("foo %#n bar", 4, "foo  bar");
-    DoCountTest("foo % n bar", 4, "foo  bar");
-    DoCountTest("foo %+n bar", 4, "foo  bar");
-    DoCountTest("foo %-n bar", 4, "foo  bar");
-    DoCountTest("foo %0n bar", 4, "foo  bar");
-    DoShortCountTest("foo %hn bar", 4, "foo  bar");
-    DoCountTest("foo %ln bar", 4, "foo  bar");
-    DoCountTest("foo %Ln bar", 4, "foo  bar");
-    DoCountTest("foo %I64n bar", 4, "foo  bar");
-    DoCountTest("foo %20.3n bar", 4, "foo  bar");
-
-    PAL_Terminate();
-    return PASS;
-}
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat
deleted file mode 100644 (file)
index 33056de..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
-TYPE = DEFAULT
-EXE1 = test5
-Description
-= Tests _snprintf with the count specifier
@@ -14,7 +14,6 @@ add_subdirectory(test19)
 add_subdirectory(test2)
 add_subdirectory(test3)
 add_subdirectory(test4)
-add_subdirectory(test5)
 add_subdirectory(test6)
 add_subdirectory(test7)
 add_subdirectory(test8)
@@ -4,9 +4,9 @@
 
 /*============================================================================
 **
-** Source:  _snprintf.h
+** Source:  sprintf_s.h
 **
-** Purpose: Containts common testing functions for _snprintf
+** Purpose: Containts common testing functions for sprintf_s
 **
 **
 **==========================================================================*/
@@ -18,7 +18,7 @@ void DoStrTest(const char *formatstr, char* param, const char *checkstr)
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, param);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
     {
         Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n"
@@ -31,7 +31,7 @@ void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr)
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, param);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
     {
         Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n"
@@ -46,7 +46,7 @@ void DoPointerTest(const char *formatstr, void* param, char* paramstr, char
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, param);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0)
     {
         Fail("ERROR: failed to insert %s into \"%s\"\n"
@@ -60,7 +60,7 @@ void DoCountTest(const char *formatstr, int param, const char *checkstr)
     char buf[512] = { 0 };
     int n = -1;
     
-    _snprintf(buf, 512, formatstr, &n);
+    sprintf_s(buf, 512, formatstr, &n);
 
     if (n != param)
     {
@@ -78,7 +78,7 @@ void DoShortCountTest(const char *formatstr, int param, const char *checkstr)
     char buf[256] = { 0 };
     short int n = -1;
     
-    _snprintf(buf, 256, formatstr, &n);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, &n);
 
     if (n != param)
     {
@@ -95,7 +95,7 @@ void DoCharTest(const char *formatstr, char param, const char *checkstr)
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, param);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
     {
         Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n"
@@ -108,7 +108,7 @@ void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr)
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, param);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
     {
         Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n"
@@ -121,7 +121,7 @@ void DoNumTest(const char *formatstr, int value, const char *checkstr)
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, value);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, value);
     if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
     {
         Fail("ERROR: failed to insert %#x into \"%s\"\n"
@@ -134,7 +134,7 @@ void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *c
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, value);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, value);
     if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0)
     {
         Fail("ERROR: failed to insert %s into \"%s\"\n"
@@ -148,7 +148,7 @@ void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, ch
 {
     char buf[256] = { 0 };
 
-    _snprintf(buf, 256, formatstr, value);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, value);
     if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0
        && memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
     {
@@ -163,7 +163,7 @@ void DoArgumentPrecTest(const char *formatstr, int precision, void *param, char
 {
     char buf[256];
 
-    _snprintf(buf, 256, formatstr, precision, param);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param);
     if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
        memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
     {
@@ -179,7 +179,7 @@ const char *checkstr1, const char *checkstr2)
 {
     char buf[256];
 
-    _snprintf(buf, 256, formatstr, precision, param);
+    _snprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param);
     if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
        memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
     {
@@ -6,7 +6,7 @@
 **
 ** Source:  test1.c
 **
-** Purpose: General test to see if _snprintf works correctly
+** Purpose: General test to see if sprintf_s works correctly
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -33,21 +33,21 @@ int __cdecl main(int argc, char *argv[])
     }
 
 
-    _snprintf(buf, 256, "hello world");
+    _snprintf_s(buf, 256, _TRUNCATE, "hello world");
     if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0)
     {
         Fail("ERROR: expected \"%s\" (up to %d chars), got \"%s\"\n",
              checkstr, 256, buf);
     }
 
-    _snprintf(buf, 256, "xxxxxxxxxxxxxxxxx");
-    ret = _snprintf(buf, 8, "hello world");
+    _snprintf_s(buf, 256, _TRUNCATE, "xxxxxxxxxxxxxxxxx");
+    ret = _snprintf_s(buf, 8, _TRUNCATE, "hello world");
 
     if (ret >= 0)
     {
         Fail("ERROR: expected negative return value, got %d", ret);
     }
-    if (memcmp(checkstr, buf, 8) != 0 || buf[8] != 'x')
+    if (memcmp(checkstr, buf, 7) != 0 || buf[7] != 0 || buf[8] != 'x')
     {
         Fail("ERROR: expected %s (up to %d chars), got %s\n",
               checkstr, 8, buf);
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test1
 Description
-= General test to see if _snprintf works correctly
+= General test to see if sprintf_s works correctly
@@ -6,7 +6,7 @@
 **
 ** Source:  test10.c
 **
-** Purpose: Tests _snprintf with octal numbers
+** Purpose: Tests sprintf_s with octal numbers
 **
 **
 **==========================================================================*/
@@ -15,7 +15,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test10
 Description
-= Tests _snprintf with octal numbers
+= Tests sprintf_s with octal numbers
@@ -6,7 +6,7 @@
 **
 ** Source:  test11.c
 **
-** Purpose: Tests _snprintf with unsigned numbers
+** Purpose: Tests sprintf_s with unsigned numbers
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test11
 Description
-= Tests _snprintf with unsigned numbers
+= Tests sprintf_s with unsigned numbers
@@ -6,7 +6,7 @@
 **
 ** Source:  test12.c
 **
-** Purpose: Tests _snprintf with hex numbers (lowercase)
+** Purpose: Tests sprintf_s with hex numbers (lowercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test12
 Description
-= Tests _snprintf with hex numbers (lowercase)
+= Tests sprintf_s with hex numbers (lowercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test13.c
 **
-** Purpose: Tests _snprintf with hex numbers (uppercase)
+** Purpose: Tests sprintf_s with hex numbers (uppercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test13
 Description
-= Tests _snprintf with hex numbers (uppercase)
+= Tests sprintf_s with hex numbers (uppercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test14.c
 **
-** Purpose: Tests _snprintf with exponential format doubles (lowercase)
+** Purpose: Tests sprintf_s with exponential format doubles (lowercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test14
 Description
-= Tests _snprintf with exponential format doubles (lowercase)
+= Tests sprintf_s with exponential format doubles (lowercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test15.c
 **
-** Purpose: Tests _snprintf with exponential format doubles (uppercase)
+** Purpose: Tests sprintf_s with exponential format doubles (uppercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test15
 Description
-= Tests _snprintf with exponential format doubles (uppercase)
+= Tests sprintf_s with exponential format doubles (uppercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test16.c
 **
-** Purpose: Test #15 for the _snprintf function 
+** Purpose: Test #15 for the sprintf_s function 
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test16
 Description
-= Tests _snprintf with decimal point format doubles
+= Tests sprintf_s with decimal point format doubles
@@ -6,7 +6,7 @@
 **
 ** Source:  test17.c
 **
-** Purpose: Tests _snprintf with compact format doubles (lowercase)
+** Purpose: Tests sprintf_s with compact format doubles (lowercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test17
 Description
-= Tests _snprintf with compact format doubles (lowercase)
+= Tests sprintf_s with compact format doubles (lowercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test18.c
 **
-** Purpose: Tests _snprintf with compact format doubles (uppercase)
+** Purpose: Tests sprintf_s with compact format doubles (uppercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test18
 Description
-= Tests _snprintf with compact format doubles (uppercase)
+= Tests sprintf_s with compact format doubles (uppercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test19.c
 **
-** Purpose:Tests _snprintf with argument specified precision 
+** Purpose:Tests sprintf_s with argument specified precision 
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -31,12 +31,6 @@ int __cdecl main(int argc, char *argv[])
 
     DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba");
     DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba");
-    DoArgumentPrecTest("%.*n", 3, (void*)&n, "pointer to int", "", "");
-    if (n != 0)
-    {
-        Fail("ERROR: Expected count parameter to resolve to %d, got %X\n",
-              0, n);
-    }
 
     DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a");
     DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a");
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test19
 Description
-= Tests _snprintf with argument specified precision
+= Tests sprintf_s with argument specified precision
@@ -6,7 +6,7 @@
 **
 ** Source:  test2.c
 **
-** Purpose:Tests _snprintf with strings
+** Purpose:Tests sprintf_s with strings
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 /*
  * Notes: memcmp is used, as is strlen.
  */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test2
 Description
-= Tests _snprintf with strings
+= Tests sprintf_s with strings
@@ -6,7 +6,7 @@
 **
 ** Source:  test3.c
 **
-** Purpose: Tests _snprintf with wide strings
+** Purpose: Tests sprintf_s with wide strings
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test3
 Description
-= Tests _snprintf with wide strings
+= Tests sprintf_s with wide strings
@@ -6,7 +6,7 @@
 **
 ** Source:  test4.c
 **
-** Purpose: Tests _snprintf with pointers
+** Purpose: Tests sprintf_s with pointers
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test4
 Description
-= Tests _snprintf with pointers
+= Tests sprintf_s with pointers
@@ -6,7 +6,7 @@
 **
 ** Source:  test6.c
 **
-** Purpose: Tests _snprintf with characters
+** Purpose: Tests sprintf_s with characters
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name =Positive Test for _snprintf
+Function = sprintf_s
+Name =Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test6
 Description
-= Tests _snprintf with characters
+= Tests sprintf_s with characters
@@ -6,7 +6,7 @@
 **
 ** Source:  test7.c
 **
-** Purpose: Tests _snprintf with wide characters
+** Purpose: Tests sprintf_s with wide characters
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 /*
  * Notes: memcmp is used, as is strlen.
  */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test7
 Description
-= Tests _snprintf with wide characters
+= Tests sprintf_s with wide characters
@@ -6,7 +6,7 @@
 **
 ** Source:  test8.c
 **
-** Purpose: Tests _snprintf with decimal numbers
+** Purpose: Tests sprintf_s with decimal numbers
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test8
 Description
-= Tests _snprintf with decimal numbers
+= Tests sprintf_s with decimal numbers
@@ -6,7 +6,7 @@
 **
 ** Source:  test9.c
 **
-** Purpose: Tests _snprintf with integer numbers
+** Purpose: Tests sprintf_s with integer numbers
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snprintf.h"
+#include "../_snprintf_s.h"
 
 /*
  * Notes: memcmp is used, as is strlen.
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snprintf
-Name = Positive Test for _snprintf
+Function = sprintf_s
+Name = Positive Test for sprintf_s
 TYPE = DEFAULT
 EXE1 = test9
 Description
-= Tests _snprintf with integer numbers
+= Tests sprintf_s with integer numbers
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt
deleted file mode 100644 (file)
index 1ad16d2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
-  test5.cpp
-)
-
-add_executable(paltest_snwprintf_test5
-  ${SOURCES}
-)
-
-add_dependencies(paltest_snwprintf_test5 coreclrpal)
-
-target_link_libraries(paltest_snwprintf_test5
-  pthread
-  m
-  coreclrpal
-)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.cpp
deleted file mode 100644 (file)
index bbe4597..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================================
-**
-** Source:  test5.c
-**
-** Purpose: Tests _snwprintf with the count specifier
-**
-**
-**==========================================================================*/
-
-
-
-#include <palsuite.h>
-#include "../_snwprintf.h"
-
-/* memcmp is used to verify the results, so this test is dependent on it. */
-/* ditto with wcslen */
-
-int __cdecl main(int argc, char *argv[])
-{
-    WCHAR *longStr;
-    WCHAR *longResult;
-
-    if (PAL_Initialize(argc, argv) != 0)
-    {
-        return FAIL;
-    }
-
-    longStr = convert("really-long-string-that-just-keeps-going-on-and-on-and-on.."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        "%n bar");
-    longResult = convert("really-long-string-that-just-keeps-going-on-and-on-and-on.."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        "..................useless-filler.................................."
-        " bar");
-    DoCountTest(convert("foo %n bar"), 4, convert("foo  bar"));
-    DoCountTest(longStr, 257, longResult);
-    DoCountTest(convert("fo%n bar"), 2, convert("fo bar"));
-    DoCountTest(convert("%n"), 0, convert(""));
-    DoCountTest(convert("foo %#n bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo % n bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo %+n bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo %-n bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo %0n bar"), 4, convert("foo  bar"));
-    DoShortCountTest(convert("foo %hn bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo %ln bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo %Ln bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo %I64n bar"), 4, convert("foo  bar"));
-    DoCountTest(convert("foo %20.3n bar"), 4, convert("foo  bar"));
-
-    free(longStr);
-    free(longResult);
-
-    PAL_Terminate();
-
-    return PASS;
-}
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat
deleted file mode 100644 (file)
index 2180b81..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
-TYPE = DEFAULT
-EXE1 = test5
-Description
-= Tests _snwprintf with the count specifier
@@ -14,7 +14,6 @@ add_subdirectory(test19)
 add_subdirectory(test2)
 add_subdirectory(test3)
 add_subdirectory(test4)
-add_subdirectory(test5)
 add_subdirectory(test6)
 add_subdirectory(test7)
 add_subdirectory(test8)
@@ -4,9 +4,9 @@
 
 /*============================================================================
 **
-** Source:  _snwprintf.h
+** Source:  swprintf_s.h
 **
-** Purpose: Containts common testing functions for _snwprintf
+** Purpose: Containts common testing functions for swprintf_s
 **
 **
 **==========================================================================*/
@@ -18,7 +18,7 @@ void DoWStrTest(const WCHAR *formatstr, WCHAR *param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param);
 
     if (memcmp(buf, checkstr, wcslen(checkstr) * 2 + 2) != 0)
     {
@@ -32,7 +32,7 @@ void DoStrTest(const WCHAR *formatstr, char *param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param);
 
     if (memcmp(buf, checkstr, wcslen(checkstr) * 2 + 2) != 0)
     {
@@ -46,7 +46,7 @@ void DoPointerTest(const WCHAR *formatstr, void* param, const WCHAR *checkstr1)
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0)
     {
         Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n"
@@ -60,7 +60,7 @@ void DoCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr)
     WCHAR buf[512] = { 0 };
     int n = -1;
 
-    _snwprintf(buf, 512, formatstr, &n);
+    swprintf_s(buf, 512, formatstr, &n);
 
     if (n != param)
     {
@@ -80,7 +80,7 @@ void DoShortCountTest(const WCHAR *formatstr, int param, const WCHAR *checkstr)
     WCHAR buf[256] = { 0 };
     short int n = -1;
 
-    _snwprintf(buf, 256, formatstr, &n);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, &n);
 
     if (n != param)
     {
@@ -99,7 +99,7 @@ void DoCharTest(const WCHAR *formatstr, char param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0)
     {
         Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n"
@@ -112,7 +112,7 @@ void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr, wcslen(checkstr)*2 + 2) != 0)
     {
         Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n"
@@ -125,7 +125,7 @@ void DoNumTest(const WCHAR *formatstr, int value, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, value);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, value);
     if (memcmp(buf, checkstr, wcslen(checkstr)* 2 + 2) != 0)
     {
         Fail("ERROR: failed to insert %#x into \"%s\"\n"
@@ -140,7 +140,7 @@ void DoI64Test(const WCHAR *formatstr, INT64 param, char *paramdesc,
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, param);
     if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0)
     {
         Fail("ERROR: failed to insert %s into \"%s\"\n"
@@ -154,7 +154,7 @@ void DoDoubleTest(const WCHAR *formatstr, double value, const WCHAR *checkstr1,
 {
     WCHAR buf[256] = { 0 };
 
-    _snwprintf(buf, 256, formatstr, value);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, value);
     if (memcmp(buf, checkstr1, wcslen(checkstr1)*2 + 2) != 0 &&
         memcmp(buf, checkstr2, wcslen(checkstr2)*2 + 2) != 0)
     {
@@ -170,7 +170,7 @@ void DoArgumentPrecTest(const WCHAR *formatstr, int precision, void *param,
 {
     WCHAR buf[256];
 
-    _snwprintf(buf, 256, formatstr, precision, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param);
     if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 &&
         memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0)
     {
@@ -186,7 +186,7 @@ void DoArgumentPrecDoubleTest(const WCHAR *formatstr, int precision, double para
 {
     WCHAR buf[256];
 
-    _snwprintf(buf, 256, formatstr, precision, param);
+    _snwprintf_s(buf, 256, _TRUNCATE, formatstr, precision, param);
     if (memcmp(buf, checkstr, wcslen(checkstr) + 2) != 0)
     {
         Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n"
@@ -6,7 +6,7 @@
 **
 ** Source:  test1.c
 **
-** Purpose: General test to see if _snwprintf works correctly
+** Purpose: General test to see if swprintf_s works correctly
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -32,16 +32,16 @@ int __cdecl main(int argc, char *argv[])
     }
 
     checkstr = convert("hello world");
-    _snwprintf(buf, 256, checkstr);
+    _snwprintf_s(buf, 256, _TRUNCATE, checkstr);
     if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0)
     {
         Fail("ERROR: Expected \"%s\", got \"%s\"\n", 
             convertC(checkstr), convertC(buf));
     }
 
-    _snwprintf(buf, 256, convert("xxxxxxxxxxxxxxxxx"));
-    ret = _snwprintf(buf, 8, checkstr);
-    if (memcmp(checkstr, buf, 16) != 0)
+    _snwprintf_s(buf, 256, _TRUNCATE, convert("xxxxxxxxxxxxxxxxx"));
+    ret = _snwprintf_s(buf, 8, _TRUNCATE, checkstr);
+    if ((memcmp(checkstr, buf, 14) != 0) || (buf[7] != 0))
     {
         Fail("ERROR: Expected \"%8s\", got \"%8s\"\n", 
             convertC(checkstr), convertC(buf));
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test1
 Description
-= General test to see if _snwprintf works correctly
+= General test to see if swprintf_s works correctly
@@ -6,7 +6,7 @@
 **
 ** Source:  test10.c
 **
-** Purpose: Tests _snwprintf with octal numbers
+** Purpose: Tests swprintf_s with octal numbers
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test10
 Description
-= Tests _snwprintf with octal numbers
+= Tests swprintf_s with octal numbers
@@ -6,7 +6,7 @@
 **
 ** Source:  test11.c
 **
-** Purpose: Tests _snwprintf with unsigned numbers
+** Purpose: Tests swprintf_s with unsigned numbers
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test11
 Description
-= Tests _snwprintf with unsigned numbers
+= Tests swprintf_s with unsigned numbers
@@ -6,7 +6,7 @@
 **
 ** Source:  test12.c
 **
-** Purpose: Tests _snwprintf with hex numbers (lowercase)
+** Purpose: Tests swprintf_s with hex numbers (lowercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test12
 Description
-= Tests _snwprintf with hex numbers (lowercase)
+= Tests swprintf_s with hex numbers (lowercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test13.c
 **
-** Purpose: Tests _snwprintf with hex numbers (uppercase)
+** Purpose: Tests swprintf_s with hex numbers (uppercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test13
 Description
-= Tests _snwprintf with hex numbers (uppercase)
+= Tests swprintf_s with hex numbers (uppercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test14.c
 **
-** Purpose: Tests _snwprintf with exponential format doubles (lowercase)
+** Purpose: Tests swprintf_s with exponential format doubles (lowercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test14
 Description
-= Tests _snwprintf with exponential format doubles (lowercase)
+= Tests swprintf_s with exponential format doubles (lowercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test15.c
 **
-** Purpose: Tests _snwprintf with exponential format doubles (uppercase) 
+** Purpose: Tests swprintf_s with exponential format doubles (uppercase) 
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test15
 Description
-= Tests _snwprintf with exponential format doubles (uppercase)
+= Tests swprintf_s with exponential format doubles (uppercase)
@@ -6,14 +6,14 @@
 **
 ** Source:  test16.c
 **
-** Purpose: Tests _snwprintf with decimal point format doubles
+** Purpose: Tests swprintf_s with decimal point format doubles
 **
 **
 **==========================================================================*/
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test16
 Description
-= Tests _snwprintf with decimal point format doubles
+= Tests swprintf_s with decimal point format doubles
@@ -6,7 +6,7 @@
 **
 ** Source:  test17.c
 **
-** Purpose: Tests _snwprintf with compact format doubles (lowercase)
+** Purpose: Tests swprintf_s with compact format doubles (lowercase)
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test17
 Description
-= Tests _snwprintf with compact format doubles (lowercase)
+= Tests swprintf_s with compact format doubles (lowercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test18.c
 **
-** Purpose: Tests _snwprintf with compact format doubles (uppercase)
+** Purpose: Tests swprintf_s with compact format doubles (uppercase)
 **
 **
 **==========================================================================*/
@@ -15,7 +15,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test18
 Description
-= Tests _snwprintf with compact format doubles (uppercase)
+= Tests swprintf_s with compact format doubles (uppercase)
@@ -6,7 +6,7 @@
 **
 ** Source:  test19.c
 **
-** Purpose: Tests _snwprintf with argument specified precision
+** Purpose: Tests swprintf_s with argument specified precision
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 int __cdecl main(int argc, char *argv[])
 {
@@ -29,14 +29,6 @@ int __cdecl main(int argc, char *argv[])
                        convert("ba"), convert("ba"));
     DoArgumentPrecTest(convert("%.*S"), 2, (void*)"bar", "bar",
                        convert("ba"), convert("ba"));
-    DoArgumentPrecTest(convert("%.*n"), 3, (void*)&n, "pointer to int",
-                       convert(""), convert(""));
-    if (n != 0)
-    {
-        Fail("ERROR: Expected count parameter to resolve to %d, got %X\n",
-              0, n);
-    }
-
     DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a",
                        convert("a"), convert("a"));
     DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a",
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test19
 Description
-= Tests _snwprintf with argument specified precision
+= Tests swprintf_s with argument specified precision
@@ -6,7 +6,7 @@
 **
 ** Source:  test2.c
 **
-** Purpose:Tests _snwprintf with strings
+** Purpose:Tests swprintf_s with strings
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test2
 Description
-= Tests _snwprintf with strings
+= Tests swprintf_s with strings
@@ -6,7 +6,7 @@
 **
 ** Source:  test3.c
 **
-** Purpose: Tests _snwprintf with wide strings
+** Purpose: Tests swprintf_s with wide strings
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test3
 Description
-= Tests _snwprintf with wide strings
+= Tests swprintf_s with wide strings
@@ -6,7 +6,7 @@
 **
 ** Source:  test4.c
 **
-** Purpose: Tests _snwprintf with pointers
+** Purpose: Tests swprintf_s with pointers
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test4
 Description
-= Tests _snwprintf with pointers
+= Tests swprintf_s with pointers
@@ -6,7 +6,7 @@
 **
 ** Source:  test6.c
 **
-** Purpose: Tests _snwprintf with characters
+** Purpose: Tests swprintf_s with characters
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test6
 Description
-= Tests _snwprintf with characters
+= Tests swprintf_s with characters
@@ -6,7 +6,7 @@
 **
 ** Source:  test7.c
 **
-** Purpose: Tests _snwprintf with wide characters
+** Purpose: Tests swprintf_s with wide characters
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test7
 Description
-= Tests _snwprintf with wide characters
+= Tests swprintf_s with wide characters
@@ -6,7 +6,7 @@
 **
 ** Source:  test8.c
 **
-** Purpose: Tests _snwprintf with decimal numbers 
+** Purpose: Tests swprintf_s with decimal numbers 
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test8
 Description
-= Tests _snwprintf with decimal numbers
+= Tests swprintf_s with decimal numbers
@@ -6,7 +6,7 @@
 **
 ** Source:  test9.c
 **
-** Purpose: Tests _snwprintf with integer numbers 
+** Purpose: Tests swprintf_s with integer numbers 
 **
 **
 **==========================================================================*/
@@ -14,7 +14,7 @@
 
 
 #include <palsuite.h>
-#include "../_snwprintf.h"
+#include "../_snwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,9 +4,9 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _snwprintf
-Name = Positive Test for _snwprintf
+Function = swprintf_s
+Name = Positive Test for swprintf_s
 TYPE = DEFAULT
 EXE1 = test9
 Description
-= Tests _snwprintf with integer numbers
+= Tests swprintf_s with integer numbers
index 0e97856..f96bf08 100644 (file)
@@ -10,4 +10,4 @@ TYPE = DEFAULT
 EXE1 = test1
 Description
 = Tests the PAL implementation of the _vsnprintf function.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 1399afa..a3d8eca 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test10
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with octal numbers.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index faa7428..17e9f04 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test11
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with unsigned numbers.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index d48a5cc..82f58e4 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test12
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with hex numbers (lowercase).
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index a3f14c2..d308edf 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test13
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with hex numbers (uppercase).
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index f4d921c..8d11b1d 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test14
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with exponential format doubles (lowercase).
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 3a6620b..9139125 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test15
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with exponential format doubles (uppercase).
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 6363f29..fc2f130 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test16
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with decimal point format doubles.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index ecec515..aeb9244 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test17
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with compact format doubles (lowercase).
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 34fd7ae..57aaed5 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test18
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with compact format doubles (uppercase).
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 05f4b5b..cda8966 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test19
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with argument specified precision.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 5ee925e..6e8f03e 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test2
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with strings.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 626949c..638cef6 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test3
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with wide strings.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index bdfdef8..03ff293 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test4
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with pointers.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 3cd3f7e..c384882 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test5
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with the count specifier.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index e379e0b..e375f92 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test6
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with characters.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 9074940..09eb481 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test7
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with wide characters.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 0afc334..1bdf411 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test8
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with decimal numbers.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
index 125724a..bdaae87 100644 (file)
@@ -11,4 +11,4 @@ EXE1 = test9
 Description
 = Tests the PAL implementation of the _vsnprintf function.
 = Tests _vsnprintf with integer numbers.
-= This test is modeled after _snprintf.
+= This test is modeled after sprintf_s.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.cpp
deleted file mode 100644 (file)
index 6f39be2..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source:    test4.c
-**
-** Purpose:   Test #4 for the _vsnwprintf function.
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-#include "../_vsnwprintf.h"
-
-/* memcmp is used to verify the results, so this test is dependent on it. */
-/* ditto with wcslen */
-static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr,
-                   WCHAR *checkstr1)
-{
-    WCHAR buf[256] = { 0 };
-
-    TestVsnwprintf(buf, 256, formatstr, param);
-    if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0)
-
-    {
-        Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n"
-            "Expected \"%s\" got \"%s\".\n",
-                paramstr,
-                convertC(formatstr),
-                convertC(checkstr1),
-                convertC(buf));
-    }
-}
-
-static void DoI64DoubleTest(WCHAR *formatstr, INT64 value, WCHAR *valuestr,
-                            WCHAR *checkstr1)
-{
-    WCHAR buf[256] = { 0 };
-
-    TestVsnwprintf(buf, 256, formatstr, value);
-    if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0)
-    {
-        Fail("ERROR: failed to insert %s into \"%s\"\n"
-            "Expected \"%s\", got \"%s\".\n",
-                value,
-                convertC(formatstr),
-                convertC(checkstr1),
-                convertC(buf));
-    }
-}
-
-int __cdecl main(int argc, char *argv[])
-{
-    void *ptr = (void*) 0x123456;
-    INT64 lptr = I64(0x1234567887654321);
-    
-    if (PAL_Initialize(argc, argv) != 0)
-    {
-        return(FAIL);
-    }
-
-/*
-**  Run only on 64 bit platforms
-*/
-#if defined(BIT64) && defined(PLATFORM_UNIX)
-       Trace("Testing for 64 Bit Platforms \n");
-       DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000"));
-       DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"),
-                               convert("0000000000123456"));
-       DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"),
-                               convert(" 0000000000123456"));
-       DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"),
-                               convert(" 0000000000123456"));
-       DoPointerTest(convert("%-17p"), ptr, convert("pointer to 0x123456"),
-                               convert("0000000000123456 "));
-       DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"),
-                               convert("0000000000123456"));
-       DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"),
-                               convert("0X0000000000123456"));
-       DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"),
-                               convert("00123456"));
-       DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"),
-                               convert("00003456"));
-       DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"),
-                               convert("00123456"));
-       DoI64DoubleTest(convert("%I64p"), lptr,
-                                       convert("pointer to 0x1234567887654321"),
-                                       convert("1234567887654321"));
-
-#else
-       Trace("Testing for Non 64 Bit Platforms \n");
-       DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000"));
-       DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"),
-                               convert("00123456"));
-       DoPointerTest(convert("%9p"), ptr, convert("pointer to 0x123456"),
-                               convert(" 00123456"));
-       DoPointerTest(convert("%09p"), ptr, convert("pointer to 0x123456"),
-                               convert(" 00123456"));
-       DoPointerTest(convert("%-9p"), ptr, convert("pointer to 0x123456"),
-                               convert("00123456 "));
-       DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"),
-                               convert("00123456"));
-       DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"),
-                               convert("0X00123456"));
-       DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"),
-                               convert("00123456"));
-       DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"),
-                               convert("00003456"));
-       DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"),
-                               convert("00123456"));
-       DoI64DoubleTest(convert("%I64p"), lptr,
-                                       convert("pointer to 0x1234567887654321"),
-                                       convert("1234567887654321"));
-#endif
-
-    PAL_Terminate();
-    return PASS;
-}
-
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt
deleted file mode 100644 (file)
index 34787e4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
-  test5.cpp
-)
-
-add_executable(paltest_vsnwprintf_test5
-  ${SOURCES}
-)
-
-add_dependencies(paltest_vsnwprintf_test5 coreclrpal)
-
-target_link_libraries(paltest_vsnwprintf_test5
-  pthread
-  m
-  coreclrpal
-)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.cpp
deleted file mode 100644 (file)
index 224db76..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source:    test5.c
-**
-** Purpose:   Test #5 for the _vsnwprintf function.
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-#include "../_vsnwprintf.h"
-
-/* memcmp is used to verify the results, so this test is dependent on it. */
-/* ditto with wcslen */
-
-static void DoTest(WCHAR *formatstr, int param, WCHAR *checkstr)
-{
-    WCHAR buf[256] = { 0 };
-    int n = -1;
-
-    TestVsnwprintf(buf, 256, formatstr, &n);
-
-    if (n != param)
-    {
-        Fail("ERROR: Expected count parameter to resolve to %d, got %d\n",
-             param, n);
-    }
-
-    if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
-    {
-        Fail("ERROR: Expected \"%s\" got \"%s\".\n", 
-            convertC(checkstr), convertC(buf));
-    }
-}
-
-static void DoShortTest(WCHAR *formatstr, int param, WCHAR *checkstr)
-{
-    WCHAR buf[256] = { 0 };
-    short int n = -1;
-
-    TestVsnwprintf(buf, 256, formatstr, &n);
-
-    if (n != param)
-    {
-        Fail("ERROR: Expected count parameter to resolve to %d, got %d\n",
-             param, n);
-    }
-
-    if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
-    {
-        Fail("ERROR: Expected \"%s\" got \"%s\".\n",
-            convertC(checkstr), convertC(buf));
-    }    
-}
-
-int __cdecl main(int argc, char *argv[])
-{
-    if (PAL_Initialize(argc, argv) != 0)
-    {
-        return(FAIL);
-    }
-
-    DoTest(convert("foo %n bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %#n bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo % n bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %+n bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %-n bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %0n bar"), 4, convert("foo  bar"));
-    DoShortTest(convert("foo %hn bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %ln bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %Ln bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %I64n bar"), 4, convert("foo  bar"));
-    DoTest(convert("foo %20.3n bar"), 4, convert("foo  bar"));
-
-    PAL_Terminate();
-    return PASS;
-}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat
deleted file mode 100644 (file)
index 35d3816..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
-TYPE = DEFAULT
-EXE1 = test5
-Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with the count specifier.
-= This test is modeled after _snwprintf.
@@ -14,7 +14,6 @@ add_subdirectory(test19)
 add_subdirectory(test2)
 add_subdirectory(test3)
 add_subdirectory(test4)
-add_subdirectory(test5)
 add_subdirectory(test6)
 add_subdirectory(test7)
 add_subdirectory(test8)
@@ -4,9 +4,9 @@
 
 /*============================================================================
 **
-** Source:  _vsnwprintf.h
+** Source:  _vsnwprintf_s.h
 **
-** Purpose: Containts common testing functions for _vsnwprintf
+** Purpose: Containts common testing functions for _vsnwprintf_s
 **
 **
 **==========================================================================*/
 #define ___VSNWPRINTF_H__
 
 /* These functions leaks memory like crazy. C'est la vie. */
-int TestVsnwprintf(wchar_t* buf, size_t count, const wchar_t* format, ...)
+int TestVsnwprintf_s(wchar_t* buf, size_t count, const wchar_t* format, ...)
 {
     int retVal = 0;
     va_list arglist;
 
     va_start(arglist, format);
-    retVal = _vsnwprintf(buf, count, format, arglist);
+    retVal = _vsnwprintf_s(buf, count, _TRUNCATE, format, arglist);
     va_end(arglist);
 
     return( retVal);
@@ -32,7 +32,7 @@ void DoWStrTest(const WCHAR *formatstr, WCHAR *param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    TestVsnwprintf(buf, 256, formatstr, param);
+    TestVsnwprintf_s(buf, 256, formatstr, param);
 
     if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0)
     {
@@ -47,7 +47,7 @@ void DoStrTest(const WCHAR *formatstr, char *param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    TestVsnwprintf(buf, 256, formatstr, param);
+    TestVsnwprintf_s(buf, 256, formatstr, param);
 
     if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0)
     {
@@ -62,7 +62,7 @@ void DoCharTest(const WCHAR *formatstr, char param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    TestVsnwprintf(buf, 256, formatstr, param);
+    TestVsnwprintf_s(buf, 256, formatstr, param);
     if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
     {
         Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n"
@@ -76,7 +76,7 @@ void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    TestVsnwprintf(buf, 256, formatstr, param);
+    TestVsnwprintf_s(buf, 256, formatstr, param);
     if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
     {
         Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n"
@@ -90,7 +90,7 @@ void DoNumTest(const WCHAR *formatstr, int value, const WCHAR *checkstr)
 {
     WCHAR buf[256] = { 0 };
 
-    TestVsnwprintf(buf, 256, formatstr, value);
+    TestVsnwprintf_s(buf, 256, formatstr, value);
     if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0)
     {
         Fail("ERROR: failed to insert %#x into \"%s\"\n"
@@ -103,7 +103,7 @@ void DoI64NumTest(const WCHAR *formatstr, INT64 value, char *valuestr, const WCH
 {
     WCHAR buf[256] = { 0 };
 
-    TestVsnwprintf(buf, 256, formatstr, value);
+    TestVsnwprintf_s(buf, 256, formatstr, value);
     if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0)
     {
         Fail("ERROR: failed to insert %s into \"%s\"\n"
@@ -116,7 +116,7 @@ void DoDoubleTest(const WCHAR *formatstr, double value,
 {
     WCHAR buf[256] = { 0 };
 
-    TestVsnwprintf(buf, 256, formatstr, value);
+    TestVsnwprintf_s(buf, 256, formatstr, value);
     if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 &&
         memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0)
     {
@@ -6,13 +6,13 @@
 **
 ** Source:    test1.c
 **
-** Purpose:   Test #1 for the _vsnwprintf function.
+** Purpose:   Test #1 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -30,16 +30,16 @@ int __cdecl main(int argc, char *argv[])
     }
 
     checkstr = convert("hello world");
-    TestVsnwprintf(buf, 256, checkstr);
+    TestVsnwprintf_s(buf, 256, checkstr);
     if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0)
     {
         Fail("ERROR: Expected \"%s\", got \"%s\"\n",
             convertC(checkstr), convertC(buf));
     }
 
-    TestVsnwprintf(buf, 256, convert("xxxxxxxxxxxxxxxxx"));
-    ret = TestVsnwprintf(buf, 8, checkstr);
-    if (memcmp(checkstr, buf, 16) != 0)
+    TestVsnwprintf_s(buf, 256, convert("xxxxxxxxxxxxxxxxx"));
+    ret = TestVsnwprintf_s(buf, 8, checkstr);
+    if ((memcmp(checkstr, buf, 14)) != 0 || (buf[7] != 0))
     {
         Fail("ERROR: Expected \"%8s\", got \"%8s\"\n",
             convertC(checkstr), convertC(buf));
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test1
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= General test to see if _vsnwprintf works correctly.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= General test to see if _vsnwprintf_s works correctly.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test10.c
 **
-** Purpose:   Test #10 for the _vsnwprintf function.
+** Purpose:   Test #10 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
  
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test10
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with octal numbers.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with octal numbers.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test11.c
 **
-** Purpose:   Test #11 for the _vsnwprintf function.
+** Purpose:   Test #11 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
  
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test11
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with unsigned numbers.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with unsigned numbers.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test12.c
 **
-** Purpose:   Test #12 for the _vsnwprintf function.
+** Purpose:   Test #12 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test12
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with hex numbers (lowercase).
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with hex numbers (lowercase).
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test13.c
 **
-** Purpose:   Test #13 for the _vsnwprintf function.
+** Purpose:   Test #13 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
  
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test13
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with hex numbers (uppercase).
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with hex numbers (uppercase).
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test14.c
 **
-** Purpose:   Test #14 for the _vsnwprintf function.
+** Purpose:   Test #14 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test14
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with exponential format doubles (lowercase).
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with exponential format doubles (lowercase).
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test15.c
 **
-** Purpose:   Test #15 for the _vsnwprintf function.
+** Purpose:   Test #15 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test15
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with exponential format doubles (uppercase).
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with exponential format doubles (uppercase).
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test16.c
 **
-** Purpose:   Test #16 for the _vsnwprintf function.
+** Purpose:   Test #16 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test16
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with decimal point format doubles.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with decimal point format doubles.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test17.c
 **
-** Purpose:   Test #17 for the _vsnwprintf function.
+** Purpose:   Test #17 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test17
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with compact format doubles (lowercase).
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with compact format doubles (lowercase).
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test18.c
 **
-** Purpose:   Test #18 for the _vsnwprintf function.
+** Purpose:   Test #18 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test18
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with compact format doubles (uppercase).
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with compact format doubles (uppercase).
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test18.c
 **
-** Purpose:   Test #18 for the _vsnwprintf function.
+** Purpose:   Test #18 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
  
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -24,7 +24,7 @@ void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param,
 {
     WCHAR buf[256];
     
-    TestVsnwprintf(buf, 256, formatstr, precision, param);
+    TestVsnwprintf_s(buf, 256, formatstr, precision, param);
     if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 &&
         memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0)
     {
@@ -43,7 +43,7 @@ void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param,
 {
     WCHAR buf[256];
 
-    TestVsnwprintf(buf, 256, formatstr, precision, param);
+    TestVsnwprintf_s(buf, 256, formatstr, precision, param);
     if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 &&
         memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0)
     {
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test19
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with argument specified precision.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with argument specified precision.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test2.c
 **
-** Purpose:   Test #2 for the _vsnwprintf function.
+** Purpose:   Test #2 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test2
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with strings.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with strings.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test3.c
 **
-** Purpose:   Test #3 for the _vsnwprintf function.
+** Purpose:   Test #3 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test3
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with wide strings.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with wide strings.
 = This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp
new file mode 100644 (file)
index 0000000..3627ff8
--- /dev/null
@@ -0,0 +1,121 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source:    test4.c
+**
+** Purpose:   Test #4 for the _vsnwprintf_s function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf_s.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr,
+                   WCHAR *checkstr1)
+{
+    WCHAR buf[256] = { 0 };
+
+    TestVsnwprintf_s(buf, 256, formatstr, param);
+    if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0)
+
+    {
+        Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n"
+            "Expected \"%s\" got \"%s\".\n",
+                paramstr,
+                convertC(formatstr),
+                convertC(checkstr1),
+                convertC(buf));
+    }
+}
+
+static void DoI64DoubleTest(WCHAR *formatstr, INT64 value, WCHAR *valuestr,
+                            WCHAR *checkstr1)
+{
+    WCHAR buf[256] = { 0 };
+
+    TestVsnwprintf_s(buf, 256, formatstr, value);
+    if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0)
+    {
+        Fail("ERROR: failed to insert %s into \"%s\"\n"
+            "Expected \"%s\", got \"%s\".\n",
+                value,
+                convertC(formatstr),
+                convertC(checkstr1),
+                convertC(buf));
+    }
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+    void *ptr = (void*) 0x123456;
+    INT64 lptr = I64(0x1234567887654321);
+    
+    if (PAL_Initialize(argc, argv) != 0)
+    {
+        return(FAIL);
+    }
+
+/*
+**  Run only on 64 bit platforms
+*/
+#if defined(BIT64) && defined(PLATFORM_UNIX)
+    Trace("Testing for 64 Bit Platforms \n");
+    DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000"));
+    DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"),
+                convert("0000000000123456"));
+    DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"),
+                convert(" 0000000000123456"));
+    DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"),
+                convert(" 0000000000123456"));
+    DoPointerTest(convert("%-17p"), ptr, convert("pointer to 0x123456"),
+                convert("0000000000123456 "));
+    DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"),
+                convert("0000000000123456"));
+    DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"),
+                convert("0X0000000000123456"));
+    DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"),
+                convert("00123456"));
+    DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"),
+                convert("00003456"));
+    DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"),
+                convert("00123456"));
+    DoI64DoubleTest(convert("%I64p"), lptr,
+                    convert("pointer to 0x1234567887654321"),
+                    convert("1234567887654321"));
+
+#else
+    Trace("Testing for Non 64 Bit Platforms \n");
+    DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000"));
+    DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"),
+                convert("00123456"));
+    DoPointerTest(convert("%9p"), ptr, convert("pointer to 0x123456"),
+                convert(" 00123456"));
+    DoPointerTest(convert("%09p"), ptr, convert("pointer to 0x123456"),
+                convert(" 00123456"));
+    DoPointerTest(convert("%-9p"), ptr, convert("pointer to 0x123456"),
+                convert("00123456 "));
+    DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"),
+                convert("00123456"));
+    DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"),
+                convert("0X00123456"));
+    DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"),
+                convert("00123456"));
+    DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"),
+                convert("00003456"));
+    DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"),
+                convert("00123456"));
+    DoI64DoubleTest(convert("%I64p"), lptr,
+                    convert("pointer to 0x1234567887654321"),
+                    convert("1234567887654321"));
+#endif
+
+    PAL_Terminate();
+    return PASS;
+}
+
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test4
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with pointers.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with pointers.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test6.c
 **
-** Purpose:   Test #6 for the _vsnwprintf function.
+** Purpose:   Test #6 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test6
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with characters.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with characters.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test7.c
 **
-** Purpose:   Test #7 for the _vsnwprintf function.
+** Purpose:   Test #7 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test7
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with wide characters.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with wide characters.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test8.c
 **
-** Purpose:   Test #8 for the _vsnwprintf function.
+** Purpose:   Test #8 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test8
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with decimal numbers.
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with decimal numbers.
 = This test is modeled after _snwprintf.
@@ -6,13 +6,13 @@
 **
 ** Source:    test9.c
 **
-** Purpose:   Test #9 for the _vsnwprintf function.
+** Purpose:   Test #9 for the _vsnwprintf_s function.
 **
 **
 **===================================================================*/
 
 #include <palsuite.h>
-#include "../_vsnwprintf.h"
+#include "../_vsnwprintf_s.h"
 
 /* memcmp is used to verify the results, so this test is dependent on it. */
 /* ditto with wcslen */
@@ -4,11 +4,11 @@
 
 Version = 1.0
 Section = C Runtime
-Function = _vsnwprintf
-Name = Positive Test for _vsnwprintf
+Function = _vsnwprintf_s
+Name = Positive Test for _vsnwprintf_s
 TYPE = DEFAULT
 EXE1 = test9
 Description
-= Tests the PAL implementation of the _vsnwprintf function.
-= Tests _vsnwprintf with integer numbers
+= Tests the PAL implementation of the _vsnwprintf_s function.
+= Tests _vsnwprintf_s with integer numbers
 = This test is modeled after _snwprintf.
index f7597f8..d9af111 100644 (file)
@@ -362,42 +362,40 @@ c_runtime/_putenv/test4/paltest_putenv_test4
 c_runtime/_putw/test1/paltest_putw_test1
 c_runtime/_rotl/test1/paltest_rotl_test1
 c_runtime/_rotr/test1/paltest_rotr_test1
-c_runtime/_snprintf/test1/paltest_snprintf_test1
-c_runtime/_snprintf/test10/paltest_snprintf_test10
-c_runtime/_snprintf/test11/paltest_snprintf_test11
-c_runtime/_snprintf/test12/paltest_snprintf_test12
-c_runtime/_snprintf/test13/paltest_snprintf_test13
-c_runtime/_snprintf/test14/paltest_snprintf_test14
-c_runtime/_snprintf/test15/paltest_snprintf_test15
-c_runtime/_snprintf/test16/paltest_snprintf_test16
-c_runtime/_snprintf/test17/paltest_snprintf_test17
-c_runtime/_snprintf/test18/paltest_snprintf_test18
-c_runtime/_snprintf/test19/paltest_snprintf_test19
-c_runtime/_snprintf/test2/paltest_snprintf_test2
-c_runtime/_snprintf/test3/paltest_snprintf_test3
-c_runtime/_snprintf/test4/paltest_snprintf_test4
-c_runtime/_snprintf/test5/paltest_snprintf_test5
-c_runtime/_snprintf/test6/paltest_snprintf_test6
-c_runtime/_snprintf/test7/paltest_snprintf_test7
-c_runtime/_snprintf/test8/paltest_snprintf_test8
-c_runtime/_snprintf/test9/paltest_snprintf_test9
-c_runtime/_snwprintf/test1/paltest_snwprintf_test1
-c_runtime/_snwprintf/test10/paltest_snwprintf_test10
-c_runtime/_snwprintf/test11/paltest_snwprintf_test11
-c_runtime/_snwprintf/test12/paltest_snwprintf_test12
-c_runtime/_snwprintf/test13/paltest_snwprintf_test13
-c_runtime/_snwprintf/test14/paltest_snwprintf_test14
-c_runtime/_snwprintf/test15/paltest_snwprintf_test15
-c_runtime/_snwprintf/test16/paltest_snwprintf_test16
-c_runtime/_snwprintf/test17/paltest_snwprintf_test17
-c_runtime/_snwprintf/test18/paltest_snwprintf_test18
-c_runtime/_snwprintf/test19/paltest_snwprintf_test19
-c_runtime/_snwprintf/test3/paltest_snwprintf_test3
-c_runtime/_snwprintf/test4/paltest_snwprintf_test4
-c_runtime/_snwprintf/test5/paltest_snwprintf_test5
-c_runtime/_snwprintf/test6/paltest_snwprintf_test6
-c_runtime/_snwprintf/test8/paltest_snwprintf_test8
-c_runtime/_snwprintf/test9/paltest_snwprintf_test9
+c_runtime/_snprintf_s/test1/paltest_snprintf_test1
+c_runtime/_snprintf_s/test10/paltest_snprintf_test10
+c_runtime/_snprintf_s/test11/paltest_snprintf_test11
+c_runtime/_snprintf_s/test12/paltest_snprintf_test12
+c_runtime/_snprintf_s/test13/paltest_snprintf_test13
+c_runtime/_snprintf_s/test14/paltest_snprintf_test14
+c_runtime/_snprintf_s/test15/paltest_snprintf_test15
+c_runtime/_snprintf_s/test16/paltest_snprintf_test16
+c_runtime/_snprintf_s/test17/paltest_snprintf_test17
+c_runtime/_snprintf_s/test18/paltest_snprintf_test18
+c_runtime/_snprintf_s/test19/paltest_snprintf_test19
+c_runtime/_snprintf_s/test2/paltest_snprintf_test2
+c_runtime/_snprintf_s/test3/paltest_snprintf_test3
+c_runtime/_snprintf_s/test4/paltest_snprintf_test4
+c_runtime/_snprintf_s/test6/paltest_snprintf_test6
+c_runtime/_snprintf_s/test7/paltest_snprintf_test7
+c_runtime/_snprintf_s/test8/paltest_snprintf_test8
+c_runtime/_snprintf_s/test9/paltest_snprintf_test9
+c_runtime/_snwprintf_s/test1/paltest_snwprintf_test1
+c_runtime/_snwprintf_s/test10/paltest_snwprintf_test10
+c_runtime/_snwprintf_s/test11/paltest_snwprintf_test11
+c_runtime/_snwprintf_s/test12/paltest_snwprintf_test12
+c_runtime/_snwprintf_s/test13/paltest_snwprintf_test13
+c_runtime/_snwprintf_s/test14/paltest_snwprintf_test14
+c_runtime/_snwprintf_s/test15/paltest_snwprintf_test15
+c_runtime/_snwprintf_s/test16/paltest_snwprintf_test16
+c_runtime/_snwprintf_s/test17/paltest_snwprintf_test17
+c_runtime/_snwprintf_s/test18/paltest_snwprintf_test18
+c_runtime/_snwprintf_s/test19/paltest_snwprintf_test19
+c_runtime/_snwprintf_s/test3/paltest_snwprintf_test3
+c_runtime/_snwprintf_s/test4/paltest_snwprintf_test4
+c_runtime/_snwprintf_s/test6/paltest_snwprintf_test6
+c_runtime/_snwprintf_s/test8/paltest_snwprintf_test8
+c_runtime/_snwprintf_s/test9/paltest_snwprintf_test9
 c_runtime/_stricmp/test1/paltest_stricmp_test1
 c_runtime/_strlwr/test1/paltest_strlwr_test1
 c_runtime/_strnicmp/test1/paltest_strnicmp_test1
@@ -420,23 +418,22 @@ c_runtime/_vsnprintf/test6/paltest_vsnprintf_test6
 c_runtime/_vsnprintf/test7/paltest_vsnprintf_test7
 c_runtime/_vsnprintf/test8/paltest_vsnprintf_test8
 c_runtime/_vsnprintf/test9/paltest_vsnprintf_test9
-c_runtime/_vsnwprintf/test1/paltest_vsnwprintf_test1
-c_runtime/_vsnwprintf/test10/paltest_vsnwprintf_test10
-c_runtime/_vsnwprintf/test11/paltest_vsnwprintf_test11
-c_runtime/_vsnwprintf/test12/paltest_vsnwprintf_test12
-c_runtime/_vsnwprintf/test13/paltest_vsnwprintf_test13
-c_runtime/_vsnwprintf/test14/paltest_vsnwprintf_test14
-c_runtime/_vsnwprintf/test15/paltest_vsnwprintf_test15
-c_runtime/_vsnwprintf/test16/paltest_vsnwprintf_test16
-c_runtime/_vsnwprintf/test17/paltest_vsnwprintf_test17
-c_runtime/_vsnwprintf/test18/paltest_vsnwprintf_test18
-c_runtime/_vsnwprintf/test19/paltest_vsnwprintf_test19
-c_runtime/_vsnwprintf/test3/paltest_vsnwprintf_test3
-c_runtime/_vsnwprintf/test4/paltest_vsnwprintf_test4
-c_runtime/_vsnwprintf/test5/paltest_vsnwprintf_test5
-c_runtime/_vsnwprintf/test6/paltest_vsnwprintf_test6
-c_runtime/_vsnwprintf/test8/paltest_vsnwprintf_test8
-c_runtime/_vsnwprintf/test9/paltest_vsnwprintf_test9
+c_runtime/_vsnwprintf_s/test1/paltest_vsnwprintf_test1
+c_runtime/_vsnwprintf_s/test10/paltest_vsnwprintf_test10
+c_runtime/_vsnwprintf_s/test11/paltest_vsnwprintf_test11
+c_runtime/_vsnwprintf_s/test12/paltest_vsnwprintf_test12
+c_runtime/_vsnwprintf_s/test13/paltest_vsnwprintf_test13
+c_runtime/_vsnwprintf_s/test14/paltest_vsnwprintf_test14
+c_runtime/_vsnwprintf_s/test15/paltest_vsnwprintf_test15
+c_runtime/_vsnwprintf_s/test16/paltest_vsnwprintf_test16
+c_runtime/_vsnwprintf_s/test17/paltest_vsnwprintf_test17
+c_runtime/_vsnwprintf_s/test18/paltest_vsnwprintf_test18
+c_runtime/_vsnwprintf_s/test19/paltest_vsnwprintf_test19
+c_runtime/_vsnwprintf_s/test3/paltest_vsnwprintf_test3
+c_runtime/_vsnwprintf_s/test4/paltest_vsnwprintf_test4
+c_runtime/_vsnwprintf_s/test6/paltest_vsnwprintf_test6
+c_runtime/_vsnwprintf_s/test8/paltest_vsnwprintf_test8
+c_runtime/_vsnwprintf_s/test9/paltest_vsnwprintf_test9
 c_runtime/_wcsicmp/test1/paltest_wcsicmp_test1
 c_runtime/_wcslwr/test1/paltest_wcslwr_test1
 c_runtime/_wcsnicmp/test1/paltest_wcsnicmp_test1
index 37b81d2..0e12ccb 100644 (file)
@@ -26,10 +26,10 @@ c_runtime/_ecvt/test1/paltest_ecvt_test1
 c_runtime/_gcvt/test1/paltest_gcvt_test1
 c_runtime/_gcvt/test2/paltest_gcvt_test2
 c_runtime/_getw/test1/paltest_getw_test1
-c_runtime/_snwprintf/test2/paltest_snwprintf_test2
-c_runtime/_snwprintf/test7/paltest_snwprintf_test7
-c_runtime/_vsnwprintf/test2/paltest_vsnwprintf_test2
-c_runtime/_vsnwprintf/test7/paltest_vsnwprintf_test7
+c_runtime/_snwprintf_s/test2/paltest_snwprintf_test2
+c_runtime/_snwprintf_s/test7/paltest_snwprintf_test7
+c_runtime/_vsnwprintf_s/test2/paltest_vsnwprintf_test2
+c_runtime/_vsnwprintf_s/test7/paltest_vsnwprintf_test7
 debug_api/DebugBreak/test1/paltest_debugbreak_test1
 debug_api/OutputDebugStringA/test1/paltest_outputdebugstringa_test1
 debug_api/WriteProcessMemory/test1/paltest_writeprocessmemory_test1
index 804274b..e7bfd60 100644 (file)
@@ -27,44 +27,42 @@ c_runtime/_putenv/test4,1
 c_runtime/_putw/test1,1
 c_runtime/_rotl/test1,1
 c_runtime/_rotr/test1,1
-c_runtime/_snprintf/test1,1
-c_runtime/_snprintf/test2,1
-c_runtime/_snprintf/test3,1
-c_runtime/_snprintf/test4,1
-c_runtime/_snprintf/test5,1
-c_runtime/_snprintf/test6,1
-c_runtime/_snprintf/test7,1
-c_runtime/_snprintf/test8,1
-c_runtime/_snprintf/test9,1
-c_runtime/_snprintf/test10,1
-c_runtime/_snprintf/test11,1
-c_runtime/_snprintf/test12,1
-c_runtime/_snprintf/test13,1
-c_runtime/_snprintf/test14,1
-c_runtime/_snprintf/test15,1
-c_runtime/_snprintf/test16,1
-c_runtime/_snprintf/test17,1
-c_runtime/_snprintf/test18,1
-c_runtime/_snprintf/test19,1
-c_runtime/_snwprintf/test1,1
-c_runtime/_snwprintf/test2,1
-c_runtime/_snwprintf/test3,1
-c_runtime/_snwprintf/test4,1
-c_runtime/_snwprintf/test5,1
-c_runtime/_snwprintf/test6,1
-c_runtime/_snwprintf/test7,1
-c_runtime/_snwprintf/test8,1
-c_runtime/_snwprintf/test9,1
-c_runtime/_snwprintf/test10,1
-c_runtime/_snwprintf/test11,1
-c_runtime/_snwprintf/test12,1
-c_runtime/_snwprintf/test13,1
-c_runtime/_snwprintf/test14,1
-c_runtime/_snwprintf/test15,1
-c_runtime/_snwprintf/test16,1
-c_runtime/_snwprintf/test17,1
-c_runtime/_snwprintf/test18,1
-c_runtime/_snwprintf/test19,1
+c_runtime/_snprintf_s/test1,1
+c_runtime/_snprintf_s/test2,1
+c_runtime/_snprintf_s/test3,1
+c_runtime/_snprintf_s/test4,1
+c_runtime/_snprintf_s/test6,1
+c_runtime/_snprintf_s/test7,1
+c_runtime/_snprintf_s/test8,1
+c_runtime/_snprintf_s/test9,1
+c_runtime/_snprintf_s/test10,1
+c_runtime/_snprintf_s/test11,1
+c_runtime/_snprintf_s/test12,1
+c_runtime/_snprintf_s/test13,1
+c_runtime/_snprintf_s/test14,1
+c_runtime/_snprintf_s/test15,1
+c_runtime/_snprintf_s/test16,1
+c_runtime/_snprintf_s/test17,1
+c_runtime/_snprintf_s/test18,1
+c_runtime/_snprintf_s/test19,1
+c_runtime/_snwprintf_s/test1,1       
+c_runtime/_snwprintf_s/test2,1       
+c_runtime/_snwprintf_s/test3,1       
+c_runtime/_snwprintf_s/test4,1       
+c_runtime/_snwprintf_s/test6,1       
+c_runtime/_snwprintf_s/test7,1       
+c_runtime/_snwprintf_s/test8,1       
+c_runtime/_snwprintf_s/test9,1       
+c_runtime/_snwprintf_s/test10,1      
+c_runtime/_snwprintf_s/test11,1      
+c_runtime/_snwprintf_s/test12,1      
+c_runtime/_snwprintf_s/test13,1      
+c_runtime/_snwprintf_s/test14,1      
+c_runtime/_snwprintf_s/test15,1      
+c_runtime/_snwprintf_s/test16,1      
+c_runtime/_snwprintf_s/test17,1      
+c_runtime/_snwprintf_s/test18,1      
+c_runtime/_snwprintf_s/test19,1
 c_runtime/_stricmp/test1,1
 c_runtime/_strlwr/test1,1
 c_runtime/_strnicmp/test1,1
@@ -87,25 +85,25 @@ c_runtime/_vsnprintf/test16,1
 c_runtime/_vsnprintf/test17,1
 c_runtime/_vsnprintf/test18,1
 c_runtime/_vsnprintf/test19,1
-c_runtime/_vsnwprintf/test1,1
-c_runtime/_vsnwprintf/test2,1
-c_runtime/_vsnwprintf/test3,1
-c_runtime/_vsnwprintf/test4,1
-c_runtime/_vsnwprintf/test5,1
-c_runtime/_vsnwprintf/test6,1
-c_runtime/_vsnwprintf/test7,1
-c_runtime/_vsnwprintf/test8,1
-c_runtime/_vsnwprintf/test9,1
-c_runtime/_vsnwprintf/test10,1
-c_runtime/_vsnwprintf/test11,1
-c_runtime/_vsnwprintf/test12,1
-c_runtime/_vsnwprintf/test13,1
-c_runtime/_vsnwprintf/test14,1
-c_runtime/_vsnwprintf/test15,1
-c_runtime/_vsnwprintf/test16,1
-c_runtime/_vsnwprintf/test17,1
-c_runtime/_vsnwprintf/test18,1
-c_runtime/_vsnwprintf/test19,1
+c_runtime/_vsnwprintf_s/test1,1
+c_runtime/_vsnwprintf_s/test2,1
+c_runtime/_vsnwprintf_s/test3,1
+c_runtime/_vsnwprintf_s/test4,1
+c_runtime/_vsnwprintf_s/test5,1
+c_runtime/_vsnwprintf_s/test6,1
+c_runtime/_vsnwprintf_s/test7,1
+c_runtime/_vsnwprintf_s/test8,1
+c_runtime/_vsnwprintf_s/test9,1
+c_runtime/_vsnwprintf_s/test10,1
+c_runtime/_vsnwprintf_s/test11,1
+c_runtime/_vsnwprintf_s/test12,1
+c_runtime/_vsnwprintf_s/test13,1
+c_runtime/_vsnwprintf_s/test14,1
+c_runtime/_vsnwprintf_s/test15,1
+c_runtime/_vsnwprintf_s/test16,1
+c_runtime/_vsnwprintf_s/test17,1
+c_runtime/_vsnwprintf_s/test18,1
+c_runtime/_vsnwprintf_s/test19,1
 c_runtime/_wcsicmp/test1,1
 c_runtime/_wcslwr/test1,1
 c_runtime/_wcsnicmp/test1,1
index 10a678a..c4edf22 100644 (file)
@@ -75,7 +75,7 @@ int __cdecl main( int argc, char **argv )
     }
 
     ZeroMemory( lpCommandLine, MAX_PATH );
-    if ( _snprintf( lpCommandLine, MAX_PATH-1, "childprocess ") < 0 )
+    if ( sprintf_s( lpCommandLine, MAX_PATH-1, "childprocess ") < 0 )
     {
         Fail ("Error: Insufficient lpCommandline for\n");
     }
index 274780a..caa0206 100644 (file)
@@ -64,7 +64,7 @@ int __cdecl main(int argc, char *argv[])
     }
 
     /* Open the event to tell test thread we are ready. */
-    if (_snprintf(szEventName, MAX_LONGPATH-1, "%s%d", szcHelperProcessReadyEvName, dwProcessId) < 0)
+    if (sprintf_s(szEventName, MAX_LONGPATH-1, "%s%d", szcHelperProcessReadyEvName, dwProcessId) < 0)
     {
         Fail ("helper.main: Insufficient event name string length for pid=%d\n", dwProcessId);
     }
@@ -81,7 +81,7 @@ int __cdecl main(int argc, char *argv[])
     }
 
     /* Open the event to let test thread tell us to exit. */
-    if (_snprintf(szEventName, MAX_LONGPATH-1, "%s%d", szcHelperProcessFinishEvName, dwProcessId) < 0)
+    if (sprintf_s(szEventName, MAX_LONGPATH-1, "%s%d", szcHelperProcessFinishEvName, dwProcessId) < 0)
     {
         Fail ("helper.main: Insufficient event name string length for pid=%d\n", dwProcessId);
     }
index d19978c..a021649 100644 (file)
@@ -176,7 +176,7 @@ Setup()
         }
 
         /* Create the event to let helper process tell us it is ready. */
-        if (_snprintf(szEventName, MAX_PATH-1, "%s%d",
+        if (sprintf_s(szEventName, MAX_PATH-1, "%s%d",
             szcHelperProcessReadyEvName, helper_process[i].pi.dwProcessId) < 0)
         {
             Fail ("test5.Setup: Insufficient event name string length for %s\n", szcHelperProcessReadyEvName);
@@ -194,7 +194,7 @@ Setup()
         }
 
         /* Create the event to tell helper process to exit. */
-        if (_snprintf(szEventName, MAX_PATH-1, "%s%d",
+        if (sprintf_s(szEventName, MAX_PATH-1, "%s%d",
             szcHelperProcessFinishEvName, helper_process[i].pi.dwProcessId) < 0)
         {
             Fail ("test5.Setup: Insufficient event name string length for %s\n", szcHelperProcessFinishEvName);
index 1a95815..a53b6c9 100644 (file)
@@ -80,11 +80,11 @@ int __cdecl main(int argc, char **argv)
         }
     }
 
-    _snprintf(szEventName, 128, "%s_Event", szTestName);
+    sprintf_s(szEventName, 128, "%s_Event", szTestName);
     szEventName[127] = 0;
-    _snprintf(szMutexName, 128, "%s_Mutex", szTestName);
+    sprintf_s(szMutexName, 128, "%s_Mutex", szTestName);
     szMutexName[127] = 0;
-    _snprintf(szSemName, 128, "%s_Semaphore", szTestName);
+    sprintf_s(szSemName, 128, "%s_Semaphore", szTestName);
     szSemName[127] = 0;
 
     iRet = MultiByteToWideChar(CP_ACP, 0, szEventName, strlen(szEventName)+1, wszEventName, 128);
index 399d2c3..d5e3137 100644 (file)
@@ -156,14 +156,14 @@ DWORD PALAPI TestThread(PVOID pArg)
         
     dwThreadNum = (DWORD)pArg;
 
-    _snprintf (szTestName, 128, "Test6_%u", dwThreadNum);
+    sprintf_s (szTestName, 128, "Test6_%u", dwThreadNum);
     szTestName[127] = 0;
 
-    _snprintf(szEventName, 128, "%s_Event", szTestName);
+    sprintf_s(szEventName, 128, "%s_Event", szTestName);
     szEventName[127] = 0;
-    _snprintf(szMutexName, 128, "%s_Mutex", szTestName);
+    sprintf_s(szMutexName, 128, "%s_Mutex", szTestName);
     szMutexName[127] = 0;
-    _snprintf(szSemName, 128, "%s_Semaphore", szTestName);
+    sprintf_s(szSemName, 128, "%s_Semaphore", szTestName);
     szSemName[127] = 0;
 
     iRet = MultiByteToWideChar(CP_ACP, 0, szEventName, strlen(szEventName)+1, wszEventName, 128);
@@ -323,7 +323,7 @@ DWORD PALAPI TestThread(PVOID pArg)
             si.cb = sizeof(si);
             ZeroMemory ( &pi, sizeof(pi) );
         
-            _snprintf (szCmd, 128, "child6 -event %s", szTestName);
+            sprintf_s (szCmd, 128, "child6 -event %s", szTestName);
             szCmd[127] = 0;
 
             bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
@@ -363,7 +363,7 @@ DWORD PALAPI TestThread(PVOID pArg)
             si.cb = sizeof(si);
             ZeroMemory ( &pi, sizeof(pi) );
 
-            _snprintf (szCmd, 128, "child6 -semaphore %s", szTestName);
+            sprintf_s (szCmd, 128, "child6 -semaphore %s", szTestName);
             szCmd[127] = 0;
         
             bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE, 
@@ -423,7 +423,7 @@ DWORD PALAPI TestThread(PVOID pArg)
             si.cb = sizeof(si);
             ZeroMemory ( &pi, sizeof(pi) );            
             
-            _snprintf (szCmd, 128, "child6 -mutex %s -exitcode %d", szTestName, iDesiredExitCode);
+            sprintf_s (szCmd, 128, "child6 -mutex %s -exitcode %d", szTestName, iDesiredExitCode);
             szCmd[127] = 0;
         
             bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
@@ -527,7 +527,7 @@ DWORD PALAPI TestThread(PVOID pArg)
             si.cb = sizeof(si);
             ZeroMemory ( &pi, sizeof(pi) );
         
-            _snprintf (szCmd, 128, "child6 -mutex_and_named_event %s", szTestName);
+            sprintf_s (szCmd, 128, "child6 -mutex_and_named_event %s", szTestName);
             szCmd[127] = 0;
 
             bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE, 
index 154e9de..ce532d7 100644 (file)
@@ -2211,7 +2211,7 @@ void SString::VPrintf(const WCHAR *format, va_list args)
         else
         if (errno!=0 && errno!=EBADF && errno!=ERANGE)
         {
-            CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf failed. Potential globalization bug.");
+            CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf_s failed. Potential globalization bug.");
             ThrowHR(HRESULT_FROM_WIN32(ERROR_NO_UNICODE_TRANSLATION));
         }
     }
@@ -2293,7 +2293,7 @@ void SString::PVPrintf(const WCHAR *format, va_list args)
         else
         if (errno!=0 && errno!=EBADF && errno!=ERANGE)
         {
-            CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf failed. Potential globalization bug.");
+            CONSISTENCY_CHECK_MSG(FALSE, "_vsnwprintf_s failed. Potential globalization bug.");
             ThrowHR(HRESULT_FROM_WIN32(ERROR_NO_UNICODE_TRANSLATION));
         }
     }
index 585de67..45a9783 100644 (file)
@@ -6153,12 +6153,12 @@ __forceinline bool Nirvana_PrintMethodDescWorker(__in_ecount(iBuffer) char * szB
 
     if (*pNamespace != 0)
     {
-        if(FAILED(StringCchPrintfA(szBuffer, iBuffer, "%s.%s.%s", pNamespace, pClassName, pSigString)))
+        if (_snprintf_s(szBuffer, iBuffer, _TRUNCATE, "%s.%s.%s", pNamespace, pClassName, pSigString) == -1)
             return false;
     }
     else
     {
-        if(FAILED(StringCchPrintfA(szBuffer, iBuffer, "%s.%s", pClassName, pSigString)))
+        if (_snprintf_s(szBuffer, iBuffer, _TRUNCATE, "%s.%s", pClassName, pSigString) == -1)
             return false;
     }