Michael Stefaniuc : gdi32/tests: Use wide-char string literals.

Alexandre Julliard julliard at winehq.org
Fri Dec 18 12:52:54 CST 2020


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Thu Dec 17 23:10:19 2020 +0100

gdi32/tests: Use wide-char string literals.

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

---

 dlls/gdi32/tests/driver.c   |  2 +-
 dlls/gdi32/tests/font.c     | 24 +++++++++++-------------
 dlls/gdi32/tests/icm.c      |  4 +---
 dlls/gdi32/tests/metafile.c |  3 +--
 4 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c
index 2110765835f..eb0da18b32e 100644
--- a/dlls/gdi32/tests/driver.c
+++ b/dlls/gdi32/tests/driver.c
@@ -32,7 +32,7 @@
 
 #include "wine/test.h"
 
-static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
+static const WCHAR display1W[] = L"\\\\.\\DISPLAY1";
 
 static NTSTATUS (WINAPI *pD3DKMTCheckOcclusion)(const D3DKMT_CHECKOCCLUSION *);
 static NTSTATUS (WINAPI *pD3DKMTCheckVidPnExclusiveOwnership)(const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *);
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 86ccddd05ea..ad7408f5620 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -1136,7 +1136,6 @@ static void ABCWidths_helper(const char* description, HDC hdc, WORD *glyphs, con
 
 static void test_GetCharABCWidths(void)
 {
-    static const WCHAR str[] = {'i',0};
     BOOL ret;
     HDC hdc;
     LOGFONTA lf;
@@ -1201,7 +1200,7 @@ static void test_GetCharABCWidths(void)
     hdc = GetDC(0);
     hfont = SelectObject(hdc, hfont);
 
-    nb = pGetGlyphIndicesW(hdc, str, 1, glyphs, 0);
+    nb = pGetGlyphIndicesW(hdc, L"i", 1, glyphs, 0);
     ok(nb == 1, "GetGlyphIndicesW should have returned 1\n");
 
     ret = GetCharABCWidthsI(NULL, 0, 1, glyphs, abc);
@@ -1382,7 +1381,7 @@ static void test_GetCharABCWidths(void)
     SetMapMode(hdc, MM_ANISOTROPIC);
     SelectObject(hdc, hfont);
 
-    nb = pGetGlyphIndicesW(hdc, str, 1, glyphs, 0);
+    nb = pGetGlyphIndicesW(hdc, L"i", 1, glyphs, 0);
     ok(nb == 1, "GetGlyphIndicesW should have returned 1\n");
 
     ret = GetCharABCWidthsI(hdc, 0, 1, glyphs, abc);
@@ -1433,8 +1432,7 @@ static void test_GetCharABCWidths(void)
 
 static void test_text_extents(void)
 {
-    static const WCHAR wt[] = {'O','n','e','\n','t','w','o',' ','3',0};
-    static const WCHAR emptyW[] = {0};
+    static const WCHAR wt[] = L"One\ntwo 3";
     LPINT extents;
     INT i, len, fit1, fit2, extents2[3];
     LOGFONTA lf;
@@ -1484,7 +1482,7 @@ static void test_text_extents(void)
     ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
 
     memset(&sz, 0xcc, sizeof(sz));
-    ret = GetTextExtentPointW(hdc, emptyW, 0, &sz);
+    ret = GetTextExtentPointW(hdc, L"", 0, &sz);
     ok(ret, "got %d\n", ret);
     ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
 
@@ -1633,7 +1631,7 @@ static void test_GetGlyphIndices(void)
     DWORD    charcount;
     LOGFONTA lf;
     DWORD    flags = 0;
-    WCHAR    testtext[] = {'T','e','s','t',0xffff,0};
+    WCHAR    testtext[] = L"Test\xffff";
     WORD     glyphs[(sizeof(testtext)/2)-1];
     TEXTMETRICA textm;
     HFONT hOldFont;
@@ -4445,7 +4443,7 @@ static void test_RealizationInfo(void)
 static void test_GetTextFace(void)
 {
     static const char faceA[] = "Tahoma";
-    static const WCHAR faceW[] = {'T','a','h','o','m','a', 0};
+    static const WCHAR faceW[] = L"Tahoma";
     LOGFONTA fA = {0};
     LOGFONTW fW = {0};
     char bufA[LF_FACESIZE];
@@ -6822,7 +6820,7 @@ static void test_fake_bold_font(void)
 
 static void test_bitmap_font_glyph_index(void)
 {
-    const WCHAR text[] = {'#','!','/','b','i','n','/','s','h',0};
+    const WCHAR text[] = L"#!/bin/sh";
     const struct {
         LPCSTR face;
         BYTE charset;
@@ -7117,10 +7115,10 @@ static void test_ttf_names(void)
 
 static void test_lang_names(void)
 {
-    static const WCHAR name_cond_ja_w[] = {0x30d5,0x30a9,0x30f3,0x30c8,0x540d,' ','C','o','n','d',' ','(','j','a',')',0};
-    static const WCHAR name_cond_ja_reg_w[] = {0x30d5,0x30a9,0x30f3,0x30c8,0x540d,' ','C','o','n','d',' ','(','j','a',')',' ','R','e','g',0};
-    static const WCHAR name_cond_ja_reg_ja_w[] = {0x30d5,0x30a9,0x30f3,0x30c8,0x540d,' ','C','o','n','d',' ','(','j','a',')',' ','R','e','g',' ','(','j','a',')',0};
-    static const WCHAR name_wws_ja_w[] = {0x30d5,0x30a9,0x30f3,0x30c8,0x540d,' ','W','W','S',' ','(','j','a',')',0};
+    static const WCHAR name_cond_ja_w[] = L"\x30d5\x30a9\x30f3\x30c8\x540d Cond (ja)";
+    static const WCHAR name_cond_ja_reg_w[] = L"\x30d5\x30a9\x30f3\x30c8\x540d Cond (ja) Reg";
+    static const WCHAR name_cond_ja_reg_ja_w[] = L"\x30d5\x30a9\x30f3\x30c8\x540d Cond (ja) Reg (ja)";
+    static const WCHAR name_wws_ja_w[] = L"\x30d5\x30a9\x30f3\x30c8\x540d WWS (ja)";
 
     struct enum_fullname_data efnd;
     struct enum_fullname_data_w efnd_w;
diff --git a/dlls/gdi32/tests/icm.c b/dlls/gdi32/tests/icm.c
index 340ebeef55a..509d5c0c579 100644
--- a/dlls/gdi32/tests/icm.c
+++ b/dlls/gdi32/tests/icm.c
@@ -27,8 +27,6 @@
 
 #include "wine/test.h"
 
-static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
-
 static void test_GetICMProfileA( HDC dc )
 {
     BOOL ret;
@@ -167,7 +165,7 @@ static void test_SetICMMode( HDC dc )
     ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
-    dc = CreateDCW( displayW, NULL, NULL, NULL );
+    dc = CreateDCW( L"DISPLAY", NULL, NULL, NULL );
     if ( !dc && ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) )
     {
         win_skip( "CreateDCW is not implemented\n" );
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 5a64fe6d60a..8dae908126d 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -312,7 +312,6 @@ static int CALLBACK eto_scale_enum_proc(HDC hdc, HANDLETABLE *handle_table,
 static void test_ExtTextOutScale(void)
 {
     const RECT rc = { 0, 0, 100, 100 };
-    const WCHAR str[] = {'a',0 };
     struct eto_scale_test_record test;
     HDC hdcDisplay, hdcMetafile;
     HENHMETAFILE hMetafile;
@@ -392,7 +391,7 @@ static void test_ExtTextOutScale(void)
             ok(ret, "SetViewportExtEx failed\n");
         }
 
-        ret = ExtTextOutW(hdcMetafile, 0, 0, 0, 0, str, 1, NULL);
+        ret = ExtTextOutW(hdcMetafile, 0, 0, 0, 0, L"a", 1, NULL);
         ok(ret, "ExtTextOutW failed\n");
 
         hMetafile = CloseEnhMetaFile(hdcMetafile);




More information about the wine-cvs mailing list