Skip to content

Commit

Permalink
Ticket 6306: Added regression test and mention suppression in comment (
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitcowboy committed Jan 5, 2024
1 parent 8ca93c9 commit 3241cf5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3241cf5

Please sign in to comment.