qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH-for-7.0] qga/vss-win32: fix compilation with clang++


From: Helge Konetzka
Subject: [PATCH-for-7.0] qga/vss-win32: fix compilation with clang++
Date: Wed, 16 Mar 2022 13:31:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2

Compiling with clang++ of msys2 toolchain clang64 leads to an error
on initializing 'char*' variable nul with a 'const char*' value

Signed-off-by: Helge Konetzka <hk@zapateado.de>
---
Compiling with clang++ of msys2 toolchain clang64 leads to

[1445/1747] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
...
qga/vss-win32/install.cpp:49:24: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'
    char *msg = NULL, *nul = strchr(text, '(');
                       ^     ~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
make: *** [Makefile:163: run-ninja] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
---
 qga/vss-win32/install.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 8076efe3cb..b57508fbe0 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -46,7 +46,8 @@ void errmsg(DWORD err, const char *text)
      * If text doesn't contains '(', negative precision is given, which is
      * treated as though it were missing.
      */
-    char *msg = NULL, *nul = strchr(text, '(');
+    char *msg = NULL;
+    const char *nul = strchr(text, '(');
     int len = nul ? nul - text : -1;

     FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
--
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]