[Libguestfs] [PATCH 4/6] Use StringCchPrintf/snwprintf consistently throughout

Matthew Booth mbooth at redhat.com
Mon Nov 18 14:17:48 UTC 2013


---
 RHSrvAny/RHSrvAny.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/RHSrvAny/RHSrvAny.c b/RHSrvAny/RHSrvAny.c
index 933de7c..2db261a 100644
--- a/RHSrvAny/RHSrvAny.c
+++ b/RHSrvAny/RHSrvAny.c
@@ -35,6 +35,12 @@
 #include <strsafe.h>
 #endif
 
+#ifdef HAVE_STRINGCCHPRINTF
+#define SNPRINTF StringCchPrintf
+#else
+#define SNPRINTF snwprintf
+#endif
+
 #include "RHSrvAny.h"
 
 static TCHAR *svcname = TEXT("RHSrvAny");
@@ -215,7 +221,7 @@ SvcInstall() {
     }
 
     /* Construct ImagePath, which is actually a command line in this instance */
-    if (snwprintf(imagePath, MAX_PATH, L"%s -s %s", szPath, svcname) >= MAX_PATH)
+    if (SNPRINTF(imagePath, MAX_PATH, TEXT("%s -s %s"), szPath, svcname) >= MAX_PATH)
     {
         printf("ImagePath exceeded %d characters\n", MAX_PATH);
         return EXIT_FAILURE;
@@ -517,12 +523,7 @@ SvcReportEvent (
     if (
         NULL != hEventSource
     ) {
-#ifdef HAVE_STRINGCCHPRINTF
-        StringCchPrintf
-#else
-        snwprintf
-#endif
-                  (
+        SNPRINTF(
             Buffer,
             80,
             TEXT("%s failed with %d"),
-- 
1.8.3.1




More information about the Libguestfs mailing list