Legacy _snwprintf() and snwprintf() functions replaced with ISO C
swprintf().
Assigning _snwprintf() return value to unused variable was also removed
at one occasion.
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20171013095008.8288-1-simon@rozman.si>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15633.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
... | ... |
@@ -4622,7 +4622,7 @@ get_adapter_index_method_1(const char *guid) |
4622 | 4622 |
DWORD index; |
4623 | 4623 |
ULONG aindex; |
4624 | 4624 |
wchar_t wbuf[256]; |
4625 |
- _snwprintf(wbuf, SIZE(wbuf), L"\\DEVICE\\TCPIP_%S", guid); |
|
4625 |
+ swprintf(wbuf, SIZE(wbuf), L"\\DEVICE\\TCPIP_%S", guid); |
|
4626 | 4626 |
wbuf [SIZE(wbuf) - 1] = 0; |
4627 | 4627 |
if (GetAdapterIndex(wbuf, &aindex) != NO_ERROR) |
4628 | 4628 |
{ |
... | ... |
@@ -277,7 +277,7 @@ ReturnProcessId(HANDLE pipe, DWORD pid, DWORD count, LPHANDLE events) |
277 | 277 |
* Same format as error messages (3 line string) with error = 0 in |
278 | 278 |
* 0x%08x format, PID on line 2 and a description "Process ID" on line 3 |
279 | 279 |
*/ |
280 |
- _snwprintf(buf, _countof(buf), L"0x%08x\n0x%08x\n%s", 0, pid, msg); |
|
280 |
+ swprintf(buf, _countof(buf), L"0x%08x\n0x%08x\n%s", 0, pid, msg); |
|
281 | 281 |
buf[_countof(buf) - 1] = '\0'; |
282 | 282 |
|
283 | 283 |
WritePipeAsync(pipe, buf, wcslen(buf) * 2, count, events); |
... | ... |
@@ -403,8 +403,8 @@ ValidateOptions(HANDLE pipe, const WCHAR *workdir, const WCHAR *options) |
403 | 403 |
|
404 | 404 |
if (!CheckOption(workdir, 2, argv_tmp, &settings)) |
405 | 405 |
{ |
406 |
- snwprintf(buf, _countof(buf), msg1, argv[0], workdir, |
|
407 |
- settings.ovpn_admin_group); |
|
406 |
+ swprintf(buf, _countof(buf), msg1, argv[0], workdir, |
|
407 |
+ settings.ovpn_admin_group); |
|
408 | 408 |
buf[_countof(buf) - 1] = L'\0'; |
409 | 409 |
ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); |
410 | 410 |
} |
... | ... |
@@ -422,15 +422,15 @@ ValidateOptions(HANDLE pipe, const WCHAR *workdir, const WCHAR *options) |
422 | 422 |
{ |
423 | 423 |
if (wcscmp(L"--config", argv[i]) == 0 && argc-i > 1) |
424 | 424 |
{ |
425 |
- snwprintf(buf, _countof(buf), msg1, argv[i+1], workdir, |
|
426 |
- settings.ovpn_admin_group); |
|
425 |
+ swprintf(buf, _countof(buf), msg1, argv[i+1], workdir, |
|
426 |
+ settings.ovpn_admin_group); |
|
427 | 427 |
buf[_countof(buf) - 1] = L'\0'; |
428 | 428 |
ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); |
429 | 429 |
} |
430 | 430 |
else |
431 | 431 |
{ |
432 |
- snwprintf(buf, _countof(buf), msg2, argv[i], |
|
433 |
- settings.ovpn_admin_group); |
|
432 |
+ swprintf(buf, _countof(buf), msg2, argv[i], |
|
433 |
+ settings.ovpn_admin_group); |
|
434 | 434 |
buf[_countof(buf) - 1] = L'\0'; |
435 | 435 |
ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); |
436 | 436 |
} |
... | ... |
@@ -955,7 +955,7 @@ RegisterDNS(LPVOID unused) |
955 | 955 |
|
956 | 956 |
if (GetSystemDirectory(sys_path, MAX_PATH)) |
957 | 957 |
{ |
958 |
- _snwprintf(ipcfg, MAX_PATH, L"%s\\%s", sys_path, L"ipconfig.exe"); |
|
958 |
+ swprintf(ipcfg, MAX_PATH, L"%s\\%s", sys_path, L"ipconfig.exe"); |
|
959 | 959 |
ipcfg[MAX_PATH-1] = L'\0'; |
960 | 960 |
} |
961 | 961 |
|
... | ... |
@@ -1595,8 +1595,8 @@ RunOpenvpn(LPVOID p) |
1595 | 1595 |
else if (exit_code != 0) |
1596 | 1596 |
{ |
1597 | 1597 |
WCHAR buf[256]; |
1598 |
- int len = _snwprintf(buf, _countof(buf), |
|
1599 |
- L"OpenVPN exited with error: exit code = %lu", exit_code); |
|
1598 |
+ swprintf(buf, _countof(buf), |
|
1599 |
+ L"OpenVPN exited with error: exit code = %lu", exit_code); |
|
1600 | 1600 |
buf[_countof(buf) - 1] = L'\0'; |
1601 | 1601 |
ReturnError(pipe, ERROR_OPENVPN_STARTUP, buf, 1, &exit_event); |
1602 | 1602 |
} |
... | ... |
@@ -65,7 +65,7 @@ CheckConfigPath(const WCHAR *workdir, const WCHAR *fname, const settings_t *s) |
65 | 65 |
/* convert fname to full path */ |
66 | 66 |
if (PathIsRelativeW(fname) ) |
67 | 67 |
{ |
68 |
- snwprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); |
|
68 |
+ swprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); |
|
69 | 69 |
tmp[_countof(tmp)-1] = L'\0'; |
70 | 70 |
config_file = tmp; |
71 | 71 |
} |