Commit e09e67e8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Get rid of W->A calls.

parent e07a9568
...@@ -648,15 +648,35 @@ INT WINAPI SHStringFromGUIDA(REFGUID guid, LPSTR lpszDest, INT cchMax) ...@@ -648,15 +648,35 @@ INT WINAPI SHStringFromGUIDA(REFGUID guid, LPSTR lpszDest, INT cchMax)
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.24] * @ [SHLWAPI.24]
* *
* Unicode version of SHStringFromGUIDA. * Convert a GUID to a string.
*
* PARAMS
* guid [I] GUID to convert
* str [O] Destination for string
* cmax [I] Length of output buffer
*
* RETURNS
* The length of the string created.
*/ */
INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax) INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax)
{ {
char xguid[40]; WCHAR xguid[40];
INT iLen = SHStringFromGUIDA(guid, xguid, cchMax); INT iLen;
static const WCHAR wszFormat[] = {'{','%','0','8','l','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};
TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax);
sprintfW(xguid, wszFormat, 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]);
iLen = strlenW(xguid) + 1;
if (iLen) if (iLen > cchMax)
MultiByteToWideChar(CP_ACP, 0, xguid, -1, lpszDest, cchMax); return 0;
memcpy(lpszDest, xguid, iLen*sizeof(WCHAR));
return iLen; return iLen;
} }
...@@ -2706,7 +2726,7 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle ...@@ -2706,7 +2726,7 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle
wc.cbWndExtra = 4; wc.cbWndExtra = 4;
wc.hInstance = shlwapi_hInstance; wc.hInstance = shlwapi_hInstance;
wc.hIcon = NULL; wc.hIcon = NULL;
wc.hCursor = LoadCursorA(NULL, (LPSTR)IDC_ARROW); wc.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; wc.hbrBackground = (HBRUSH)COLOR_BTNSHADOW;
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = szClass; wc.lpszClassName = szClass;
...@@ -2719,10 +2739,10 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle ...@@ -2719,10 +2739,10 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle
hWndParent, hMenu, shlwapi_hInstance, 0); hWndParent, hMenu, shlwapi_hInstance, 0);
if (hWnd) if (hWnd)
{ {
SetWindowLongA(hWnd, DWL_MSGRESULT, z); SetWindowLongW(hWnd, DWL_MSGRESULT, z);
if (wndProc) if (wndProc)
SetWindowLongPtrA(hWnd, GWLP_WNDPROC, wndProc); SetWindowLongPtrW(hWnd, GWLP_WNDPROC, wndProc);
} }
return hWnd; return hWnd;
} }
......
...@@ -599,7 +599,7 @@ LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch) ...@@ -599,7 +599,7 @@ LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
while (lpszStr <= lpszEnd && *lpszStr) while (lpszStr <= lpszEnd && *lpszStr)
{ {
if (!ChrCmpIA(*lpszSearch, *lpszStr)) if (!ChrCmpIW(*lpszSearch, *lpszStr))
{ {
if (!StrCmpNIW(lpszStr, lpszSearch, iLen)) if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
lpszRet = (LPWSTR)lpszStr; lpszRet = (LPWSTR)lpszStr;
...@@ -2186,7 +2186,7 @@ INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp) ...@@ -2186,7 +2186,7 @@ INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp)
return 1; return 1;
else else
{ {
iDiff = SHLWAPI_ChrCmpHelperA(*lpszStr,*lpszComp,NORM_IGNORECASE); iDiff = SHLWAPI_ChrCmpHelperW(*lpszStr,*lpszComp,NORM_IGNORECASE);
if (iDiff > 0) if (iDiff > 0)
return 1; return 1;
else if (iDiff < 0) else if (iDiff < 0)
...@@ -2208,12 +2208,12 @@ typedef struct tagSHLWAPI_BYTEFORMATS ...@@ -2208,12 +2208,12 @@ typedef struct tagSHLWAPI_BYTEFORMATS
LONGLONG dLimit; LONGLONG dLimit;
double dDivisor; double dDivisor;
double dNormaliser; double dNormaliser;
LPCSTR lpszFormat; LPCWSTR lpwszFormat;
CHAR wPrefix; WCHAR wPrefix;
} SHLWAPI_BYTEFORMATS; } SHLWAPI_BYTEFORMATS;
/************************************************************************* /*************************************************************************
* StrFormatByteSize64A [SHLWAPI.@] * StrFormatByteSizeW [SHLWAPI.@]
* *
* Create a string containing an abbreviated byte count of up to 2^63-1. * Create a string containing an abbreviated byte count of up to 2^63-1.
* *
...@@ -2228,12 +2228,12 @@ typedef struct tagSHLWAPI_BYTEFORMATS ...@@ -2228,12 +2228,12 @@ typedef struct tagSHLWAPI_BYTEFORMATS
* NOTES * NOTES
* There is no StrFormatByteSize64W function, it is called StrFormatByteSizeW(). * There is no StrFormatByteSize64W function, it is called StrFormatByteSizeW().
*/ */
LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax) LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
{ {
static const char szBytes[] = "%ld bytes"; static const WCHAR wszBytes[] = {'%','l','d',' ','b','y','t','e','s',0};
static const char sz3_0[] = "%3.0f"; static const WCHAR wsz3_0[] = {'%','3','.','0','f',0};
static const char sz3_1[] = "%3.1f"; static const WCHAR wsz3_1[] = {'%','3','.','1','f',0};
static const char sz3_2[] = "%3.2f"; static const WCHAR wsz3_2[] = {'%','3','.','2','f',0};
#define KB ((ULONGLONG)1024) #define KB ((ULONGLONG)1024)
#define MB (KB*KB) #define MB (KB*KB)
...@@ -2243,25 +2243,25 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax) ...@@ -2243,25 +2243,25 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
static const SHLWAPI_BYTEFORMATS bfFormats[] = static const SHLWAPI_BYTEFORMATS bfFormats[] =
{ {
{ 10*KB, 10.24, 100.0, sz3_2, 'K' }, /* 10 KB */ { 10*KB, 10.24, 100.0, wsz3_2, 'K' }, /* 10 KB */
{ 100*KB, 102.4, 10.0, sz3_1, 'K' }, /* 100 KB */ { 100*KB, 102.4, 10.0, wsz3_1, 'K' }, /* 100 KB */
{ 1000*KB, 1024.0, 1.0, sz3_0, 'K' }, /* 1000 KB */ { 1000*KB, 1024.0, 1.0, wsz3_0, 'K' }, /* 1000 KB */
{ 10*MB, 10485.76, 100.0, sz3_2, 'M' }, /* 10 MB */ { 10*MB, 10485.76, 100.0, wsz3_2, 'M' }, /* 10 MB */
{ 100*MB, 104857.6, 10.0, sz3_1, 'M' }, /* 100 MB */ { 100*MB, 104857.6, 10.0, wsz3_1, 'M' }, /* 100 MB */
{ 1000*MB, 1048576.0, 1.0, sz3_0, 'M' }, /* 1000 MB */ { 1000*MB, 1048576.0, 1.0, wsz3_0, 'M' }, /* 1000 MB */
{ 10*GB, 10737418.24, 100.0, sz3_2, 'G' }, /* 10 GB */ { 10*GB, 10737418.24, 100.0, wsz3_2, 'G' }, /* 10 GB */
{ 100*GB, 107374182.4, 10.0, sz3_1, 'G' }, /* 100 GB */ { 100*GB, 107374182.4, 10.0, wsz3_1, 'G' }, /* 100 GB */
{ 1000*GB, 1073741824.0, 1.0, sz3_0, 'G' }, /* 1000 GB */ { 1000*GB, 1073741824.0, 1.0, wsz3_0, 'G' }, /* 1000 GB */
{ 10*TB, 10485.76, 100.0, sz3_2, 'T' }, /* 10 TB */ { 10*TB, 10485.76, 100.0, wsz3_2, 'T' }, /* 10 TB */
{ 100*TB, 104857.6, 10.0, sz3_1, 'T' }, /* 100 TB */ { 100*TB, 104857.6, 10.0, wsz3_1, 'T' }, /* 100 TB */
{ 1000*TB, 1048576.0, 1.0, sz3_0, 'T' }, /* 1000 TB */ { 1000*TB, 1048576.0, 1.0, wsz3_0, 'T' }, /* 1000 TB */
{ 10*PB, 10737418.24, 100.00, sz3_2, 'P' }, /* 10 PB */ { 10*PB, 10737418.24, 100.00, wsz3_2, 'P' }, /* 10 PB */
{ 100*PB, 107374182.4, 10.00, sz3_1, 'P' }, /* 100 PB */ { 100*PB, 107374182.4, 10.00, wsz3_1, 'P' }, /* 100 PB */
{ 1000*PB, 1073741824.0, 1.00, sz3_0, 'P' }, /* 1000 PB */ { 1000*PB, 1073741824.0, 1.00, wsz3_0, 'P' }, /* 1000 PB */
{ 0, 10995116277.76, 100.00, sz3_2, 'E' } /* EB's, catch all */ { 0, 10995116277.76, 100.00, wsz3_2, 'E' } /* EB's, catch all */
}; };
char szBuff[32]; WCHAR wszBuff[32];
char szAdd[4]; WCHAR wszAdd[] = {' ','?','B',0};
double dBytes; double dBytes;
UINT i = 0; UINT i = 0;
...@@ -2272,7 +2272,7 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax) ...@@ -2272,7 +2272,7 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
if (llBytes < 1024) /* 1K */ if (llBytes < 1024) /* 1K */
{ {
snprintf (lpszDest, cchMax, szBytes, (long)llBytes); snprintfW(lpszDest, cchMax, wszBytes, (long)llBytes);
return lpszDest; return lpszDest;
} }
...@@ -2298,30 +2298,26 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax) ...@@ -2298,30 +2298,26 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
dBytes = floor(dBytes / bfFormats[i].dDivisor) / bfFormats[i].dNormaliser; dBytes = floor(dBytes / bfFormats[i].dDivisor) / bfFormats[i].dNormaliser;
sprintf(szBuff, bfFormats[i].lpszFormat, dBytes); sprintfW(wszBuff, bfFormats[i].lpwszFormat, dBytes);
szAdd[0] = ' '; wszAdd[1] = bfFormats[i].wPrefix;
szAdd[1] = bfFormats[i].wPrefix; strcatW(wszBuff, wszAdd);
szAdd[2] = 'B'; strncpyW(lpszDest, wszBuff, cchMax);
szAdd[3] = '\0';
strcat(szBuff, szAdd);
strncpy(lpszDest, szBuff, cchMax);
return lpszDest; return lpszDest;
} }
/************************************************************************* /*************************************************************************
* StrFormatByteSizeW [SHLWAPI.@] * StrFormatByteSize64A [SHLWAPI.@]
* *
* See StrFormatByteSize64A. * See StrFormatByteSizeW.
*/ */
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
UINT cchMax)
{ {
char szBuff[32]; WCHAR wszBuff[32];
StrFormatByteSize64A(llBytes, szBuff, sizeof(szBuff)); StrFormatByteSizeW(llBytes, wszBuff, sizeof(wszBuff)/sizeof(WCHAR));
if (lpszDest) if (lpszDest)
MultiByteToWideChar(CP_ACP, 0, szBuff, -1, lpszDest, cchMax); WideCharToMultiByte(CP_ACP, 0, wszBuff, -1, lpszDest, cchMax, 0, 0);
return lpszDest; return lpszDest;
} }
......
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