Ticket 6306: Added regression test and mention suppression in comment (#5835)

This commit is contained in:
orbitcowboy 2024-01-05 12:58:27 +01:00 committed by GitHub
parent 8ca93c983b
commit 3241cf5966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -4290,6 +4290,28 @@ void nullPointer_istream_read(std::istream &f)
f.read(NULL, 10);
}
std::size_t nullPointer_strxfrm(char *dest, const char *src, std::size_t count)
{
(void)strxfrm(dest, src, count);
// In case the 3rd argument is 0, the 1st argument is permitted to be a null pointer. (#6306)
(void)strxfrm(nullptr, src, 0);
(void)strxfrm(nullptr, src, 1);
(void)strxfrm(nullptr, src, count);
// cppcheck-suppress nullPointer
return strxfrm(dest, nullptr, count);
}
std::size_t nullPointer_wcsxfrm(wchar_t *dest, const wchar_t *src, std::size_t count)
{
(void)wcsxfrm(dest, src, count);
// In case the 3rd argument is 0, the 1st argument is permitted to be a null pointer. (#6306)
(void)wcsxfrm(nullptr, src, 0);
(void)wcsxfrm(nullptr, src, 1);
(void)wcsxfrm(nullptr, src, count);
// cppcheck-suppress nullPointer
return wcsxfrm(dest, nullptr, count);
}
void nullPointer_asctime(void)
{
const struct tm *tm = 0;