Michael Stefaniuc : hostname: Use wide-char string literals.

Alexandre Julliard julliard at winehq.org
Tue Oct 6 15:33:09 CDT 2020


Module: wine
Branch: master
Commit: 0df592b7d5121862231b8224175f59bed160c5f7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0df592b7d5121862231b8224175f59bed160c5f7

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Mon Oct  5 23:22:52 2020 +0200

hostname: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/hostname/hostname.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/programs/hostname/hostname.c b/programs/hostname/hostname.c
index 0738e718e1..e6c2ed76cd 100644
--- a/programs/hostname/hostname.c
+++ b/programs/hostname/hostname.c
@@ -91,18 +91,15 @@ static int WINAPIV hostname_message_printfW(int msg, ...)
 
 static int hostname_message(int msg)
 {
-    static const WCHAR formatW[] = {'%','s',0};
     WCHAR msg_buffer[8192];
 
     LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
 
-    return hostname_printfW(formatW, msg_buffer);
+    return hostname_printfW(L"%s", msg_buffer);
 }
 
 static int display_computer_name(void)
 {
-    static const WCHAR fmtW[] = {'%','s','\r','\n',0};
-
     WCHAR name[MAX_COMPUTERNAME_LENGTH + 1];
     DWORD size = ARRAY_SIZE(name);
     BOOL ret;
@@ -114,7 +111,7 @@ static int display_computer_name(void)
         return 1;
     }
 
-    hostname_printfW(fmtW, name);
+    hostname_printfW(L"%s\r\n", name);
     return 0;
 }
 
@@ -122,11 +119,9 @@ int __cdecl wmain(int argc, WCHAR *argv[])
 {
     if (argc > 1)
     {
-        static const WCHAR slashHelpW[] = {'/','?',0};
-
         unsigned int i;
 
-        if (!wcsncmp(argv[1], slashHelpW, ARRAY_SIZE(slashHelpW) - 1))
+        if (!wcsncmp(argv[1], L"/?", ARRAY_SIZE(L"/?") - 1))
         {
             hostname_message(STRING_USAGE);
             return 1;




More information about the wine-cvs mailing list