From 0a258964c28b0d1a09766ce7a00354fc5951278f Mon Sep 17 00:00:00 2001 From: Eric Pouech <pouech-eric@wanadoo.fr> Date: Tue, 30 Nov 2004 21:38:57 +0000 Subject: [PATCH] Const correctness fixes. --- dlls/advapi32/registry.c | 4 +- dlls/advapi32/service.c | 8 +- dlls/advapi32/tests/registry.c | 2 +- dlls/cabinet/cabextract.c | 39 ++--- dlls/crypt32/main.c | 6 +- dlls/d3d8/device.c | 14 +- dlls/d3d8/drawprim.c | 16 +- dlls/d3d8/shader.c | 10 +- dlls/d3d8/vshaderdeclaration.c | 60 ++++---- dlls/d3d9/pixelshader.c | 2 +- dlls/ddraw/d3ddevice/mesa.c | 4 +- dlls/ddraw/d3dlight.c | 2 +- dlls/ddraw/helper.c | 2 +- dlls/devenum/devenum_main.c | 2 +- dlls/dplayx/dplobby.c | 4 +- dlls/dpnet/address.c | 6 +- dlls/gdi/driver.c | 12 +- dlls/gdi/enhmfdrv/graphics.c | 2 +- dlls/gdi/tests/metafile.c | 11 +- dlls/imm32/imm.c | 2 +- dlls/msdmo/dmoreg.c | 6 +- dlls/msvcrt/dir.c | 24 +-- dlls/ole32/compobj.c | 2 +- dlls/ole32/storage.c | 2 +- dlls/ole32/storage32.c | 22 +-- dlls/oleaut32/typelib2.c | 2 +- dlls/oledlg/insobjdlg.c | 2 +- dlls/opengl32/wgl.c | 8 +- dlls/quartz/avisplit.c | 11 +- dlls/quartz/filtermapper.c | 24 +-- dlls/rpcrt4/cproxy.c | 4 +- dlls/rpcrt4/ndr_marshall.c | 170 ++++++++++----------- dlls/setupapi/install.c | 2 +- dlls/shell32/changenotify.c | 18 +-- dlls/shell32/debughlp.c | 2 +- dlls/shell32/pidl.c | 8 +- dlls/shell32/shellord.c | 2 +- dlls/shell32/shlfolder.c | 2 +- dlls/shell32/shpolicy.c | 8 +- dlls/shlwapi/clist.c | 2 +- dlls/shlwapi/url.c | 2 +- dlls/user/exticon.c | 12 +- dlls/user/msg16.c | 2 +- dlls/user/resource.c | 2 +- dlls/version/resource.c | 13 +- dlls/winedos/ppdev.c | 2 +- dlls/wineps/escape.c | 22 +-- dlls/wineps/init.c | 4 +- dlls/winmm/mci.c | 22 +-- dlls/winspool/info.c | 10 +- dlls/x11drv/dib.c | 109 ++++++------- dlls/x11drv/dib_convert.c | 100 ++++++------ dlls/x11drv/dib_dst_swap.c | 112 +++++++------- dlls/x11drv/dib_src_swap.c | 102 ++++++------- dlls/x11drv/init.c | 6 +- dlls/x11drv/opengl.c | 4 +- dlls/x11drv/palette.c | 4 +- dlls/x11drv/xfont.c | 2 +- dlls/x11drv/xrender.c | 11 +- include/wine/server.h | 2 +- libs/unicode/cptable.c | 2 +- libs/unicode/wctomb.c | 2 +- programs/rpcss/epmap_server.c | 4 +- programs/taskmgr/dbgchnl.c | 2 +- programs/uninstaller/main.c | 2 +- programs/winefile/winefile.c | 16 +- programs/winemenubuilder/winemenubuilder.c | 6 +- server/debugger.c | 2 +- server/registry.c | 4 +- 69 files changed, 558 insertions(+), 554 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 01d59f65c10..3ecd09e41a3 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -1041,7 +1041,7 @@ DWORD WINAPI RegSetValueW( HKEY hkey, LPCWSTR name, DWORD type, LPCWSTR data, DW if ((ret = RegCreateKeyW( hkey, name, &subkey )) != ERROR_SUCCESS) return ret; } - ret = RegSetValueExW( subkey, NULL, 0, REG_SZ, (LPBYTE)data, + ret = RegSetValueExW( subkey, NULL, 0, REG_SZ, (const BYTE*)data, (strlenW( data ) + 1) * sizeof(WCHAR) ); if (subkey != hkey) RegCloseKey( subkey ); return ret; @@ -1066,7 +1066,7 @@ DWORD WINAPI RegSetValueA( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWOR { if ((ret = RegCreateKeyA( hkey, name, &subkey )) != ERROR_SUCCESS) return ret; } - ret = RegSetValueExA( subkey, NULL, 0, REG_SZ, (LPBYTE)data, strlen(data)+1 ); + ret = RegSetValueExA( subkey, NULL, 0, REG_SZ, (const BYTE*)data, strlen(data)+1 ); if (subkey != hkey) RegCloseKey( subkey ); return ret; } diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 51766e2a23f..0193b2463a0 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -725,7 +725,7 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, if(lpDisplayName) { - r = RegSetValueExW(hKey, szDisplayName, 0, REG_SZ, (LPBYTE)lpDisplayName, + r = RegSetValueExW(hKey, szDisplayName, 0, REG_SZ, (const BYTE*)lpDisplayName, (strlenW(lpDisplayName)+1)*sizeof(WCHAR) ); if (r!=ERROR_SUCCESS) goto error; @@ -746,7 +746,7 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, if(lpBinaryPathName) { - r = RegSetValueExW(hKey, szImagePath, 0, REG_SZ, (LPBYTE)lpBinaryPathName, + r = RegSetValueExW(hKey, szImagePath, 0, REG_SZ, (const BYTE*)lpBinaryPathName, (strlenW(lpBinaryPathName)+1)*sizeof(WCHAR) ); if (r!=ERROR_SUCCESS) goto error; @@ -754,7 +754,7 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, if(lpLoadOrderGroup) { - r = RegSetValueExW(hKey, szGroup, 0, REG_SZ, (LPBYTE)lpLoadOrderGroup, + r = RegSetValueExW(hKey, szGroup, 0, REG_SZ, (const BYTE*)lpLoadOrderGroup, (strlenW(lpLoadOrderGroup)+1)*sizeof(WCHAR) ); if (r!=ERROR_SUCCESS) goto error; @@ -770,7 +770,7 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, } while (lpDependencies[len++]); r = RegSetValueExW(hKey, szDependencies, 0, REG_MULTI_SZ, - (LPBYTE)lpDependencies, len ); + (const BYTE*)lpDependencies, len ); if (r!=ERROR_SUCCESS) goto error; } diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 8843cea8742..cc88d666414 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -177,7 +177,7 @@ static void test_enum_value(void) /* Unicode tests */ SetLastError(0); - res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (BYTE *)foobarW, 7*sizeof(WCHAR) ); + res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (const BYTE *)foobarW, 7*sizeof(WCHAR) ); if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) goto CLEANUP; ok( res == 0, "RegSetValueExW failed error %ld\n", res ); diff --git a/dlls/cabinet/cabextract.c b/dlls/cabinet/cabextract.c index f750e6bf072..646a8680d59 100644 --- a/dlls/cabinet/cabextract.c +++ b/dlls/cabinet/cabextract.c @@ -52,7 +52,7 @@ THOSE_ZIP_CONSTS; /* try to open a cabinet file, returns success */ BOOL cabinet_open(struct cabinet *cab) { - char *name = (char *)cab->filename; + const char *name = cab->filename; HANDLE fh; TRACE("(cab == ^%p)\n", cab); @@ -177,8 +177,9 @@ BOOL ensure_filepath(char *path) { */ BOOL file_open(struct cab_file *fi, BOOL lower, LPCSTR dir) { - char c, *s, *d, *name; + char c, *d, *name; BOOL ok = FALSE; + const char *s; TRACE("(fi == ^%p, lower == %s, dir == %s)\n", fi, lower ? "TRUE" : "FALSE", debugstr_a(dir)); @@ -279,7 +280,7 @@ void cabinet_skip(struct cabinet *cab, cab_off_t distance) TRACE("(cab == ^%p, distance == %u)\n", cab, distance); if (SetFilePointer(cab->fh, distance, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER) { if (distance != INVALID_SET_FILE_POINTER) - ERR("%s\n", debugstr_a((char *) cab->filename)); + ERR("%s\n", debugstr_a(cab->filename)); } } @@ -291,7 +292,7 @@ void cabinet_skip(struct cabinet *cab, cab_off_t distance) void cabinet_seek(struct cabinet *cab, cab_off_t offset) { TRACE("(cab == ^%p, offset == %u)\n", cab, offset); if (SetFilePointer(cab->fh, offset, NULL, FILE_BEGIN) != offset) - ERR("%s seek failure\n", debugstr_a((char *)cab->filename)); + ERR("%s seek failure\n", debugstr_a(cab->filename)); } /******************************************************************* @@ -317,15 +318,15 @@ BOOL cabinet_read(struct cabinet *cab, cab_UBYTE *buf, cab_off_t length) TRACE("(cab == ^%p, buf == ^%p, length == %u)\n", cab, buf, length); if (length > avail) { - WARN("%s: WARNING; cabinet is truncated\n", debugstr_a((char *)cab->filename)); + WARN("%s: WARNING; cabinet is truncated\n", debugstr_a(cab->filename)); length = avail; } if (! ReadFile( cab->fh, (LPVOID) buf, length, &bytes_read, NULL )) { - ERR("%s read error\n", debugstr_a((char *) cab->filename)); + ERR("%s read error\n", debugstr_a(cab->filename)); return FALSE; } else if (bytes_read != length) { - ERR("%s read size mismatch\n", debugstr_a((char *) cab->filename)); + ERR("%s read size mismatch\n", debugstr_a(cab->filename)); return FALSE; } @@ -358,7 +359,7 @@ char *cabinet_read_string(struct cabinet *cab) if (!ok) { if (len == maxlen) { - ERR("%s: WARNING; cabinet is truncated\n", debugstr_a((char *) cab->filename)); + ERR("%s: WARNING; cabinet is truncated\n", debugstr_a(cab->filename)); break; } len += 256; @@ -403,21 +404,21 @@ BOOL cabinet_read_entries(struct cabinet *cab) /* check basic MSCF signature */ if (EndGetI32(buf+cfhead_Signature) != 0x4643534d) { - ERR("%s: not a Microsoft cabinet file\n", debugstr_a((char *) cab->filename)); + ERR("%s: not a Microsoft cabinet file\n", debugstr_a(cab->filename)); return FALSE; } /* get the number of folders */ num_folders = EndGetI16(buf+cfhead_NumFolders); if (num_folders == 0) { - ERR("%s: no folders in cabinet\n", debugstr_a((char *) cab->filename)); + ERR("%s: no folders in cabinet\n", debugstr_a(cab->filename)); return FALSE; } /* get the number of files */ num_files = EndGetI16(buf+cfhead_NumFiles); if (num_files == 0) { - ERR("%s: no files in cabinet\n", debugstr_a((char *) cab->filename)); + ERR("%s: no files in cabinet\n", debugstr_a(cab->filename)); return FALSE; } @@ -425,7 +426,7 @@ BOOL cabinet_read_entries(struct cabinet *cab) if ((buf[cfhead_MajorVersion] > 1) || (buf[cfhead_MajorVersion] == 1 && buf[cfhead_MinorVersion] > 3)) { - WARN("%s: WARNING; cabinet format version > 1.3\n", debugstr_a((char *) cab->filename)); + WARN("%s: WARNING; cabinet format version > 1.3\n", debugstr_a(cab->filename)); } /* read the reserved-sizes part of header, if present */ @@ -437,13 +438,13 @@ BOOL cabinet_read_entries(struct cabinet *cab) cab->block_resv = buf[cfheadext_DataReserved]; if (header_resv > 60000) { - WARN("%s: WARNING; header reserved space > 60000\n", debugstr_a((char *) cab->filename)); + WARN("%s: WARNING; header reserved space > 60000\n", debugstr_a(cab->filename)); } /* skip the reserved header */ if (header_resv) if (SetFilePointer(cab->fh, (cab_off_t) header_resv, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER) - ERR("seek failure: %s\n", debugstr_a((char *) cab->filename)); + ERR("seek failure: %s\n", debugstr_a(cab->filename)); } if (cab->flags & cfheadPREV_CABINET) { @@ -528,7 +529,7 @@ struct cabinet *load_cab_offset(LPCSTR name, cab_off_t offset) struct cabinet *cab = (struct cabinet *) calloc(1, sizeof(struct cabinet)); int ok; - TRACE("(name == %s, offset == %u)\n", debugstr_a((char *) name), offset); + TRACE("(name == %s, offset == %u)\n", debugstr_a(name), offset); if (!cab) return NULL; @@ -1954,7 +1955,7 @@ struct cabinet *find_cabs_in_file(LPCSTR name, cab_UBYTE search_buf[]) cab_off_t offset, caboff, cablen = 0, foffset = 0, filelen, length; int state = 0, found = 0, ok = 0; - TRACE("(name == %s)\n", debugstr_a((char *) name)); + TRACE("(name == %s)\n", debugstr_a(name)); /* open the file and search for cabinet headers */ if ((cab = (struct cabinet *) calloc(1, sizeof(struct cabinet)))) { @@ -2489,7 +2490,7 @@ void extract_file(struct cab_file *fi, int lower, int fix, LPCSTR dir, cab_decom exit_handler: if (err) { const char *errmsg; - char *cabname; + const char *cabname; switch (err) { case DECR_NOMEMORY: errmsg = "out of memory!\n"; break; @@ -2508,10 +2509,10 @@ exit_handler: } if (CAB(current)) { - cabname = (char *) (CAB(current)->cab[CAB(split)]->filename); + cabname = (CAB(current)->cab[CAB(split)]->filename); } else { - cabname = (char *) (fi->folder->cab[0]->filename); + cabname = (fi->folder->cab[0]->filename); } ERR(errmsg, cabname); diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c index f06994925fe..2160fa3aa6f 100644 --- a/dlls/crypt32/main.c +++ b/dlls/crypt32/main.c @@ -122,9 +122,9 @@ static LONG CRYPT_SIPWriteFunction( LPGUID guid, LPCWSTR szKey, return r; /* write the values */ - RegSetValueExW( hKey, szFuncName, 0, REG_SZ, (LPBYTE) szFunction, + RegSetValueExW( hKey, szFuncName, 0, REG_SZ, (const BYTE*) szFunction, ( lstrlenW( szFunction ) + 1 ) * sizeof (WCHAR) ); - RegSetValueExW( hKey, szDllName, 0, REG_SZ, (LPBYTE) szDll, + RegSetValueExW( hKey, szDllName, 0, REG_SZ, (const BYTE*) szDll, ( lstrlenW( szDll ) + 1) * sizeof (WCHAR) ); RegCloseKey( hKey ); @@ -248,7 +248,7 @@ BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, /* write the values */ RegSetValueExA( hKey, "FuncName", 0, REG_SZ, pszOverrideFuncName, lstrlenA( pszOverrideFuncName ) + 1 ); - RegSetValueExW( hKey, szDllName, 0, REG_SZ, (LPBYTE) pwszDll, + RegSetValueExW( hKey, szDllName, 0, REG_SZ, (const BYTE*) pwszDll, (lstrlenW( pwszDll ) + 1) * sizeof (WCHAR) ); RegCloseKey( hKey ); diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index f4765f9a322..2010a09d293 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -239,7 +239,7 @@ void setup_light(LPDIRECT3DDEVICE8 iface, LONG Index, PLIGHTINFOEL *lightInfo) { } /* Setup this textures matrix */ -static void set_texture_matrix(float *smat, DWORD flags) +static void set_texture_matrix(const float *smat, DWORD flags) { float mat[16]; @@ -1531,7 +1531,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(LPDIRECT3DDEVICE8 iface, D3DT glActiveTextureARB(GL_TEXTURE0_ARB + tex); checkGLcall("glActiveTextureARB"); #endif - set_texture_matrix((float *)lpmatrix, This->UpdateStateBlock->texture_state[tex][D3DTSS_TEXTURETRANSFORMFLAGS]); + set_texture_matrix((const float *)lpmatrix, This->UpdateStateBlock->texture_state[tex][D3DTSS_TEXTURETRANSFORMFLAGS]); } } else if (d3dts == D3DTS_VIEW) { /* handle the VIEW matrice */ @@ -1543,7 +1543,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(LPDIRECT3DDEVICE8 iface, D3DT glMatrixMode(GL_MODELVIEW); checkGLcall("glMatrixMode(GL_MODELVIEW)"); glPushMatrix(); - glLoadMatrixf((float *)lpmatrix); + glLoadMatrixf((const float *)lpmatrix); checkGLcall("glLoadMatrixf(...)"); /* If we are changing the View matrix, reset the light and clipping planes to the new view @@ -4090,7 +4090,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(LPDIRECT3DDEVICE8 return D3DERR_INVALIDCALL; } if (ConstantCount > 1) { - FLOAT* f = (FLOAT*)pConstantData; + const FLOAT* f = (const FLOAT*)pConstantData; UINT i; TRACE_(d3d_shader)("(%p) : SetVertexShaderConstant C[%lu..%lu]=\n", This, Register, Register + ConstantCount - 1); for (i = 0; i < ConstantCount; ++i) { @@ -4098,7 +4098,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(LPDIRECT3DDEVICE8 f += 4; } } else { - FLOAT* f = (FLOAT*) pConstantData; + const FLOAT* f = (const FLOAT*) pConstantData; TRACE_(d3d_shader)("(%p) : SetVertexShaderConstant, C[%lu]={%f, %f, %f, %f}\n", This, Register, f[0], f[1], f[2], f[3]); } This->UpdateStateBlock->Changed.vertexShaderConstant = TRUE; @@ -4262,7 +4262,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShaderConstant(LPDIRECT3DDEVICE8 i return D3DERR_INVALIDCALL; } if (ConstantCount > 1) { - FLOAT* f = (FLOAT*)pConstantData; + const FLOAT* f = (const FLOAT*)pConstantData; UINT i; TRACE_(d3d_shader)("(%p) : SetPixelShaderConstant C[%lu..%lu]=\n", This, Register, Register + ConstantCount - 1); for (i = 0; i < ConstantCount; ++i) { @@ -4270,7 +4270,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShaderConstant(LPDIRECT3DDEVICE8 i f += 4; } } else { - FLOAT* f = (FLOAT*) pConstantData; + const FLOAT* f = (const FLOAT*) pConstantData; TRACE_(d3d_shader)("(%p) : SetPixelShaderConstant, C[%lu]={%f, %f, %f, %f}\n", This, Register, f[0], f[1], f[2], f[3]); } This->UpdateStateBlock->Changed.pixelShaderConstant = TRUE; diff --git a/dlls/d3d8/drawprim.c b/dlls/d3d8/drawprim.c index ff0df02c70c..c18eb9c885b 100644 --- a/dlls/d3d8/drawprim.c +++ b/dlls/d3d8/drawprim.c @@ -901,11 +901,11 @@ void drawStridedFast(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *sd, TRACE("glElements(%x, %d, %ld, ...)\n", glPrimType, NumVertexes, minIndex); #if 1 /* FIXME: Want to use DrawRangeElements, but wrong calculation! */ glDrawElements(glPrimType, NumVertexes, idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT, - (char *)idxData+(idxSize * startIdx)); + (const char *)idxData+(idxSize * startIdx)); #else glDrawRangeElements(glPrimType, minIndex, minIndex+NumVertexes-1, NumVertexes, idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT, - (char *)idxData+(idxSize * startIdx)); + (const char *)idxData+(idxSize * startIdx)); #endif checkGLcall("glDrawRangeElements"); @@ -946,8 +946,8 @@ void drawStridedSlow(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *sd, /* Variable Initialization */ if (idxData != NULL) { - if (idxSize == 2) pIdxBufS = (short *) idxData; - else pIdxBufL = (long *) idxData; + if (idxSize == 2) pIdxBufS = (const short *) idxData; + else pIdxBufL = (const long *) idxData; } /* Ok, Work out which primitive is requested and how many vertexes that will be */ @@ -1257,8 +1257,8 @@ void drawStridedSoftwareVS(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *s /* Variable Initialization */ if (idxData != NULL) { - if (idxSize == 2) pIdxBufS = (short *) idxData; - else pIdxBufL = (long *) idxData; + if (idxSize == 2) pIdxBufS = (const short *) idxData; + else pIdxBufL = (const long *) idxData; } /* Ok, Work out which primitive is requested and how many vertexes that will be */ @@ -1409,11 +1409,11 @@ void drawStridedHardwareVS(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *s TRACE("glElements(%x, %d, %ld, ...)\n", glPrimType, NumVertexes, minIndex); #if 1 /* FIXME: Want to use DrawRangeElements, but wrong calculation! */ glDrawElements(glPrimType, NumVertexes, idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT, - (char *)idxData+(idxSize * startIdx)); + (const char *)idxData+(idxSize * startIdx)); #else glDrawRangeElements(glPrimType, minIndex, minIndex+NumVertexes-1, NumVertexes, idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT, - (char *)idxData+(idxSize * startIdx)); + (const char *)idxData+(idxSize * startIdx)); #endif checkGLcall("glDrawRangeElements"); diff --git a/dlls/d3d8/shader.c b/dlls/d3d8/shader.c index 0f7b2a787e4..d4c92a3adbb 100644 --- a/dlls/d3d8/shader.c +++ b/dlls/d3d8/shader.c @@ -1892,10 +1892,10 @@ inline static VOID IDirect3DPixelShaderImpl_GenerateProgramArbHW(IDirect3DPixelS { DWORD reg = *pToken & 0x00001FFF; sprintf(tmpLine, "PARAM C%lu = { %f, %f, %f, %f };", reg, - *((float*)(pToken+1)), - *((float*)(pToken+2)), - *((float*)(pToken+3)), - *((float*)(pToken+4)) ); + *((const float*)(pToken+1)), + *((const float*)(pToken+2)), + *((const float*)(pToken+3)), + *((const float*)(pToken+4)) ); addline(&lineNum, pgmStr, tmpLine); constants[reg] = 1; autoparam = 0; @@ -2267,7 +2267,7 @@ inline static VOID IDirect3DPixelShaderImpl_ParseProgram(IDirect3DPixelShaderImp if (D3DSIO_DEF != code) { pshader_program_dump_param(*pToken, 1); } else { - TRACE("%f", *((float*) pToken)); + TRACE("%f", *((const float*) pToken)); } ++pToken; ++len; diff --git a/dlls/d3d8/vshaderdeclaration.c b/dlls/d3d8/vshaderdeclaration.c index 1438d014c26..d93068c4a35 100644 --- a/dlls/d3d8/vshaderdeclaration.c +++ b/dlls/d3d8/vshaderdeclaration.c @@ -157,10 +157,10 @@ static CONST char* VertexShaderDeclRegister[] = { #endif TRACE(" c[%lu] = (%8f, %8f, %8f, %8f)\n", constaddress, - *(float*) pToken, - *(float*) (pToken + 1), - *(float*) (pToken + 2), - *(float*) (pToken + 3)); + *(const float*) pToken, + *(const float*) (pToken + 1), + *(const float*) (pToken + 2), + *(const float*) (pToken + 3)); pToken += 4; ++constaddress; } @@ -434,10 +434,10 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* DWORD constaddress = ((token & D3DVSD_CONSTADDRESSMASK) >> D3DVSD_CONSTADDRESSSHIFT); ++pToken; for (i = 0; i < count; ++i) { - vshader->data->C[constaddress + i].x = *(float*)pToken; - vshader->data->C[constaddress + i].y = *(float*)(pToken + 1); - vshader->data->C[constaddress + i].z = *(float*)(pToken + 2); - vshader->data->C[constaddress + i].w = *(float*)(pToken + 3); + vshader->data->C[constaddress + i].x = *(const float*)pToken; + vshader->data->C[constaddress + i].y = *(const float*)(pToken + 1); + vshader->data->C[constaddress + i].z = *(const float*)(pToken + 2); + vshader->data->C[constaddress + i].w = *(const float*)(pToken + 3); pToken += 4; } @@ -456,7 +456,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* TRACE(" type : %ld, reg = %ld\n", type, reg); switch (type) { case D3DVSDT_FLOAT1: - x = *(float*) curPos; + x = *(const float*) curPos; curPos = curPos + sizeof(float); /**/ vshader->input.V[reg].x = x; @@ -466,9 +466,9 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* break; case D3DVSDT_FLOAT2: - x = *(float*) curPos; + x = *(const float*) curPos; curPos = curPos + sizeof(float); - y = *(float*) curPos; + y = *(const float*) curPos; curPos = curPos + sizeof(float); /**/ vshader->input.V[reg].x = x; @@ -478,11 +478,11 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* break; case D3DVSDT_FLOAT3: - x = *(float*) curPos; + x = *(const float*) curPos; curPos = curPos + sizeof(float); - y = *(float*) curPos; + y = *(const float*) curPos; curPos = curPos + sizeof(float); - z = *(float*) curPos; + z = *(const float*) curPos; curPos = curPos + sizeof(float); /**/ vshader->input.V[reg].x = x; @@ -492,13 +492,13 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* break; case D3DVSDT_FLOAT4: - x = *(float*) curPos; + x = *(const float*) curPos; curPos = curPos + sizeof(float); - y = *(float*) curPos; + y = *(const float*) curPos; curPos = curPos + sizeof(float); - z = *(float*) curPos; + z = *(const float*) curPos; curPos = curPos + sizeof(float); - w = *(float*) curPos; + w = *(const float*) curPos; curPos = curPos + sizeof(float); /**/ vshader->input.V[reg].x = x; @@ -508,7 +508,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* break; case D3DVSDT_D3DCOLOR: - dw = *(DWORD*) curPos; + dw = *(const DWORD*) curPos; curPos = curPos + sizeof(DWORD); /**/ vshader->input.V[reg].x = (float) (((dw >> 16) & 0xFF) / 255.0f); @@ -518,9 +518,9 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* break; case D3DVSDT_SHORT2: - u = *(SHORT*) curPos; + u = *(const SHORT*) curPos; curPos = curPos + sizeof(SHORT); - v = *(SHORT*) curPos; + v = *(const SHORT*) curPos; curPos = curPos + sizeof(SHORT); /**/ vshader->input.V[reg].x = (float) u; @@ -530,13 +530,13 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* break; case D3DVSDT_SHORT4: - u = *(SHORT*) curPos; + u = *(const SHORT*) curPos; curPos = curPos + sizeof(SHORT); - v = *(SHORT*) curPos; + v = *(const SHORT*) curPos; curPos = curPos + sizeof(SHORT); - r = *(SHORT*) curPos; + r = *(const SHORT*) curPos; curPos = curPos + sizeof(SHORT); - t = *(SHORT*) curPos; + t = *(const SHORT*) curPos; curPos = curPos + sizeof(SHORT); /**/ vshader->input.V[reg].x = (float) u; @@ -546,7 +546,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputSW(IDirect3DDevice8Impl* break; case D3DVSDT_UBYTE4: - dw = *(DWORD*) curPos; + dw = *(const DWORD*) curPos; curPos = curPos + sizeof(DWORD); /**/ vshader->input.V[reg].x = (float) ((dw & 0x000F) >> 0); @@ -621,10 +621,10 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInputArbHW(IDirect3DDevice8Im for (i = 0; i < count; ++i) { FIXME("Confirm this is correct handling of consts inside the hw vertex shader\n"); GL_EXTCALL(glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, constaddress+i, (GLfloat *)pToken)); - vshader->data->C[constaddress + i].x = *(float*)pToken; - vshader->data->C[constaddress + i].y = *(float*)(pToken + 1); - vshader->data->C[constaddress + i].z = *(float*)(pToken + 2); - vshader->data->C[constaddress + i].w = *(float*)(pToken + 3); + vshader->data->C[constaddress + i].x = *(const float*)pToken; + vshader->data->C[constaddress + i].y = *(const float*)(pToken + 1); + vshader->data->C[constaddress + i].z = *(const float*)(pToken + 2); + vshader->data->C[constaddress + i].w = *(const float*)(pToken + 3); pToken += 4; } diff --git a/dlls/d3d9/pixelshader.c b/dlls/d3d9/pixelshader.c index 5a305d4daf5..3fdfa6f1ae9 100644 --- a/dlls/d3d9/pixelshader.c +++ b/dlls/d3d9/pixelshader.c @@ -134,7 +134,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9 if f += 4; } } else { - FLOAT* f = (FLOAT*) pConstantData; + const FLOAT* f = (const FLOAT*) pConstantData; TRACE("(%p) : SetPixelShaderConstant, C[%u]={%f, %f, %f, %f}\n", This, Register, f[0], f[1], f[2], f[3]); } This->UpdateStateBlock->Changed.pixelShaderConstant = TRUE; diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 90ef8e4a42f..d10e8b08459 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -1288,7 +1288,7 @@ inline static void handle_diffuse_and_specular(STATEBLOCK *sb, BYTE *fog_table, inline static void handle_texture(D3DVALUE *coords) { glTexCoord2fv(coords); } -inline static void handle_textures(D3DVALUE *coords, int tex_stage) { +inline static void handle_textures(const D3DVALUE *coords, int tex_stage) { if (GL_extensions.glMultiTexCoord2fv) { GL_extensions.glMultiTexCoord2fv(GL_TEXTURE0_WINE + tex_stage, coords); } else { @@ -1515,7 +1515,7 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This, for (tex_stage = 0; tex_stage < num_active_stages; tex_stage++) { int tex_index = This->state_block.texture_stage_state[tex_stage][D3DTSS_TEXCOORDINDEX - 1] & 0x0000FFFF; if (tex_index >= num_tex_index) { - handle_textures((D3DVALUE *) no_index, tex_stage); + handle_textures((const D3DVALUE *) no_index, tex_stage); } else { D3DVALUE *tex_coord = (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[tex_index].lpvData) + diff --git a/dlls/ddraw/d3dlight.c b/dlls/ddraw/d3dlight.c index eb4ab129d7e..801444d3693 100644 --- a/dlls/ddraw/d3dlight.c +++ b/dlls/ddraw/d3dlight.c @@ -112,7 +112,7 @@ Main_IDirect3DLightImpl_1_SetLight(LPDIRECT3DLIGHT iface, if ((((LPD3DLIGHT2)lpLight)->dwFlags & D3DLIGHT_NO_SPECULAR) != 0) light7->dcvSpecular = lpLight->dcvColor; else - light7->dcvSpecular = *(D3DCOLORVALUE*)zero_value; + light7->dcvSpecular = *(const D3DCOLORVALUE*)zero_value; light7->dcvAmbient = lpLight->dcvColor; light7->dvPosition = lpLight->dvPosition; light7->dvDirection = lpLight->dvDirection; diff --git a/dlls/ddraw/helper.c b/dlls/ddraw/helper.c index 10430d6229d..ea17a4f260d 100644 --- a/dlls/ddraw/helper.c +++ b/dlls/ddraw/helper.c @@ -334,7 +334,7 @@ static void DDRAW_dump_DWORD(const void *in) { DPRINTF("%ld", *((const DWORD *) in)); } static void DDRAW_dump_PTR(const void *in) { - DPRINTF("%p", *((const void **) in)); + DPRINTF("%p", *((const void * const*) in)); } void DDRAW_dump_DDCOLORKEY(const DDCOLORKEY *ddck) { DPRINTF(" Low : %ld - High : %ld", ddck->dwColorSpaceLowValue, ddck->dwColorSpaceHighValue); diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c index e1d07637c49..fb2f28e5e42 100644 --- a/dlls/devenum/devenum_main.c +++ b/dlls/devenum/devenum_main.c @@ -357,7 +357,7 @@ static HRESULT register_clsids(int count, const register_info * pRegInfo, LPCWST wcszThreadingModel, 0, REG_SZ, - (LPVOID)pszThreadingModel, + (LPCVOID)pszThreadingModel, (lstrlenW(pszThreadingModel) + 1) * sizeof(WCHAR)); RegCloseKey(hkeyInproc32); } diff --git a/dlls/dplayx/dplobby.c b/dlls/dplayx/dplobby.c index c4eafb483f8..24ea197df65 100644 --- a/dlls/dplayx/dplobby.c +++ b/dlls/dplayx/dplobby.c @@ -694,7 +694,7 @@ extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, L while ( dwTotalSizeEnumerated < dwAddressSize ) { - LPDPADDRESS lpElements = (LPDPADDRESS)lpAddress; + const DPADDRESS* lpElements = (const DPADDRESS*)lpAddress; DWORD dwSizeThisEnumeration; /* Invoke the enum method. If false is returned, stop enumeration */ @@ -707,7 +707,7 @@ extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, L } dwSizeThisEnumeration = sizeof( DPADDRESS ) + lpElements->dwDataSize; - lpAddress = (BYTE*) lpAddress + dwSizeThisEnumeration; + lpAddress = (const BYTE*) lpAddress + dwSizeThisEnumeration; dwTotalSizeEnumerated += dwSizeThisEnumeration; } diff --git a/dlls/dpnet/address.c b/dlls/dpnet/address.c index 4737a2ab5b4..a162209dabd 100644 --- a/dlls/dpnet/address.c +++ b/dlls/dpnet/address.c @@ -172,14 +172,14 @@ HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(PDIRECTPLAY8ADDRESS iface, C switch (dwDataType) { case DPNA_DATATYPE_DWORD: if (sizeof(DWORD) != dwDataSize) return DPNERR_INVALIDPARAM; - TRACE("(%p, %lu): DWORD Type -> %lu \n", lpvData, dwDataSize, *(DWORD*) lpvData); + TRACE("(%p, %lu): DWORD Type -> %lu \n", lpvData, dwDataSize, *(const DWORD*) lpvData); break; case DPNA_DATATYPE_GUID: if (sizeof(GUID) != dwDataSize) return DPNERR_INVALIDPARAM; - TRACE("(%p, %lu): GUID Type -> %s \n", lpvData, dwDataSize, debugstr_guid((GUID*) lpvData)); + TRACE("(%p, %lu): GUID Type -> %s \n", lpvData, dwDataSize, debugstr_guid((const GUID*) lpvData)); break; case DPNA_DATATYPE_STRING: - TRACE("(%p, %lu): STRING Type -> %s \n", lpvData, dwDataSize, (CHAR*) lpvData); + TRACE("(%p, %lu): STRING Type -> %s \n", lpvData, dwDataSize, (const CHAR*) lpvData); break; case DPNA_DATATYPE_BINARY: TRACE("(%p, %lu): BINARY Type\n", lpvData, dwDataSize); diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c index e2a8bb7c6ec..959fb2402b0 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -401,7 +401,7 @@ DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA) WORD dmW_size; dmW_size = dmA->dmSize + CCHDEVICENAME; - if (dmA->dmSize >= (char *)dmA->dmFormName - (char *)dmA + CCHFORMNAME) + if (dmA->dmSize >= (const char *)dmA->dmFormName - (const char *)dmA + CCHFORMNAME) dmW_size += CCHFORMNAME; dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra); @@ -412,16 +412,16 @@ DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA) /* copy slightly more, to avoid long computations */ memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA->dmSize - CCHDEVICENAME); - if (dmA->dmSize >= (char *)dmA->dmFormName - (char *)dmA + CCHFORMNAME) + if (dmA->dmSize >= (const char *)dmA->dmFormName - (const char *)dmA + CCHFORMNAME) { MultiByteToWideChar(CP_ACP, 0, dmA->dmFormName, CCHFORMNAME, dmW->dmFormName, CCHFORMNAME); - if (dmA->dmSize > (char *)&dmA->dmLogPixels - (char *)dmA) - memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - ((char *)&dmA->dmLogPixels - (char *)dmA)); + if (dmA->dmSize > (const char *)&dmA->dmLogPixels - (const char *)dmA) + memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - ((const char *)&dmA->dmLogPixels - (const char *)dmA)); } if (dmA->dmDriverExtra) - memcpy((char *)dmW + dmW_size, (char *)dmA + dmA->dmSize, dmA->dmDriverExtra); + memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA->dmSize, dmA->dmDriverExtra); dmW->dmSize = dmW_size; @@ -636,7 +636,7 @@ INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out case QUERYESCSUPPORT: { - INT *ptr = (INT *)in_data; + const INT *ptr = (const INT *)in_data; if (in_count < sizeof(INT)) return 0; switch(*ptr) { diff --git a/dlls/gdi/enhmfdrv/graphics.c b/dlls/gdi/enhmfdrv/graphics.c index 0f272fe708a..601a2d206de 100644 --- a/dlls/gdi/enhmfdrv/graphics.c +++ b/dlls/gdi/enhmfdrv/graphics.c @@ -519,7 +519,7 @@ EMFDRV_PolyPolylinegon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT po BOOL EMFDRV_PolyPolyline(PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polys) { - return EMFDRV_PolyPolylinegon( dev, pt, (INT *)counts, polys, + return EMFDRV_PolyPolylinegon( dev, pt, (const INT *)counts, polys, EMR_POLYPOLYLINE ); } diff --git a/dlls/gdi/tests/metafile.c b/dlls/gdi/tests/metafile.c index b3dda3d132c..efc6aa7ed09 100644 --- a/dlls/gdi/tests/metafile.c +++ b/dlls/gdi/tests/metafile.c @@ -34,7 +34,8 @@ static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, { static int n_record; DWORD i; - INT *dx, *orig_dx = (INT *)param; + const INT *dx; + INT *orig_dx = (INT *)param; LOGFONTA device_lf; trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n", @@ -50,8 +51,8 @@ static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, case EMR_EXTTEXTOUTA: { - EMREXTTEXTOUTA *emr_ExtTextOutA = (EMREXTTEXTOUTA *)emr; - dx = (INT *)((char *)emr + emr_ExtTextOutA->emrtext.offDx); + const EMREXTTEXTOUTA *emr_ExtTextOutA = (const EMREXTTEXTOUTA *)emr; + dx = (const INT *)((const char *)emr + emr_ExtTextOutA->emrtext.offDx); ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError()); @@ -74,8 +75,8 @@ static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, case EMR_EXTTEXTOUTW: { - EMREXTTEXTOUTW *emr_ExtTextOutW = (EMREXTTEXTOUTW *)emr; - dx = (INT *)((char *)emr + emr_ExtTextOutW->emrtext.offDx); + const EMREXTTEXTOUTW *emr_ExtTextOutW = (const EMREXTTEXTOUTW *)emr; + dx = (const INT *)((const char *)emr + emr_ExtTextOutW->emrtext.offDx); ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError()); diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 63b9d32e812..1749db4f0b7 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -1340,7 +1340,7 @@ BOOL WINAPI ImmSetCompositionStringW( dwCompLen); memcpy(root_context->CompositionString,lpComp,dwCompLen); - wParam = ((WCHAR*)lpComp)[0]; + wParam = ((const WCHAR*)lpComp)[0]; flags |= GCS_COMPCLAUSE | GCS_COMPATTR; } else diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c index cf6a57570cc..ba1fdd5101b 100644 --- a/dlls/msdmo/dmoreg.c +++ b/dlls/msdmo/dmoreg.c @@ -153,14 +153,14 @@ HRESULT WINAPI DMORegister( goto lend; /* Set default Name value */ - hres = RegSetValueExW(hkey, NULL, 0, REG_SZ, (LPBYTE) szName, + hres = RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE*) szName, (strlenW(szName) + 1)) * sizeof(WCHAR); /* Set InputTypes */ hres = RegSetValueExW(hkey, szDMOInputType, 0, REG_BINARY, - (LPBYTE) pInTypes, cInTypes * sizeof(DMO_PARTIAL_MEDIATYPE)); + (const BYTE*) pInTypes, cInTypes * sizeof(DMO_PARTIAL_MEDIATYPE)); /* Set OutputTypes */ hres = RegSetValueExW(hkey, szDMOOutputType, 0, REG_BINARY, - (LPBYTE) pOutTypes, cOutTypes * sizeof(DMO_PARTIAL_MEDIATYPE)); + (const BYTE*) pOutTypes, cOutTypes * sizeof(DMO_PARTIAL_MEDIATYPE)); if (dwFlags & DMO_REGISTERF_IS_KEYED) { diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c index 827ba7336d8..d8001c64a07 100644 --- a/dlls/msvcrt/dir.c +++ b/dlls/msvcrt/dir.c @@ -47,11 +47,11 @@ static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddata_t else ft->attrib = fd->dwFileAttributes; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftCreationTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftCreationTime, &dw ); ft->time_create = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); ft->time_access = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); ft->time_write = dw; ft->size = fd->nFileSizeLow; strcpy(ft->name, fd->cFileName); @@ -67,11 +67,11 @@ static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata else ft->attrib = fd->dwFileAttributes; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftCreationTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftCreationTime, &dw ); ft->time_create = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); ft->time_access = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); ft->time_write = dw; ft->size = fd->nFileSizeLow; strcpyW(ft->name, fd->cFileName); @@ -87,11 +87,11 @@ static void msvcrt_fttofdi64( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddat else ft->attrib = fd->dwFileAttributes; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftCreationTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftCreationTime, &dw ); ft->time_create = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); ft->time_access = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); ft->time_write = dw; ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow; strcpy(ft->name, fd->cFileName); @@ -107,11 +107,11 @@ static void msvcrt_wfttofdi64( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfindd else ft->attrib = fd->dwFileAttributes; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftCreationTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftCreationTime, &dw ); ft->time_create = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); ft->time_access = dw; - RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); + RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); ft->time_write = dw; ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow; strcpyW(ft->name, fd->cFileName); diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index ce3508da568..046242f75d6 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -615,7 +615,7 @@ HRESULT WINAPI __CLSIDFromStringA( LPCSTR idstr, /* [in] string representation of guid */ CLSID *id) /* [out] GUID converted from string */ { - const BYTE *s = (BYTE *) idstr; + const BYTE *s = (const BYTE *) idstr; int i; BYTE table[256]; diff --git a/dlls/ole32/storage.c b/dlls/ole32/storage.c index bad6d92d246..0e0b4858e00 100644 --- a/dlls/ole32/storage.c +++ b/dlls/ole32/storage.c @@ -1125,7 +1125,7 @@ HRESULT WINAPI IStream16_fnWrite( ULONG *byteswritten=pcbWrite,xxwritten; int oldsize,newsize,i,curoffset=0,lastblocknr,blocknr,cc; HANDLE hf = This->hf; - LPBYTE pbv = (LPBYTE)pv; + const BYTE* pbv = (const BYTE*)pv; if (!pcbWrite) byteswritten=&xxwritten; *byteswritten = 0; diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 6ec67d2ec53..6dcdeda8246 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -144,8 +144,8 @@ static void updatePropertyChain( StgProperty newProperty); static LONG propertyNameCmp( - OLECHAR *newProperty, - OLECHAR *currentProperty); + const OLECHAR *newProperty, + const OLECHAR *currentProperty); /*********************************************************************** @@ -1158,7 +1158,7 @@ HRESULT WINAPI StorageImpl_CreateStorage( */ hr = IStorage_OpenStorage( iface, - (OLECHAR*)pwcsName, + (const OLECHAR*)pwcsName, 0, grfMode, 0, @@ -1284,8 +1284,8 @@ static ULONG getFreeProperty( * 0 when newPrpoerty == currentProperty */ static LONG propertyNameCmp( - OLECHAR *newProperty, - OLECHAR *currentProperty) + const OLECHAR *newProperty, + const OLECHAR *currentProperty) { LONG diff = lstrlenW(newProperty) - lstrlenW(currentProperty); @@ -3962,8 +3962,8 @@ ULONG IEnumSTATSTGImpl_FindProperty( currentProperty); if ( propertyNameCmp( - (OLECHAR*)currentProperty->name, - (OLECHAR*)lpszPropName) == 0) + (const OLECHAR*)currentProperty->name, + (const OLECHAR*)lpszPropName) == 0) return currentSearchNode; /* @@ -4348,7 +4348,7 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This, ULONG offsetInBlock = offset.u.LowPart % This->parentStorage->bigBlockSize; ULONG bytesToWrite; ULONG blockIndex; - BYTE* bufferWalker; + const BYTE* bufferWalker; BYTE* bigBlockBuffer; /* @@ -4385,7 +4385,7 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This, * This is OK since we don't intend to modify that buffer. */ *bytesWritten = 0; - bufferWalker = (BYTE*)buffer; + bufferWalker = (const BYTE*)buffer; while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) ) { @@ -5095,7 +5095,7 @@ BOOL SmallBlockChainStream_WriteAt( ULONG bytesToWriteInBuffer; ULONG blockIndex; ULONG bytesWrittenFromBigBlockFile; - BYTE* bufferWalker; + const BYTE* bufferWalker; /* * This should never happen on a small block file. @@ -5121,7 +5121,7 @@ BOOL SmallBlockChainStream_WriteAt( * This is OK since we don't intend to modify that buffer. */ *bytesWritten = 0; - bufferWalker = (BYTE*)buffer; + bufferWalker = (const BYTE*)buffer; while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) ) { /* diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index 4159c8938d0..a6a7d06ed02 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -271,7 +271,7 @@ static int ctl2_hash_guid( hash = 0; for (i = 0; i < 8; i ++) { - hash ^= ((short *)guid)[i]; + hash ^= ((const short *)guid)[i]; } return (hash & 0xf) | ((hash & 0x10) & (0 - !!(hash & 0xe0))); diff --git a/dlls/oledlg/insobjdlg.c b/dlls/oledlg/insobjdlg.c index e5cdfdb45dc..54245a7ac66 100644 --- a/dlls/oledlg/insobjdlg.c +++ b/dlls/oledlg/insobjdlg.c @@ -106,7 +106,7 @@ UINT WINAPI OleUIInsertObjectA(LPOLEUIINSERTOBJECTA lpOleUIInsertObject) dlgInfo.lpOleUIInsertObject = lpOleUIInsertObject; dlgInfo.bObjListInit = FALSE; - lRes = DialogBoxIndirectParamA(OLEDLG_hInstance, (LPDLGTEMPLATEA) template, + lRes = DialogBoxIndirectParamA(OLEDLG_hInstance, (const DLGTEMPLATE*) template, lpOleUIInsertObject->hWndOwner, UIInsertObjectDlgProc, (LPARAM) &dlgInfo); diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 5d2943713d9..ce627f9f6ae 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -301,13 +301,13 @@ int WINAPI wglGetLayerPaletteEntries(HDC hdc, * wglGetProcAddress (OPENGL32.@) */ static int compar(const void *elt_a, const void *elt_b) { - return strcmp(((OpenGL_extension *) elt_a)->name, - ((OpenGL_extension *) elt_b)->name); + return strcmp(((const OpenGL_extension *) elt_a)->name, + ((const OpenGL_extension *) elt_b)->name); } static int wgl_compar(const void *elt_a, const void *elt_b) { - return strcmp(((WGL_extension *) elt_a)->func_name, - ((WGL_extension *) elt_b)->func_name); + return strcmp(((const WGL_extension *) elt_a)->func_name, + ((const WGL_extension *) elt_b)->func_name); } void* WINAPI wglGetProcAddress(LPCSTR lpszProc) { diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index 9c104af426e..2a3910075d8 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -710,7 +710,7 @@ static HRESULT AVISplitter_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt) static HRESULT AVISplitter_ProcessStreamList(AVISplitter * This, const BYTE * pData, DWORD cb) { PIN_INFO piOutput; - RIFFCHUNK * pChunk; + const RIFFCHUNK * pChunk; IPin ** ppOldPins; HRESULT hr; AM_MEDIA_TYPE amt; @@ -730,7 +730,10 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitter * This, const BYTE * pD piOutput.pFilter = (IBaseFilter *)This; wsprintfW(piOutput.achName, wszStreamTemplate, This->cStreams); - for (pChunk = (RIFFCHUNK *)pData; ((BYTE *)pChunk >= pData) && ((BYTE *)pChunk + sizeof(RIFFCHUNK) < pData + cb) && (pChunk->cb > 0); pChunk = (RIFFCHUNK *)((BYTE*)pChunk + sizeof(RIFFCHUNK) + pChunk->cb)) + for (pChunk = (const RIFFCHUNK *)pData; + ((const BYTE *)pChunk >= pData) && ((const BYTE *)pChunk + sizeof(RIFFCHUNK) < pData + cb) && (pChunk->cb > 0); + pChunk = (const RIFFCHUNK *)((const BYTE*)pChunk + sizeof(RIFFCHUNK) + pChunk->cb) + ) { switch (pChunk->fcc) { @@ -758,7 +761,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitter * This, const BYTE * pD amt.majortype.Data1 = pStrHdr->fccType; memcpy(&amt.subtype, &MEDIATYPE_Video, sizeof(GUID)); amt.subtype.Data1 = pStrHdr->fccHandler; - TRACE("Subtype FCC: %.04s\n", (LPSTR)&pStrHdr->fccHandler); + TRACE("Subtype FCC: %.04s\n", (LPCSTR)&pStrHdr->fccHandler); amt.lSampleSize = pStrHdr->dwSampleSize; amt.bFixedSizeSamples = (amt.lSampleSize != 0); @@ -821,7 +824,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitter * This, const BYTE * pD TRACE("JUNK chunk ignored\n"); break; default: - FIXME("unknown chunk type \"%.04s\" ignored\n", (LPSTR)&pChunk->fcc); + FIXME("unknown chunk type \"%.04s\" ignored\n", (LPCSTR)&pChunk->fcc); } } diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c index 201a5401bd4..7f273989f4b 100644 --- a/dlls/quartz/filtermapper.c +++ b/dlls/quartz/filtermapper.c @@ -265,7 +265,7 @@ static HRESULT WINAPI FilterMapper2_CreateCategory( if (SUCCEEDED(hr)) { - hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, wszFriendlyName, 0, REG_SZ, (LPBYTE)szDescription, (strlenW(szDescription) + 1) * sizeof(WCHAR))); + hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, wszFriendlyName, 0, REG_SZ, (const BYTE*)szDescription, (strlenW(szDescription) + 1) * sizeof(WCHAR))); } if (SUCCEEDED(hr)) @@ -411,9 +411,9 @@ static HRESULT FM2_WriteFilterData(IPropertyBag * pPropBag, const REGFILTER2 * p add_data(&mainStore, (LPBYTE)&rrfp, sizeof(rrfp)); if (rrfp.bCategory) { - DWORD index = find_data(&clsidStore, (LPBYTE)rgPin2.clsPinCategory, sizeof(CLSID)); + DWORD index = find_data(&clsidStore, (const BYTE*)rgPin2.clsPinCategory, sizeof(CLSID)); if (index == -1) - index = add_data(&clsidStore, (LPBYTE)rgPin2.clsPinCategory, sizeof(CLSID)); + index = add_data(&clsidStore, (const BYTE*)rgPin2.clsPinCategory, sizeof(CLSID)); index += size; add_data(&mainStore, (LPBYTE)&index, sizeof(index)); @@ -429,13 +429,13 @@ static HRESULT FM2_WriteFilterData(IPropertyBag * pPropBag, const REGFILTER2 * p rt.signature[0] += j; rt.dwUnused = 0; - rt.dwOffsetMajor = find_data(&clsidStore, (LPBYTE)rgPin2.lpMediaType[j].clsMajorType, sizeof(CLSID)); + rt.dwOffsetMajor = find_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMajorType, sizeof(CLSID)); if (rt.dwOffsetMajor == -1) - rt.dwOffsetMajor = add_data(&clsidStore, (LPBYTE)rgPin2.lpMediaType[j].clsMajorType, sizeof(CLSID)); + rt.dwOffsetMajor = add_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMajorType, sizeof(CLSID)); rt.dwOffsetMajor += size; - rt.dwOffsetMinor = find_data(&clsidStore, (LPBYTE)rgPin2.lpMediaType[j].clsMinorType, sizeof(CLSID)); + rt.dwOffsetMinor = find_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMinorType, sizeof(CLSID)); if (rt.dwOffsetMinor == -1) - rt.dwOffsetMinor = add_data(&clsidStore, (LPBYTE)rgPin2.lpMediaType[j].clsMinorType, sizeof(CLSID)); + rt.dwOffsetMinor = add_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMinorType, sizeof(CLSID)); rt.dwOffsetMinor += size; add_data(&mainStore, (LPBYTE)&rt, sizeof(rt)); @@ -443,9 +443,9 @@ static HRESULT FM2_WriteFilterData(IPropertyBag * pPropBag, const REGFILTER2 * p for (j = 0; j < rgPin2.nMediums; j++) { - DWORD index = find_data(&clsidStore, (LPBYTE)(rgPin2.lpMedium + j), sizeof(REGPINMEDIUM)); + DWORD index = find_data(&clsidStore, (const BYTE*)(rgPin2.lpMedium + j), sizeof(REGPINMEDIUM)); if (index == -1) - index = add_data(&clsidStore, (LPBYTE)(rgPin2.lpMedium + j), sizeof(REGPINMEDIUM)); + index = add_data(&clsidStore, (const BYTE*)(rgPin2.lpMedium + j), sizeof(REGPINMEDIUM)); index += size; add_data(&mainStore, (LPBYTE)&index, sizeof(index)); @@ -826,8 +826,8 @@ static BOOL MatchTypes( /* internal helper function for qsort of MONIKER_MERIT array */ static int mm_compare(const void * left, const void * right) { - const struct MONIKER_MERIT * mmLeft = (struct MONIKER_MERIT *)left; - const struct MONIKER_MERIT * mmRight = (struct MONIKER_MERIT *)right; + const struct MONIKER_MERIT * mmLeft = (const struct MONIKER_MERIT *)left; + const struct MONIKER_MERIT * mmRight = (const struct MONIKER_MERIT *)right; if (mmLeft->dwMerit == mmRight->dwMerit) return 0; @@ -1225,7 +1225,7 @@ static HRESULT WINAPI FilterMapper_RegisterFilter(IFilterMapper * iface, CLSID c if (SUCCEEDED(hr)) { - hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, NULL, 0, REG_SZ, (LPBYTE)szName, strlenW(szName) + 1)); + hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, NULL, 0, REG_SZ, (const BYTE*)szName, strlenW(szName) + 1)); CloseHandle(hKey); } diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c index 35bf8687e44..af8709a22c5 100644 --- a/dlls/rpcrt4/cproxy.c +++ b/dlls/rpcrt4/cproxy.c @@ -101,7 +101,7 @@ static HRESULT WINAPI ObjectStubless(DWORD index) ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); PFORMAT_STRING fs = This->stubless->ProcFormatString + This->stubless->FormatStringOffset[index]; - unsigned bytes = *(WORD*)(fs+8) - STACK_ADJUST; + unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST; TRACE("(%p)->(%ld)([%d bytes]) ret=%08lx\n", iface, index, bytes, *(DWORD*)(args+bytes)); return RPCRT4_NdrClientCall2(This->stubless->pStubDesc, fs, args); @@ -161,7 +161,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid, struct StublessThunk *thunk = &This->thunks[i]; if (vtbl->Vtbl[i] == (LPVOID)-1) { PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[i]; - unsigned bytes = *(WORD*)(fs+8) - STACK_ADJUST; + unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST; TRACE("method %d: stacksize=%d\n", i, bytes); FILL_STUBLESS(thunk, i, bytes) This->PVtbl[i] = thunk; diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index d6b0ca2048a..56654c9456a 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -561,7 +561,7 @@ void WINAPI PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("type=%d, attr=%d\n", type, attr); pFormat += 2; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; - else desc = pFormat + *(SHORT*)pFormat; + else desc = pFormat + *(const SHORT*)pFormat; if (attr & RPC_FC_P_DEREF) { Pointer = *(unsigned char**)Pointer; TRACE("deref => %p\n", Pointer); @@ -600,7 +600,7 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("type=%d, attr=%d\n", type, attr); pFormat += 2; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; - else desc = pFormat + *(SHORT*)pFormat; + else desc = pFormat + *(const SHORT*)pFormat; if (attr & RPC_FC_P_DEREF) { pPointer = *(unsigned char***)pPointer; TRACE("deref => %p\n", pPointer); @@ -636,7 +636,7 @@ void WINAPI PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("type=%d, attr=%d\n", type, attr); pFormat += 2; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; - else desc = pFormat + *(SHORT*)pFormat; + else desc = pFormat + *(const SHORT*)pFormat; if (attr & RPC_FC_P_DEREF) { Pointer = *(unsigned char**)Pointer; TRACE("deref => %p\n", Pointer); @@ -669,7 +669,7 @@ unsigned long WINAPI PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("type=%d, attr=%d\n", type, attr); pFormat += 2; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; - else desc = pFormat + *(SHORT*)pFormat; + else desc = pFormat + *(const SHORT*)pFormat; if (attr & RPC_FC_P_DEREF) { TRACE("deref\n"); } @@ -704,7 +704,7 @@ void WINAPI PointerFree(PMIDL_STUB_MESSAGE pStubMsg, if (attr & RPC_FC_P_DONTFREE) return; pFormat += 2; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; - else desc = pFormat + *(SHORT*)pFormat; + else desc = pFormat + *(const SHORT*)pFormat; if (attr & RPC_FC_P_DEREF) { Pointer = *(unsigned char**)Pointer; TRACE("deref => %p\n", Pointer); @@ -776,18 +776,18 @@ unsigned char * WINAPI EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, pFormat += 2; break; case RPC_FC_FIXED_REPEAT: - rep = *(WORD*)&pFormat[2]; - stride = *(WORD*)&pFormat[4]; - ofs = *(WORD*)&pFormat[6]; - count = *(WORD*)&pFormat[8]; + rep = *(const WORD*)&pFormat[2]; + stride = *(const WORD*)&pFormat[4]; + ofs = *(const WORD*)&pFormat[6]; + count = *(const WORD*)&pFormat[8]; xofs = 0; pFormat += 10; break; case RPC_FC_VARIABLE_REPEAT: rep = pStubMsg->MaxCount; - stride = *(WORD*)&pFormat[2]; - ofs = *(WORD*)&pFormat[4]; - count = *(WORD*)&pFormat[6]; + stride = *(const WORD*)&pFormat[2]; + ofs = *(const WORD*)&pFormat[4]; + count = *(const WORD*)&pFormat[6]; xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0; pFormat += 8; break; @@ -798,8 +798,8 @@ unsigned char * WINAPI EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *membase = pMemory + xofs; unsigned u; for (u=0; u<count; u++,info+=8) { - unsigned char *memptr = membase + *(SHORT*)&info[0]; - unsigned char *bufptr = Mark + *(SHORT*)&info[2]; + unsigned char *memptr = membase + *(const SHORT*)&info[0]; + unsigned char *bufptr = Mark + *(const SHORT*)&info[2]; PointerMarshall(pStubMsg, bufptr, *(unsigned char**)memptr, info+4); } rep--; @@ -842,18 +842,18 @@ unsigned char * WINAPI EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pFormat += 2; break; case RPC_FC_FIXED_REPEAT: - rep = *(WORD*)&pFormat[2]; - stride = *(WORD*)&pFormat[4]; - ofs = *(WORD*)&pFormat[6]; - count = *(WORD*)&pFormat[8]; + rep = *(const WORD*)&pFormat[2]; + stride = *(const WORD*)&pFormat[4]; + ofs = *(const WORD*)&pFormat[6]; + count = *(const WORD*)&pFormat[8]; xofs = 0; pFormat += 10; break; case RPC_FC_VARIABLE_REPEAT: rep = pStubMsg->MaxCount; - stride = *(WORD*)&pFormat[2]; - ofs = *(WORD*)&pFormat[4]; - count = *(WORD*)&pFormat[6]; + stride = *(const WORD*)&pFormat[2]; + ofs = *(const WORD*)&pFormat[4]; + count = *(const WORD*)&pFormat[6]; xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0; pFormat += 8; break; @@ -864,8 +864,8 @@ unsigned char * WINAPI EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *membase = *ppMemory + xofs; unsigned u; for (u=0; u<count; u++,info+=8) { - unsigned char *memptr = membase + *(SHORT*)&info[0]; - unsigned char *bufptr = Mark + *(SHORT*)&info[2]; + unsigned char *memptr = membase + *(const SHORT*)&info[0]; + unsigned char *bufptr = Mark + *(const SHORT*)&info[2]; PointerUnmarshall(pStubMsg, bufptr, (unsigned char**)memptr, info+4, fMustAlloc); } rep--; @@ -903,18 +903,18 @@ void WINAPI EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pFormat += 2; break; case RPC_FC_FIXED_REPEAT: - rep = *(WORD*)&pFormat[2]; - stride = *(WORD*)&pFormat[4]; - ofs = *(WORD*)&pFormat[6]; - count = *(WORD*)&pFormat[8]; + rep = *(const WORD*)&pFormat[2]; + stride = *(const WORD*)&pFormat[4]; + ofs = *(const WORD*)&pFormat[6]; + count = *(const WORD*)&pFormat[8]; xofs = 0; pFormat += 10; break; case RPC_FC_VARIABLE_REPEAT: rep = pStubMsg->MaxCount; - stride = *(WORD*)&pFormat[2]; - ofs = *(WORD*)&pFormat[4]; - count = *(WORD*)&pFormat[6]; + stride = *(const WORD*)&pFormat[2]; + ofs = *(const WORD*)&pFormat[4]; + count = *(const WORD*)&pFormat[6]; xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0; pFormat += 8; break; @@ -925,7 +925,7 @@ void WINAPI EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *membase = pMemory + xofs; unsigned u; for (u=0; u<count; u++,info+=8) { - unsigned char *memptr = membase + *(SHORT*)&info[0]; + unsigned char *memptr = membase + *(const SHORT*)&info[0]; PointerBufferSize(pStubMsg, *(unsigned char**)memptr, info+4); } rep--; @@ -961,18 +961,18 @@ unsigned long WINAPI EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pFormat += 2; break; case RPC_FC_FIXED_REPEAT: - rep = *(WORD*)&pFormat[2]; - stride = *(WORD*)&pFormat[4]; - ofs = *(WORD*)&pFormat[6]; - count = *(WORD*)&pFormat[8]; + rep = *(const WORD*)&pFormat[2]; + stride = *(const WORD*)&pFormat[4]; + ofs = *(const WORD*)&pFormat[6]; + count = *(const WORD*)&pFormat[8]; xofs = 0; pFormat += 10; break; case RPC_FC_VARIABLE_REPEAT: rep = pStubMsg->MaxCount; - stride = *(WORD*)&pFormat[2]; - ofs = *(WORD*)&pFormat[4]; - count = *(WORD*)&pFormat[6]; + stride = *(const WORD*)&pFormat[2]; + ofs = *(const WORD*)&pFormat[4]; + count = *(const WORD*)&pFormat[6]; xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0; pFormat += 8; break; @@ -982,7 +982,7 @@ unsigned long WINAPI EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING info = pFormat; unsigned u; for (u=0; u<count; u++,info+=8) { - unsigned char *bufptr = Mark + *(SHORT*)&info[2]; + unsigned char *bufptr = Mark + *(const SHORT*)&info[2]; PointerMemorySize(pStubMsg, bufptr, info+4); } rep--; @@ -1020,18 +1020,18 @@ void WINAPI EmbeddedPointerFree(PMIDL_STUB_MESSAGE pStubMsg, pFormat += 2; break; case RPC_FC_FIXED_REPEAT: - rep = *(WORD*)&pFormat[2]; - stride = *(WORD*)&pFormat[4]; - ofs = *(WORD*)&pFormat[6]; - count = *(WORD*)&pFormat[8]; + rep = *(const WORD*)&pFormat[2]; + stride = *(const WORD*)&pFormat[4]; + ofs = *(const WORD*)&pFormat[6]; + count = *(const WORD*)&pFormat[8]; xofs = 0; pFormat += 10; break; case RPC_FC_VARIABLE_REPEAT: rep = pStubMsg->MaxCount; - stride = *(WORD*)&pFormat[2]; - ofs = *(WORD*)&pFormat[4]; - count = *(WORD*)&pFormat[6]; + stride = *(const WORD*)&pFormat[2]; + ofs = *(const WORD*)&pFormat[4]; + count = *(const WORD*)&pFormat[6]; xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0; pFormat += 8; break; @@ -1042,7 +1042,7 @@ void WINAPI EmbeddedPointerFree(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *membase = pMemory + xofs; unsigned u; for (u=0; u<count; u++,info+=8) { - unsigned char *memptr = membase + *(SHORT*)&info[0]; + unsigned char *memptr = membase + *(const SHORT*)&info[0]; PointerFree(pStubMsg, *(unsigned char**)memptr, info+4); } rep--; @@ -1128,7 +1128,7 @@ unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { - unsigned size = *(LPWORD)(pFormat+2); + unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); memcpy(pStubMsg->Buffer, pMemory, size); @@ -1151,7 +1151,7 @@ unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned char fMustAlloc) { - unsigned size = *(LPWORD)(pFormat+2); + unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); if (fMustAlloc) { @@ -1204,7 +1204,7 @@ void WINAPI NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { - unsigned size = *(LPWORD)(pFormat+2); + unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); pStubMsg->BufferLength += size; if (pFormat[0] != RPC_FC_STRUCT) @@ -1245,9 +1245,9 @@ unsigned long WINAPI EmbeddedComplexSize(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_PSTRUCT: case RPC_FC_CSTRUCT: case RPC_FC_BOGUS_STRUCT: - return *(WORD*)&pFormat[2]; + return *(const WORD*)&pFormat[2]; case RPC_FC_USER_MARSHAL: - return *(WORD*)&pFormat[4]; + return *(const WORD*)&pFormat[4]; default: FIXME("unhandled embedded type %02x\n", *pFormat); } @@ -1295,7 +1295,7 @@ unsigned char * WINAPI ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; - desc = pFormat + *(SHORT*)pFormat; + desc = pFormat + *(const SHORT*)pFormat; size = EmbeddedComplexSize(pStubMsg, desc); TRACE("embedded complex (size=%ld) <= %p\n", size, pMemory); m = NdrMarshaller[*desc & NDR_TABLE_MASK]; @@ -1357,7 +1357,7 @@ unsigned char * WINAPI ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; - desc = pFormat + *(SHORT*)pFormat; + desc = pFormat + *(const SHORT*)pFormat; size = EmbeddedComplexSize(pStubMsg, desc); TRACE("embedded complex (size=%ld) => %p\n", size, pMemory); m = NdrUnmarshaller[*desc & NDR_TABLE_MASK]; @@ -1413,7 +1413,7 @@ unsigned char * WINAPI ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; - desc = pFormat + *(SHORT*)pFormat; + desc = pFormat + *(const SHORT*)pFormat; size = EmbeddedComplexSize(pStubMsg, desc); m = NdrBufferSizer[*desc & NDR_TABLE_MASK]; if (m) m(pStubMsg, pMemory, desc); @@ -1465,7 +1465,7 @@ unsigned char * WINAPI ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_EMBEDDED_COMPLEX: pMemory += pFormat[1]; pFormat += 2; - desc = pFormat + *(SHORT*)pFormat; + desc = pFormat + *(const SHORT*)pFormat; size = EmbeddedComplexSize(pStubMsg, desc); m = NdrFreer[*desc & NDR_TABLE_MASK]; if (m) m(pStubMsg, pMemory, desc); @@ -1512,7 +1512,7 @@ unsigned long WINAPI ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_EMBEDDED_COMPLEX: size += pFormat[1]; pFormat += 2; - desc = pFormat + *(SHORT*)pFormat; + desc = pFormat + *(const SHORT*)pFormat; size += EmbeddedComplexSize(pStubMsg, desc); pFormat += 2; continue; @@ -1541,9 +1541,9 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); pFormat += 4; - if (*(WORD*)pFormat) conf_array = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat; pFormat += 2; - if (*(WORD*)pFormat) pointer_desc = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat; pFormat += 2; pStubMsg->Memory = pMemory; @@ -1568,7 +1568,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned char fMustAlloc) { - unsigned size = *(LPWORD)(pFormat+2); + unsigned size = *(const WORD*)(pFormat+2); PFORMAT_STRING conf_array = NULL; PFORMAT_STRING pointer_desc = NULL; unsigned char *pMemory; @@ -1579,9 +1579,9 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, *ppMemory = NdrAllocate(pStubMsg, size); pFormat += 4; - if (*(WORD*)pFormat) conf_array = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat; pFormat += 2; - if (*(WORD*)pFormat) pointer_desc = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat; pFormat += 2; pMemory = ComplexUnmarshall(pStubMsg, *ppMemory, pFormat, pointer_desc, fMustAlloc); @@ -1606,9 +1606,9 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); pFormat += 4; - if (*(WORD*)pFormat) conf_array = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat; pFormat += 2; - if (*(WORD*)pFormat) pointer_desc = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat; pFormat += 2; pStubMsg->Memory = pMemory; @@ -1634,9 +1634,9 @@ unsigned long WINAPI NdrComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, FIXME("(%p,%p): stub\n", pStubMsg, pFormat); pFormat += 4; - if (*(WORD*)pFormat) conf_array = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat; pFormat += 2; - if (*(WORD*)pFormat) pointer_desc = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat; pFormat += 2; return 0; @@ -1656,9 +1656,9 @@ void WINAPI NdrComplexStructFree(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); pFormat += 4; - if (*(WORD*)pFormat) conf_array = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat; pFormat += 2; - if (*(WORD*)pFormat) pointer_desc = pFormat + *(WORD*)pFormat; + if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat; pFormat += 2; pStubMsg->Memory = pMemory; @@ -1678,7 +1678,7 @@ unsigned char * WINAPI NdrConformantArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { - DWORD size = 0, esize = *(LPWORD)(pFormat+2); + DWORD size = 0, esize = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]); @@ -1707,7 +1707,7 @@ unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned char fMustAlloc) { - DWORD size = 0, esize = *(LPWORD)(pFormat+2); + DWORD size = 0, esize = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]); @@ -1742,7 +1742,7 @@ void WINAPI NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { - DWORD size = 0, esize = *(LPWORD)(pFormat+2); + DWORD size = 0, esize = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]); @@ -1853,14 +1853,14 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, DWORD size = 0, count, def; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - def = *(WORD*)&pFormat[2]; + def = *(const WORD*)&pFormat[2]; pFormat += 4; pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def); size = pStubMsg->MaxCount; TRACE("conformance=%ld\n", size); - if (*(DWORD*)pFormat != 0xffffffff) + if (*(const DWORD*)pFormat != 0xffffffff) FIXME("compute variance\n"); pFormat += 4; @@ -1917,14 +1917,14 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, DWORD size = 0, count, def; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - def = *(WORD*)&pFormat[2]; + def = *(const WORD*)&pFormat[2]; pFormat += 4; pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def); size = pStubMsg->MaxCount; TRACE("conformance=%ld\n", size); - if (*(DWORD*)pFormat != 0xffffffff) + if (*(const DWORD*)pFormat != 0xffffffff) FIXME("compute variance\n"); pFormat += 4; @@ -1962,14 +1962,14 @@ void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg, DWORD size = 0, count, def; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - def = *(WORD*)&pFormat[2]; + def = *(const WORD*)&pFormat[2]; pFormat += 4; pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def); size = pStubMsg->MaxCount; TRACE("conformance=%ld\n", size); - if (*(DWORD*)pFormat != 0xffffffff) + if (*(const DWORD*)pFormat != 0xffffffff) FIXME("compute variance\n"); pFormat += 4; @@ -1991,7 +1991,7 @@ unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { /* unsigned flags = pFormat[1]; */ - unsigned index = *(WORD*)&pFormat[2]; + unsigned index = *(const WORD*)&pFormat[2]; unsigned long uflag = UserMarshalFlags(pStubMsg); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); TRACE("index=%d\n", index); @@ -2014,8 +2014,8 @@ unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char fMustAlloc) { /* unsigned flags = pFormat[1];*/ - unsigned index = *(WORD*)&pFormat[2]; - DWORD memsize = *(WORD*)&pFormat[4]; + unsigned index = *(const WORD*)&pFormat[2]; + DWORD memsize = *(const WORD*)&pFormat[4]; unsigned long uflag = UserMarshalFlags(pStubMsg); TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); TRACE("index=%d\n", index); @@ -2038,8 +2038,8 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { /* unsigned flags = pFormat[1];*/ - unsigned index = *(WORD*)&pFormat[2]; - DWORD bufsize = *(WORD*)&pFormat[6]; + unsigned index = *(const WORD*)&pFormat[2]; + DWORD bufsize = *(const WORD*)&pFormat[6]; unsigned long uflag = UserMarshalFlags(pStubMsg); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); TRACE("index=%d\n", index); @@ -2061,8 +2061,8 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned long WINAPI NdrUserMarshalMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { - unsigned index = *(WORD*)&pFormat[2]; -/* DWORD memsize = *(WORD*)&pFormat[4]; */ + unsigned index = *(const WORD*)&pFormat[2]; +/* DWORD memsize = *(const WORD*)&pFormat[4]; */ FIXME("(%p,%p): stub\n", pStubMsg, pFormat); TRACE("index=%d\n", index); @@ -2077,7 +2077,7 @@ void WINAPI NdrUserMarshalFree(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { /* unsigned flags = pFormat[1]; */ - unsigned index = *(WORD*)&pFormat[2]; + unsigned index = *(const WORD*)&pFormat[2]; unsigned long uflag = UserMarshalFlags(pStubMsg); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); TRACE("index=%d\n", index); diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c index eeedd91d77f..344e91934ce 100644 --- a/dlls/setupapi/install.c +++ b/dlls/setupapi/install.c @@ -342,7 +342,7 @@ static BOOL do_reg_operation( HKEY hkey, const WCHAR *value, INFCONTEXT *context { TRACE( "setting value %s to %s\n", debugstr_w(value), debugstr_w(str) ); if (str) RegSetValueExW( hkey, value, 0, type, (BYTE *)str, size * sizeof(WCHAR) ); - else RegSetValueExW( hkey, value, 0, type, (BYTE *)&empty, sizeof(WCHAR) ); + else RegSetValueExW( hkey, value, 0, type, (const BYTE *)&empty, sizeof(WCHAR) ); } HeapFree( GetProcessHeap(), 0, str ); return TRUE; diff --git a/dlls/shell32/changenotify.c b/dlls/shell32/changenotify.c index aab5da63ed2..b2588abc4a9 100644 --- a/dlls/shell32/changenotify.c +++ b/dlls/shell32/changenotify.c @@ -263,7 +263,7 @@ BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2, return -1; } -static BOOL should_notify( LPITEMIDLIST changed, LPCITEMIDLIST watched, BOOL sub ) +static BOOL should_notify( LPCITEMIDLIST changed, LPCITEMIDLIST watched, BOOL sub ) { TRACE("%p %p %d\n", changed, watched, sub ); if ( !watched ) @@ -280,7 +280,7 @@ static BOOL should_notify( LPITEMIDLIST changed, LPCITEMIDLIST watched, BOOL sub */ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2) { - LPITEMIDLIST Pidls[2]; + LPCITEMIDLIST Pidls[2]; LPNOTIFICATIONLIST ptr; UINT typeFlag = uFlags & SHCNF_TYPE; @@ -326,8 +326,8 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID if (dwItem2) Pidls[1] = SHSimpleIDListFromPathW((LPCWSTR)dwItem2); break; case SHCNF_IDLIST: - Pidls[0] = (LPITEMIDLIST)dwItem1; - Pidls[1] = (LPITEMIDLIST)dwItem2; + Pidls[0] = (LPCITEMIDLIST)dwItem1; + Pidls[1] = (LPCITEMIDLIST)dwItem2; break; case SHCNF_PRINTERA: case SHCNF_PRINTERW: @@ -404,8 +404,8 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID /* if we allocated it, free it. The ANSI flag is also set in its Unicode sibling. */ if ((typeFlag & SHCNF_PATHA) || (typeFlag & SHCNF_PRINTERA)) { - if (Pidls[0]) SHFree(Pidls[0]); - if (Pidls[1]) SHFree(Pidls[1]); + if (Pidls[0]) SHFree((LPITEMIDLIST)Pidls[0]); + if (Pidls[1]) SHFree((LPITEMIDLIST)Pidls[1]); } } @@ -440,7 +440,7 @@ HANDLE WINAPI SHChangeNotification_Lock( { DWORD i; LPNOTIFICATIONLIST node; - LPITEMIDLIST *idlist; + LPCITEMIDLIST *idlist; TRACE("%p %08lx %p %p\n", hChange, dwProcessId, lppidls, lpwEventId); @@ -451,9 +451,9 @@ HANDLE WINAPI SHChangeNotification_Lock( { idlist = SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl ); for(i=0; i<node->cidl; i++) - idlist[i] = (LPITEMIDLIST)node->pidlSignaled; + idlist[i] = (LPCITEMIDLIST)node->pidlSignaled; *lpwEventId = node->wSignalledEvent; - *lppidls = idlist; + *lppidls = (LPITEMIDLIST*)idlist; node->wSignalledEvent = 0; } else diff --git a/dlls/shell32/debughlp.c b/dlls/shell32/debughlp.c index 2522c885364..181410390f5 100644 --- a/dlls/shell32/debughlp.c +++ b/dlls/shell32/debughlp.c @@ -262,7 +262,7 @@ BOOL pcheck (LPCITEMIDLIST pidl) memset(szTemp, ' ', BYTES_PRINTED*4 + 1); for ( i = 0; (i<pidltemp->mkid.cb) && (i<BYTES_PRINTED); i++) { - c = ((unsigned char *)pidltemp)[i]; + c = ((const unsigned char *)pidltemp)[i]; szTemp[i*3+0] = ((c>>4)>9)? (c>>4)+55 : (c>>4)+48; szTemp[i*3+1] = ((0x0F&c)>9)? (0x0F&c)+55 : (0x0F&c)+48; diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index f7018a47fad..e6c77e1ae1f 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -129,7 +129,7 @@ BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR pa flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR; break; } - if (!*(LPWORD)pidl || type == ILGDN_FORPARSING) + if (!*(const WORD*)pidl || type == ILGDN_FORPARSING) { ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag, &strret); if (SUCCEEDED(ret)) @@ -779,7 +779,7 @@ UINT WINAPI ILGetSize(LPCITEMIDLIST pidl) if (pidl) { while (si->cb) { len += si->cb; - si = (LPSHITEMID)(((LPBYTE)si)+si->cb); + si = (LPCSHITEMID)(((const BYTE*)si)+si->cb); } len += 2; } @@ -814,7 +814,7 @@ LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl) len = pidl->mkid.cb; if (len) { - pidl = (LPITEMIDLIST) (((LPBYTE)pidl)+len); + pidl = (LPCITEMIDLIST) (((const BYTE*)pidl)+len); TRACE("-- %p\n", pidl); return (LPITEMIDLIST)pidl; } @@ -1757,7 +1757,7 @@ BOOL _ILIsPidlSimple ( LPCITEMIDLIST pidl) if(! _ILIsDesktop(pidl)) /* pidl=NULL or mkid.cb=0 */ { WORD len = pidl->mkid.cb; - LPCITEMIDLIST pidlnext = (LPCITEMIDLIST) (((LPBYTE)pidl) + len ); + LPCITEMIDLIST pidlnext = (LPCITEMIDLIST) (((const BYTE*)pidl) + len ); if (pidlnext->mkid.cb) ret = FALSE; } diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index c03e2937a5a..13f3d7ac540 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -761,7 +761,7 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name); } else { - lstrcpyA(doc_name, (LPSTR) pv); + lstrcpyA(doc_name, (LPCSTR) pv); } TRACE("full document name %s\n", doc_name); PathStripPathA(doc_name); diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 386e5c65abf..7b525a2c10a 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -143,7 +143,7 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut) while (*pszTail && (*pszTail != (WCHAR) '\\')) pszTail++; - dwCopy = (WCHAR *) pszTail - (WCHAR *) pszNext + 1; + dwCopy = (const WCHAR *) pszTail - (const WCHAR *) pszNext + 1; lstrcpynW (pszOut, pszNext, (dwOut < dwCopy) ? dwOut : dwCopy); if (*pszTail) diff --git a/dlls/shell32/shpolicy.c b/dlls/shell32/shpolicy.c index 4ff03b008e6..8e435425780 100644 --- a/dlls/shell32/shpolicy.c +++ b/dlls/shell32/shpolicy.c @@ -897,15 +897,15 @@ BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey) { if (SHELL_OsIsUnicode()) { - if (lstrcmpiW((LPWSTR)inpRegKey, strRegistryPolicyW) && - lstrcmpiW((LPWSTR)inpRegKey, strPolicyW)) + if (lstrcmpiW((LPCWSTR)inpRegKey, strRegistryPolicyW) && + lstrcmpiW((LPCWSTR)inpRegKey, strPolicyW)) /* doesn't match, fail */ return 0; } else { - if (lstrcmpiA((LPSTR)inpRegKey, strRegistryPolicyA) && - lstrcmpiA((LPSTR)inpRegKey, strPolicyA)) + if (lstrcmpiA((LPCSTR)inpRegKey, strRegistryPolicyA) && + lstrcmpiA((LPCSTR)inpRegKey, strPolicyA)) /* doesn't match, fail */ return 0; } diff --git a/dlls/shlwapi/clist.c b/dlls/shlwapi/clist.c index 4eab19c68ab..c5312de2348 100644 --- a/dlls/shlwapi/clist.c +++ b/dlls/shlwapi/clist.c @@ -51,7 +51,7 @@ HRESULT WINAPI SHAddDataBlock(LPSHLWAPI_CLIST*,LPCSHLWAPI_CLIST); */ inline static LPSHLWAPI_CLIST NextItem(LPCSHLWAPI_CLIST lpList) { - const char* address = (char*)lpList; + const char* address = (const char*)lpList; address += lpList->ulSize; return (LPSHLWAPI_CLIST)address; } diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c index 450767bc60a..92ab29b5f9e 100644 --- a/dlls/shlwapi/url.c +++ b/dlls/shlwapi/url.c @@ -1394,7 +1394,7 @@ HRESULT WINAPI UrlHashA(LPCSTR pszUrl, unsigned char *lpDest, DWORD nDestLen) if (IsBadStringPtrA(pszUrl, -1) || IsBadWritePtr(lpDest, nDestLen)) return E_INVALIDARG; - HashData((PBYTE)pszUrl, (int)strlen(pszUrl), lpDest, nDestLen); + HashData((const BYTE*)pszUrl, (int)strlen(pszUrl), lpDest, nDestLen); return S_OK; } diff --git a/dlls/user/exticon.c b/dlls/user/exticon.c index aa4086b9db1..cea8b72c87c 100644 --- a/dlls/user/exticon.c +++ b/dlls/user/exticon.c @@ -102,7 +102,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI { pos = (min + max) / 2; if (entry[pos].u1.s2.Id == id) - return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s3.OffsetToDirectory); + return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); if (entry[pos].u1.s2.Id > id) max = pos - 1; else min = pos + 1; } @@ -120,7 +120,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_ { const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry; entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); - return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry->u2.s3.OffsetToDirectory); + return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s3.OffsetToDirectory); } /************************************************************************* @@ -461,7 +461,7 @@ static UINT ICO_ExtractIconExW( /* search resource id */ int n = 0; int iId = abs(nIconIndex); - PIMAGE_RESOURCE_DIRECTORY_ENTRY xprdeTmp = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(icongroupresdir+1); + const IMAGE_RESOURCE_DIRECTORY_ENTRY* xprdeTmp = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(icongroupresdir+1); while(n<iconDirCount && xprdeTmp) { @@ -494,7 +494,7 @@ static UINT ICO_ExtractIconExW( nIcons = iconDirCount - nIconIndex; /* starting from specified index */ - xresent = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(icongroupresdir+1) + nIconIndex; + xresent = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(icongroupresdir+1) + nIconIndex; for (i=0; i < nIcons; i++,xresent++) { @@ -505,7 +505,7 @@ static UINT ICO_ExtractIconExW( /* default language (0) */ resdir = find_entry_default(resdir,rootresdir); - igdataent = (PIMAGE_RESOURCE_DATA_ENTRY)resdir; + igdataent = (const IMAGE_RESOURCE_DATA_ENTRY*)resdir; /* lookup address in mapped image for virtual address */ igdata = NULL; @@ -550,7 +550,7 @@ static UINT ICO_ExtractIconExW( continue; } xresdir = find_entry_default(xresdir, rootresdir); - idataent = (PIMAGE_RESOURCE_DATA_ENTRY)xresdir; + idataent = (const IMAGE_RESOURCE_DATA_ENTRY*)xresdir; idata = NULL; /* map virtual to address in image */ diff --git a/dlls/user/msg16.c b/dlls/user/msg16.c index 3c7a7c60926..70ade579ff8 100644 --- a/dlls/user/msg16.c +++ b/dlls/user/msg16.c @@ -242,7 +242,7 @@ BOOL16 WINAPI TranslateMessage32_16( const MSG32_16 *msg, BOOL16 wHaveParamHigh */ BOOL16 WINAPI TranslateMessage16( const MSG16 *msg ) { - return TranslateMessage32_16( (MSG32_16 *)msg, FALSE ); + return TranslateMessage32_16( (const MSG32_16 *)msg, FALSE ); } diff --git a/dlls/user/resource.c b/dlls/user/resource.c index 4f931b86fee..bde2d298bee 100644 --- a/dlls/user/resource.c +++ b/dlls/user/resource.c @@ -78,7 +78,7 @@ HACCEL WINAPI LoadAcceleratorsW(HINSTANCE instance,LPCWSTR lpTableName) if (HIWORD(lpTableName)) TRACE_(accel)("%p '%s'\n", - (LPVOID)instance, (char *)( lpTableName ) ); + (LPVOID)instance, (const char *)( lpTableName ) ); else TRACE_(accel)("%p 0x%04x\n", (LPVOID)instance, LOWORD(lpTableName) ); diff --git a/dlls/version/resource.c b/dlls/version/resource.c index a29baf47026..2d36d3ccd0a 100644 --- a/dlls/version/resource.c +++ b/dlls/version/resource.c @@ -66,7 +66,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI { pos = (min + max) / 2; if (entry[pos].u1.s2.Id == id) - return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s3.OffsetToDirectory); + return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); if (entry[pos].u1.s2.Id > id) max = pos - 1; else min = pos + 1; } @@ -86,7 +86,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_ const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry; entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); - return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry->u2.s3.OffsetToDirectory); + return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s3.OffsetToDirectory); } @@ -124,11 +124,11 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_ while (min <= max) { pos = (min + max) / 2; - str = (IMAGE_RESOURCE_DIR_STRING_U *)((char *)root + entry[pos].u1.s1.NameOffset); + str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root + entry[pos].u1.s1.NameOffset); res = strncmpiW( nameW, str->NameString, str->Length ); if (!res && namelen == str->Length) { - ret = (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].u2.s3.OffsetToDirectory); + ret = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); break; } if (res < 0) max = pos - 1; @@ -345,7 +345,7 @@ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, /* Find resource */ resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress); - resPtr = (PIMAGE_RESOURCE_DIRECTORY)resDir; + resPtr = (const IMAGE_RESOURCE_DIRECTORY*)resDir; resPtr = find_entry_by_name( resPtr, typeid, resDir ); if ( !resPtr ) { @@ -366,7 +366,7 @@ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, } /* Find resource data section */ - resData = (PIMAGE_RESOURCE_DATA_ENTRY)resPtr; + resData = (const IMAGE_RESOURCE_DATA_ENTRY*)resPtr; for ( i = 0; i < nSections; i++ ) if ( resData->OffsetToData >= sections[i].VirtualAddress && resData->OffsetToData < sections[i].VirtualAddress + @@ -475,4 +475,3 @@ DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType, return reslen; } - diff --git a/dlls/winedos/ppdev.c b/dlls/winedos/ppdev.c index 4ef847fde2d..a56c56e9ffb 100644 --- a/dlls/winedos/ppdev.c +++ b/dlls/winedos/ppdev.c @@ -61,7 +61,7 @@ static int PPDeviceNum=0; static int IO_pp_sort(const void *p1,const void *p2) { - return ((PPDeviceStruct*)p1)->userbase - ((PPDeviceStruct*)p2)->userbase; + return ((const PPDeviceStruct*)p1)->userbase - ((const PPDeviceStruct*)p2)->userbase; } /* IO_pp_init diff --git a/dlls/wineps/escape.c b/dlls/wineps/escape.c index 5cec36820cf..999f67dab8e 100644 --- a/dlls/wineps/escape.c +++ b/dlls/wineps/escape.c @@ -48,7 +48,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i WARN("cbInput < sizeof(INT) (=%d) for QUERYESCSUPPORT\n", cbInput); return 0; } else { - UINT num = *(UINT *)in_data; + UINT num = *(const UINT *)in_data; TRACE("QUERYESCSUPPORT for %d\n", num); switch(num) { @@ -120,7 +120,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i case SETLINECAP: { - INT newCap = *(INT *)in_data; + INT newCap = *(const INT *)in_data; if(cbInput != sizeof(INT)) { WARN("cbInput != sizeof(INT) (=%d) for SETLINECAP\n", cbInput); return 0; @@ -131,7 +131,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i case SETLINEJOIN: { - INT newJoin = *(INT *)in_data; + INT newJoin = *(const INT *)in_data; if(cbInput != sizeof(INT)) { WARN("cbInput != sizeof(INT) (=%d) for SETLINEJOIN\n", cbInput); return 0; @@ -142,7 +142,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i case SETMITERLIMIT: { - INT newLimit = *(INT *)in_data; + INT newLimit = *(const INT *)in_data; if(cbInput != sizeof(INT)) { WARN("cbInput != sizeof(INT) (=%d) for SETMITERLIMIT\n", cbInput); return 0; @@ -172,7 +172,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i case EXT_DEVICE_CAPS: { - UINT cap = *(UINT *)in_data; + UINT cap = *(const UINT *)in_data; if(cbInput != sizeof(UINT)) { WARN("cbInput != sizeof(UINT) (=%d) for EXT_DEVICE_CAPS\n", cbInput); return 0; @@ -195,7 +195,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i case EPSPRINTING: { - UINT epsprint = *(UINT*)in_data; + UINT epsprint = *(const UINT*)in_data; /* FIXME: In this mode we do not need to send page intros and page * ends according to the doc. But I just ignore that detail * for now. @@ -221,14 +221,14 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i WriteSpool16(physDev->job.hJob, (LPSTR)psbegindocument, sizeof(psbegindocument)-1); physDev->job.in_passthrough = TRUE; } - return WriteSpool16(physDev->job.hJob,((char*)in_data)+2,*(WORD*)in_data); + return WriteSpool16(physDev->job.hJob,((char*)in_data)+2,*(const WORD*)in_data); } case POSTSCRIPT_IGNORE: { BOOL ret = physDev->job.quiet; - TRACE("POSTSCRIPT_IGNORE %d\n", *(short*)in_data); - physDev->job.quiet = *(short*)in_data; + TRACE("POSTSCRIPT_IGNORE %d\n", *(const short*)in_data); + physDev->job.quiet = *(const short*)in_data; return ret; } @@ -249,7 +249,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i case END_PATH: { - struct PATH_INFO *info = (struct PATH_INFO*)in_data; + const struct PATH_INFO *info = (const struct PATH_INFO*)in_data; TRACE("END_PATH\n"); if(!physDev->pathdepth) { @@ -273,7 +273,7 @@ INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID i case CLIP_TO_PATH: { - WORD mode = *(WORD*)in_data; + WORD mode = *(const WORD*)in_data; switch(mode) { case CLIP_SAVE: diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c index 3ab4dd0a10a..a3ecdce6e4a 100644 --- a/dlls/wineps/init.c +++ b/dlls/wineps/init.c @@ -264,7 +264,7 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) LPDEVMODEA dmA; DWORD size; BOOL Formname; - ptrdiff_t off_formname = (char *)dmW->dmFormName - (char *)dmW; + ptrdiff_t off_formname = (const char *)dmW->dmFormName - (const char *)dmW; if(!dmW) return NULL; Formname = (dmW->dmSize > off_formname); @@ -284,7 +284,7 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) (off_formname + CCHFORMNAME * sizeof(WCHAR))); } dmA->dmSize = size; - memcpy((char *)dmA + dmA->dmSize, (char *)dmW + dmW->dmSize, + memcpy((char *)dmA + dmA->dmSize, (const char *)dmW + dmW->dmSize, dmW->dmDriverExtra); return dmA; } diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c index 6378eac0c5c..6fc6a3ab4b1 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c @@ -248,8 +248,8 @@ static BOOL MCI_IsCommandTableValid(UINT uTbl) do { str = lmem; lmem += strlen(lmem) + 1; - flg = *(LPDWORD)lmem; - eid = *(LPWORD)(lmem + sizeof(DWORD)); + flg = *(const DWORD*)lmem; + eid = *(const WORD*)(lmem + sizeof(DWORD)); lmem += sizeof(DWORD) + sizeof(WORD); idx ++; /* EPP TRACE("cmd='%s' %08lx %04x\n", str, flg, eid); */ @@ -291,8 +291,8 @@ static BOOL MCI_DumpCommandTable(UINT uTbl) do { str = lmem; lmem += strlen(lmem) + 1; - flg = *(LPDWORD)lmem; - eid = *(LPWORD)(lmem + sizeof(DWORD)); + flg = *(const DWORD*)lmem; + eid = *(const WORD*)(lmem + sizeof(DWORD)); TRACE("cmd='%s' %08lx %04x\n", str, flg, eid); lmem += sizeof(DWORD) + sizeof(WORD); } while (eid != MCI_END_COMMAND && eid != MCI_END_COMMAND_LIST); @@ -379,7 +379,7 @@ UINT MCI_SetCommandTable(void *table, UINT uDevType) count = 0; do { lmem += strlen(lmem) + 1; - eid = *(LPWORD)(lmem + sizeof(DWORD)); + eid = *(const WORD*)(lmem + sizeof(DWORD)); lmem += sizeof(DWORD) + sizeof(WORD); if (eid == MCI_COMMAND_HEAD) count++; @@ -393,7 +393,7 @@ UINT MCI_SetCommandTable(void *table, UINT uDevType) do { str = lmem; lmem += strlen(lmem) + 1; - eid = *(LPWORD)(lmem + sizeof(DWORD)); + eid = *(const WORD*)(lmem + sizeof(DWORD)); lmem += sizeof(DWORD) + sizeof(WORD); if (eid == MCI_COMMAND_HEAD) S_MciCmdTable[uTbl].aVerbs[count++] = str; @@ -619,8 +619,8 @@ static LPCSTR MCI_FindCommand(UINT uTbl, LPCSTR verb) static DWORD MCI_GetReturnType(LPCSTR lpCmd) { lpCmd += strlen(lpCmd) + 1 + sizeof(DWORD) + sizeof(WORD); - if (*lpCmd == '\0' && *(LPWORD)(lpCmd + 1 + sizeof(DWORD)) == MCI_RETURN) { - return *(LPDWORD)(lpCmd + 1); + if (*lpCmd == '\0' && *(const WORD*)(lpCmd + 1 + sizeof(DWORD)) == MCI_RETURN) { + return *(const DWORD*)(lpCmd + 1); } return 0L; } @@ -630,7 +630,7 @@ static DWORD MCI_GetReturnType(LPCSTR lpCmd) */ static WORD MCI_GetMessage(LPCSTR lpCmd) { - return (WORD)*(LPDWORD)(lpCmd + strlen(lpCmd) + 1); + return (WORD)*(const DWORD*)(lpCmd + strlen(lpCmd) + 1); } /************************************************************************** @@ -712,8 +712,8 @@ static DWORD MCI_ParseOptArgs(LPDWORD data, int _offset, LPCSTR lpCmd, do { /* loop on options for command table for the requested verb */ str = lmem; lmem += (len = strlen(lmem)) + 1; - flg = *(LPDWORD)lmem; - eid = *(LPWORD)(lmem + sizeof(DWORD)); + flg = *(const DWORD*)lmem; + eid = *(const WORD*)(lmem + sizeof(DWORD)); lmem += sizeof(DWORD) + sizeof(WORD); /* EPP TRACE("\tcmd='%s' inCst=%c eid=%04x\n", str, inCst ? 'Y' : 'N', eid); */ diff --git a/dlls/winspool/info.c b/dlls/winspool/info.c index 2547e9ecb6c..155c60fc097 100644 --- a/dlls/winspool/info.c +++ b/dlls/winspool/info.c @@ -394,7 +394,7 @@ PRINTCAP_LoadPrinters(void) { static inline DWORD set_reg_szW(HKEY hkey, const WCHAR *keyname, const WCHAR *value) { if (value) - return RegSetValueExW(hkey, keyname, 0, REG_SZ, (LPBYTE)value, + return RegSetValueExW(hkey, keyname, 0, REG_SZ, (const BYTE*)value, lstrlenW(value) * sizeof(WCHAR)); else return ERROR_FILE_NOT_FOUND; @@ -595,7 +595,7 @@ static DWORD WINSPOOL_GetOpenedPrinterRegKey(HANDLE hPrinter, HKEY *phkey) static LPDEVMODEW DEVMODEcpyAtoW(DEVMODEW *dmW, const DEVMODEA *dmA) { BOOL Formname; - ptrdiff_t off_formname = (char *)dmA->dmFormName - (char *)dmA; + ptrdiff_t off_formname = (const char *)dmA->dmFormName - (const char *)dmA; DWORD size; Formname = (dmA->dmSize > off_formname); @@ -614,7 +614,7 @@ static LPDEVMODEW DEVMODEcpyAtoW(DEVMODEW *dmW, const DEVMODEA *dmA) (off_formname + CCHFORMNAME)); } dmW->dmSize = size; - memcpy((char *)dmW + dmW->dmSize, (char *)dmA + dmA->dmSize, + memcpy((char *)dmW + dmW->dmSize, (const char *)dmA + dmA->dmSize, dmA->dmDriverExtra); return dmW; } @@ -628,7 +628,7 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) LPDEVMODEA dmA; DWORD size; BOOL Formname; - ptrdiff_t off_formname = (char *)dmW->dmFormName - (char *)dmW; + ptrdiff_t off_formname = (const char *)dmW->dmFormName - (const char *)dmW; if(!dmW) return NULL; Formname = (dmW->dmSize > off_formname); @@ -648,7 +648,7 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) (off_formname + CCHFORMNAME * sizeof(WCHAR))); } dmA->dmSize = size; - memcpy((char *)dmA + dmA->dmSize, (char *)dmW + dmW->dmSize, + memcpy((char *)dmA + dmA->dmSize, (const char *)dmW + dmW->dmSize, dmW->dmDriverExtra); return dmA; } diff --git a/dlls/x11drv/dib.c b/dlls/x11drv/dib.c index 2701ca680ea..f41372f0944 100644 --- a/dlls/x11drv/dib.c +++ b/dlls/x11drv/dib.c @@ -167,7 +167,7 @@ int X11DRV_DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse ) if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) { - BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)info; + const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)info; colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0; return sizeof(BITMAPCOREHEADER) + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD)); @@ -215,7 +215,7 @@ static int DIB_GetBitmapInfoEx( const BITMAPINFOHEADER *header, LONG *width, { if (header->biSize == sizeof(BITMAPCOREHEADER)) { - BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)header; + const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)header; *width = core->bcWidth; *height = core->bcHeight; *planes = core->bcPlanes; @@ -271,7 +271,7 @@ int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping, { if (quads) { - RGBQUAD * rgb = (RGBQUAD *)colorPtr; + const RGBQUAD * rgb = (const RGBQUAD *)colorPtr; if (depth == 1) /* Monochrome */ for (i = start; i < end; i++, rgb++) @@ -285,7 +285,7 @@ int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping, } else { - RGBTRIPLE * rgb = (RGBTRIPLE *)colorPtr; + const RGBTRIPLE * rgb = (const RGBTRIPLE *)colorPtr; if (depth == 1) /* Monochrome */ for (i = start; i < end; i++, rgb++) @@ -301,7 +301,7 @@ int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping, else /* DIB_PAL_COLORS */ { if (colorPtr) { - WORD * index = (WORD *)colorPtr; + const WORD * index = (const WORD *)colorPtr; for (i = start; i < end; i++, index++) colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, PALETTEINDEX(*index) ); @@ -337,10 +337,10 @@ int *X11DRV_DIB_BuildColorMap( X11DRV_PDEVICE *physDev, WORD coloruse, WORD dept } else { - colors = 1 << ((BITMAPCOREHEADER *)info)->bcBitCount; + colors = 1 << ((const BITMAPCOREHEADER *)info)->bcBitCount; } - colorPtr = (LPBYTE) info + (WORD) info->bmiHeader.biSize; + colorPtr = (const BYTE*) info + (WORD) info->bmiHeader.biSize; if (colors > 256) { @@ -641,7 +641,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, if ((width&7)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -685,7 +685,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, if ((width&7)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else if (bmpImage->blue_mask==0x7c00) { @@ -714,7 +714,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, if ((width&7)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -747,7 +747,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, if ((width&7)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else if (bmpImage->blue_mask==0xf800) { @@ -776,7 +776,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, if ((width&7)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -824,7 +824,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, if ((width&7)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -849,7 +849,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, if ((width&7)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } @@ -1016,7 +1016,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, if ((width&1)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1060,7 +1060,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, if ((width&1)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else if (bmpImage->blue_mask==0x7c00) { @@ -1089,7 +1089,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, if ((width&1)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1122,7 +1122,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, if ((width&1)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else if (bmpImage->blue_mask==0xf800) { @@ -1151,7 +1151,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, if ((width&1)!=0) { *dstbyte=dstval; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1201,7 +1201,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, srcbyte[1], srcbyte[0]) << 4); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1231,7 +1231,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, srcbyte[1], srcbyte[2]) << 4); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } @@ -1277,7 +1277,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, srcbyte[1], srcbyte[0]) << 4); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1307,7 +1307,7 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, srcbyte[1], srcbyte[2]) << 4); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } @@ -1579,7 +1579,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, srcval.peGreen, srcval.peBlue); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1614,7 +1614,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, ((srcval << 3) & 0xf8) | /* b */ ((srcval >> 2) & 0x07) ); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else if (bmpImage->blue_mask==0x7c00) { @@ -1634,7 +1634,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, ((srcval >> 7) & 0xf8) | /* b */ ((srcval >> 12) & 0x07) ); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1658,7 +1658,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, ((srcval << 3) & 0xf8) | /* b */ ((srcval >> 2) & 0x07) ); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else if (bmpImage->blue_mask==0xf800) { @@ -1678,7 +1678,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, ((srcval >> 8) & 0xf8) | /* b */ ((srcval >> 13) & 0x07) ); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1717,7 +1717,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, srcbyte[0]); srcbyte+=bytes_per_pixel; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -1733,7 +1733,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, srcbyte[2]); srcbyte+=bytes_per_pixel; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } @@ -2809,7 +2809,7 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits, dstbyte[2]=srcval.peRed; dstbyte+=3; } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -2859,7 +2859,8 @@ static void X11DRV_DIB_SetImageBits_32(int lines, const BYTE *srcbits, XImage *bmpImage, DWORD linebytes) { - DWORD x, *ptr; + DWORD x; + const DWORD *ptr; int h, width = min(srcwidth, dstwidth); const dib_conversions *convs = (bmpImage->byte_order == LSBFirst) ? &dib_normal : &dib_dst_byteswap; @@ -2870,7 +2871,7 @@ static void X11DRV_DIB_SetImageBits_32(int lines, const BYTE *srcbits, linebytes = -linebytes; } - ptr = (DWORD *) srcbits + left; + ptr = (const DWORD *) srcbits + left; switch (bmpImage->depth) { @@ -3390,7 +3391,7 @@ static void X11DRV_DIB_GetImageBits_32( int lines, BYTE *dstbits, (srcval.peGreen << gShift) | (srcval.peBlue << bShift); } - srcbits = (char*)srcbits - bmpImage->bytes_per_line; + srcbits = (const char*)srcbits - bmpImage->bytes_per_line; dstbits += linebytes; } } else { @@ -3768,17 +3769,17 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO break; case 15: case 16: - descr.rMask = (descr.compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0x7c00; - descr.gMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x03e0; - descr.bMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x001f; + descr.rMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr ) : 0x7c00; + descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 1) : 0x03e0; + descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 2) : 0x001f; descr.colorMap = 0; break; case 24: case 32: - descr.rMask = (descr.compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0xff0000; - descr.gMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x00ff00; - descr.bMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x0000ff; + descr.rMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr ) : 0xff0000; + descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 1) : 0x00ff00; + descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 2) : 0x0000ff; descr.colorMap = 0; break; } @@ -3859,17 +3860,17 @@ INT X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan, break; case 15: case 16: - descr.rMask = (descr.compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0x7c00; - descr.gMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x03e0; - descr.bMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x001f; + descr.rMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD*)colorPtr ) : 0x7c00; + descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD*)colorPtr + 1) : 0x03e0; + descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD*)colorPtr + 2) : 0x001f; descr.colorMap = 0; break; case 24: case 32: - descr.rMask = (descr.compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0xff0000; - descr.gMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x00ff00; - descr.bMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x0000ff; + descr.rMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD*)colorPtr ) : 0xff0000; + descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD*)colorPtr + 1) : 0x00ff00; + descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD*)colorPtr + 2) : 0x0000ff; descr.colorMap = 0; break; @@ -3984,13 +3985,13 @@ INT X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan, break; case 15: case 16: - descr.rMask = (descr.compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0x7c00; + descr.rMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr ) : 0x7c00; descr.gMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x03e0; descr.bMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x001f; break; case 24: case 32: - descr.rMask = (descr.compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0xff0000; + descr.rMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr ) : 0xff0000; descr.gMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x00ff00; descr.bMask = (descr.compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x0000ff; break; @@ -4784,16 +4785,16 @@ HBITMAP X11DRV_DIB_CreateDIBSection( { case 15: case 16: - dib->dibSection.dsBitfields[0] = (compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0x7c00; - dib->dibSection.dsBitfields[1] = (compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x03e0; - dib->dibSection.dsBitfields[2] = (compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x001f; + dib->dibSection.dsBitfields[0] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr ) : 0x7c00; + dib->dibSection.dsBitfields[1] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 1) : 0x03e0; + dib->dibSection.dsBitfields[2] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 2) : 0x001f; break; case 24: case 32: - dib->dibSection.dsBitfields[0] = (compression == BI_BITFIELDS) ? *(DWORD *) colorPtr : 0xff0000; - dib->dibSection.dsBitfields[1] = (compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 1) : 0x00ff00; - dib->dibSection.dsBitfields[2] = (compression == BI_BITFIELDS) ? *((DWORD *)colorPtr + 2) : 0x0000ff; + dib->dibSection.dsBitfields[0] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr ) : 0xff0000; + dib->dibSection.dsBitfields[1] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 1) : 0x00ff00; + dib->dibSection.dsBitfields[2] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 2) : 0x0000ff; break; } dib->dibSection.dshSection = section; diff --git a/dlls/x11drv/dib_convert.c b/dlls/x11drv/dib_convert.c index 11e3ecb47f1..185d64e7595 100644 --- a/dlls/x11drv/dib_convert.c +++ b/dlls/x11drv/dib_convert.c @@ -77,7 +77,7 @@ static void convert_5x5_asis(int width, int height, for (y=0; y<height; y++) { memcpy(dstbits, srcbits, width*2); - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -105,12 +105,12 @@ static void convert_555_reverse(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 10) & 0x7c00) | /* h */ ( srcval & 0x03e0) | /* g */ ((srcval >> 10) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -137,12 +137,12 @@ static void convert_555_to_565_asis(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 1) & 0xffc0) | /* h, g */ ((srcval >> 4) & 0x0020) | /* g - 1 bit */ (srcval & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -170,13 +170,13 @@ static void convert_555_to_565_reverse(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 10) & 0x001f) | /* h */ ((srcval << 1) & 0x07c0) | /* g */ ((srcval >> 4) & 0x0020) | /* g - 1 bit */ ((srcval << 11) & 0xf800); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -203,7 +203,7 @@ static void convert_555_to_888_asis(int width, int height, ((srcval >> 12) & 0x07); /* h - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -230,7 +230,7 @@ static void convert_555_to_888_reverse(int width, int height, ((srcval >> 2) & 0x07); /* l - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -256,7 +256,7 @@ static void convert_555_to_0888_asis(int width, int height, ((srcval << 3) & 0x0000f8) | /* l */ ((srcval >> 2) & 0x000007); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -282,7 +282,7 @@ static void convert_555_to_0888_reverse(int width, int height, ((srcval << 19) & 0xf80000) | /* l */ ((srcval << 14) & 0x070000); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -343,7 +343,7 @@ static void convert_5x5_to_any0888(int width, int height, (green << gLeftShift) | (blue << bLeftShift); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -374,12 +374,12 @@ static void convert_565_reverse(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 11) & 0xf800) | /* h */ ( srcval & 0x07e0) | /* g */ ((srcval >> 11) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -405,11 +405,11 @@ static void convert_565_to_555_asis(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 1) & 0x7fe0) | /* h, g */ ( srcval & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -436,12 +436,12 @@ static void convert_565_to_555_reverse(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 11) & 0x001f) | /* h */ ((srcval >> 1) & 0x03e0) | /* g */ ((srcval << 10) & 0x7c00); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -468,7 +468,7 @@ static void convert_565_to_888_asis(int width, int height, ((srcval >> 13) & 0x07); /* h - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -495,7 +495,7 @@ static void convert_565_to_888_reverse(int width, int height, ((srcval >> 2) & 0x07); /* l - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -521,7 +521,7 @@ static void convert_565_to_0888_asis(int width, int height, ((srcval << 3) & 0x0000f8) | /* l */ ((srcval >> 2) & 0x000007); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -547,7 +547,7 @@ static void convert_565_to_0888_reverse(int width, int height, ((srcval << 19) & 0xf80000) | /* l */ ((srcval << 14) & 0x070000); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -565,7 +565,7 @@ static void convert_888_asis(int width, int height, for (y=0; y<height; y++) { memcpy(dstbits, srcbits, width*3); - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -589,7 +589,7 @@ static void convert_888_reverse(int width, int height, srcpixel+=3; dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -631,7 +631,7 @@ static void convert_888_to_555_asis(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] >> 3) & 0x001f); /* l */ @@ -640,7 +640,7 @@ static void convert_888_to_555_asis(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -682,7 +682,7 @@ static void convert_888_to_555_reverse(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] << 7) & 0x7c00); /* l */ @@ -691,7 +691,7 @@ static void convert_888_to_555_reverse(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -733,7 +733,7 @@ static void convert_888_to_565_asis(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] >> 3) & 0x001f); /* l */ @@ -742,7 +742,7 @@ static void convert_888_to_565_asis(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -784,7 +784,7 @@ static void convert_888_to_565_reverse(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] << 8) & 0xf800); /* l */ @@ -793,7 +793,7 @@ static void convert_888_to_565_reverse(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -831,10 +831,10 @@ static void convert_888_to_0888_asis(int width, int height, for (x=0; x<oddwidth; x++) { DWORD srcval; srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=( srcval & 0x00ffffff); /* h, g, l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -879,12 +879,12 @@ static void convert_888_to_0888_reverse(int width, int height, for (x=0; x<oddwidth; x++) { DWORD srcval; srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=((srcval >> 16) & 0x0000ff) | /* h */ ( srcval & 0x00ff00) | /* g */ ((srcval << 16) & 0xff0000); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -911,7 +911,7 @@ static void convert_rgb888_to_any0888(int width, int height, (srcpixel[2] << rLeftShift); /* r */ srcpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -938,7 +938,7 @@ static void convert_bgr888_to_any0888(int width, int height, (srcpixel[2] << bLeftShift); /* b */ srcpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -955,7 +955,7 @@ static void convert_0888_asis(int width, int height, for (y=0; y<height; y++) { memcpy(dstbits, srcbits, width*4); - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -978,7 +978,7 @@ static void convert_0888_reverse(int width, int height, ( srcval & 0x0000ff00) | /* g */ ((srcval >> 16) & 0x000000ff); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1011,7 +1011,7 @@ static void convert_0888_any(int width, int height, (((srcval >> gRightShift) & 0xff) << gLeftShift) | (((srcval >> bRightShift) & 0xff) << bLeftShift); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1034,7 +1034,7 @@ static void convert_0888_to_555_asis(int width, int height, ((srcval >> 6) & 0x03e0) | /* g */ ((srcval >> 3) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1057,7 +1057,7 @@ static void convert_0888_to_555_reverse(int width, int height, ((srcval >> 6) & 0x03e0) | /* g */ ((srcval << 7) & 0x7c00); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1080,7 +1080,7 @@ static void convert_0888_to_565_asis(int width, int height, ((srcval >> 5) & 0x07e0) | /* g */ ((srcval >> 3) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1103,7 +1103,7 @@ static void convert_0888_to_565_reverse(int width, int height, ((srcval >> 5) & 0x07e0) | /* g */ ((srcval << 8) & 0xf800); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1153,7 +1153,7 @@ static void convert_any0888_to_5x5(int width, int height, (((srcval >> gRightShift) & gdst) << gLeftShift) | (((srcval >> bRightShift) & bdst) << bLeftShift); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1192,7 +1192,7 @@ static void convert_0888_to_888_asis(int width, int height, dstbyte+=sizeof(WORD); *dstbyte++=srcval >> 16; /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1245,7 +1245,7 @@ static void convert_0888_to_888_reverse(int width, int height, dstbyte += sizeof(WORD); *dstbyte++=srcval; /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1274,7 +1274,7 @@ static void convert_any0888_to_rgb888(int width, int height, dstpixel[2]=(srcval >> rRightShift); /* r */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1303,7 +1303,7 @@ static void convert_any0888_to_bgr888(int width, int height, dstpixel[2]=(srcval >> bRightShift); /* b */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } diff --git a/dlls/x11drv/dib_dst_swap.c b/dlls/x11drv/dib_dst_swap.c index a9866a72419..af9a5db471a 100644 --- a/dlls/x11drv/dib_dst_swap.c +++ b/dlls/x11drv/dib_dst_swap.c @@ -64,11 +64,11 @@ static void convert_5x5_asis_dst_byteswap(int width, int height, } if(width&1) { /* And the odd pixel */ - WORD srcval = *(WORD*)srcpixel; + WORD srcval = *(const WORD*)srcpixel; *(WORD*)dstpixel = ((srcval << 8) & 0xff00) | ((srcval >> 8) & 0x00ff); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -96,13 +96,13 @@ static void convert_555_reverse_dst_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x1f00) | /* h */ ((srcval >> 8) & 0x0003) | /* g - 2 bits */ ((srcval << 8) & 0xe000) | /* g - 3 bits */ ((srcval << 2) & 0x007c); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -130,13 +130,13 @@ static void convert_555_to_565_asis_dst_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 7) & 0x00ff) | /* h, g - 3 bits */ ((srcval << 9) & 0xc000) | /* g - 2 bits */ ((srcval << 4) & 0x2000) | /* g - 1 bit */ ((srcval << 8) & 0x1f00); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -165,14 +165,14 @@ static void convert_555_to_565_reverse_dst_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x1f00) | /* h */ ((srcval >> 7) & 0x0007) | /* g - 3 bits */ ((srcval << 9) & 0xc000) | /* g - 2 bits */ ((srcval << 4) & 0x2000) | /* g - 1 bit */ ((srcval << 3) & 0x00f8); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -234,7 +234,7 @@ static void convert_555_to_888_asis_dst_byteswap(int width, int height, } FLIP_DWORD(dstpixel + x - 1); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -296,7 +296,7 @@ static void convert_555_to_888_reverse_dst_byteswap(int width, int height, } FLIP_DWORD(dstpixel + x - 1); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -322,7 +322,7 @@ static void convert_555_to_0888_asis_dst_byteswap(int width, int height, ((srcval << 27) & 0xf8000000) | /* l */ ((srcval << 22) & 0x07000000); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -348,7 +348,7 @@ static void convert_555_to_0888_reverse_dst_byteswap(int width, int height, ((srcval << 11) & 0x0000f800) | /* l */ ((srcval << 6) & 0x00000700); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -411,7 +411,7 @@ static void convert_5x5_to_any0888_dst_byteswap(int width, int height, FLIP_DWORD(dstpixel); dstpixel++; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -443,13 +443,13 @@ static void convert_565_reverse_dst_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 3) & 0x1f00) | /* h */ ((srcval >> 8) & 0x0007) | /* g - 3 bits */ ((srcval << 8) & 0xe000) | /* g - 3 bits */ ((srcval << 3) & 0x00f8); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -476,12 +476,12 @@ static void convert_565_to_555_asis_dst_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 7) & 0xe000) | /* g - 3 bits*/ ((srcval << 8) & 0x1f00) | /* l */ ((srcval >> 9) & 0x007f); /* h, g - 2 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -509,13 +509,13 @@ static void convert_565_to_555_reverse_dst_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 7) & 0xe000) | /* g - 3 bits */ ((srcval >> 3) & 0x1f00) | /* l */ ((srcval << 2) & 0x007c) | /* h */ ((srcval >> 9) & 0x0003); /* g - 2 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -578,7 +578,7 @@ static void convert_565_to_888_asis_dst_byteswap(int width, int height, FLIP_DWORD(dstpixel + x - 1); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -640,7 +640,7 @@ static void convert_565_to_888_reverse_dst_byteswap(int width, int height, } FLIP_DWORD(dstpixel + x - 1); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -666,7 +666,7 @@ static void convert_565_to_0888_asis_dst_byteswap(int width, int height, ((srcval << 27) & 0xf8000000) | /* l */ ((srcval << 22) & 0x07000000); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -692,7 +692,7 @@ static void convert_565_to_0888_reverse_dst_byteswap(int width, int height, ((srcval << 11) & 0x0000f800) | /* l */ ((srcval << 6) & 0x00000700); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -709,13 +709,13 @@ static void convert_888_asis_dst_byteswap(int width, int height, for (y=0; y<height; y++) { for(x = 0; x < ((width+1)*3/4); x++) { - DWORD srcval = *((DWORD*)srcbits + x); + DWORD srcval = *((const DWORD*)srcbits + x); *((DWORD*)dstbits + x) = ((srcval << 24) & 0xff000000) | ((srcval << 8) & 0x00ff0000) | ((srcval >> 8) & 0x0000ff00) | ((srcval >> 24) & 0x000000ff); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -745,7 +745,7 @@ static void convert_888_reverse_dst_byteswap(int width, int height, } if(width&3) { BYTE *dstbyte = (BYTE*)dstpixel; - const BYTE *srcbyte = (BYTE*)srcpixel; + const BYTE *srcbyte = (const BYTE*)srcpixel; for(x = 0; x < (width&3); x++) { dstbyte[2] = srcbyte[0]; dstbyte[1] = srcbyte[1]; @@ -757,7 +757,7 @@ static void convert_888_reverse_dst_byteswap(int width, int height, } FLIP_DWORD(dstpixel + x - 1); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -803,7 +803,7 @@ static void convert_888_to_555_asis_dst_byteswap(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] << 5) & 0x1f00); /* l */ @@ -813,7 +813,7 @@ static void convert_888_to_555_asis_dst_byteswap(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -859,7 +859,7 @@ static void convert_888_to_555_reverse_dst_byteswap(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] >> 1) & 0x007c); /* l */ @@ -870,7 +870,7 @@ static void convert_888_to_555_reverse_dst_byteswap(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -916,7 +916,7 @@ static void convert_888_to_565_asis_dst_byteswap(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] << 5) & 0x1f00); /* l */ @@ -926,7 +926,7 @@ static void convert_888_to_565_asis_dst_byteswap(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -972,7 +972,7 @@ static void convert_888_to_565_reverse_dst_byteswap(int width, int height, dstpixel+=4; } /* And now up to 3 odd pixels */ - srcbyte=(LPBYTE)srcpixel; + srcbyte=(const BYTE*)srcpixel; for (x=0; x<oddwidth; x++) { WORD dstval; dstval =((srcbyte[0] << 0) & 0x00f8); /* l */ @@ -982,7 +982,7 @@ static void convert_888_to_565_reverse_dst_byteswap(int width, int height, *dstpixel++=dstval; srcbyte+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1024,12 +1024,12 @@ static void convert_888_to_0888_asis_dst_byteswap(int width, int height, for (x=0; x<oddwidth; x++) { DWORD srcval; srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=((srcval << 24) & 0xff000000) | /* l */ ((srcval << 8) & 0x00ff0000) | /* g */ ((srcval >> 8) & 0x0000ff00); /* h */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1066,10 +1066,10 @@ static void convert_888_to_0888_reverse_dst_byteswap(int width, int height, for (x=0; x<oddwidth; x++) { DWORD srcval; srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=((srcval << 8) & 0xffffff00); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1098,7 +1098,7 @@ static void convert_rgb888_to_any0888_dst_byteswap(int width, int height, dstpixel++; srcpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1127,7 +1127,7 @@ static void convert_bgr888_to_any0888_dst_byteswap(int width, int height, dstpixel++; srcpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1144,13 +1144,13 @@ static void convert_0888_asis_dst_byteswap(int width, int height, for (y=0; y<height; y++) { for(x = 0; x < width; x++) { - DWORD srcval = *((DWORD*)srcbits + x); + DWORD srcval = *((const DWORD*)srcbits + x); *((DWORD*)dstbits + x) = ((srcval << 24) & 0xff000000) | ((srcval << 8) & 0x00ff0000) | ((srcval >> 8) & 0x0000ff00) | ((srcval >> 24) & 0x000000ff); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1172,7 +1172,7 @@ static void convert_0888_reverse_dst_byteswap(int width, int height, srcval=*srcpixel++; *dstpixel++=((srcval << 8) & 0xffffff00); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1207,7 +1207,7 @@ static void convert_0888_any_dst_byteswap(int width, int height, FLIP_DWORD(dstpixel); dstpixel++; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1232,7 +1232,7 @@ static void convert_0888_to_555_asis_dst_byteswap(int width, int height, ((srcval << 5) & 0x1f00); /* l */ dstpixel++; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1257,7 +1257,7 @@ static void convert_0888_to_555_reverse_dst_byteswap(int width, int height, ((srcval >> 1) & 0x7c00); /* l */ dstpixel++; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1281,7 +1281,7 @@ static void convert_0888_to_565_asis_dst_byteswap(int width, int height, ((srcval << 3) & 0xe000) | /* g - 3 bits */ ((srcval << 5) & 0x1f00); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1305,7 +1305,7 @@ static void convert_0888_to_565_reverse_dst_byteswap(int width, int height, ((srcval << 3) & 0xe000) | /* g - 3 bits */ ((srcval << 0) & 0x00f8); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1357,7 +1357,7 @@ static void convert_any0888_to_5x5_dst_byteswap(int width, int height, FLIP_WORD(dstpixel); dstpixel++; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1399,7 +1399,7 @@ static void convert_0888_to_888_asis_dst_byteswap(int width, int height, /* And now up to 3 odd pixels */ if(width&3) { BYTE *dstbyte = (BYTE*)dstpixel; - const BYTE *srcbyte = (BYTE*)srcpixel; + const BYTE *srcbyte = (const BYTE*)srcpixel; for(x = 0; x < (width&3); x++) { dstbyte[0] = srcbyte[0]; dstbyte[1] = srcbyte[1]; @@ -1411,7 +1411,7 @@ static void convert_0888_to_888_asis_dst_byteswap(int width, int height, } FLIP_DWORD(dstpixel + x - 1); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1447,7 +1447,7 @@ static void convert_0888_to_888_reverse_dst_byteswap(int width, int height, /* And now up to 3 odd pixels */ if(width&3) { BYTE *dstbyte = (BYTE*)dstpixel; - const BYTE *srcbyte = (BYTE*)srcpixel; + const BYTE *srcbyte = (const BYTE*)srcpixel; for(x = 0; x < (width&3); x++) { dstbyte[2] = srcbyte[0]; dstbyte[1] = srcbyte[1]; @@ -1459,7 +1459,7 @@ static void convert_0888_to_888_reverse_dst_byteswap(int width, int height, } FLIP_DWORD(dstpixel + x - 1); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1493,7 +1493,7 @@ static void convert_any0888_to_rgb888_dst_byteswap(int width, int height, if(x&3) FLIP_DWORD((DWORD*)(dstpixel + x - 4)); - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1526,7 +1526,7 @@ static void convert_any0888_to_bgr888_dst_byteswap(int width, int height, } if(x&3) FLIP_DWORD((DWORD*)(dstpixel + x - 4)); - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } diff --git a/dlls/x11drv/dib_src_swap.c b/dlls/x11drv/dib_src_swap.c index 9bfaf265710..a81ae1d222e 100644 --- a/dlls/x11drv/dib_src_swap.c +++ b/dlls/x11drv/dib_src_swap.c @@ -66,11 +66,11 @@ static void convert_5x5_asis_src_byteswap(int width, int height, } if(width&1) { /* And the odd pixel */ - WORD srcval = *(WORD*)srcpixel; + WORD srcval = *(const WORD*)srcpixel; *(WORD*)dstpixel = ((srcval << 8) & 0xff00) | ((srcval >> 8) & 0x00ff); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -98,13 +98,13 @@ static void convert_555_reverse_src_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x001f) | /* h */ ((srcval << 8) & 0x0300) | /* g - 2 bits */ ((srcval >> 8) & 0x00e0) | /* g - 3 bits */ ((srcval << 2) & 0x7c00); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -132,13 +132,13 @@ static void convert_555_to_565_asis_src_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 9) & 0xfe00) | /* h, g - 2bits*/ ((srcval >> 7) & 0x01c0) | /* g - 3 bits */ ((srcval << 4) & 0x0020) | /* g - 1 bit */ ((srcval >> 8) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -167,14 +167,14 @@ static void convert_555_to_565_reverse_src_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x001f) | /* h */ ((srcval << 9) & 0x0600) | /* g - 2 bits */ ((srcval >> 7) & 0x01c0) | /* g - 3 bits */ ((srcval << 4) & 0x0020) | /* g - 1 bit */ ((srcval << 3) & 0xf800); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -203,7 +203,7 @@ static void convert_555_to_888_asis_src_byteswap(int width, int height, ((srcval >> 4) & 0x07); /* h - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -232,7 +232,7 @@ static void convert_555_to_888_reverse_src_byteswap(int width, int height, ((srcval >> 10) & 0x07); /* l - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -260,7 +260,7 @@ static void convert_555_to_0888_asis_src_byteswap(int width, int height, ((srcval >> 5) & 0x0000f8) | /* l */ ((srcval >> 10) & 0x000007); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -288,7 +288,7 @@ static void convert_555_to_0888_reverse_src_byteswap(int width, int height, ((srcval << 11) & 0xf80000) | /* l */ ((srcval << 6) & 0x070000); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -351,7 +351,7 @@ static void convert_5x5_to_any0888_src_byteswap(int width, int height, (green << gLeftShift) | (blue << bLeftShift); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -383,13 +383,13 @@ static void convert_565_reverse_src_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 3) & 0xf800) | /* l */ ((srcval << 8) & 0x0700) | /* g - 3 bits */ ((srcval >> 8) & 0x00e0) | /* g - 3 bits */ ((srcval >> 3) & 0x001f); /* h */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -416,12 +416,12 @@ static void convert_565_to_555_asis_src_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 7) & 0x7f80) | /* h, g - 3 bits */ ((srcval >> 9) & 0x0060) | /* g - 2 bits */ ((srcval >> 8) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -449,13 +449,13 @@ static void convert_565_to_555_reverse_src_byteswap(int width, int height, if (width&1) { /* And the the odd pixel */ WORD srcval; - srcval=*((WORD*)srcpixel); + srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 3) & 0x001f) | /* h */ ((srcval >> 9) & 0x0060) | /* g - 2 bits */ ((srcval << 7) & 0x0380) | /* g - 3 bits */ ((srcval << 2) & 0x7c00); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -483,7 +483,7 @@ static void convert_565_to_888_asis_src_byteswap(int width, int height, ((srcval >> 5) & 0x07); /* h - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -511,7 +511,7 @@ static void convert_565_to_888_reverse_src_byteswap(int width, int height, ((srcval >> 10) & 0x07); /* l - 3 bits */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -538,7 +538,7 @@ static void convert_565_to_0888_asis_src_byteswap(int width, int height, ((srcval >> 5) & 0x0000f8) | /* l */ ((srcval >> 10) & 0x000007); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -565,7 +565,7 @@ static void convert_565_to_0888_reverse_src_byteswap(int width, int height, ((srcval << 11) & 0xf80000) | /* l */ ((srcval << 6) & 0x070000); /* l - 3 bits */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -582,13 +582,13 @@ static void convert_888_asis_src_byteswap(int width, int height, for (y=0; y<height; y++) { for(x = 0; x < ((width+1)*3/4); x++) { - DWORD srcval = *((DWORD*)srcbits + x); + DWORD srcval = *((const DWORD*)srcbits + x); *((DWORD*)dstbits + x) = ((srcval << 24) & 0xff000000) | ((srcval << 8) & 0x00ff0000) | ((srcval >> 8) & 0x0000ff00) | ((srcval >> 24) & 0x000000ff); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -636,7 +636,7 @@ static void convert_888_reverse_src_byteswap(int width, int height, } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -696,7 +696,7 @@ static void convert_888_to_555_asis_src_byteswap(int width, int height, srcbyte+=3; } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -755,7 +755,7 @@ static void convert_888_to_555_reverse_src_byteswap(int width, int height, srcbyte+=3; } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -814,7 +814,7 @@ static void convert_888_to_565_asis_src_byteswap(int width, int height, srcbyte+=3; } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -873,7 +873,7 @@ static void convert_888_to_565_reverse_src_byteswap(int width, int height, srcbyte+=3; } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -919,11 +919,11 @@ static void convert_888_to_0888_asis_src_byteswap(int width, int height, DWORD srcval; FLIP_DWORD(srcarray+x); srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=( srcval & 0x00ffffff); /* h, g, l */ } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -976,13 +976,13 @@ static void convert_888_to_0888_reverse_src_byteswap(int width, int height, DWORD srcval; FLIP_DWORD(srcarray+x); srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=((srcval >> 16) & 0x0000ff) | /* h */ ( srcval & 0x00ff00) | /* g */ ((srcval << 16) & 0xff0000); /* l */ } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1031,13 +1031,13 @@ static void convert_rgb888_to_any0888_src_byteswap(int width, int height, DWORD srcval; FLIP_DWORD(srcarray+x); srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=(((srcval >> 0) & 0xff) << bLeftShift) | /* b */ (((srcval >> 8) & 0xff) << gLeftShift) | /* g */ (((srcval >> 16) & 0xff) << rLeftShift); /* r */ } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1086,13 +1086,13 @@ static void convert_bgr888_to_any0888_src_byteswap(int width, int height, DWORD srcval; FLIP_DWORD(srcarray+x); srcval=*srcpixel; - srcpixel=(LPDWORD)(((char*)srcpixel)+3); + srcpixel=(const DWORD*)(((const char*)srcpixel)+3); *dstpixel++=(((srcval >> 0) & 0xff) << rLeftShift) | /* r */ (((srcval >> 8) & 0xff) << gLeftShift) | /* g */ (((srcval >> 16) & 0xff) << bLeftShift); /* b */ } } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1110,13 +1110,13 @@ static void convert_0888_asis_src_byteswap(int width, int height, for (y=0; y<height; y++) { for(x = 0; x < width; x++) { - DWORD srcval = *((DWORD*)srcbits + x); + DWORD srcval = *((const DWORD*)srcbits + x); *((DWORD*)dstbits + x) = ((srcval << 24) & 0xff000000) | ((srcval << 8) & 0x00ff0000) | ((srcval >> 8) & 0x0000ff00) | ((srcval >> 24) & 0x000000ff); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1137,7 +1137,7 @@ static void convert_0888_reverse_src_byteswap(int width, int height, srcval=*srcpixel++; *dstpixel++=((srcval >> 8) & 0x00ffffff); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1171,7 +1171,7 @@ static void convert_0888_any_src_byteswap(int width, int height, (((srcval >> gRightShift) & 0xff) << gLeftShift) | (((srcval >> bRightShift) & 0xff) << bLeftShift); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1194,7 +1194,7 @@ static void convert_0888_to_555_asis_src_byteswap(int width, int height, ((srcval >> 14) & 0x03e0) | /* g */ ((srcval >> 27) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1217,7 +1217,7 @@ static void convert_0888_to_555_reverse_src_byteswap(int width, int height, ((srcval >> 14) & 0x03e0) | /* g */ ((srcval >> 17) & 0x7c00); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1240,7 +1240,7 @@ static void convert_0888_to_565_asis_src_byteswap(int width, int height, ((srcval >> 13) & 0x07e0) | /* g */ ((srcval >> 27) & 0x001f); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1263,7 +1263,7 @@ static void convert_0888_to_565_reverse_src_byteswap(int width, int height, ((srcval >> 13) & 0x07e0) | /* g */ ((srcval >> 16) & 0xf800); /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1314,7 +1314,7 @@ static void convert_any0888_to_5x5_src_byteswap(int width, int height, (((srcval >> gRightShift) & gdst) << gLeftShift) | (((srcval >> bRightShift) & bdst) << bLeftShift); } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1364,7 +1364,7 @@ static void convert_0888_to_888_asis_src_byteswap(int width, int height, dstbyte+=sizeof(WORD); *dstbyte++=srcval >> 16; /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1410,7 +1410,7 @@ static void convert_0888_to_888_reverse_src_byteswap(int width, int height, dstbyte+=sizeof(WORD); *dstbyte++= srcval >> 24; /* l */ } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1440,7 +1440,7 @@ static void convert_any0888_to_rgb888_src_byteswap(int width, int height, dstpixel[2]=(srcval >> rRightShift); /* r */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } @@ -1470,7 +1470,7 @@ static void convert_any0888_to_bgr888_src_byteswap(int width, int height, dstpixel[2]=(srcval >> bRightShift); /* b */ dstpixel+=3; } - srcbits = (char*)srcbits + srclinebytes; + srcbits = (const char*)srcbits + srclinebytes; dstbits = (char*)dstbits + dstlinebytes; } } diff --git a/dlls/x11drv/init.c b/dlls/x11drv/init.c index d6722a21ac2..71a9a6a0d5a 100644 --- a/dlls/x11drv/init.c +++ b/dlls/x11drv/init.c @@ -280,7 +280,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID case QUERYESCSUPPORT: if (in_data) { - switch (*(INT *)in_data) + switch (*(const INT *)in_data) { case DCICOMMAND: return DD_HAL_VERSION; @@ -302,7 +302,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID case X11DRV_ESCAPE: if (in_data && in_count >= sizeof(enum x11drv_escape_codes)) { - switch(*(enum x11drv_escape_codes *)in_data) + switch(*(const enum x11drv_escape_codes *)in_data) { case X11DRV_GET_DISPLAY: if (out_count >= sizeof(Display *)) @@ -330,7 +330,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID case X11DRV_SET_DRAWABLE: if (in_count >= sizeof(struct x11drv_escape_set_drawable)) { - struct x11drv_escape_set_drawable *data = (struct x11drv_escape_set_drawable *)in_data; + const struct x11drv_escape_set_drawable *data = (const struct x11drv_escape_set_drawable *)in_data; if(physDev->xrender) X11DRV_XRender_UpdateDrawable( physDev ); physDev->org = data->org; physDev->drawable = data->drawable; diff --git a/dlls/x11drv/opengl.c b/dlls/x11drv/opengl.c index 53345a2877b..f62a3ea66fa 100644 --- a/dlls/x11drv/opengl.c +++ b/dlls/x11drv/opengl.c @@ -58,7 +58,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(opengl); #define APIENTRY WINAPI -static void dump_PIXELFORMATDESCRIPTOR(PIXELFORMATDESCRIPTOR *ppfd) { +static void dump_PIXELFORMATDESCRIPTOR(const PIXELFORMATDESCRIPTOR *ppfd) { DPRINTF(" - size / version : %d / %d\n", ppfd->nSize, ppfd->nVersion); DPRINTF(" - dwFlags : "); #define TEST_AND_DUMP(t,tv) if ((t) & (tv)) DPRINTF(#tv " ") @@ -172,7 +172,7 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev, if (TRACE_ON(opengl)) { TRACE("(%p,%p)\n", physDev, ppfd); - dump_PIXELFORMATDESCRIPTOR((PIXELFORMATDESCRIPTOR *) ppfd); + dump_PIXELFORMATDESCRIPTOR((const PIXELFORMATDESCRIPTOR *) ppfd); } if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) { diff --git a/dlls/x11drv/palette.c b/dlls/x11drv/palette.c index e87f188bee4..695b963c74b 100644 --- a/dlls/x11drv/palette.c +++ b/dlls/x11drv/palette.c @@ -484,7 +484,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template sysPixel[i] = color.pixel; TRACE("syscolor(%lx) -> pixel %i\n", - *(COLORREF*)(sys_pal_template+i), (int)color.pixel); + *(const COLORREF*)(sys_pal_template+i), (int)color.pixel); /* Set EGA mapping if color in the first or last eight */ @@ -1039,7 +1039,7 @@ static BOOL X11DRV_PALETTE_CheckSysColor( const PALETTEENTRY *sys_pal_template, { int i; for( i = 0; i < NB_RESERVED_COLORS; i++ ) - if( c == (*(COLORREF*)(sys_pal_template + i) & 0x00ffffff) ) + if( c == (*(const COLORREF*)(sys_pal_template + i) & 0x00ffffff) ) return 0; return 1; } diff --git a/dlls/x11drv/xfont.c b/dlls/x11drv/xfont.c index fd509796019..edc2ac713f0 100644 --- a/dlls/x11drv/xfont.c +++ b/dlls/x11drv/xfont.c @@ -1902,7 +1902,7 @@ static INT XFONT_IsSubset(const fontInfo* match, const fontInfo* fi) /* 0 - keep both, 1 - keep match, -1 - keep fi */ /* Compare dfItalic, Underline, Strikeout, Weight, Charset */ - m = (BYTE*)&fi->df.dfPixWidth - (BYTE*)&fi->df.dfItalic; + m = (const BYTE*)&fi->df.dfPixWidth - (const BYTE*)&fi->df.dfItalic; if( memcmp(&match->df.dfItalic, &fi->df.dfItalic, m )) return 0; if( (!((fi->fi_flags & FI_SCALABLE) + (match->fi_flags & FI_SCALABLE)) diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c index a7e141b9c0c..89bb1d8f7c1 100644 --- a/dlls/x11drv/xrender.c +++ b/dlls/x11drv/xrender.c @@ -975,14 +975,13 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag XGCValues xgcval; LOGFONTW lf; int render_op = PictOpOver; - WORD *glyphs; + const WORD *glyphs; POINT pt; gsCacheEntry *entry; BOOL retv = FALSE; HDC hdc = physDev->hdc; int textPixel, backgroundPixel; - INT *deltas = NULL; - INT char_extra; + INT *deltas = NULL, char_extra; HRGN saved_region = 0; UINT align = GetTextAlign( hdc ); @@ -990,10 +989,10 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag lprect, debugstr_wn(wstr, count), count, lpDx); if(flags & ETO_GLYPH_INDEX) - glyphs = (LPWORD)wstr; + glyphs = (const WORD*)wstr; else { glyphs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR)); - GetGlyphIndicesW(hdc, wstr, count, glyphs, 0); + GetGlyphIndicesW(hdc, wstr, count, (WORD*)glyphs, 0); } if(lprect) @@ -1543,7 +1542,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag done: X11DRV_UnlockDIBSection( physDev, TRUE ); - if(glyphs != wstr) HeapFree(GetProcessHeap(), 0, glyphs); + if(glyphs != wstr) HeapFree(GetProcessHeap(), 0, (WORD*)glyphs); return retv; } diff --git a/include/wine/server.h b/include/wine/server.h index 8bda4031e1b..fefc6c221a3 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -67,7 +67,7 @@ inline static unsigned int wine_server_call_err( void *req_ptr ) /* get the size of the variable part of the returned reply */ inline static size_t wine_server_reply_size( const void *reply ) { - return ((struct reply_header *)reply)->reply_size; + return ((const struct reply_header *)reply)->reply_size; } /* add some data to be sent along with the request */ diff --git a/libs/unicode/cptable.c b/libs/unicode/cptable.c index cf94fafe499..d68386a7764 100644 --- a/libs/unicode/cptable.c +++ b/libs/unicode/cptable.c @@ -154,7 +154,7 @@ static const union cptable * const cptables[59] = static int cmp_codepage( const void *codepage, const void *entry ) { - return (unsigned int)codepage - (*(union cptable **)entry)->info.codepage; + return (unsigned int)codepage - (*(const union cptable **)entry)->info.codepage; } diff --git a/libs/unicode/wctomb.c b/libs/unicode/wctomb.c index 5f9874018ba..68be134e7ae 100644 --- a/libs/unicode/wctomb.c +++ b/libs/unicode/wctomb.c @@ -142,7 +142,7 @@ static inline int wcstombs_sbcs( const struct sbcs_table *table, ret = -1; } - if (dst <= (char *)src && dst + 16 > (char *)src) + if (dst <= (const char *)src && dst + 16 > (const char *)src) { /* overlapping buffers, do it char by char */ while (srclen--) diff --git a/programs/rpcss/epmap_server.c b/programs/rpcss/epmap_server.c index 2be05dbc869..5c4d4a79307 100644 --- a/programs/rpcss/epmap_server.c +++ b/programs/rpcss/epmap_server.c @@ -175,7 +175,7 @@ void RPCSS_RegisterRpcEndpoints(RPC_SYNTAX_IDENTIFIER iface, int object_count, { const char *data = vardata; const char *end = data + vardata_size; - UUID *objects = (UUID *)data; + const UUID *objects = (const UUID *)data; int c; data += object_count * sizeof(UUID); @@ -192,7 +192,7 @@ void RPCSS_UnregisterRpcEndpoints(RPC_SYNTAX_IDENTIFIER iface, int object_count, { const char *data = vardata; const char *end = data + vardata_size; - const UUID *objects = (UUID *)data; + const UUID *objects = (const UUID *)data; int c; data += object_count * sizeof(UUID); diff --git a/programs/taskmgr/dbgchnl.c b/programs/taskmgr/dbgchnl.c index aa44859043d..aebbb0ed56c 100644 --- a/programs/taskmgr/dbgchnl.c +++ b/programs/taskmgr/dbgchnl.c @@ -219,7 +219,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user, unsigned { for (i = 0; i < dol.nb_channels; i++) { - if (ReadProcessMemory(hProcess, (void*)(dol.channels + i), &buf_addr, sizeof(buf_addr), NULL) && + if (ReadProcessMemory(hProcess, (void const *)(dol.channels + i), &buf_addr, sizeof(buf_addr), NULL) && ReadProcessMemory(hProcess, buf_addr, buffer, sizeof(buffer), NULL)) { if (unique) diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c index eb4dc476273..2898df0aa6d 100644 --- a/programs/uninstaller/main.c +++ b/programs/uninstaller/main.c @@ -200,7 +200,7 @@ int main( int argc, char *argv[]) int cmp_by_name(const void *a, const void *b) { - return lstrcmpiW(((uninst_entry *)a)->descr, ((uninst_entry *)b)->descr); + return lstrcmpiW(((const uninst_entry *)a)->descr, ((const uninst_entry *)b)->descr); } int FetchUninstallInformation(void) diff --git a/programs/winefile/winefile.c b/programs/winefile/winefile.c index 07082d8062f..decffc21f72 100644 --- a/programs/winefile/winefile.c +++ b/programs/winefile/winefile.c @@ -1065,8 +1065,8 @@ static int compareType(const WIN32_FIND_DATA* fd1, const WIN32_FIND_DATA* fd2) static int compareName(const void* arg1, const void* arg2) { - const WIN32_FIND_DATA* fd1 = &(*(Entry**)arg1)->data; - const WIN32_FIND_DATA* fd2 = &(*(Entry**)arg2)->data; + const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; int cmp = compareType(fd1, fd2); if (cmp) @@ -1077,8 +1077,8 @@ static int compareName(const void* arg1, const void* arg2) static int compareExt(const void* arg1, const void* arg2) { - const WIN32_FIND_DATA* fd1 = &(*(Entry**)arg1)->data; - const WIN32_FIND_DATA* fd2 = &(*(Entry**)arg2)->data; + const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; const TCHAR *name1, *name2, *ext1, *ext2; int cmp = compareType(fd1, fd2); @@ -1110,8 +1110,8 @@ static int compareExt(const void* arg1, const void* arg2) static int compareSize(const void* arg1, const void* arg2) { - WIN32_FIND_DATA* fd1 = &(*(Entry**)arg1)->data; - WIN32_FIND_DATA* fd2 = &(*(Entry**)arg2)->data; + const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; int cmp = compareType(fd1, fd2); if (cmp) @@ -1131,8 +1131,8 @@ static int compareSize(const void* arg1, const void* arg2) static int compareDate(const void* arg1, const void* arg2) { - WIN32_FIND_DATA* fd1 = &(*(Entry**)arg1)->data; - WIN32_FIND_DATA* fd2 = &(*(Entry**)arg2)->data; + const WIN32_FIND_DATA* fd1 = &(*(const Entry* const*)arg1)->data; + const WIN32_FIND_DATA* fd2 = &(*(const Entry* const*)arg2)->data; int cmp = compareType(fd1, fd2); if (cmp) diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 7c627e355f2..2447a722251 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -131,8 +131,8 @@ static BOOL SaveIconResAsXPM(const BITMAPINFO *pIcon, const char *szXPMFileName, int nANDWidthBytes; BOOL b8BitColors; int nColors; - BYTE *pXOR; - BYTE *pAND; + const BYTE *pXOR; + const BYTE *pAND; BOOL aColorUsed[256] = {0}; int nColorsUsed = 0; int i,j; @@ -151,7 +151,7 @@ static BOOL SaveIconResAsXPM(const BITMAPINFO *pIcon, const char *szXPMFileName, b8BitColors = pIcon->bmiHeader.biBitCount == 8; nColors = pIcon->bmiHeader.biClrUsed ? pIcon->bmiHeader.biClrUsed : 1 << pIcon->bmiHeader.biBitCount; - pXOR = (BYTE*) pIcon + sizeof (BITMAPINFOHEADER) + (nColors * sizeof (RGBQUAD)); + pXOR = (const BYTE*) pIcon + sizeof (BITMAPINFOHEADER) + (nColors * sizeof (RGBQUAD)); pAND = pXOR + nHeight * nXORWidthBytes; #define MASK(x,y) (pAND[(x) / 8 + (nHeight - (y) - 1) * nANDWidthBytes] & (1 << (7 - (x) % 8))) diff --git a/server/debugger.c b/server/debugger.c index e7c1b9a0e02..b509f4fcd51 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -641,7 +641,7 @@ DECL_HANDLER(queue_exception_event) struct debug_event_exception data; struct debug_event *event; const CONTEXT *context = get_req_data(); - EXCEPTION_RECORD *rec = (EXCEPTION_RECORD *)(context + 1); + const EXCEPTION_RECORD *rec = (const EXCEPTION_RECORD *)(context + 1); if (get_req_data_size() < sizeof(*rec) + sizeof(*context)) { diff --git a/server/registry.c b/server/registry.c index 02bf2c78733..0c133b201f8 100644 --- a/server/registry.c +++ b/server/registry.c @@ -1709,7 +1709,7 @@ DECL_HANDLER(create_key) } else { - const WCHAR *class_ptr = (WCHAR *)((char *)get_req_data() + req->namelen); + const WCHAR *class_ptr = (const WCHAR *)((const char *)get_req_data() + req->namelen); if ((class = req_strdupW( req, class_ptr, get_req_data_size() - req->namelen ))) { @@ -1792,7 +1792,7 @@ DECL_HANDLER(set_key_value) if ((key = get_hkey_obj( req->hkey, KEY_SET_VALUE ))) { size_t datalen = get_req_data_size() - req->namelen; - const char *data = (char *)get_req_data() + req->namelen; + const char *data = (const char *)get_req_data() + req->namelen; set_value( key, name, req->type, data, datalen ); release_object( key ); -- GitLab