diff --git a/lib/checkio.cpp b/lib/checkio.cpp index 05efdf4e8..b61af0dc8 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -770,7 +770,7 @@ void CheckIO::checkFormatString(const Token * const tok, invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, true); break; default: - if (argInfo.typeToken->str() != "int") + if (argInfo.typeToken->str() != "int" || !argInfo.typeToken->isUnsigned()) invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, true); else if (typesMatch(argInfo.typeToken->originalName(), "size_t") || typesMatch(argInfo.typeToken->originalName(), "ptrdiff_t") || diff --git a/test/testio.cpp b/test/testio.cpp index 08d2509fe..6de795af4 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -1186,8 +1186,8 @@ private: TEST_SCANF("%x", "unsigned int", "short"); TEST_SCANF("%x", "unsigned int", "signed short"); TEST_SCANF("%x", "unsigned int", "unsigned short"); - // TEST_SCANF("%x", "unsigned int", "int"); - // TODO TEST_SCANF("%x", "unsigned int", "signed int"); + TEST_SCANF("%x", "unsigned int", "int"); + TEST_SCANF("%x", "unsigned int", "signed int"); TEST_SCANF("%x", "unsigned int", "long"); TEST_SCANF("%x", "unsigned int", "signed long"); TEST_SCANF("%x", "unsigned int", "unsigned long");