Commit 63246a53 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

comctl32: Cast-qual warnings fix.

parent 7e6b7d21
......@@ -276,11 +276,13 @@ static INT PROPSHEET_FindPageByResId(PropSheetInfo * psInfo, LRESULT resId)
static void PROPSHEET_AtoW(LPCWSTR *tostr, LPCSTR frstr)
{
INT len;
WCHAR *to;
TRACE("<%s>\n", frstr);
len = MultiByteToWideChar(CP_ACP, 0, frstr, -1, 0, 0);
*tostr = Alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, frstr, -1, (LPWSTR)*tostr, len);
to = Alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, frstr, -1, to, len);
*tostr = to;
}
/******************************************************************************
......@@ -314,8 +316,10 @@ static BOOL PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh,
if (HIWORD(lppsh->pszCaption))
{
int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0);
psInfo->ppshheader.pszCaption = Alloc( len*sizeof (WCHAR) );
MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len);
WCHAR *caption = Alloc( len*sizeof (WCHAR) );
MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, caption, len);
psInfo->ppshheader.pszCaption = caption;
}
}
psInfo->nPages = lppsh->nPages;
......@@ -368,8 +372,9 @@ static BOOL PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh,
if (HIWORD(lppsh->pszCaption))
{
int len = strlenW(lppsh->pszCaption);
psInfo->ppshheader.pszCaption = Alloc( (len+1)*sizeof(WCHAR) );
strcpyW( (WCHAR *)psInfo->ppshheader.pszCaption, lppsh->pszCaption );
WCHAR *caption = Alloc( (len+1)*sizeof(WCHAR) );
psInfo->ppshheader.pszCaption = strcpyW( caption, lppsh->pszCaption );
}
}
psInfo->nPages = lppsh->nPages;
......@@ -402,7 +407,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
PropSheetInfo * psInfo,
int index)
{
DLGTEMPLATE* pTemplate;
const DLGTEMPLATE* pTemplate;
const WORD* p;
DWORD dwFlags;
int width, height;
......@@ -431,7 +436,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
* Process page template.
*/
if (dwFlags & PSP_DLGINDIRECT)
pTemplate = (DLGTEMPLATE*)lppsp->u.pResource;
pTemplate = lppsp->u.pResource;
else if(dwFlags & PSP_INTERNAL_UNICODE )
{
HRSRC hResource = FindResourceW(lppsp->hInstance,
......@@ -459,7 +464,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
p = (const WORD *)pTemplate;
if (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF)
if (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF)
{
/* DLGTEMPLATEEX (not defined in any std. header file) */
......@@ -545,6 +550,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
WCHAR szTitle[256];
const WCHAR *pTitle;
static const WCHAR pszNull[] = { '(','n','u','l','l',')',0 };
WCHAR *text;
int len;
if ( !HIWORD( lppsp->pszTitle ) )
......@@ -561,8 +567,8 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
pTitle = lppsp->pszTitle;
len = strlenW(pTitle);
psInfo->proppage[index].pszText = Alloc( (len+1)*sizeof (WCHAR) );
strcpyW( (LPWSTR)psInfo->proppage[index].pszText,pTitle);
text = Alloc( (len+1)*sizeof (WCHAR) );
psInfo->proppage[index].pszText = strcpyW( text, pTitle);
}
/*
......@@ -1238,11 +1244,11 @@ PROPSHEET_WizardSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
* See also dialog.c/DIALOG_ParseTemplate32().
*/
static UINT GetTemplateSize(DLGTEMPLATE* pTemplate)
static UINT GetTemplateSize(const DLGTEMPLATE* pTemplate)
{
const WORD* p = (const WORD *)pTemplate;
BOOL istemplateex = (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF);
BOOL istemplateex = (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF);
WORD nrofitems;
UINT ret;
......@@ -1307,7 +1313,7 @@ static UINT GetTemplateSize(DLGTEMPLATE* pTemplate)
p += lstrlenW((LPCWSTR)p) + 1;
/* font, if DS_SETFONT set */
if ((DS_SETFONT & ((istemplateex)? ((MyDLGTEMPLATEEX*)pTemplate)->style :
if ((DS_SETFONT & ((istemplateex)? ((const MyDLGTEMPLATEEX*)pTemplate)->style :
pTemplate->style)))
{
p+=(istemplateex)?3:1;
......@@ -1332,7 +1338,7 @@ static UINT GetTemplateSize(DLGTEMPLATE* pTemplate)
p++;
break;
case 0xffff:
TRACE("class ordinal 0x%08x\n",*(DWORD*)p);
TRACE("class ordinal 0x%08x\n",*(const DWORD*)p);
p += 2;
break;
default:
......@@ -1348,7 +1354,7 @@ static UINT GetTemplateSize(DLGTEMPLATE* pTemplate)
p++;
break;
case 0xffff:
TRACE("text ordinal 0x%08x\n",*(DWORD*)p);
TRACE("text ordinal 0x%08x\n",*(const DWORD*)p);
p += 2;
break;
default:
......@@ -1360,7 +1366,7 @@ static UINT GetTemplateSize(DLGTEMPLATE* pTemplate)
--nrofitems;
}
ret = (p - (WORD*)pTemplate) * sizeof(WORD);
ret = (p - (const WORD*)pTemplate) * sizeof(WORD);
TRACE("%p %p size 0x%08x\n", p, pTemplate, ret);
return ret;
}
......@@ -2788,7 +2794,7 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
sizeof(PropSheetInfo));
UINT i, n;
BYTE* pByte;
const BYTE* pByte;
TRACE("(%p)\n", lppsh);
......@@ -2796,7 +2802,7 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) *
lppsh->nPages);
pByte = (BYTE*) psInfo->ppshheader.u3.ppsp;
pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
for (n = i = 0; i < lppsh->nPages; i++, n++)
{
......@@ -2805,7 +2811,7 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
else
{
psInfo->proppage[n].hpage = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)pByte);
pByte += ((LPPROPSHEETPAGEA)pByte)->dwSize;
pByte += ((LPCPROPSHEETPAGEA)pByte)->dwSize;
}
if (!PROPSHEET_CollectPageInfo((LPCPROPSHEETPAGEW)psInfo->proppage[n].hpage,
......@@ -2839,7 +2845,7 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
sizeof(PropSheetInfo));
UINT i, n;
BYTE* pByte;
const BYTE* pByte;
TRACE("(%p)\n", lppsh);
......@@ -2847,7 +2853,7 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) *
lppsh->nPages);
pByte = (BYTE*) psInfo->ppshheader.u3.ppsp;
pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
for (n = i = 0; i < lppsh->nPages; i++, n++)
{
......@@ -2856,7 +2862,7 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
else
{
psInfo->proppage[n].hpage = CreatePropertySheetPageW((LPCPROPSHEETPAGEW)pByte);
pByte += ((LPPROPSHEETPAGEW)pByte)->dwSize;
pByte += ((LPCPROPSHEETPAGEW)pByte)->dwSize;
}
if (!PROPSHEET_CollectPageInfo((LPCPROPSHEETPAGEW)psInfo->proppage[n].hpage,
......@@ -2943,8 +2949,9 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
if (HIWORD( ppsp->u.pszTemplate ))
{
int len = strlen(lpPropSheetPage->u.pszTemplate) + 1;
ppsp->u.pszTemplate = Alloc( len );
strcpy( (LPSTR)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate );
char *template = Alloc( len );
ppsp->u.pszTemplate = (LPWSTR)strcpy( template, lpPropSheetPage->u.pszTemplate );
}
}
......@@ -3008,8 +3015,9 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage
if (HIWORD( ppsp->u.pszTemplate ))
{
int len = strlenW(lpPropSheetPage->u.pszTemplate) + 1;
ppsp->u.pszTemplate = Alloc( len * sizeof (WCHAR) );
strcpyW( (WCHAR *)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate );
WCHAR *template = Alloc( len * sizeof (WCHAR) );
ppsp->u.pszTemplate = strcpyW( template, lpPropSheetPage->u.pszTemplate );
}
}
......@@ -3018,8 +3026,9 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage
if (HIWORD( ppsp->u2.pszIcon ))
{
int len = strlenW(lpPropSheetPage->u2.pszIcon) + 1;
ppsp->u2.pszIcon = Alloc( len * sizeof (WCHAR) );
strcpyW( (WCHAR *)ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon );
WCHAR *icon = Alloc( len * sizeof (WCHAR) );
ppsp->u2.pszIcon = strcpyW( icon, lpPropSheetPage->u2.pszIcon );
}
}
......
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