std.cfg: Improved configuration of std::ifstream::open() and std::ios_base::open().

This commit is contained in:
orbitcowboy 2022-05-10 09:50:02 +02:00
parent 440e8f9c22
commit 6a3520164a
2 changed files with 29 additions and 2 deletions

View File

@ -7182,7 +7182,9 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<noreturn>false</noreturn>
<leak-ignore/>
<returnValue type="void"/>
<arg nr="1" direction="in"/>
<arg nr="1" direction="in">
<not-null/>
</arg>
<arg nr="2" direction="in" default="std::ios_base::in">
<not-uninit/>
</arg>
@ -7193,7 +7195,9 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<noreturn>false</noreturn>
<leak-ignore/>
<returnValue type="void"/>
<arg nr="1" direction="in"/>
<arg nr="1" direction="in">
<not-null/>
</arg>
<arg nr="2" direction="in" default="std::ios_base::in | std::ios_base::out">
<not-uninit/>
</arg>

View File

@ -33,6 +33,29 @@
#include <iterator>
#include <vector>
void nullPointer_std_ifstream_open(std::fstream &fs, const std::string &strFileName, const char* filename, std::ios_base::openmode mode)
{
// cppcheck-suppress nullPointer
fs.open(nullptr, mode);
fs.open(filename, mode);
fs.open(strFileName, mode);
// cppcheck-suppress nullPointer
fs.open(nullptr);
fs.open(filename);
fs.open(strFileName);
}
void nullPointer_std_ifstream_open(std::ifstream &is, const std::string &strFileName, const char* filename, std::ios_base::openmode mode)
{
// cppcheck-suppress nullPointer
is.open(nullptr, mode);
is.open(filename, mode);
is.open(strFileName, mode);
// cppcheck-suppress nullPointer
is.open(nullptr);
is.open(filename);
is.open(strFileName);
}
void bufferAccessOutOfBounds_std_fstream_write(std::fstream &fs, const char* s, std::streamsize n)
{