summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2016-11-21 16:22:45 +0100
committerJan Kotas <jkotas@microsoft.com>2016-11-21 07:22:45 -0800
commit716cb7ea87e40abb4b106df55af7ff4666170296 (patch)
tree512ecfde277f7257c8f883715ba0b2596e415db5 /src
parent3c3ab1a269a48b81c2a57e55da76b7e5f0f24eb9 (diff)
downloadcoreclr-716cb7ea87e40abb4b106df55af7ff4666170296.tar.gz
coreclr-716cb7ea87e40abb4b106df55af7ff4666170296.tar.bz2
coreclr-716cb7ea87e40abb4b106df55af7ff4666170296.zip
Remove unsafe banned functions (#8162)
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.
Diffstat (limited to 'src')
-rw-r--r--src/ToolBox/SOS/Strike/stressLogDump.cpp2
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/logging.cpp6
-rw-r--r--src/ToolBox/superpmi/superpmi/neardiffer.cpp2
-rw-r--r--src/debug/daccess/daccess.cpp10
-rw-r--r--src/dlls/mscordac/mscordac_unixexports.src10
-rw-r--r--src/ilasm/main.cpp2
-rw-r--r--src/nativeresources/resourcestring.cpp10
-rw-r--r--src/pal/inc/mbusafecrt.h4
-rw-r--r--src/pal/inc/pal.h17
-rw-r--r--src/pal/inc/rt/palrt.h55
-rw-r--r--src/pal/inc/rt/safecrt.h13
-rw-r--r--src/pal/inc/strsafe.h1512
-rw-r--r--src/pal/src/config.h.in1
-rw-r--r--src/pal/src/configure.cmake1
-rw-r--r--src/pal/src/cruntime/printf.cpp88
-rw-r--r--src/pal/src/include/pal/palinternal.h11
-rw-r--r--src/pal/src/safecrt/mbusafecrt.cpp4
-rw-r--r--src/pal/src/safecrt/output.inl39
-rw-r--r--src/pal/src/safecrt/snprintf.cpp2
-rw-r--r--src/pal/src/safecrt/sprintf.cpp10
-rw-r--r--src/pal/src/safecrt/swprintf.cpp2
-rw-r--r--src/pal/src/safecrt/vsprintf.cpp2
-rw-r--r--src/pal/src/safecrt/vswprint.cpp83
-rw-r--r--src/pal/src/thread/process.cpp2
-rw-r--r--src/pal/tests/palsuite/c_runtime/CMakeLists.txt6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.cpp61
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt)1
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/_snprintf_s.h (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h)28
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/test1.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.cpp)12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/test10.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/test11.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/test12.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/test13.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/test14.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/test15.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/test16.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/test17.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/test18.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/test19.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.cpp)10
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/test2.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/test3.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/test6.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/test7.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/test8.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/test9.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.cpp63
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt)1
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/_snwprintf_s.h (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h)28
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/test1.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.cpp)12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/test10.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/test11.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/test12.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/test13.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/test14.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test14/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/test15.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test15/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/test16.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/test17.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/test18.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/test19.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.cpp)12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/test2.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/test3.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/test6.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/test7.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/test8.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/test9.cpp (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat)6
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat2
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.cpp121
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.cpp81
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt)1
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/_vsnwprintf_s.h (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h)22
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/test1.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.cpp)12
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/test10.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/test11.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/test12.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/test13.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/test14.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/test16.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/test17.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/test18.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/test19.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.cpp)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/test2.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/test3.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp121
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/test6.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/test7.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/test8.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/CMakeLists.txt (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/test9.cpp (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.cpp)4
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/testinfo.dat (renamed from src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat)8
-rw-r--r--src/pal/tests/palsuite/paltestlist.txt103
-rw-r--r--src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt8
-rw-r--r--src/pal/tests/palsuite/palverify.dat112
-rw-r--r--src/pal/tests/palsuite/threading/OpenEventW/test3/test3.cpp2
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/helper.cpp4
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/test5.cpp4
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/child6.cpp6
-rw-r--r--src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/test6.cpp16
-rw-r--r--src/utilcode/sstring.cpp4
-rw-r--r--src/vm/codeman.cpp4
232 files changed, 706 insertions, 2726 deletions
diff --git a/src/ToolBox/SOS/Strike/stressLogDump.cpp b/src/ToolBox/SOS/Strike/stressLogDump.cpp
index f277f92434..9dfbe1ed5e 100644
--- a/src/ToolBox/SOS/Strike/stressLogDump.cpp
+++ b/src/ToolBox/SOS/Strike/stressLogDump.cpp
@@ -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
diff --git a/src/ToolBox/superpmi/superpmi-shared/logging.cpp b/src/ToolBox/superpmi/superpmi-shared/logging.cpp
index 5f7aa48a4f..69c321bb39 100644
--- a/src/ToolBox/superpmi/superpmi-shared/logging.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/logging.cpp
@@ -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,
diff --git a/src/ToolBox/superpmi/superpmi/neardiffer.cpp b/src/ToolBox/superpmi/superpmi/neardiffer.cpp
index 5b2e3b1b57..3f2c4db3b8 100644
--- a/src/ToolBox/superpmi/superpmi/neardiffer.cpp
+++ b/src/ToolBox/superpmi/superpmi/neardiffer.cpp
@@ -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));
diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp
index aebfa43a91..99067dfed6 100644
--- a/src/debug/daccess/daccess.cpp
+++ b/src/debug/daccess/daccess.cpp
@@ -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)
diff --git a/src/dlls/mscordac/mscordac_unixexports.src b/src/dlls/mscordac/mscordac_unixexports.src
index f2134974ef..aa0b541bd2 100644
--- a/src/dlls/mscordac/mscordac_unixexports.src
+++ b/src/dlls/mscordac/mscordac_unixexports.src
@@ -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
diff --git a/src/ilasm/main.cpp b/src/ilasm/main.cpp
index 811c65640e..2bef40dd47 100644
--- a/src/ilasm/main.cpp
+++ b/src/ilasm/main.cpp
@@ -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)
diff --git a/src/nativeresources/resourcestring.cpp b/src/nativeresources/resourcestring.cpp
index 13d5aeeef9..236a2a3ca7 100644
--- a/src/nativeresources/resourcestring.cpp
+++ b/src/nativeresources/resourcestring.cpp
@@ -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;
}
}
diff --git a/src/pal/inc/mbusafecrt.h b/src/pal/inc/mbusafecrt.h
index 055ababda3..8cf050f419 100644
--- a/src/pal/inc/mbusafecrt.h
+++ b/src/pal/inc/mbusafecrt.h
@@ -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, ... );
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 7da8114256..25aa9be60d 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -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);
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h
index be162890f5..6d758039a9 100644
--- a/src/pal/inc/rt/palrt.h
+++ b/src/pal/inc/rt/palrt.h
@@ -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;
diff --git a/src/pal/inc/rt/safecrt.h b/src/pal/inc/rt/safecrt.h
index 6b95e28dfb..3cc10cef33 100644
--- a/src/pal/inc/rt/safecrt.h
+++ b/src/pal/inc/rt/safecrt.h
@@ -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;
diff --git a/src/pal/inc/strsafe.h b/src/pal/inc/strsafe.h
index 5a9f0edd43..58749f27ee 100644
--- a/src/pal/inc/strsafe.h
+++ b/src/pal/inc/strsafe.h
@@ -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);
@@ -5543,394 +4421,6 @@ 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)
-{
- 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));
-
- if ((iRet < 0) || (((size_t)iRet) > cchMax))
- {
- // need to null terminate the string
- pszDest += cchMax;
- *pszDest = '\0';
-
- // 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';
- }
- }
-
- return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFEAPI StringVPrintfWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszFormat, va_list argList)
-{
- 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));
-
- if ((iRet < 0) || (((size_t)iRet) > cchMax))
- {
- // need to null terminate the string
- pszDest += cchMax;
- *pszDest = L'\0';
-
- // 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';
- }
- }
-
- 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)
-{
- 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 (pszFormat == NULL)
- {
- pszFormat = "";
- }
- }
-
- if (SUCCEEDED(hr))
- {
- if (cchDest == 0)
- {
- pszDestEnd = pszDest;
- cchRemaining = 0;
-
- // only fail if there was actually a non-empty format string
- if (*pszFormat != '\0')
- {
- if (pszDest == NULL)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- hr = STRSAFE_E_INSUFFICIENT_BUFFER;
- }
- }
- }
- 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)));
- }
- }
- }
- }
- }
-
- 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';
- }
- }
- }
- }
-
- if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
- {
- if (ppszDestEnd)
- {
- *ppszDestEnd = pszDestEnd;
- }
-
- if (pcchRemaining)
- {
- *pcchRemaining = cchRemaining;
- }
- }
-
- return hr;
-}
-
-#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)
-{
- HRESULT hr = S_OK;
- WCHAR* pszDestEnd = pszDest;
- size_t cchRemaining = 0;
-
- // ASSERT(cbDest == (cchDest * sizeof(WCHAR)) ||
- // cbDest == (cchDest * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
-
- // 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 (pszFormat == NULL)
- {
- pszFormat = u"";
- }
- }
-
- if (SUCCEEDED(hr))
- {
- if (cchDest == 0)
- {
- pszDestEnd = pszDest;
- cchRemaining = 0;
-
- // only fail if there was actually a non-empty format string
- if (*pszFormat != L'\0')
- {
- if (pszDest == NULL)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- hr = STRSAFE_E_INSUFFICIENT_BUFFER;
- }
- }
- }
- 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)));
- }
- }
- }
- }
- }
-
- 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 = 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';
- }
- }
- }
- }
-
- if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER))
- {
- if (ppszDestEnd)
- {
- *ppszDestEnd = pszDestEnd;
- }
-
- if (pcchRemaining)
- {
- *pcchRemaining = cchRemaining;
- }
- }
-
- return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-
STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch)
{
HRESULT hr = S_OK;
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in
index 7a53c8cb5d..4d21fb70e4 100644
--- a/src/pal/src/config.h.in
+++ b/src/pal/src/config.h.in
@@ -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
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
index 82ae08a954..f4b83bcaec 100644
--- a/src/pal/src/configure.cmake
+++ b/src/pal/src/configure.cmake
@@ -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)
diff --git a/src/pal/src/cruntime/printf.cpp b/src/pal/src/cruntime/printf.cpp
index dab04789e7..83964183b2 100644
--- a/src/pal/src/cruntime/printf.cpp
+++ b/src/pal/src/cruntime/printf.cpp
@@ -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:
diff --git a/src/pal/src/include/pal/palinternal.h b/src/pal/src/include/pal/palinternal.h
index 218d40d0b7..44f2528991 100644
--- a/src/pal/src/include/pal/palinternal.h
+++ b/src/pal/src/include/pal/palinternal.h
@@ -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
diff --git a/src/pal/src/safecrt/mbusafecrt.cpp b/src/pal/src/safecrt/mbusafecrt.cpp
index ca853d9269..9b3ffd599c 100644
--- a/src/pal/src/safecrt/mbusafecrt.cpp
+++ b/src/pal/src/safecrt/mbusafecrt.cpp
@@ -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;
diff --git a/src/pal/src/safecrt/output.inl b/src/pal/src/safecrt/output.inl
index ae0692efc5..5b86cf2c96 100644
--- a/src/pal/src/safecrt/output.inl
+++ b/src/pal/src/safecrt/output.inl
@@ -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);
}
diff --git a/src/pal/src/safecrt/snprintf.cpp b/src/pal/src/safecrt/snprintf.cpp
index c892d1a9b6..dea87167b9 100644
--- a/src/pal/src/safecrt/snprintf.cpp
+++ b/src/pal/src/safecrt/snprintf.cpp
@@ -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.
*
diff --git a/src/pal/src/safecrt/sprintf.cpp b/src/pal/src/safecrt/sprintf.cpp
index 5454179f8d..8a51d2644e 100644
--- a/src/pal/src/safecrt/sprintf.cpp
+++ b/src/pal/src/safecrt/sprintf.cpp
@@ -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;
}
diff --git a/src/pal/src/safecrt/swprintf.cpp b/src/pal/src/safecrt/swprintf.cpp
index 75004eafe2..2fbfcfaf58 100644
--- a/src/pal/src/safecrt/swprintf.cpp
+++ b/src/pal/src/safecrt/swprintf.cpp
@@ -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);
diff --git a/src/pal/src/safecrt/vsprintf.cpp b/src/pal/src/safecrt/vsprintf.cpp
index 4f2bd9fdeb..e1a94d086d 100644
--- a/src/pal/src/safecrt/vsprintf.cpp
+++ b/src/pal/src/safecrt/vsprintf.cpp
@@ -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,
diff --git a/src/pal/src/safecrt/vswprint.cpp b/src/pal/src/safecrt/vswprint.cpp
index 77c79b8752..b9940a693a 100644
--- a/src/pal/src/safecrt/vswprint.cpp
+++ b/src/pal/src/safecrt/vswprint.cpp
@@ -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.
*
@@ -23,19 +23,10 @@
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_ */
diff --git a/src/pal/src/thread/process.cpp b/src/pal/src/thread/process.cpp
index 315145dc03..c57d604e9c 100644
--- a/src/pal/src/thread/process.cpp
+++ b/src/pal/src/thread/process.cpp
@@ -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);
}
diff --git a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt
index c45dd602fa..d2da52785e 100644
--- a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt
@@ -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
index 7319680b94..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/CMakeLists.txt
+++ /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
index 46ab1dd35e..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/test5.cpp
+++ /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
index 33056defd8..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test5/testinfo.dat
+++ /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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/CMakeLists.txt
index cafb9536b0..8fe1cb60ac 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/CMakeLists.txt
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h b/src/pal/tests/palsuite/c_runtime/_snprintf_s/_snprintf_s.h
index b3655b2b2b..9ed5209bea 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/_snprintf.h
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/_snprintf_s.h
@@ -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)
{
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/CMakeLists.txt
index 9e4c671ec8..9e4c671ec8 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/test1.cpp
index eef7406baa..d180b05df5 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/test1.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/test1.cpp
@@ -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);
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/testinfo.dat
index c15ce1dcba..255c534cdf 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test1/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test1/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/CMakeLists.txt
index 57e7fb16d3..57e7fb16d3 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/test10.cpp
index 9191ccef27..7ecb9102e4 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/test10.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/test10.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/testinfo.dat
index 44ff48e030..25ed554ea3 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test10/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test10/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/CMakeLists.txt
index 4fc179c5a8..4fc179c5a8 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/test11.cpp
index 9d9302dee0..c2ac015698 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/test11.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/test11.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/testinfo.dat
index 1a77077950..3144f1290e 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test11/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test11/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/CMakeLists.txt
index a35609eb57..a35609eb57 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/test12.cpp
index d782fce788..52171838cc 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/test12.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/test12.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/testinfo.dat
index 6801c7417e..ed91cecc46 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test12/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test12/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/CMakeLists.txt
index 3bf986e851..3bf986e851 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/test13.cpp
index 68ba554d93..15e47558b0 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/test13.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/test13.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/testinfo.dat
index 6901589a1b..fd5f53017c 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test13/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test13/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/CMakeLists.txt
index 985303ecf8..985303ecf8 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/test14.cpp
index d874690ba4..331475e962 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/test14.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/test14.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/testinfo.dat
index 0f32b9b59a..23cf423354 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test14/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test14/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/CMakeLists.txt
index c7f5796089..c7f5796089 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/test15.cpp
index a637a706f5..d43613b6cf 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/test15.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/test15.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/testinfo.dat
index 8008cff0b5..537e6d1db2 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test15/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test15/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/CMakeLists.txt
index 9a224bc23b..9a224bc23b 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/test16.cpp
index 6793019383..21cbb1ed30 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/test16.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/test16.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/testinfo.dat
index e7a7df8f53..4e98eccac2 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test16/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test16/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/CMakeLists.txt
index 3a8a349c84..3a8a349c84 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/test17.cpp
index 9981b44619..d161270b84 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/test17.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/test17.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/testinfo.dat
index 4756bd0d78..5e41e20d44 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test17/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test17/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/CMakeLists.txt
index 96e39e8f41..96e39e8f41 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/test18.cpp
index d28aec57d0..46ec287cc1 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/test18.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/test18.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/testinfo.dat
index 819d28cec9..06ae3a632e 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test18/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test18/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/CMakeLists.txt
index be3570f163..be3570f163 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/test19.cpp
index a644071ea7..91b1dae583 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/test19.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/test19.cpp
@@ -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");
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/testinfo.dat
index 875abf7071..7064c01771 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test19/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test19/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/CMakeLists.txt
index 11d18e61c3..11d18e61c3 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/test2.cpp
index 3ccb66c23e..e58669466f 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/test2.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/test2.cpp
@@ -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.
*/
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/testinfo.dat
index 40a1ede3d5..cce2dc67e7 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test2/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test2/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/CMakeLists.txt
index b8d4178962..b8d4178962 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/test3.cpp
index 496159c51e..3c52b44246 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/test3.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/test3.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/testinfo.dat
index fa53224510..cc8de0eae5 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test3/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test3/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/CMakeLists.txt
index 568b7122de..568b7122de 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp
index 8c39f222cc..216557f10a 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/test4.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/testinfo.dat
index 5d822d160b..f53f784991 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test4/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/CMakeLists.txt
index 820cc66d55..820cc66d55 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/test6.cpp
index 32001c2d20..45c9e2b79b 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/test6.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/test6.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/testinfo.dat
index ba2ff818aa..06e31e85d6 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test6/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test6/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/CMakeLists.txt
index a2af7c4a8c..a2af7c4a8c 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/test7.cpp
index bfd5c3f4f1..5c10fc8ea7 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/test7.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/test7.cpp
@@ -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.
*/
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/testinfo.dat
index 5c2406c7b2..647c9d80fd 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test7/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test7/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/CMakeLists.txt
index 53545c5dbf..53545c5dbf 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/test8.cpp
index 60ff1b05b8..416e357e1e 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/test8.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/test8.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/testinfo.dat
index f6520d8dde..524834e53e 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test8/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test8/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/CMakeLists.txt
index 33ca9db7a8..33ca9db7a8 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/test9.cpp
index e836bcaee3..18b1cb7830 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/test9.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/test9.cpp
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/testinfo.dat
index 2a64b26030..7c51443a3d 100644
--- a/src/pal/tests/palsuite/c_runtime/_snprintf/test9/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test9/testinfo.dat
@@ -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
index 1ad16d2572..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/CMakeLists.txt
+++ /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
index bbe459751b..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/test5.cpp
+++ /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
index 2180b81cf5..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test5/testinfo.dat
+++ /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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/CMakeLists.txt
index cafb9536b0..8fe1cb60ac 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/CMakeLists.txt
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/_snwprintf_s.h
index 1682db8139..19d192114b 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/_snwprintf.h
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/_snwprintf_s.h
@@ -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"
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/CMakeLists.txt
index eac86f30e4..eac86f30e4 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/test1.cpp
index 5d13aaf05d..ba85103cb1 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/test1.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/test1.cpp
@@ -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));
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/testinfo.dat
index 079a3b3989..96d7914ce0 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test1/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test1/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/CMakeLists.txt
index 82ee739587..82ee739587 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/test10.cpp
index e8a6d93ea3..298f82b002 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/test10.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/test10.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/testinfo.dat
index 2c07cc6e45..887bbf76c8 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test10/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test10/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/CMakeLists.txt
index f7d7845571..f7d7845571 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/test11.cpp
index 95f7f53210..519668791b 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/test11.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/test11.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/testinfo.dat
index f81a7861bf..3bda85e335 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test11/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test11/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/CMakeLists.txt
index 5b926fb548..5b926fb548 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/test12.cpp
index ab58fa345f..52780aff0a 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/test12.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/test12.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/testinfo.dat
index 653babae84..d808a3b8f4 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test12/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test12/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/CMakeLists.txt
index 52a3c75a15..52a3c75a15 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/test13.cpp
index 5a3e22802d..fa948b3a1b 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/test13.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/test13.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/testinfo.dat
index cdeced6654..2e5800ec31 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test13/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test13/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/CMakeLists.txt
index d557a30b42..d557a30b42 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/test14.cpp
index c34875246d..aea289d1a1 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/test14.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/test14.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/testinfo.dat
index b47611aa44..25bd5099c9 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test14/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test14/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/CMakeLists.txt
index 2e5ee362fc..2e5ee362fc 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/test15.cpp
index f45005b758..14db14b498 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/test15.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/test15.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/testinfo.dat
index 2c81391689..95d90e82e7 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test15/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test15/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/CMakeLists.txt
index f4ce409dcb..f4ce409dcb 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/test16.cpp
index 88f55bdc10..4d9a717f24 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/test16.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/test16.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/testinfo.dat
index 8d844e0b18..b81c847c69 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test16/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test16/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/CMakeLists.txt
index 159e15dafe..159e15dafe 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/test17.cpp
index 82f2330b48..6af1815b85 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/test17.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/test17.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/testinfo.dat
index 6b01fb3d7d..d64366702a 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test17/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test17/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/CMakeLists.txt
index 5964e849a4..5964e849a4 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/test18.cpp
index dbb6233061..020a885090 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/test18.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/test18.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/testinfo.dat
index 480087f560..dfc2cd5f43 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test18/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test18/testinfo.dat
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/CMakeLists.txt
index 5d84847ec1..5d84847ec1 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/test19.cpp
index 584e66f8c7..d335d1d10c 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/test19.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/test19.cpp
@@ -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",
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/testinfo.dat
index 376cbc84d1..95269cdd39 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test19/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test19/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/CMakeLists.txt
index ea33d48bd5..ea33d48bd5 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/test2.cpp
index 974b7967f2..86bfdc9839 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/test2.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/test2.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/testinfo.dat
index 9c65c93e5a..88f1981609 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test2/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test2/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/CMakeLists.txt
index 5095b1a12e..5095b1a12e 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/test3.cpp
index bfb75ce323..f6db6f265d 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/test3.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/test3.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/testinfo.dat
index b39f4f56b7..5ed59e61ac 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test3/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test3/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/CMakeLists.txt
index 9cf81ea1bd..9cf81ea1bd 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp
index 28f7998591..02d4781bd3 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/test4.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/testinfo.dat
index 3f3600160f..2b35f2d0d3 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test4/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/CMakeLists.txt
index 4996c7716f..4996c7716f 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/test6.cpp
index 3d4ed3f882..576e061acd 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/test6.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/test6.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/testinfo.dat
index 6a170cd549..d8db7f8335 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test6/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test6/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/CMakeLists.txt
index 0e55fbf4d7..0e55fbf4d7 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/test7.cpp
index 7954ff71ca..54dd32b433 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/test7.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/test7.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/testinfo.dat
index 5749539e3f..fa5bd30008 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test7/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test7/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/CMakeLists.txt
index 8f7fbda5a0..8f7fbda5a0 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/test8.cpp
index 91c2820076..9f1b555e3c 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/test8.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/test8.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/testinfo.dat
index 6398f60183..d76a421ea3 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test8/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test8/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/CMakeLists.txt
index f769c9eaa5..f769c9eaa5 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/test9.cpp
index f8f994fdcc..76d60631a2 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/test9.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/test9.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/testinfo.dat
index 287de4a9e9..b2a038df62 100644
--- a/src/pal/tests/palsuite/c_runtime/_snwprintf/test9/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test9/testinfo.dat
@@ -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
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat
index 0e97856927..f96bf084f2 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test1/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat
index 1399afae05..a3d8eca54e 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test10/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat
index faa7428eff..17e9f04946 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test11/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat
index d48a5cc60d..82f58e4371 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test12/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat
index a3f14c21dc..d308edf871 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test13/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat
index f4d921c139..8d11b1d6ff 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test14/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat
index 3a6620ba46..913912508e 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test15/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat
index 6363f294af..fc2f13071b 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test16/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat
index ecec515de3..aeb924495c 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test17/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat
index 34fd7ae2ff..57aaed5953 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test18/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat
index 05f4b5bd87..cda8966865 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test19/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat
index 5ee925e3f6..6e8f03e639 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test2/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat
index 626949c7c8..638cef69ef 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test3/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat
index bdfdef85ae..03ff2931bc 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test4/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat
index 3cd3f7ee86..c3848824f1 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test5/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat
index e379e0b3b8..e375f9238d 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test6/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat
index 90749400a5..09eb481b59 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test7/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat
index 0afc334a67..1bdf411983 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test8/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat
index 125724a36b..bdaae87ce8 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf/test9/testinfo.dat
@@ -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
index 6f39be2a80..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.cpp
+++ /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
index 34787e4a51..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt
+++ /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
index 224db766ff..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.cpp
+++ /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
index 35d3816a76..0000000000
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat
+++ /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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/CMakeLists.txt
index cafb9536b0..8fe1cb60ac 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/CMakeLists.txt
@@ -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)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/_vsnwprintf_s.h
index 2be1398331..34cf411c25 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/_vsnwprintf_s.h
@@ -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
**
**
**==========================================================================*/
@@ -15,13 +15,13 @@
#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)
{
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/CMakeLists.txt
index d1245168f3..d1245168f3 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/test1.cpp
index 0238e42611..4a7a02e778 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/test1.cpp
@@ -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));
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/testinfo.dat
index d806fb8ed8..450c5b9034 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test1/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/CMakeLists.txt
index 6367964f1d..6367964f1d 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/test10.cpp
index 6e188e56ff..e33f2281df 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/test10.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/testinfo.dat
index beb5b41be9..59af082f49 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test10/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/CMakeLists.txt
index b45fd0ed1e..b45fd0ed1e 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/test11.cpp
index af54985bdc..4e860bbc21 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/test11.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/testinfo.dat
index 083b0fa5af..10c0014fca 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test11/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/CMakeLists.txt
index 2a15b198c0..2a15b198c0 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/test12.cpp
index b593a82b4b..2dcfcf5998 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/test12.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/testinfo.dat
index a4450ed8d0..de089895b9 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test12/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/CMakeLists.txt
index 01ab97cc62..01ab97cc62 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/test13.cpp
index 59a9dc496f..c95278a56b 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/test13.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/testinfo.dat
index fa54ae8a62..94479d527c 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test13/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/CMakeLists.txt
index c6c990312f..c6c990312f 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/test14.cpp
index 633f9d68ae..cab1b247df 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/test14.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/testinfo.dat
index 0796f5e81c..0d46d97649 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test14/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/CMakeLists.txt
index e1a32b1825..e1a32b1825 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp
index 0af41fe1dc..d5738991a6 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/testinfo.dat
index 9de3c83b8a..7737f49a35 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/CMakeLists.txt
index 9e2b25b308..9e2b25b308 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/test16.cpp
index 77571b01b3..72c546eb63 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/test16.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/testinfo.dat
index b7134c785b..9aec1c008a 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test16/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/CMakeLists.txt
index 2d8ba31a08..2d8ba31a08 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/test17.cpp
index 3a9d70ad03..e6860b930f 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/test17.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/testinfo.dat
index 5d5553151e..1487b7a17e 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test17/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/CMakeLists.txt
index 503856c2f3..503856c2f3 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/test18.cpp
index 03f9870113..a164edbc0f 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/test18.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/testinfo.dat
index f56c80980d..54c4e87c89 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test18/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/CMakeLists.txt
index 68485eff12..68485eff12 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/test19.cpp
index adbb9961d8..c2a85478ae 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/test19.cpp
@@ -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)
{
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/testinfo.dat
index 77178f1471..2913e30406 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test19/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/CMakeLists.txt
index a512be6e47..a512be6e47 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/test2.cpp
index 20499954db..18e5adffd3 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/test2.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/testinfo.dat
index 429911bd83..5b9b6292dc 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test2/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/CMakeLists.txt
index 7991c25afc..7991c25afc 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/test3.cpp
index 9a37d3fc4b..5e2bfa21a0 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/test3.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/testinfo.dat
index d4e2686763..62160695e6 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test3/testinfo.dat
@@ -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/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/CMakeLists.txt
index 18f5d02df2..18f5d02df2 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/CMakeLists.txt
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
index 0000000000..3627ff8bc8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp
@@ -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;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/testinfo.dat
index 56f488a66a..9fbfcba5cf 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/CMakeLists.txt
index c431da4a00..c431da4a00 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/test6.cpp
index 1bd83ea85c..ecba5853a6 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/test6.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/testinfo.dat
index 6afe96d1cd..1b411d7982 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test6/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/CMakeLists.txt
index 5759b836b5..5759b836b5 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/test7.cpp
index e13798b784..519657a202 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/test7.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/testinfo.dat
index ece40aa195..8f2ccf0b58 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test7/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/CMakeLists.txt
index 5e8a6284a5..5e8a6284a5 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/test8.cpp
index 8f02412eb0..15641f7b9e 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/test8.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/testinfo.dat
index d7a567a6d6..905740c1bb 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test8/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/CMakeLists.txt
index 323365dcd9..323365dcd9 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/test9.cpp
index 7b5b6cd8a6..38f6be21e7 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.cpp
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/test9.cpp
@@ -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 */
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/testinfo.dat
index 726b060240..974efdb4cf 100644
--- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test9/testinfo.dat
@@ -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.
diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt
index f7597f87b1..d9af111b25 100644
--- a/src/pal/tests/palsuite/paltestlist.txt
+++ b/src/pal/tests/palsuite/paltestlist.txt
@@ -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
diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
index 37b81d2060..0e12ccbf55 100644
--- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
+++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
@@ -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
diff --git a/src/pal/tests/palsuite/palverify.dat b/src/pal/tests/palsuite/palverify.dat
index 804274bdb3..e7bfd60aed 100644
--- a/src/pal/tests/palsuite/palverify.dat
+++ b/src/pal/tests/palsuite/palverify.dat
@@ -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
diff --git a/src/pal/tests/palsuite/threading/OpenEventW/test3/test3.cpp b/src/pal/tests/palsuite/threading/OpenEventW/test3/test3.cpp
index 10a678a107..c4edf22a76 100644
--- a/src/pal/tests/palsuite/threading/OpenEventW/test3/test3.cpp
+++ b/src/pal/tests/palsuite/threading/OpenEventW/test3/test3.cpp
@@ -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");
}
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/helper.cpp b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/helper.cpp
index 274780a216..caa0206a11 100644
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/helper.cpp
+++ b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/helper.cpp
@@ -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);
}
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/test5.cpp b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/test5.cpp
index d19978c103..a0216494ba 100644
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/test5.cpp
+++ b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test5/test5.cpp
@@ -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);
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/child6.cpp b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/child6.cpp
index 1a95815ddf..a53b6c9727 100644
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/child6.cpp
+++ b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/child6.cpp
@@ -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);
diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/test6.cpp b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/test6.cpp
index 399d2c3bff..d5e3137899 100644
--- a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/test6.cpp
+++ b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/test6.cpp
@@ -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,
diff --git a/src/utilcode/sstring.cpp b/src/utilcode/sstring.cpp
index 154e9ded7a..ce532d70f6 100644
--- a/src/utilcode/sstring.cpp
+++ b/src/utilcode/sstring.cpp
@@ -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));
}
}
diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp
index 585de67f44..45a978310f 100644
--- a/src/vm/codeman.cpp
+++ b/src/vm/codeman.cpp
@@ -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;
}