[PATCH 6/6] Fix compiler warnings with flag -Wcast-qual

Mikhail Maroukhine mikolg at yandex.ru
Fri Mar 26 15:53:36 CDT 2010


---
 dlls/comctl32/tooltips.c   |    6 +++---
 dlls/imm32/imm.c           |    4 ++--
 dlls/quartz/avidec.c       |    2 +-
 dlls/quartz/avisplit.c     |    4 ++--
 dlls/rpcrt4/ndr_marshall.c |   16 ++++++++--------
 dlls/user32/cursoricon.c   |    8 ++++----
 6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index 083dd07..688d3b5 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -1626,11 +1626,11 @@ TOOLTIPS_SetTitleT (TOOLTIPS_INFO *infoPtr, UINT_PTR uTitleIcon, LPCWSTR pszTitl
         }
         else
         {
-            size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, (LPSTR)pszTitle, -1, NULL, 0);
+            size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszTitle, -1, NULL, 0);
             infoPtr->pszTitle = Alloc(size);
             if (!infoPtr->pszTitle)
                 return FALSE;
-            MultiByteToWideChar(CP_ACP, 0, (LPSTR)pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
+            MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
         }
     }
     else
@@ -1729,7 +1729,7 @@ TOOLTIPS_TrackActivate (TOOLTIPS_INFO *infoPtr, BOOL track_activate, const TTTOO
 	    return FALSE;
 
 	/* activate */
-	infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoT (infoPtr, (TTTOOLINFOW*)ti);
+	infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoT (infoPtr, (const TTTOOLINFOW*)ti);
 	if (infoPtr->nTrackTool != -1) {
 	    TRACE("activated!\n");
 	    infoPtr->bTrackActive = TRUE;
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 6f97448..2898e5e 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -1843,10 +1843,10 @@ HKL WINAPI ImmInstallIMEW(
 
     if (rc == ERROR_SUCCESS)
     {
-        rc = RegSetValueExW(hkey, szImeFileW, 0, REG_SZ, (LPBYTE)lpszIMEFileName,
+        rc = RegSetValueExW(hkey, szImeFileW, 0, REG_SZ, (const BYTE*)lpszIMEFileName,
                             (lstrlenW(lpszIMEFileName) + 1) * sizeof(WCHAR));
         if (rc == ERROR_SUCCESS)
-            rc = RegSetValueExW(hkey, szLayoutTextW, 0, REG_SZ, (LPBYTE)lpszLayoutText,
+            rc = RegSetValueExW(hkey, szLayoutTextW, 0, REG_SZ, (const BYTE*)lpszLayoutText,
                                 (lstrlenW(lpszLayoutText) + 1) * sizeof(WCHAR));
         RegCloseKey(hkey);
         return hkl;
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index 68b1908..8469bbc 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -203,7 +203,7 @@ static HRESULT AVIDec_ConnectInput(InputPin *pin, const AM_MEDIA_TYPE * pmt)
             bmi = &format2->bmiHeader;
         else
             goto failed;
-        TRACE("Fourcc: %s\n", debugstr_an((char *)&pmt->subtype.Data1, 4));
+        TRACE("Fourcc: %s\n", debugstr_an((const char *)&pmt->subtype.Data1, 4));
 
         This->hvid = ICLocate(pmt->majortype.Data1, pmt->subtype.Data1, bmi, NULL, ICMODE_DECOMPRESS);
         if (This->hvid)
diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c
index faa844b..42ec2ae 100644
--- a/dlls/quartz/avisplit.c
+++ b/dlls/quartz/avisplit.c
@@ -692,7 +692,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
                     amt.formattype = FORMAT_WaveFormatEx;
                     break;
                 default:
-                    FIXME("fccType %.4s not handled yet\n", (char *)&pStrHdr->fccType);
+                    FIXME("fccType %.4s not handled yet\n", (const char *)&pStrHdr->fccType);
                     amt.formattype = FORMAT_None;
                 }
                 amt.majortype = MEDIATYPE_Video;
@@ -793,7 +793,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
             TRACE("bIndexSubType: %hd\n", pIndex->bIndexSubType);
             TRACE("bIndexType: %hd\n", pIndex->bIndexType);
             TRACE("nEntriesInUse: %u\n", pIndex->nEntriesInUse);
-            TRACE("dwChunkId: %.4s\n", (char *)&pIndex->dwChunkId);
+            TRACE("dwChunkId: %.4s\n", (const char *)&pIndex->dwChunkId);
             if (pIndex->dwReserved[0])
                 TRACE("dwReserved[0]: %u\n", pIndex->dwReserved[0]);
             if (pIndex->dwReserved[2])
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 9946bd1..f36069c 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -2395,7 +2395,7 @@ unsigned char *  WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubM
 
   TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
 
-  maxsize = *(USHORT *)&pFormat[2];
+  maxsize = *(const USHORT *)&pFormat[2];
 
   if (*pFormat == RPC_FC_CSTRING)
   {
@@ -2445,7 +2445,7 @@ unsigned char *  WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu
   TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n",
     pStubMsg, *ppMemory, pFormat, fMustAlloc);
 
-  maxsize = *(USHORT *)&pFormat[2];
+  maxsize = *(const USHORT *)&pFormat[2];
 
   ReadVariance(pStubMsg, NULL, maxsize);
   if (pStubMsg->Offset)
@@ -2495,7 +2495,7 @@ void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
 
   TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
 
-  maxsize = *(USHORT *)&pFormat[2];
+  maxsize = *(const USHORT *)&pFormat[2];
 
   SizeVariance(pStubMsg);
 
@@ -2538,7 +2538,7 @@ ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
 
   TRACE("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat);
 
-  maxsize = *(USHORT *)&pFormat[2];
+  maxsize = *(const USHORT *)&pFormat[2];
 
   ReadVariance(pStubMsg, NULL, maxsize);
 
@@ -6268,7 +6268,7 @@ static unsigned char *WINAPI NdrRangeMarshall(
     unsigned char *pMemory,
     PFORMAT_STRING pFormat)
 {
-    NDR_RANGE *pRange = (NDR_RANGE *)pFormat;
+    const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat;
     unsigned char base_type;
 
     TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
@@ -6294,7 +6294,7 @@ unsigned char *WINAPI NdrRangeUnmarshall(
     PFORMAT_STRING pFormat,
     unsigned char fMustAlloc)
 {
-    NDR_RANGE *pRange = (NDR_RANGE *)pFormat;
+    const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat;
     unsigned char base_type;
 
     TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false");
@@ -6391,7 +6391,7 @@ static void WINAPI NdrRangeBufferSize(
     unsigned char *pMemory,
     PFORMAT_STRING pFormat)
 {
-    NDR_RANGE *pRange = (NDR_RANGE *)pFormat;
+    const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat;
     unsigned char base_type;
 
     TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
@@ -6413,7 +6413,7 @@ static ULONG WINAPI NdrRangeMemorySize(
     PMIDL_STUB_MESSAGE pStubMsg,
     PFORMAT_STRING pFormat)
 {
-    NDR_RANGE *pRange = (NDR_RANGE *)pFormat;
+    const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat;
     unsigned char base_type;
 
     if (pRange->type != RPC_FC_RANGE)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 6f2359d..fcdb278 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1038,11 +1038,11 @@ static void riff_find_chunk( DWORD chunk_id, DWORD chunk_type, const riff_chunk_
 
     while (ptr < end)
     {
-        if ((!chunk_type && *(DWORD *)ptr == chunk_id )
-                || (chunk_type && *(DWORD *)ptr == chunk_type && *((DWORD *)ptr + 2) == chunk_id ))
+        if ((!chunk_type && *(const DWORD *)ptr == chunk_id )
+                || (chunk_type && *(const DWORD *)ptr == chunk_type && *((const DWORD *)ptr + 2) == chunk_id ))
         {
             ptr += sizeof(DWORD);
-            chunk->data_size = (*(DWORD *)ptr + 1) & ~1;
+            chunk->data_size = (*(const DWORD *)ptr + 1) & ~1;
             ptr += sizeof(DWORD);
             if (chunk_type == ANI_LIST_ID || chunk_type == ANI_RIFF_ID) ptr += sizeof(DWORD);
             chunk->data = ptr;
@@ -1051,7 +1051,7 @@ static void riff_find_chunk( DWORD chunk_id, DWORD chunk_type, const riff_chunk_
         }
 
         ptr += sizeof(DWORD);
-        ptr += (*(DWORD *)ptr + 1) & ~1;
+        ptr += (*(const DWORD *)ptr + 1) & ~1;
         ptr += sizeof(DWORD);
     }
 }
-- 
1.6.3.3


------------UkujtWiUou1pqsQqTfDrMl--




More information about the wine-patches mailing list