C++: Effect on tests.

This commit is contained in:
Geoffrey White
2021-02-02 10:40:22 +00:00
parent 03922aa1f5
commit eed2aee17d
3 changed files with 5 additions and 7 deletions

View File

@@ -1,3 +1,2 @@
| printf.cpp:33:31:33:37 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
| printf.cpp:39:29:39:35 | test | This argument should be of type 'wchar_t *' but is of type 'char16_t *' |
| printf.cpp:45:29:45:35 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
| printf.cpp:52:29:52:35 | test | This argument should be of type 'char16_t *' but is of type 'wchar_t *' |

View File

@@ -1,2 +1 @@
| printf.cpp:15:5:15:12 | swprintf | char | char16_t | char16_t |
| printf.cpp:26:5:26:11 | sprintf | char | char16_t | char16_t |
| printf.cpp:26:5:26:11 | sprintf | char | wchar_t | wchar_t |

View File

@@ -30,13 +30,13 @@ int sprintf(char *dest, char *format, ...);
void test1() {
WCHAR string[20];
swprintf(string, u"test %s", u"test"); // BAD: `char16_t` string parameter read as `char` string
swprintf(string, u"test %s", u"test"); // BAD: `char16_t` string parameter read as `char` string [NOT DETECTED]
}
void test2() {
char string[20];
sprintf(string, "test %S", u"test"); // GOOD
sprintf(string, "test %S", u"test"); // GOOD [FALSE POSITIVE]
}
void test3() {
@@ -49,5 +49,5 @@ void test3() {
void test4() {
char string[20];
sprintf(string, "test %S", L"test"); // BAD: `wchar_t` string parameter read as `char16_t` string
sprintf(string, "test %S", L"test"); // BAD: `wchar_t` string parameter read as `char16_t` string [NOT DETECTED]
}