Skip to content

Commit 708d387

Browse files
committed
C++: Actually it's more appropriate to remove the implementation of vswprintf.
1 parent 4e904dd commit 708d387

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| printf.cpp:24:31:24:37 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
2-
| printf.cpp:36:29:36:35 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
3-
| printf.cpp:43:29:43:35 | test | This argument should be of type 'char16_t *' but is of type 'wchar_t *' |
1+
| printf.cpp:31:31:31:37 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
2+
| printf.cpp:43:29:43:35 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
3+
| printf.cpp:50:29:50:35 | test | This argument should be of type 'char16_t *' but is of type 'wchar_t *' |
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| printf.cpp:15:5:15:12 | swprintf | char | char16_t | char16_t |
2-
| printf.cpp:17:5:17:11 | sprintf | char | char16_t | char16_t |
1+
| printf.cpp:13:5:13:12 | swprintf | char | char16_t | char16_t |
2+
| printf.cpp:24:5:24:11 | sprintf | char | char16_t | char16_t |

cpp/ql/test/query-tests/Likely Bugs/Format/WrongTypeFormatArguments/Linux_two_byte_wprintf/printf.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ typedef void *va_list;
88
#define va_start(va, other)
99
#define va_end(args)
1010

11-
int vswprintf(WCHAR *dest, WCHAR *format, va_list args) {
12-
return 0;
13-
}
11+
int vswprintf(WCHAR *dest, WCHAR *format, va_list args);
12+
13+
int swprintf(WCHAR *dest, WCHAR *format, ...) {
14+
va_list args;
15+
va_start(args, format);
16+
17+
int ret = vswprintf(dest, format, args);
1418

15-
int swprintf(WCHAR *dest, WCHAR *format, ...);
19+
va_end(args);
20+
21+
return ret;
22+
}
1623

1724
int sprintf(char *dest, char *format, ...);
1825

0 commit comments

Comments
 (0)