From 75e28e46c510df5562e7f6d833dbcf0b7221d514 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Mon, 28 May 2018 10:08:11 +0200 Subject: [PATCH] windows.cfg: Added support for _mbscat(). --- cfg/windows.cfg | 13 +++++++++++++ test/cfg/std.c | 2 +- test/cfg/windows.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 3412e793c..ee4da8949 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -5295,6 +5295,19 @@ HFONT CreateFont( + + + + false + + + + + + + + + false diff --git a/test/cfg/std.c b/test/cfg/std.c index 2ffbda9d5..05a269c7f 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -2861,7 +2861,7 @@ void bufferAccessOutOfBounds_strcat(char *dest, const char * const source) const char * const srcstr3 = "123"; const char * const srcstr4 = "1234"; // @todo #8599 cppcheck-suppress bufferAccessOutOfBounds - (void)strcat(buf4,srcstr4); // off by one issue: strcat is appends \0' at the end + (void)strcat(buf4,srcstr4); // off by one issue: strcat is appends \0' at the end // no warning shall be shown for (void)strcat(dest,source); diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index ea688a7bb..57df97827 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -765,3 +765,31 @@ HANDLE test_CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, // no warning shall be shown for return CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); } + +// unsigned char *_mbscat(unsigned char *strDestination, const unsigned char *strSource); +unsigned char * uninitvar_mbscat(unsigned char *strDestination, const unsigned char *strSource) +{ + unsigned char *uninit_deststr; + unsigned char *uninit_srcstr; + // cppcheck-suppress uninitvar + (void)_mbscat(uninit_deststr,uninit_srcstr); + // cppcheck-suppress uninitvar + (void)_mbscat(strDestination,uninit_srcstr); + // cppcheck-suppress uninitvar + (void)_mbscat(uninit_deststr,uninit_deststr); + + // no warning shall be shown for + return _mbscat(strDestination,strSource); +} + +// unsigned char *_mbscat(unsigned char *strDestination, const unsigned char *strSource); +unsigned char * nullPointer_mbscat(unsigned char *strDestination, const unsigned char *strSource) +{ + // cppcheck-suppress nullPointer + (void)_mbscat(0,strSource); + // cppcheck-suppress nullPointer + (void)_mbscat(strDestination,0); + + // no warning shall be shown for + return _mbscat(strDestination,strSource); +}