posix.cfg: Improved configuration of fseeko()/fseeko64().

This commit is contained in:
orbitcowboy 2022-02-07 09:03:39 +01:00
parent 2f17147900
commit a7b7b46d76
2 changed files with 21 additions and 2 deletions

View File

@ -4483,8 +4483,9 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<not-bool/>
</arg>
</function>
<!-- int fseeko(FILE *stream, off_t offset, int whence); -->
<function name="fseeko">
<!-- int fseeko (FILE *stream, off_t offset , int whence); -->
<!-- int fseeko64(FILE *stream, off64_t offset, int whence); -->
<function name="fseeko,fseeko64">
<returnValue type="int"/>
<noreturn>false</noreturn>
<leak-ignore/>
@ -4499,6 +4500,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:2</valid>
</arg>
</function>
<!-- off_t ftello(FILE *stream); -->

View File

@ -29,6 +29,23 @@
#include <wchar.h>
#include <string.h>
void invalidFunctionArg_fseeko(FILE* stream, off_t offset, int origin)
{
// cppcheck-suppress invalidFunctionArg
(void)fseeko(stream, offset, -1);
// cppcheck-suppress invalidFunctionArg
(void)fseeko(stream, offset, 3);
// cppcheck-suppress invalidFunctionArg
(void)fseeko(stream, offset, 42+SEEK_SET);
// cppcheck-suppress invalidFunctionArg
(void)fseeko(stream, offset, SEEK_SET+42);
// No warning is expected for
(void)fseeko(stream, offset, origin);
(void)fseeko(stream, offset, SEEK_SET);
(void)fseeko(stream, offset, SEEK_CUR);
(void)fseeko(stream, offset, SEEK_END);
}
char * overlappingWriteFunction_stpcpy(char *src, char *dest)
{
// No warning shall be shown: