[PATCH 1/7] qga/win: Use swprintf instead of snwprintf

Kostiantyn Kostiuk posted 7 patches 2 days, 16 hours ago
Maintainers: Kostiantyn Kostiuk <kkostiuk@redhat.com>, Michael Roth <michael.roth@amd.com>
[PATCH 1/7] qga/win: Use swprintf instead of snwprintf
Posted by Kostiantyn Kostiuk 2 days, 16 hours ago
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>
---
 qga/commands-win32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index c0bf3467bd..2bf5581aaa 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1590,7 +1590,7 @@ static DWORD get_interface_index(const char *guid)
     ULONG index;
     DWORD status;
     wchar_t wbuf[INTERFACE_PATH_BUF_SZ];
-    snwprintf(wbuf, INTERFACE_PATH_BUF_SZ, L"\\device\\tcpip_%s", guid);
+    swprintf(wbuf, INTERFACE_PATH_BUF_SZ, L"\\device\\tcpip_%s", guid);
     wbuf[INTERFACE_PATH_BUF_SZ - 1] = 0;
     status = GetAdapterIndex (wbuf, &index);
     if (status != NO_ERROR) {
--
2.52.0