@samitouri / QOSamiQemu / commits / f2a468d39e

qga/win: Use swprintf instead of snwprintf

snwprintf is a Microsoft extension, and according to the MSVC spec, it is called _snwprintf. MinGW defines both snwprintf and _snwprintf, while MSVC defines only _snwprintf. We can also use swprintf here. The only difference between the two is the return value, and we are not using it. So change the function to support MSVC build env. Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com> Link: https://lore.kernel.org/r/20260330113906.168002-2-kkostiuk@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Kostiantyn Kostiuk committed Mar 30, 2026 at 14:39 UTC f2a468d39e4ebb328603a090ef5c1523f18d7005
1 file changed +1 -1
qga/commands-win32.c
+1 -1
@@ -1590,7 +1590,7 @@ static DWORD get_interface_index(const char *guid)
1590 ULONG index;
1591 DWORD status;
1592 wchar_t wbuf[INTERFACE_PATH_BUF_SZ];
1593 - snwprintf(wbuf, INTERFACE_PATH_BUF_SZ, L"\\device\\tcpip_%s", guid);
1593 + swprintf(wbuf, INTERFACE_PATH_BUF_SZ, L"\\device\\tcpip_%s", guid);
1594 wbuf[INTERFACE_PATH_BUF_SZ - 1] = 0;
1595 status = GetAdapterIndex (wbuf, &index);
1596 if (status != NO_ERROR) {