comctl32: Cast-qual warnings fix
Andrew Talbot
Andrew.Talbot at talbotville.com
Tue Nov 28 16:23:42 CST 2006
Changelog:
comctl32: Cast-qual warnings fix.
diff -urN a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
--- a/dlls/comctl32/propsheet.c 2006-11-21 19:18:02.000000000 +0000
+++ b/dlls/comctl32/propsheet.c 2006-11-28 22:00:32.000000000 +0000
@@ -276,11 +276,13 @@
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 @@
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 @@
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 @@
PropSheetInfo * psInfo,
int index)
{
- DLGTEMPLATE* pTemplate;
+ const DLGTEMPLATE* pTemplate;
const WORD* p;
DWORD dwFlags;
int width, height;
@@ -431,7 +436,7 @@
* 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 @@
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 @@
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 @@
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 @@
* 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 @@
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 @@
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 @@
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 @@
--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 @@
PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
sizeof(PropSheetInfo));
UINT i, n;
- BYTE* pByte;
+ const BYTE* pByte;
TRACE("(%p)\n", lppsh);
@@ -2796,7 +2802,7 @@
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 @@
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 @@
PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
sizeof(PropSheetInfo));
UINT i, n;
- BYTE* pByte;
+ const BYTE* pByte;
TRACE("(%p)\n", lppsh);
@@ -2847,7 +2853,7 @@
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 @@
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,10 @@
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 );
+ WCHAR *template = Alloc( len );
+
+ strcpy( (LPSTR)template, lpPropSheetPage->u.pszTemplate );
+ ppsp->u.pszTemplate = template;
}
}
@@ -3008,8 +3016,9 @@
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 +3027,9 @@
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 );
}
}
More information about the wine-patches
mailing list