Andrew Talbot : comctl32: Cast-qual warnings fix.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 29 07:24:03 CST 2006


Module: wine
Branch: master
Commit: 63246a539680b3bced86dea3870da2f17b329a6f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=63246a539680b3bced86dea3870da2f17b329a6f

Author: Andrew Talbot <Andrew.Talbot at talbotville.com>
Date:   Tue Nov 28 22:23:42 2006 +0000

comctl32: Cast-qual warnings fix.

---

 dlls/comctl32/propsheet.c |   67 +++++++++++++++++++++++++-------------------
 1 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index a865f51..7261d19 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -276,11 +276,13 @@ static INT PROPSHEET_FindPageByResId(Pro
 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(
      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(
      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(LP
                                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(LP
    * 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(LP
 
   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(LP
     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(LP
       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,
  * 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*
   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*
 	  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*
 	  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*
       --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(LPCPROPSHE
   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(LPCPROPSHE
 
   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(LPCPROPSHE
     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(LPCPROPSHE
   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(LPCPROPSHE
 
   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(LPCPROPSHE
     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 CreatePropertyShee
         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 CreatePropertyShee
         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 CreatePropertyShee
         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-cvs mailing list