[PATCH] oleaut32: Use more wide-char string literals.

Michael Stefaniuc mstefani at winehq.org
Sat Nov 28 16:07:23 CST 2020


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/oleaut32/oleaut.c     | 81 ++++++++++---------------------
 dlls/oleaut32/olefont.c    |  2 +-
 dlls/oleaut32/usrmarshal.c |  3 +-
 dlls/oleaut32/varformat.c  | 98 +++++++++++++++-----------------------
 4 files changed, 66 insertions(+), 118 deletions(-)

diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c
index a026c2bc374..08e6bc6e3f2 100644
--- a/dlls/oleaut32/oleaut.c
+++ b/dlls/oleaut32/oleaut.c
@@ -1138,39 +1138,23 @@ HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon)
  */
 HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str)
 {
-    static const WCHAR ar_month1W[] = {0x645,0x62d,0x631,0x645,0};
-    static const WCHAR ar_month2W[] = {0x635,0x641,0x631,0};
-    static const WCHAR ar_month3W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x627,0x648,0x644,0};
-    static const WCHAR ar_month4W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0};
-    static const WCHAR ar_month5W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x627,0x648,0x644,0x649,0};
-    static const WCHAR ar_month6W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0x629,0};
-    static const WCHAR ar_month7W[] = {0x631,0x62c,0x628,0};
-    static const WCHAR ar_month8W[] = {0x634,0x639,0x628,0x627,0x646,0};
-    static const WCHAR ar_month9W[] = {0x631,0x645,0x636,0x627,0x646,0};
-    static const WCHAR ar_month10W[] = {0x634,0x648,0x627,0x643,0};
-    static const WCHAR ar_month11W[] = {0x630,0x648,' ',0x627,0x644,0x642,0x639,0x62f,0x629,0};
-    static const WCHAR ar_month12W[] = {0x630,0x648,' ',0x627,0x644,0x62d,0x62c,0x629,0};
-
     static const WCHAR *arabic_hijri[] =
     {
-        ar_month1W,
-        ar_month2W,
-        ar_month3W,
-        ar_month4W,
-        ar_month5W,
-        ar_month6W,
-        ar_month7W,
-        ar_month8W,
-        ar_month9W,
-        ar_month10W,
-        ar_month11W,
-        ar_month12W,
+        L"\x0645\x062d\x0631\x0645",
+        L"\x0635\x0641\x0631",
+        L"\x0631\x0628\x064a\x0639 \x0627\x0644\x0627\x0648\x0644",
+        L"\x0631\x0628\x064a\x0639 \x0627\x0644\x062b\x0627\x0646\x064a",
+        L"\x062c\x0645\x0627\x062f\x0649 \x0627\x0644\x0627\x0648\x0644\x0649",
+        L"\x062c\x0645\x0627\x062f\x0649 \x0627\x0644\x062b\x0627\x0646\x064a\x0629",
+        L"\x0631\x062c\x0628",
+        L"\x0634\x0639\x0628\x0627\x0646",
+        L"\x0631\x0645\x0636\x0627\x0646",
+        L"\x0634\x0648\x0627\x0643",
+        L"\x0630\x0648 \x0627\x0644\x0642\x0639\x062f\x0629",
+        L"\x0630\x0648 \x0627\x0644\x062d\x062c\x0629",
         NULL
     };
 
-    static const WCHAR pl_month9W[] = {'w','r','z','e',0x15b,'n','i','a',0};
-    static const WCHAR pl_month10W[] = {'p','a',0x17a,'d','z','i','e','r','n','i','k','a',0};
-
     static const WCHAR *polish_genitive_names[] =
     {
         L"stycznia",
@@ -1181,40 +1165,27 @@ HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str)
         L"czerwca",
         L"lipca",
         L"sierpnia",
-        pl_month9W,
-        pl_month10W,
+        L"wrze\x015bnia",
+        L"pa\x017a" "dziernika",
         L"listopada",
         L"grudnia",
         NULL
     };
 
-    static const WCHAR ru_month1W[] = {0x44f,0x43d,0x432,0x430,0x440,0x44f,0};
-    static const WCHAR ru_month2W[] = {0x444,0x435,0x432,0x440,0x430,0x43b,0x44f,0};
-    static const WCHAR ru_month3W[] = {0x43c,0x430,0x440,0x442,0x430,0};
-    static const WCHAR ru_month4W[] = {0x430,0x43f,0x440,0x435,0x43b,0x44f,0};
-    static const WCHAR ru_month5W[] = {0x43c,0x430,0x44f,0};
-    static const WCHAR ru_month6W[] = {0x438,0x44e,0x43d,0x44f,0};
-    static const WCHAR ru_month7W[] = {0x438,0x44e,0x43b,0x44f,0};
-    static const WCHAR ru_month8W[] = {0x430,0x432,0x433,0x443,0x441,0x442,0x430,0};
-    static const WCHAR ru_month9W[] = {0x441,0x435,0x43d,0x442,0x44f,0x431,0x440,0x44f,0};
-    static const WCHAR ru_month10W[] = {0x43e,0x43a,0x442,0x44f,0x431,0x440,0x44f,0};
-    static const WCHAR ru_month11W[] = {0x43d,0x43e,0x44f,0x431,0x440,0x44f,0};
-    static const WCHAR ru_month12W[] = {0x434,0x435,0x43a,0x430,0x431,0x440,0x44f,0};
-
     static const WCHAR *russian_genitive_names[] =
     {
-        ru_month1W,
-        ru_month2W,
-        ru_month3W,
-        ru_month4W,
-        ru_month5W,
-        ru_month6W,
-        ru_month7W,
-        ru_month8W,
-        ru_month9W,
-        ru_month10W,
-        ru_month11W,
-        ru_month12W,
+        L"\x044f\x043d\x0432\x0430\x0440\x044f",
+        L"\x0444\x0435\x0432\x0440\x0430\x043b\x044f",
+        L"\x043c\x0430\x0440\x0442\x0430",
+        L"\x0430\x043f\x0440\x0435\x043b\x044f",
+        L"\x043c\x0430\x044f",
+        L"\x0438\x044e\x043d\x044f",
+        L"\x0438\x044e\x043b\x044f",
+        L"\x0430\x0432\x0433\x0443\x0441\x0442\x0430",
+        L"\x0441\x0435\x043d\x0442\x044f\x0431\x0440\x044f",
+        L"\x043e\x043a\x0442\x044f\x0431\x0440\x044f",
+        L"\x043d\x043e\x044f\x0431\x0440\x044f",
+        L"\x0434\x0435\x043a\x0430\x0431\x0440\x044f",
         NULL
     };
 
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index 1fd67f9b1b7..f071d00c602 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -338,7 +338,7 @@ HRESULT WINAPI OleCreateFontIndirect(
   *ppvObj = 0;
 
   if (!lpFontDesc) {
-    static WCHAR fname[] = { 'S','y','s','t','e','m',0 };
+    static WCHAR fname[] = L"System";
 
     fd.cbSizeofstruct = sizeof(fd);
     fd.lpstrName      = fname;
diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c
index 163b48f6f46..5eeafb8e378 100644
--- a/dlls/oleaut32/usrmarshal.c
+++ b/dlls/oleaut32/usrmarshal.c
@@ -2261,7 +2261,6 @@ HRESULT __RPC_STUB IPropertyBag_Read_Stub(
     DWORD varType,
     IUnknown *pUnkObj)
 {
-  static const WCHAR emptyWstr[] = {0};
   IDispatch *disp;
   HRESULT hr;
   TRACE("(%p, %s, %p, %p, %x, %p)\n", This, debugstr_w(pszPropName), pVar,
@@ -2287,7 +2286,7 @@ HRESULT __RPC_STUB IPropertyBag_Read_Stub(
       V_UNKNOWN(pVar) = pUnkObj;
       break;
     case VT_BSTR:
-      V_BSTR(pVar) = SysAllocString(emptyWstr);
+      V_BSTR(pVar) = SysAllocString(L"");
       break;
     case VT_SAFEARRAY:
       FIXME("Safearray support not yet implemented.\n");
diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c
index 4fbb2ffa068..e88bf0bc365 100644
--- a/dlls/oleaut32/varformat.c
+++ b/dlls/oleaut32/varformat.c
@@ -44,10 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(variant);
  */
 #define LCID_US MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT)
 
-static const WCHAR szPercent_d[] = { '%','d','\0' };
-static const WCHAR szPercentZeroTwo_d[] = { '%','0','2','d','\0' };
-static const WCHAR szPercentZeroStar_d[] = { '%','0','*','d','\0' };
-
 /******************************************************************************
  * Variant-Formats {OLEAUT32}
  *
@@ -272,7 +268,6 @@ typedef struct tagFMT_DATE_HEADER
 #define FMT_STR_COPY_SKIP   0x41 /* Copy len chars or skip if no char */
 
 /* Named Formats and their tokenised values */
-static const WCHAR szGeneralDate[] = { 'G','e','n','e','r','a','l',' ','D','a','t','e','\0' };
 static const BYTE fmtGeneralDate[0x0a] =
 {
   0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -280,7 +275,6 @@ static const BYTE fmtGeneralDate[0x0a] =
   FMT_DATE_GENERAL,FMT_GEN_END
 };
 
-static const WCHAR szShortDate[] = { 'S','h','o','r','t',' ','D','a','t','e','\0' };
 static const BYTE fmtShortDate[0x0a] =
 {
   0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -288,7 +282,6 @@ static const BYTE fmtShortDate[0x0a] =
   FMT_DATE_SHORT,FMT_GEN_END
 };
 
-static const WCHAR szMediumDate[] = { 'M','e','d','i','u','m',' ','D','a','t','e','\0' };
 static const BYTE fmtMediumDate[0x0a] =
 {
   0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -296,7 +289,6 @@ static const BYTE fmtMediumDate[0x0a] =
   FMT_DATE_MEDIUM,FMT_GEN_END
 };
 
-static const WCHAR szLongDate[] = { 'L','o','n','g',' ','D','a','t','e','\0' };
 static const BYTE fmtLongDate[0x0a] =
 {
   0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -304,7 +296,6 @@ static const BYTE fmtLongDate[0x0a] =
   FMT_DATE_LONG,FMT_GEN_END
 };
 
-static const WCHAR szShortTime[] = { 'S','h','o','r','t',' ','T','i','m','e','\0' };
 static const BYTE fmtShortTime[0x0c] =
 {
   0x0c,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -312,7 +303,6 @@ static const BYTE fmtShortTime[0x0c] =
   FMT_DATE_TIME_UNK2,FMT_DATE_TIME_SEP,FMT_DATE_MIN_0,FMT_GEN_END
 };
 
-static const WCHAR szMediumTime[] = { 'M','e','d','i','u','m',' ','T','i','m','e','\0' };
 static const BYTE fmtMediumTime[0x11] =
 {
   0x11,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -321,7 +311,6 @@ static const BYTE fmtMediumTime[0x11] =
   FMT_GEN_INLINE,0x01,' ','\0',FMT_DATE_AMPM_SYS1,FMT_GEN_END
 };
 
-static const WCHAR szLongTime[] = { 'L','o','n','g',' ','T','i','m','e','\0' };
 static const BYTE fmtLongTime[0x0d] =
 {
   0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -329,7 +318,6 @@ static const BYTE fmtLongTime[0x0d] =
   FMT_DATE_TIME_SYS,FMT_GEN_END
 };
 
-static const WCHAR szTrueFalse[] = { 'T','r','u','e','/','F','a','l','s','e','\0' };
 static const BYTE fmtTrueFalse[0x0d] =
 {
   0x0d,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -337,7 +325,6 @@ static const BYTE fmtTrueFalse[0x0d] =
   FMT_NUM_TRUE_FALSE,FMT_GEN_END
 };
 
-static const WCHAR szYesNo[] = { 'Y','e','s','/','N','o','\0' };
 static const BYTE fmtYesNo[0x0d] =
 {
   0x0d,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -345,7 +332,6 @@ static const BYTE fmtYesNo[0x0d] =
   FMT_NUM_YES_NO,FMT_GEN_END
 };
 
-static const WCHAR szOnOff[] = { 'O','n','/','O','f','f','\0' };
 static const BYTE fmtOnOff[0x0d] =
 {
   0x0d,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -353,13 +339,11 @@ static const BYTE fmtOnOff[0x0d] =
   FMT_NUM_ON_OFF,FMT_GEN_END
 };
 
-static const WCHAR szGeneralNumber[] = { 'G','e','n','e','r','a','l',' ','N','u','m','b','e','r','\0' };
 static const BYTE fmtGeneralNumber[sizeof(FMT_HEADER)] =
 {
   sizeof(FMT_HEADER),FMT_TYPE_GENERAL,sizeof(FMT_HEADER),0x0,0x0,0x0
 };
 
-static const WCHAR szCurrency[] = { 'C','u','r','r','e','n','c','y','\0' };
 static const BYTE fmtCurrency[0x26] =
 {
   0x26,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x12,0x0,0x0,
@@ -374,7 +358,6 @@ static const BYTE fmtCurrency[0x26] =
   FMT_GEN_END
 };
 
-static const WCHAR szFixed[] = { 'F','i','x','e','d','\0' };
 static const BYTE fmtFixed[0x11] =
 {
   0x11,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -382,7 +365,6 @@ static const BYTE fmtFixed[0x11] =
   FMT_NUM_COPY_ZERO,0x1,FMT_NUM_DECIMAL,FMT_NUM_COPY_ZERO,0x2,FMT_GEN_END
 };
 
-static const WCHAR szStandard[] = { 'S','t','a','n','d','a','r','d','\0' };
 static const BYTE fmtStandard[0x11] =
 {
   0x11,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -390,7 +372,6 @@ static const BYTE fmtStandard[0x11] =
   FMT_NUM_COPY_ZERO,0x1,FMT_NUM_DECIMAL,FMT_NUM_COPY_ZERO,0x2,FMT_GEN_END
 };
 
-static const WCHAR szPercent[] = { 'P','e','r','c','e','n','t','\0' };
 static const BYTE fmtPercent[0x15] =
 {
   0x15,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -399,7 +380,6 @@ static const BYTE fmtPercent[0x15] =
   FMT_GEN_INLINE,0x1,'%','\0',FMT_GEN_END
 };
 
-static const WCHAR szScientific[] = { 'S','c','i','e','n','t','i','f','i','c','\0' };
 static const BYTE fmtScientific[0x13] =
 {
   0x13,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -416,22 +396,22 @@ typedef struct tagNAMED_FORMAT
 /* Format name to tokenised format. Must be kept sorted by name */
 static const NAMED_FORMAT VARIANT_NamedFormats[] =
 {
-  { szCurrency, fmtCurrency },
-  { szFixed, fmtFixed },
-  { szGeneralDate, fmtGeneralDate },
-  { szGeneralNumber, fmtGeneralNumber },
-  { szLongDate, fmtLongDate },
-  { szLongTime, fmtLongTime },
-  { szMediumDate, fmtMediumDate },
-  { szMediumTime, fmtMediumTime },
-  { szOnOff, fmtOnOff },
-  { szPercent, fmtPercent },
-  { szScientific, fmtScientific },
-  { szShortDate, fmtShortDate },
-  { szShortTime, fmtShortTime },
-  { szStandard, fmtStandard },
-  { szTrueFalse, fmtTrueFalse },
-  { szYesNo, fmtYesNo }
+  { L"Currency", fmtCurrency },
+  { L"Fixed", fmtFixed },
+  { L"General Date", fmtGeneralDate },
+  { L"General Number", fmtGeneralNumber },
+  { L"Long Date", fmtLongDate },
+  { L"Long Time", fmtLongTime },
+  { L"Medium Date", fmtMediumDate },
+  { L"Medium Time", fmtMediumTime },
+  { L"On/Off", fmtOnOff },
+  { L"Percent", fmtPercent },
+  { L"Scientific", fmtScientific },
+  { L"Short Date", fmtShortDate },
+  { L"Short Time", fmtShortTime },
+  { L"Standard", fmtStandard },
+  { L"True/False", fmtTrueFalse },
+  { L"Yes/No", fmtYesNo }
 };
 typedef const NAMED_FORMAT *LPCNAMED_FORMAT;
 
@@ -1415,13 +1395,13 @@ VARIANT_FormatNumber_Bool:
       if (exponent < 0)
       {
         *pBuff++ = '-';
-        swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), szPercentZeroStar_d, pToken[1], -exponent);
+        swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), L"%0*d", pToken[1], -exponent);
       }
       else
       {
         if (*pToken == FMT_NUM_EXP_POS_L || *pToken == FMT_NUM_EXP_POS_U)
           *pBuff++ = '+';
-        swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), szPercentZeroStar_d, pToken[1], exponent);
+        swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), L"%0*d", pToken[1], exponent);
       }
       while (*pBuff)
         pBuff++;
@@ -1697,12 +1677,12 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
       break;
 
     case FMT_DATE_DAY:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.st.wDay;
       break;
 
     case FMT_DATE_DAY_0:
-      szPrintFmt = szPercentZeroTwo_d;
+      szPrintFmt = L"%02d";
       dwVal = udate.st.wDay;
       break;
 
@@ -1736,7 +1716,7 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
       break;
 
     case FMT_DATE_DAY_WEEK:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       if (pToken[1])
         dwVal = udate.st.wDayOfWeek + 2 - pToken[1];
       else
@@ -1749,19 +1729,19 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
       break;
 
     case FMT_DATE_WEEK_YEAR:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.wDayOfYear / 7 + 1;
       pToken += 2;
       FIXME("Ignoring nFirstDay of %d, nFirstWeek of %d\n", pToken[0], pToken[1]);
       break;
 
     case FMT_DATE_MON:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.st.wMonth;
       break;
 
     case FMT_DATE_MON_0:
-      szPrintFmt = szPercentZeroTwo_d;
+      szPrintFmt = L"%02d";
       dwVal = udate.st.wMonth;
       break;
 
@@ -1780,58 +1760,58 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
       break;
 
     case FMT_DATE_YEAR_DOY:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.wDayOfYear;
       break;
 
     case FMT_DATE_YEAR_0:
-      szPrintFmt = szPercentZeroTwo_d;
+      szPrintFmt = L"%02d";
       dwVal = udate.st.wYear % 100;
       break;
 
     case FMT_DATE_YEAR_LONG:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.st.wYear;
       break;
 
     case FMT_DATE_MIN:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.st.wMinute;
       break;
 
     case FMT_DATE_MIN_0:
-      szPrintFmt = szPercentZeroTwo_d;
+      szPrintFmt = L"%02d";
       dwVal = udate.st.wMinute;
       break;
 
     case FMT_DATE_SEC:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.st.wSecond;
       break;
 
     case FMT_DATE_SEC_0:
-      szPrintFmt = szPercentZeroTwo_d;
+      szPrintFmt = L"%02d";
       dwVal = udate.st.wSecond;
       break;
 
     case FMT_DATE_HOUR:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.st.wHour;
       break;
 
     case FMT_DATE_HOUR_0:
     case FMT_DATE_TIME_UNK2:
-      szPrintFmt = szPercentZeroTwo_d;
+      szPrintFmt = L"%02d";
       dwVal = udate.st.wHour;
       break;
 
     case FMT_DATE_HOUR_12:
-      szPrintFmt = szPercent_d;
+      szPrintFmt = L"%d";
       dwVal = udate.st.wHour ? udate.st.wHour > 12 ? udate.st.wHour - 12 : udate.st.wHour : 12;
       break;
 
     case FMT_DATE_HOUR_12_0:
-      szPrintFmt = szPercentZeroTwo_d;
+      szPrintFmt = L"%02d";
       dwVal = udate.st.wHour ? udate.st.wHour > 12 ? udate.st.wHour - 12 : udate.st.wHour : 12;
       break;
 
@@ -1918,7 +1898,7 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat,
                                     LPBYTE rgbTok, ULONG dwFlags,
                                     BSTR *pbstrOut, LCID lcid)
 {
-  static WCHAR szEmpty[] = { '\0' };
+  static WCHAR szEmpty[] = L"";
   WCHAR buff[256], *pBuff = buff;
   WCHAR *pSrc;
   FMT_HEADER *header = (FMT_HEADER*)rgbTok;
@@ -2189,7 +2169,7 @@ HRESULT WINAPI VarFormat(LPVARIANT pVarIn, LPOLESTR lpszFormat,
  */
 HRESULT WINAPI VarFormatDateTime(LPVARIANT pVarIn, INT nFormat, ULONG dwFlags, BSTR *pbstrOut)
 {
-  static WCHAR szEmpty[] = { '\0' };
+  static WCHAR szEmpty[] = L"";
   const BYTE* lpFmt = NULL;
 
   TRACE("%s,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nFormat, dwFlags, pbstrOut);
@@ -2345,8 +2325,6 @@ HRESULT WINAPI VarFormatNumber(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
 HRESULT WINAPI VarFormatPercent(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT nParens,
                                 INT nGrouping, ULONG dwFlags, BSTR *pbstrOut)
 {
-  static const WCHAR szPercent[] = { '%','\0' };
-  static const WCHAR szPercentBracket[] = { '%',')','\0' };
   WCHAR buff[256];
   HRESULT hRet;
   VARIANT vDbl;
@@ -2382,7 +2360,7 @@ HRESULT WINAPI VarFormatPercent(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
 
         dwLen -= bBracket;
         memcpy(buff, *pbstrOut, dwLen * sizeof(WCHAR));
-        lstrcpyW(buff + dwLen, bBracket ? szPercentBracket : szPercent);
+        lstrcpyW(buff + dwLen, bBracket ? L"%)" : L"%");
         SysFreeString(*pbstrOut);
         *pbstrOut = SysAllocString(buff);
         if (!*pbstrOut)
-- 
2.26.2




More information about the wine-devel mailing list