Michael Stefaniuc : wineps.drv: Use wide-char string literals.

Alexandre Julliard julliard at winehq.org
Thu Nov 12 15:17:44 CST 2020


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Thu Nov 12 00:37:58 2020 +0100

wineps.drv: Use wide-char string literals.

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

---

 dlls/wineps.drv/driver.c   | 11 ++++-------
 dlls/wineps.drv/init.c     |  4 ++--
 dlls/wineps.drv/type1afm.c | 14 +++++---------
 3 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/dlls/wineps.drv/driver.c b/dlls/wineps.drv/driver.c
index c3d22cec1af..27e1c6e03c8 100644
--- a/dlls/wineps.drv/driver.c
+++ b/dlls/wineps.drv/driver.c
@@ -227,8 +227,6 @@ typedef struct
 static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
                                            WPARAM wParam, LPARAM lParam)
 {
-  static const WCHAR resW[] = {'%','d',0};
-  static const WCHAR resxyW[] = {'%','d','x','%','d',0};
   PSDRV_DLGINFO *di;
   int i, Cursel;
   PAGESIZE *ps;
@@ -280,7 +278,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
         WCHAR buf[256];
 
         res = di->pi->ppd->DefaultResolution;
-        len = swprintf(buf, ARRAY_SIZE(buf), resW, res);
+        len = swprintf(buf, ARRAY_SIZE(buf), L"%d", res);
         buf[len++] = ' ';
         LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
         SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
@@ -310,9 +308,9 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
             DWORD idx;
 
             if (res->resx == res->resy)
-                len = swprintf(buf, ARRAY_SIZE(buf), resW, res->resx);
+                len = swprintf(buf, ARRAY_SIZE(buf), L"%d", res->resx);
             else
-                len = swprintf(buf, ARRAY_SIZE(buf), resxyW, res->resx, res->resy);
+                len = swprintf(buf, ARRAY_SIZE(buf), L"%dx%d", res->resx, res->resy);
             buf[len++] = ' ';
             LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
             idx = SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
@@ -552,7 +550,6 @@ INT CDECL PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput
     PSDRV_DLGINFO di;
     PSDRV_DEVMODE dlgdm;
     WCHAR SetupW[64];
-    static const WCHAR PAPERW[] = {'P','A','P','E','R','\0'};
 
     LoadStringW(PSDRV_hInstance, IDS_SETUP, SetupW, ARRAY_SIZE(SetupW));
     hinstComctl32 = LoadLibraryA("comctl32.dll");
@@ -565,7 +562,7 @@ INT CDECL PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput
     di.dlgdm = &dlgdm;
     psp.dwSize = sizeof(psp);
     psp.hInstance = PSDRV_hInstance;
-    psp.u.pszTemplate = PAPERW;
+    psp.u.pszTemplate = L"PAPER";
     psp.u2.pszIcon = NULL;
     psp.pfnDlgProc = PSDRV_PaperDlgProc;
     psp.lParam = (LPARAM)&di;
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index 5c96986bb9d..ad6d6a07373 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -40,7 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
 static const PSDRV_DEVMODE DefaultDevmode =
 {
   { /* dmPublic */
-/* dmDeviceName */      {'W','i','n','e',' ','P','o','s','t','S','c','r','i','p','t',' ','D','r','i','v','e','r',0},
+/* dmDeviceName */      L"Wine PostScript Driver",
 /* dmSpecVersion */	0x30a,
 /* dmDriverVersion */	0x001,
 /* dmSize */		sizeof(DEVMODEW),
@@ -66,7 +66,7 @@ static const PSDRV_DEVMODE DefaultDevmode =
 /* dmYResolution */	300,
 /* dmTTOption */	DMTT_SUBDEV,
 /* dmCollate */		DMCOLLATE_FALSE,
-/* dmFormName */	{'L','e','t','t','e','r',0},
+/* dmFormName */        L"Letter",
 /* dmLogPixels */	0,
 /* dmBitsPerPel */	0,
 /* dmPelsWidth */	0,
diff --git a/dlls/wineps.drv/type1afm.c b/dlls/wineps.drv/type1afm.c
index 68cf6537b1c..c78753393c0 100644
--- a/dlls/wineps.drv/type1afm.c
+++ b/dlls/wineps.drv/type1afm.c
@@ -1093,13 +1093,12 @@ static BOOL BuildAFM(FILE *file)
  */
 static BOOL ReadAFMFile(LPCWSTR filename)
 {
-    static const WCHAR rW[] = {'r',0};
     FILE    *f;
     BOOL    retval;
 
     TRACE("%s\n", debugstr_w(filename));
 
-    f = _wfopen(filename, rW);
+    f = _wfopen(filename, L"r");
     if (f == NULL)
     {
     	WARN("%s: %s\n", debugstr_w(filename), strerror(errno));
@@ -1120,8 +1119,6 @@ static BOOL ReadAFMFile(LPCWSTR filename)
  */
 static BOOL ReadAFMDir(LPCSTR dirname)
 {
-    static const WCHAR starW[] = {'*',0};
-    static const WCHAR afmW[] = {'.','a','f','m',0};
     WCHAR *path = wine_get_dos_file_name( dirname );
     struct _wfinddata_t data;
     intptr_t handle;
@@ -1138,7 +1135,7 @@ static BOOL ReadAFMDir(LPCSTR dirname)
     HeapFree( GetProcessHeap(), 0, path );
     p = filename + lstrlenW(filename);
     *p++ = '\\';
-    lstrcpyW( p, starW );
+    lstrcpyW( p, L"*" );
 
     handle = _wfindfirst( filename, &data );
     if (handle != -1)
@@ -1146,7 +1143,7 @@ static BOOL ReadAFMDir(LPCSTR dirname)
         do
         {
             WCHAR *ext = wcschr( data.name, '.' );
-            if (!ext || wcsicmp(ext, afmW)) continue;
+            if (!ext || wcsicmp(ext, L".afm")) continue;
             lstrcpyW( p, data.name );
             if (!(ret = ReadAFMFile( filename ))) break;
         } while (!_wfindnext( handle, &data ));
@@ -1170,7 +1167,6 @@ static BOOL ReadAFMDir(LPCSTR dirname)
  */
 BOOL PSDRV_GetType1Metrics(void)
 {
-    static const WCHAR pathW[] = {'A','F','M','P','a','t','h',0};
     HKEY hkey;
     DWORD len;
     LPWSTR valueW;
@@ -1180,11 +1176,11 @@ BOOL PSDRV_GetType1Metrics(void)
     if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts", &hkey) != ERROR_SUCCESS)
         return TRUE;
 
-    if (RegQueryValueExW( hkey, pathW, NULL, NULL, NULL, &len ) == ERROR_SUCCESS)
+    if (RegQueryValueExW( hkey, L"AFMPath", NULL, NULL, NULL, &len ) == ERROR_SUCCESS)
     {
         len += sizeof(WCHAR);
         valueW = HeapAlloc( PSDRV_Heap, 0, len );
-        if (RegQueryValueExW( hkey, pathW, NULL, NULL, (LPBYTE)valueW, &len ) == ERROR_SUCCESS)
+        if (RegQueryValueExW( hkey, L"AFMPath", NULL, NULL, (BYTE *)valueW, &len ) == ERROR_SUCCESS)
         {
             len = WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, NULL, 0, NULL, NULL );
             valueA = HeapAlloc( PSDRV_Heap, 0, len );




More information about the wine-cvs mailing list