From 46adf180d716f6cd37ba665681a4e2054b794881 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Wed, 18 May 2016 09:31:26 +0200 Subject: [PATCH] cfg: Added support for fopen_s and sprintf_s functions. Fixed a wrong tests. --- cfg/std.cfg | 21 +++++++++++++++++ cfg/windows.cfg | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ test/testio.cpp | 8 +++---- 3 files changed, 86 insertions(+), 4 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 77117b0bd..d980b9270 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -943,6 +943,26 @@ + + + + false + + + + + + + + + + + + + + false @@ -3996,6 +4016,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun fopen + fopen_s tmpfile fclose diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 8a0eb8e6e..5716f4bbc 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -985,6 +985,8 @@ _wfopen _tfopen + _wfopen_s + _tfopen_s fclose @@ -1741,6 +1743,47 @@ + + + false + + + + + + + 0: + + + + + + + + + + + false + + + + + + + 0: + + + + + + + + + + + + + + false + + + + + + + + + + + + + + diff --git a/test/testio.cpp b/test/testio.cpp index 59a8ea2b8..1f13eb7f4 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -2563,7 +2563,7 @@ private: check("void foo() {\n" " char lineBuffer [600];\n" " const char * const format = \"%15s%17s%17s%17s%17s\n\";\n" - " sprintf_s(lineBuffer, format, \"type\", \"sum\", \"avg\", \"min\", \"max\");\n" + " sprintf_s(lineBuffer, 600, format, \"type\", \"sum\", \"avg\", \"min\", \"max\");\n" "}\n", false, false, Settings::Win32A); ASSERT_EQUALS("", errout.str()); @@ -2572,9 +2572,9 @@ private: " const char format2[] = \"%15s%17s%17s%17s%17s\n\";\n" " const char * const format3 = format1;\n" " int i = 0;\n" - " sprintf_s(lineBuffer, format1, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" - " sprintf_s(lineBuffer, format2, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" - " sprintf_s(lineBuffer, format3, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" + " sprintf_s(lineBuffer, 100, format1, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" + " sprintf_s(lineBuffer, 100, format2, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" + " sprintf_s(lineBuffer, 100, format3, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" " sprintf(lineBuffer, format1, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" " sprintf(lineBuffer, format2, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n" " sprintf(lineBuffer, format3, \"type\", \"sum\", \"avg\", \"min\", i, 0);\n"