From 93ab695a5cde93c84b13084a7e15a15a40ab4263 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Fri, 26 Aug 2005 08:53:31 +0000 Subject: [PATCH] Fix gcc 4.0 warnings. --- dlls/oleaut32/varformat.c | 2 +- dlls/rsaenh/rsaenh.c | 18 +++++++++++++----- dlls/wined3d/swapchain.c | 4 ++-- dlls/wined3d/wined3d_private.h | 4 ++-- dlls/winedos/dosaspi.c | 2 +- dlls/winedos/dosmem.c | 5 +++-- dlls/winedos/module.c | 9 +++++---- dlls/wineps/driver.c | 2 +- dlls/wineps/init.c | 10 +++++----- dlls/wineps/ps.c | 4 ++-- dlls/wineps/type42.c | 2 +- dlls/winsock/tests/sock.c | 3 ++- programs/winetest/send.c | 2 +- 13 files changed, 39 insertions(+), 28 deletions(-) diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c index 9e4db05f4e7..5c04dc59de2 100644 --- a/dlls/oleaut32/varformat.c +++ b/dlls/oleaut32/varformat.c @@ -1342,7 +1342,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat, case FMT_GEN_INLINE: pToken += 2; - TRACE("copy %s\n", debugstr_a(pToken)); + TRACE("copy %s\n", debugstr_a((LPCSTR)pToken)); while (*pToken) *pBuff++ = *pToken++; break; diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index e378598c100..ce3fda89354 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -1004,7 +1004,7 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, PVTabl /* The new key container has to be inserted into the CSP immediately * after creation to be available for CPGetProvParam's PP_ENUMCONTAINERS. */ if (!(dwFlags & CRYPT_VERIFYCONTEXT)) { - BYTE szRSABase[MAX_PATH]; + CHAR szRSABase[MAX_PATH]; HKEY hRootKey, hKey; sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); @@ -1589,11 +1589,19 @@ BOOL WINAPI RSAENH_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, init_data_blob(&pCryptHash->tpPRFParams.blobSeed); if (Algid == CALG_SCHANNEL_MASTER_HASH) { - CRYPT_DATA_BLOB blobRandom, blobKeyExpansion = { 13, "key expansion" }; + static const char keyex[] = "key expansion"; + BYTE key_expansion[sizeof keyex]; + CRYPT_DATA_BLOB blobRandom, blobKeyExpansion = { 13, key_expansion }; + + memcpy( key_expansion, keyex, sizeof keyex ); if (pCryptKey->dwState != RSAENH_KEYSTATE_MASTERKEY) { - CRYPT_DATA_BLOB blobLabel = { 13, "master secret" }; + static const char msec[] = "master secret"; + BYTE master_secret[sizeof msec]; + CRYPT_DATA_BLOB blobLabel = { 13, master_secret }; BYTE abKeyValue[48]; + + memcpy( master_secret, msec, sizeof msec ); /* See RFC 2246, chapter 8.1 */ if (!concat_data_blobs(&blobRandom, @@ -2781,7 +2789,7 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, KEYCONTAINER *pKeyContainer; PROV_ENUMALGS provEnumalgs; DWORD dwTemp; - BYTE szRSABase[MAX_PATH]; + CHAR szRSABase[MAX_PATH]; HKEY hKey, hRootKey; /* This is for dwParam 41, which does not seem to be documented @@ -2866,7 +2874,7 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, } dwTemp = *pdwDataLen; - switch (RegEnumKeyExA(hKey, pKeyContainer->dwEnumContainersCtr, pbData, &dwTemp, + switch (RegEnumKeyExA(hKey, pKeyContainer->dwEnumContainersCtr, (LPSTR)pbData, &dwTemp, NULL, NULL, NULL, NULL)) { case ERROR_MORE_DATA: diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 9009a1a49b9..e3e8aa5782c 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -325,8 +325,8 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST REC HRESULT WINAPI IWineD3DSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *pDestSurface) { IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; WINED3DFORMAT d3dformat; - int width; - int height; + UINT width; + UINT height; WINED3DSURFACE_DESC desc; glDescriptor *glDescription; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8325c1129d1..d7ba6c3ace7 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -892,7 +892,7 @@ struct IWineD3DStateBlockImpl /* Vertex Shader Constants */ BOOL vertexShaderConstantB[MAX_VSHADER_CONSTANTS]; - UINT vertexShaderConstantI[MAX_VSHADER_CONSTANTS * 4]; + INT vertexShaderConstantI[MAX_VSHADER_CONSTANTS * 4]; float vertexShaderConstantF[MAX_VSHADER_CONSTANTS * 4]; BOOL softwareVertexProcessing; @@ -1133,7 +1133,7 @@ typedef struct IWineD3DVertexShaderImpl { /* FIXME: This needs to be populated with some flags of VS_CONSTANT_NOT_USED, VS_CONSTANT_CONSTANT, VS_CONSTANT_INTEGER, VS_CONSTANT_BOOLEAN, VS_CONSTANT_FLOAT, a half byte bitmap will be the best option, but I'll keep it as chards for siplicity */ /* run time datas... */ VSHADERDATA* data; - GLint prgId; + GLuint prgId; #if 0 /* needs reworking */ /* run time datas */ VSHADERINPUTDATA input; diff --git a/dlls/winedos/dosaspi.c b/dlls/winedos/dosaspi.c index 3e0d738af67..2ed0b49eee0 100644 --- a/dlls/winedos/dosaspi.c +++ b/dlls/winedos/dosaspi.c @@ -214,7 +214,7 @@ void WINAPI DOSVM_ASPIHandler( CONTEXT86 *context ) /* Get SendASPI32Command by Ordinal 2 */ /* Cast to correct argument/return types */ - pSendASPI32Command = (DWORD (*)(LPSRB))GetProcAddress(hWNASPI32, (LPBYTE)2); + pSendASPI32Command = (DWORD (*)(LPSRB))GetProcAddress(hWNASPI32, (LPCSTR)2); if( !pSendASPI32Command ) { ERR("Error getting ordinal 2 from WNASPI32\n"); diff --git a/dlls/winedos/dosmem.c b/dlls/winedos/dosmem.c index 5d7f25f33ed..fb5948d25db 100644 --- a/dlls/winedos/dosmem.c +++ b/dlls/winedos/dosmem.c @@ -166,9 +166,10 @@ static DWORD DOSMEM_GetTicksSinceMidnight(void) */ static void DOSMEM_FillBiosSegments(void) { - char *pBiosSys = DOSMEM_dosmem + 0xf0000; + BYTE *pBiosSys = (BYTE*)DOSMEM_dosmem + 0xf0000; BYTE *pBiosROMTable = pBiosSys+0xe6f5; BIOSDATA *pBiosData = DOSVM_BiosData(); + static const char bios_date[] = "13/01/99"; /* Clear all unused values */ memset( pBiosData, 0, sizeof(*pBiosData) ); @@ -212,7 +213,7 @@ static void DOSMEM_FillBiosSegments(void) *(pBiosROMTable+0x9) = 0x00; /* feature byte 5 */ /* BIOS date string */ - strcpy(pBiosSys+0xfff5, "13/01/99"); + memcpy(pBiosSys+0xfff5, bios_date, sizeof bios_date); /* BIOS ID */ *(pBiosSys+0xfffe) = 0xfc; diff --git a/dlls/winedos/module.c b/dlls/winedos/module.c index 1bbc1c28d6d..c903cda8760 100644 --- a/dlls/winedos/module.c +++ b/dlls/winedos/module.c @@ -205,7 +205,8 @@ static BOOL MZ_DoLoadImage( HANDLE hFile, LPCSTR filename, OverlayBlock *oblk, W { IMAGE_DOS_HEADER mz_header; DWORD image_start,image_size,min_size,max_size,avail; - BYTE*psp_start,*load_start,*oldenv = 0; + BYTE*psp_start,*load_start; + LPSTR oldenv = 0; int x, old_com=0, alloc; SEGPTR reloc; WORD env_seg, load_seg, rel_seg, oldpsp_seg; @@ -218,7 +219,7 @@ static BOOL MZ_DoLoadImage( HANDLE hFile, LPCSTR filename, OverlayBlock *oblk, W oldpsp_seg = DOSVM_psp; if( !par_env_seg) { par_psp = (PDB16*)((DWORD)DOSVM_psp << 4); - oldenv = (LPBYTE)((DWORD)par_psp->environment << 4); + oldenv = (LPSTR)((DWORD)par_psp->environment << 4); } } else { /* allocate new DOS process, inheriting from Wine environment */ @@ -454,7 +455,7 @@ BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID para { if(func == 0) /* load and execute */ { - LPBYTE fullCmdLine; + LPSTR fullCmdLine; WORD fullCmdLength; LPBYTE psp_start = (LPBYTE)((DWORD)DOSVM_psp << 4); PDB16 *psp = (PDB16 *)psp_start; @@ -532,7 +533,7 @@ BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID para LPBYTE cmdline = PTR_REAL_TO_LIN(SELECTOROF(blk->cmdline),OFFSETOF(blk->cmdline)); /* First character contains the length of the command line. */ - MZ_FillPSP(psp_start, cmdline + 1, cmdline[0]); + MZ_FillPSP(psp_start, (LPSTR)cmdline + 1, cmdline[0]); /* the lame MS-DOS engineers decided that the return address should be in int22 */ DOSVM_SetRMHandler(0x22, (FARPROC16)MAKESEGPTR(context->SegCs, LOWORD(context->Eip))); diff --git a/dlls/wineps/driver.c b/dlls/wineps/driver.c index 7ce751fa6c9..48f722fcf9d 100644 --- a/dlls/wineps/driver.c +++ b/dlls/wineps/driver.c @@ -145,7 +145,7 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2, if (dm2->dmPublic.dmFields & DM_COLLATE ) dm1->dmPublic.dmCollate = dm2->dmPublic.dmCollate; if (dm2->dmPublic.dmFields & DM_FORMNAME ) - lstrcpynA(dm1->dmPublic.dmFormName, dm2->dmPublic.dmFormName, CCHFORMNAME); + lstrcpynA((LPSTR)dm1->dmPublic.dmFormName, (LPCSTR)dm2->dmPublic.dmFormName, CCHFORMNAME); if (dm2->dmPublic.dmFields & DM_BITSPERPEL ) dm1->dmPublic.dmBitsPerPel = dm2->dmPublic.dmBitsPerPel; if (dm2->dmPublic.dmFields & DM_PELSWIDTH ) diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c index 5fc51495f5a..f836baea181 100644 --- a/dlls/wineps/init.c +++ b/dlls/wineps/init.c @@ -272,7 +272,7 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) Formname = (dmW->dmSize > off_formname); size = dmW->dmSize - CCHDEVICENAME - (Formname ? CCHFORMNAME : 0); dmA = HeapAlloc(heap, HEAP_ZERO_MEMORY, size + dmW->dmDriverExtra); - WideCharToMultiByte(CP_ACP, 0, dmW->dmDeviceName, -1, dmA->dmDeviceName, + WideCharToMultiByte(CP_ACP, 0, dmW->dmDeviceName, -1, (LPSTR)dmA->dmDeviceName, CCHDEVICENAME, NULL, NULL); if(!Formname) { memcpy(&dmA->dmSpecVersion, &dmW->dmSpecVersion, @@ -280,7 +280,7 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) } else { memcpy(&dmA->dmSpecVersion, &dmW->dmSpecVersion, off_formname - CCHDEVICENAME * sizeof(WCHAR)); - WideCharToMultiByte(CP_ACP, 0, dmW->dmFormName, -1, dmA->dmFormName, + WideCharToMultiByte(CP_ACP, 0, dmW->dmFormName, -1, (LPSTR)dmA->dmFormName, CCHFORMNAME, NULL, NULL); memcpy(&dmA->dmLogPixels, &dmW->dmLogPixels, dmW->dmSize - (off_formname + CCHFORMNAME * sizeof(WCHAR))); @@ -308,7 +308,7 @@ BOOL PSDRV_CreateDC( HDC hdc, PSDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR devi if ( !device && *pdev ) { physDev = *pdev; - strcpy(deviceA, physDev->Devmode->dmPublic.dmDeviceName); + lstrcpynA(deviceA, (LPCSTR)physDev->Devmode->dmPublic.dmDeviceName, CCHDEVICENAME); } else WideCharToMultiByte(CP_ACP, 0, device, -1, deviceA, sizeof(deviceA), NULL, NULL); @@ -549,7 +549,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) if (pi->Devmode == NULL) goto cleanup; memcpy(pi->Devmode, &DefaultDevmode, sizeof(DefaultDevmode) ); - strcpy(pi->Devmode->dmPublic.dmDeviceName,name); + lstrcpynA((LPSTR)pi->Devmode->dmPublic.dmDeviceName,name,CCHDEVICENAME); using_default_devmode = TRUE; /* need to do something here AddPrinter?? */ @@ -591,7 +591,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) res = GetPrinterDataA(hPrinter, "PPD File", NULL, NULL, 0, &needed); if ((res==ERROR_SUCCESS) || (res==ERROR_MORE_DATA)) { ppdFileName=HeapAlloc(PSDRV_Heap, 0, needed); - res = GetPrinterDataA(hPrinter, "PPD File", &ppdType, ppdFileName, needed, &needed); + res = GetPrinterDataA(hPrinter, "PPD File", &ppdType, (LPBYTE)ppdFileName, needed, &needed); } } /* Look for a ppd file for this printer in the config file. diff --git a/dlls/wineps/ps.c b/dlls/wineps/ps.c index bece323b887..b1c01937a90 100644 --- a/dlls/wineps/ps.c +++ b/dlls/wineps/ps.c @@ -745,7 +745,7 @@ BOOL PSDRV_WriteData(PSDRV_PDEVICE *physDev, const BYTE *data, DWORD number) do { num = min(num_left, 60); - PSDRV_WriteSpool(physDev, data, num); + PSDRV_WriteSpool(physDev, (LPCSTR)data, num); PSDRV_WriteSpool(physDev, "\n", 1); data += num; num_left -= num; @@ -852,7 +852,7 @@ BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usa return FALSE; } - bits = (char*)bmi + bmi->bmiHeader.biSize; + bits = (LPBYTE)bmi + bmi->bmiHeader.biSize; colours = bmi->bmiHeader.biClrUsed; if (colours > 256) colours = 256; if(!colours && bmi->bmiHeader.biBitCount <= 8) diff --git a/dlls/wineps/type42.c b/dlls/wineps/type42.c index a92b3e6f4d9..22b69541ff1 100644 --- a/dlls/wineps/type42.c +++ b/dlls/wineps/type42.c @@ -324,7 +324,7 @@ BOOL T42_download_glyph(PSDRV_PDEVICE *physDev, DOWNLOAD *pdl, DWORD index, if(GET_BE_WORD(t42->tables[t42->glyf_tab].data + start) == 0xffff) { /* Composite glyph */ - char *sg_start = t42->tables[t42->glyf_tab].data + start + 10; + BYTE *sg_start = t42->tables[t42->glyf_tab].data + start + 10; DWORD sg_flags, sg_index; char sg_name[MAX_G_NAME + 1]; diff --git a/dlls/winsock/tests/sock.c b/dlls/winsock/tests/sock.c index e23dff17cf8..671c8d4f0fa 100644 --- a/dlls/winsock/tests/sock.c +++ b/dlls/winsock/tests/sock.c @@ -830,7 +830,8 @@ static void test_so_reuseaddr(void) { struct sockaddr_in saddr; SOCKET s1,s2; - unsigned int rc,reuse,size; + unsigned int rc,reuse; + int size; saddr.sin_family = AF_INET; saddr.sin_port = htons(9375); diff --git a/programs/winetest/send.c b/programs/winetest/send.c index 2e6e11c8a10..0306754a813 100644 --- a/programs/winetest/send.c +++ b/programs/winetest/send.c @@ -107,7 +107,7 @@ send_file (const char *name) SOCKET s; FILE *f; #define BUFLEN 8192 - unsigned char buffer[BUFLEN+1]; + char buffer[BUFLEN+1]; size_t bytes_read, total, filesize; char *str; int ret;