From 74b18d7fd93007c8448ec0cf9cbf9af70c860796 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Mon, 4 Jun 2018 16:58:09 +0200 Subject: [PATCH] windows.cfg: Added support for _strncpy_s_l(). --- cfg/windows.cfg | 25 +++++++++++++++++++++++++ test/cfg/windows.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 56fb37c5c..10a07162c 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -3805,6 +3805,31 @@ HFONT CreateFont( + + + false + + + + + + + + + 0: + + + + + + + + + + + + + diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index 2d5b610ab..68e36a511 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -823,3 +823,38 @@ error_t nullPointer_mbscat_s(unsigned char *strDestination, size_t numberOfEleme // no warning shall be shown for return _mbscat_s(strDestination, numberOfElements, strSource); } + +// errno_t _strncpy_s_l(char *strDest, size_t numberOfElements, const char *strSource, size_t count, _locale_t locale); +error_t uninitvar__strncpy_s_l(char *strDest, size_t numberOfElements, const char *strSource, size_t count, _locale_t locale) +{ + size_t uninit_numberOfElements; + const char *uninit_strSource; + size_t uninit_count; + _locale_t uninit_locale; + + // cppcheck-suppress uninitvar + (void)_strncpy_s_l(strDest, uninit_numberOfElements, strSource, count, locale); + // cppcheck-suppress uninitvar + (void)_strncpy_s_l(strDest, numberOfElements, uninit_strSource, count, locale); + // cppcheck-suppress uninitvar + (void)_strncpy_s_l(strDest, numberOfElements, strSource, count, locale); + // cppcheck-suppress uninitvar + (void)_strncpy_s_l(strDest, numberOfElements, strSource, uninit_count, locale); + // cppcheck-suppress uninitvar + (void)_strncpy_s_l(strDest, numberOfElements, strSource, uninit_count, uninit_locale); + + // no warning shall be shown for + return _strncpy_s_l(strDest, numberOfElements, strSource, count, locale); +} + +// errno_t _strncpy_s_l(char *strDest, size_t numberOfElements, const char *strSource, size_t count, _locale_t locale); +error_t nullPointer__strncpy_s_l(char *strDest, size_t numberOfElements, const char *strSource, size_t count, _locale_t locale) +{ + // cppcheck-suppress nullPointer + (void)_strncpy_s_l(0, numberOfElements, strSource, count, locale); + // cppcheck-suppress nullPointer + (void)_strncpy_s_l(strDest, numberOfElements, 0, count, locale); + + // no warning shall be shown for + return _strncpy_s_l(strDest, numberOfElements, strSource, count, locale); +}