Commit b72440fa authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

propsys: Use wide-char string literals.

parent bbb00dce
......@@ -280,12 +280,6 @@ HRESULT WINAPI PSRefreshPropertySchema(void)
HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch)
{
static const WCHAR guid_fmtW[] = {'{','%','0','8','X','-','%','0','4','X','-',
'%','0','4','X','-','%','0','2','X','%','0','2','X','-',
'%','0','2','X','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','%','0','2','X','}',0};
static const WCHAR pid_fmtW[] = {'%','u',0};
WCHAR pidW[PKEY_PIDSTR_MAX + 1];
LPWSTR p = psz;
int len;
......@@ -305,8 +299,8 @@ HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch
return E_NOT_SUFFICIENT_BUFFER;
}
swprintf(psz, cch, guid_fmtW, pkey->fmtid.Data1, pkey->fmtid.Data2,
pkey->fmtid.Data3, pkey->fmtid.Data4[0], pkey->fmtid.Data4[1],
swprintf(psz, cch, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", pkey->fmtid.Data1,
pkey->fmtid.Data2, pkey->fmtid.Data3, pkey->fmtid.Data4[0], pkey->fmtid.Data4[1],
pkey->fmtid.Data4[2], pkey->fmtid.Data4[3], pkey->fmtid.Data4[4],
pkey->fmtid.Data4[5], pkey->fmtid.Data4[6], pkey->fmtid.Data4[7]);
......@@ -315,7 +309,7 @@ HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch
*p++ = ' ';
cch -= GUIDSTRING_MAX - 1 + 1;
len = swprintf(pidW, ARRAY_SIZE(pidW), pid_fmtW, pkey->pid);
len = swprintf(pidW, ARRAY_SIZE(pidW), L"%u", pkey->pid);
if (cch >= len + 1)
{
......
......@@ -245,10 +245,6 @@ HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
{
static const WCHAR trueW[] = {'t','r','u','e',0};
static const WCHAR falseW[] = {'f','a','l','s','e',0};
static const WCHAR true2W[] = {'#','T','R','U','E','#',0};
static const WCHAR false2W[] = {'#','F','A','L','S','E','#',0};
LONGLONG res;
HRESULT hr;
......@@ -267,13 +263,13 @@ HRESULT WINAPI PropVariantToBoolean(REFPROPVARIANT propvarIn, BOOL *ret)
if (!propvarIn->u.pwszVal)
return DISP_E_TYPEMISMATCH;
if (!lstrcmpiW(propvarIn->u.pwszVal, trueW) || !lstrcmpW(propvarIn->u.pwszVal, true2W))
if (!lstrcmpiW(propvarIn->u.pwszVal, L"true") || !lstrcmpW(propvarIn->u.pwszVal, L"#TRUE#"))
{
*ret = TRUE;
return S_OK;
}
if (!lstrcmpiW(propvarIn->u.pwszVal, falseW) || !lstrcmpW(propvarIn->u.pwszVal, false2W))
if (!lstrcmpiW(propvarIn->u.pwszVal, L"false") || !lstrcmpW(propvarIn->u.pwszVal, L"#FALSE#"))
{
*ret = FALSE;
return S_OK;
......@@ -406,11 +402,10 @@ HRESULT WINAPI PropVariantToStringAlloc(REFPROPVARIANT propvarIn, WCHAR **ret)
PCWSTR WINAPI PropVariantToStringWithDefault(REFPROPVARIANT propvarIn, LPCWSTR pszDefault)
{
static const WCHAR str_empty[] = {0};
if (propvarIn->vt == VT_BSTR)
{
if (propvarIn->u.bstrVal == NULL)
return str_empty;
return L"";
return propvarIn->u.bstrVal;
}
......@@ -580,13 +575,9 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
static void PROPVAR_GUIDToWSTR(REFGUID guid, WCHAR *str)
{
static const WCHAR format[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X',
'-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','%','0','2','X','}',0};
swprintf(str, 39, format, guid->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
swprintf(str, 39, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", guid->Data1,
guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2],
guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
}
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment