scanf with %zd expects ssize_t, not ptrdiff_t
This commit is contained in:
parent
709ee6e278
commit
eaa12db761
|
@ -1852,7 +1852,7 @@ void CheckIO::invalidScanfArgTypeError_int(const Token* tok, unsigned int numFor
|
|||
errmsg << "intmax_t";
|
||||
} else if (specifier[0] == 'z') {
|
||||
if (specifier[1] == 'd')
|
||||
errmsg << "ptrdiff_t";
|
||||
errmsg << "ssize_t";
|
||||
else
|
||||
errmsg << "size_t";
|
||||
} else if (specifier[0] == 't') {
|
||||
|
|
|
@ -1702,8 +1702,8 @@ private:
|
|||
" scanf(\"%zd\", &s2);\n"
|
||||
" scanf(\"%zd\", &s3);\n"
|
||||
"}\n";
|
||||
const char* result("[test.cpp:5]: (portability) %zd in format string (no. 1) requires 'ptrdiff_t *' but the argument type is 'size_t * {aka unsigned long *}'.\n");
|
||||
const char* result_win64("[test.cpp:5]: (portability) %zd in format string (no. 1) requires 'ptrdiff_t *' but the argument type is 'size_t * {aka unsigned long long *}'.\n");
|
||||
const char* result("[test.cpp:5]: (portability) %zd in format string (no. 1) requires 'ssize_t *' but the argument type is 'size_t * {aka unsigned long *}'.\n");
|
||||
const char* result_win64("[test.cpp:5]: (portability) %zd in format string (no. 1) requires 'ssize_t *' but the argument type is 'size_t * {aka unsigned long long *}'.\n");
|
||||
|
||||
check(code, false, true, Settings::Unix32);
|
||||
ASSERT_EQUALS(result, errout.str());
|
||||
|
|
Loading…
Reference in New Issue