comctl32/datetime: Use wide string literals.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4a0c440d30
commit
8fee131b28
|
@ -361,9 +361,6 @@ DATETIME_SetFormatA (DATETIME_INFO *infoPtr, LPCSTR lpszFormat)
|
||||||
static void
|
static void
|
||||||
DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
|
DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int resultSize)
|
||||||
{
|
{
|
||||||
static const WCHAR fmt_dW[] = { '%', 'd', 0 };
|
|
||||||
static const WCHAR fmt__2dW[] = { '%', '.', '2', 'd', 0 };
|
|
||||||
static const WCHAR fmt__3sW[] = { '%', '.', '3', 's', 0 };
|
|
||||||
SYSTEMTIME date = infoPtr->date;
|
SYSTEMTIME date = infoPtr->date;
|
||||||
int spec;
|
int spec;
|
||||||
WCHAR buffer[80];
|
WCHAR buffer[80];
|
||||||
|
@ -395,10 +392,10 @@ DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int
|
||||||
*result = 0;
|
*result = 0;
|
||||||
break;
|
break;
|
||||||
case ONEDIGITDAY:
|
case ONEDIGITDAY:
|
||||||
wsprintfW (result, fmt_dW, date.wDay);
|
wsprintfW (result, L"%d", date.wDay);
|
||||||
break;
|
break;
|
||||||
case TWODIGITDAY:
|
case TWODIGITDAY:
|
||||||
wsprintfW (result, fmt__2dW, date.wDay);
|
wsprintfW (result, L"%.2d", date.wDay);
|
||||||
break;
|
break;
|
||||||
case THREECHARDAY:
|
case THREECHARDAY:
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7, result, 4);
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7, result, 4);
|
||||||
|
@ -414,7 +411,7 @@ DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int
|
||||||
result[2] = 0;
|
result[2] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0));
|
wsprintfW (result, L"%d", date.wHour - (date.wHour > 12 ? 12 : 0));
|
||||||
break;
|
break;
|
||||||
case TWODIGIT12HOUR:
|
case TWODIGIT12HOUR:
|
||||||
if (date.wHour == 0) {
|
if (date.wHour == 0) {
|
||||||
|
@ -423,35 +420,35 @@ DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int
|
||||||
result[2] = 0;
|
result[2] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0));
|
wsprintfW (result, L"%.2d", date.wHour - (date.wHour > 12 ? 12 : 0));
|
||||||
break;
|
break;
|
||||||
case ONEDIGIT24HOUR:
|
case ONEDIGIT24HOUR:
|
||||||
wsprintfW (result, fmt_dW, date.wHour);
|
wsprintfW (result, L"%d", date.wHour);
|
||||||
break;
|
break;
|
||||||
case TWODIGIT24HOUR:
|
case TWODIGIT24HOUR:
|
||||||
wsprintfW (result, fmt__2dW, date.wHour);
|
wsprintfW (result, L"%.2d", date.wHour);
|
||||||
break;
|
break;
|
||||||
case ONEDIGITSECOND:
|
case ONEDIGITSECOND:
|
||||||
wsprintfW (result, fmt_dW, date.wSecond);
|
wsprintfW (result, L"%d", date.wSecond);
|
||||||
break;
|
break;
|
||||||
case TWODIGITSECOND:
|
case TWODIGITSECOND:
|
||||||
wsprintfW (result, fmt__2dW, date.wSecond);
|
wsprintfW (result, L"%.2d", date.wSecond);
|
||||||
break;
|
break;
|
||||||
case ONEDIGITMINUTE:
|
case ONEDIGITMINUTE:
|
||||||
wsprintfW (result, fmt_dW, date.wMinute);
|
wsprintfW (result, L"%d", date.wMinute);
|
||||||
break;
|
break;
|
||||||
case TWODIGITMINUTE:
|
case TWODIGITMINUTE:
|
||||||
wsprintfW (result, fmt__2dW, date.wMinute);
|
wsprintfW (result, L"%.2d", date.wMinute);
|
||||||
break;
|
break;
|
||||||
case ONEDIGITMONTH:
|
case ONEDIGITMONTH:
|
||||||
wsprintfW (result, fmt_dW, date.wMonth);
|
wsprintfW (result, L"%d", date.wMonth);
|
||||||
break;
|
break;
|
||||||
case TWODIGITMONTH:
|
case TWODIGITMONTH:
|
||||||
wsprintfW (result, fmt__2dW, date.wMonth);
|
wsprintfW (result, L"%.2d", date.wMonth);
|
||||||
break;
|
break;
|
||||||
case THREECHARMONTH:
|
case THREECHARMONTH:
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1, buffer, ARRAY_SIZE(buffer));
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1, buffer, ARRAY_SIZE(buffer));
|
||||||
wsprintfW (result, fmt__3sW, buffer);
|
wsprintfW (result, L"%s.3s", buffer);
|
||||||
break;
|
break;
|
||||||
case FULLMONTH:
|
case FULLMONTH:
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1,
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1,
|
||||||
|
@ -472,14 +469,14 @@ DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int
|
||||||
result[1] = 0;
|
result[1] = 0;
|
||||||
break;
|
break;
|
||||||
case ONEDIGITYEAR:
|
case ONEDIGITYEAR:
|
||||||
wsprintfW (result, fmt_dW, date.wYear % 10);
|
wsprintfW (result, L"%d", date.wYear % 10);
|
||||||
break;
|
break;
|
||||||
case TWODIGITYEAR:
|
case TWODIGITYEAR:
|
||||||
wsprintfW (result, fmt__2dW, date.wYear % 100);
|
wsprintfW (result, L"%.2d", date.wYear % 100);
|
||||||
break;
|
break;
|
||||||
case INVALIDFULLYEAR:
|
case INVALIDFULLYEAR:
|
||||||
case FULLYEAR:
|
case FULLYEAR:
|
||||||
wsprintfW (result, fmt_dW, date.wYear);
|
wsprintfW (result, L"%d", date.wYear);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,11 +598,6 @@ static int DATETIME_GetFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int co
|
||||||
{
|
{
|
||||||
/* fields are a fixed width, determined by the largest possible string */
|
/* fields are a fixed width, determined by the largest possible string */
|
||||||
/* presumably, these widths should be language dependent */
|
/* presumably, these widths should be language dependent */
|
||||||
static const WCHAR fld_d1W[] = { '2', 0 };
|
|
||||||
static const WCHAR fld_d2W[] = { '2', '2', 0 };
|
|
||||||
static const WCHAR fld_d4W[] = { '2', '2', '2', '2', 0 };
|
|
||||||
static const WCHAR fld_am1[] = { 'A', 0 };
|
|
||||||
static const WCHAR fld_am2[] = { 'A', 'M', 0 };
|
|
||||||
int spec;
|
int spec;
|
||||||
WCHAR buffer[80];
|
WCHAR buffer[80];
|
||||||
LPCWSTR bufptr;
|
LPCWSTR bufptr;
|
||||||
|
@ -640,22 +632,17 @@ static int DATETIME_GetFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int co
|
||||||
case TWODIGITMINUTE:
|
case TWODIGITMINUTE:
|
||||||
case TWODIGITMONTH:
|
case TWODIGITMONTH:
|
||||||
case TWODIGITYEAR:
|
case TWODIGITYEAR:
|
||||||
bufptr = fld_d2W;
|
bufptr = L"22";
|
||||||
break;
|
break;
|
||||||
case INVALIDFULLYEAR:
|
case INVALIDFULLYEAR:
|
||||||
case FULLYEAR:
|
case FULLYEAR:
|
||||||
bufptr = fld_d4W;
|
bufptr = L"2222";
|
||||||
break;
|
break;
|
||||||
case THREECHARMONTH:
|
case THREECHARMONTH:
|
||||||
case FULLMONTH:
|
case FULLMONTH:
|
||||||
case THREECHARDAY:
|
case THREECHARDAY:
|
||||||
case FULLDAY:
|
case FULLDAY:
|
||||||
{
|
{
|
||||||
static const WCHAR fld_day[] = {'W','e','d','n','e','s','d','a','y',0};
|
|
||||||
static const WCHAR fld_abbrday[] = {'W','e','d',0};
|
|
||||||
static const WCHAR fld_mon[] = {'S','e','p','t','e','m','b','e','r',0};
|
|
||||||
static const WCHAR fld_abbrmon[] = {'D','e','c',0};
|
|
||||||
|
|
||||||
const WCHAR *fall;
|
const WCHAR *fall;
|
||||||
LCTYPE lctype;
|
LCTYPE lctype;
|
||||||
INT i, max_count;
|
INT i, max_count;
|
||||||
|
@ -664,22 +651,22 @@ static int DATETIME_GetFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int co
|
||||||
/* choose locale data type and fallback string */
|
/* choose locale data type and fallback string */
|
||||||
switch (spec) {
|
switch (spec) {
|
||||||
case THREECHARDAY:
|
case THREECHARDAY:
|
||||||
fall = fld_abbrday;
|
fall = L"Wed";
|
||||||
lctype = LOCALE_SABBREVDAYNAME1;
|
lctype = LOCALE_SABBREVDAYNAME1;
|
||||||
max_count = 7;
|
max_count = 7;
|
||||||
break;
|
break;
|
||||||
case FULLDAY:
|
case FULLDAY:
|
||||||
fall = fld_day;
|
fall = L"Wednesday";
|
||||||
lctype = LOCALE_SDAYNAME1;
|
lctype = LOCALE_SDAYNAME1;
|
||||||
max_count = 7;
|
max_count = 7;
|
||||||
break;
|
break;
|
||||||
case THREECHARMONTH:
|
case THREECHARMONTH:
|
||||||
fall = fld_abbrmon;
|
fall = L"Dec";
|
||||||
lctype = LOCALE_SABBREVMONTHNAME1;
|
lctype = LOCALE_SABBREVMONTHNAME1;
|
||||||
max_count = 12;
|
max_count = 12;
|
||||||
break;
|
break;
|
||||||
default: /* FULLMONTH */
|
default: /* FULLMONTH */
|
||||||
fall = fld_mon;
|
fall = L"September";
|
||||||
lctype = LOCALE_SMONTHNAME1;
|
lctype = LOCALE_SMONTHNAME1;
|
||||||
max_count = 12;
|
max_count = 12;
|
||||||
break;
|
break;
|
||||||
|
@ -704,13 +691,13 @@ static int DATETIME_GetFieldWidth (const DATETIME_INFO *infoPtr, HDC hdc, int co
|
||||||
return cx;
|
return cx;
|
||||||
}
|
}
|
||||||
case ONELETTERAMPM:
|
case ONELETTERAMPM:
|
||||||
bufptr = fld_am1;
|
bufptr = L"A";
|
||||||
break;
|
break;
|
||||||
case TWOLETTERAMPM:
|
case TWOLETTERAMPM:
|
||||||
bufptr = fld_am2;
|
bufptr = L"AM";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bufptr = fld_d1W;
|
bufptr = L"2";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue