From d168219849af9b84801d5fa90d43415e2c2e06f0 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 6 Sep 2005 10:26:13 +0000 Subject: [PATCH] Fix gcc 4.0 warnings. --- dlls/crypt32/encode.c | 2 +- dlls/crypt32/tests/encode.c | 67 +++++++++++++++++++++++-------------- dlls/rpcrt4/ndr_ole.c | 2 +- dlls/rpcrt4/rpc_binding.c | 62 +++++++++++++++++----------------- dlls/rpcrt4/tests/rpc.c | 12 +++---- dlls/uxtheme/system.c | 2 +- programs/winhelp/hlpfile.c | 55 ++++++++++++++++-------------- 7 files changed, 110 insertions(+), 92 deletions(-) diff --git a/dlls/crypt32/encode.c b/dlls/crypt32/encode.c index 29a0a15312..dc4f757dcc 100644 --- a/dlls/crypt32/encode.c +++ b/dlls/crypt32/encode.c @@ -3292,7 +3292,7 @@ static BOOL WINAPI CRYPT_AsnDecodeExtensionsInternal(DWORD dwCertEncodingType, i < cExtension && ptr - pbEncoded - 1 - lenBytes < dataLen; i++) { - exts->rgExtension[i].pszObjId = nextData; + exts->rgExtension[i].pszObjId = (LPSTR)nextData; size = bytesNeeded; ret = CRYPT_AsnDecodeExtension(ptr, cbEncoded - (ptr - pbEncoded), dwFlags, diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index c9d37ba8aa..9498cccfc3 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -32,14 +32,22 @@ struct encodedInt const BYTE *encoded; }; +static const BYTE bin1[] = {0x02,0x01,0x01,0}; +static const BYTE bin2[] = {0x02,0x01,0x7f,0}; +static const BYTE bin3[] = {0x02,0x02,0x00,0x80,0}; +static const BYTE bin4[] = {0x02,0x02,0x01,0x00,0}; +static const BYTE bin5[] = {0x02,0x01,0x80,0}; +static const BYTE bin6[] = {0x02,0x02,0xff,0x7f,0}; +static const BYTE bin7[] = {0x02,0x04,0xba,0xdd,0xf0,0x0d,0}; + static const struct encodedInt ints[] = { - { 1, "\x02\x01\x01" }, - { 127, "\x02\x01\x7f" }, - { 128, "\x02\x02\x00\x80" }, - { 256, "\x02\x02\x01\x00" }, - { -128, "\x02\x01\x80" }, - { -129, "\x02\x02\xff\x7f" }, - { 0xbaddf00d, "\x02\x04\xba\xdd\xf0\x0d" }, + { 1, bin1 }, + { 127, bin2 }, + { 128, bin3 }, + { 256, bin4 }, + { -128, bin5 }, + { -129, bin6 }, + { 0xbaddf00d, bin7 }, }; struct encodedBigInt @@ -49,21 +57,28 @@ struct encodedBigInt const BYTE *decoded; }; +static const BYTE bin8[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}; +static const BYTE bin9[] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}; +static const BYTE bin10[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}; + +static const BYTE bin11[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}; +static const BYTE bin12[] = {0x02,0x09,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}; +static const BYTE bin13[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0}; + static const struct encodedBigInt bigInts[] = { - { "\xff\xff\x01\x02\x03\x04\x05\x06\x07\x08", - "\x02\x0a\x08\x07\x06\x05\x04\x03\x02\x01\xff\xff", - "\xff\xff\x01\x02\x03\x04\x05\x06\x07\x08" }, - { "\x08\x07\x06\x05\x04\x03\x02\x01\xff\xff\xff", - "\x02\x09\xff\x01\x02\x03\x04\x05\x06\x07\x08", - "\x08\x07\x06\x05\x04\x03\x02\x01\xff" }, + { bin8, bin9, bin10 }, + { bin11, bin12, bin13 }, }; +static const BYTE bin14[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}; +static const BYTE bin15[] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}; +static const BYTE bin16[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}; +static const BYTE bin17[] = {0x02,0x0c,0x00,0xff,0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}; + /* Decoded is the same as original, so don't bother storing a separate copy */ static const struct encodedBigInt bigUInts[] = { - { "\xff\xff\x01\x02\x03\x04\x05\x06\x07\x08", - "\x02\x0a\x08\x07\x06\x05\x04\x03\x02\x01\xff\xff", NULL }, - { "\x08\x07\x06\x05\x04\x03\x02\x01\xff\xff\xff", - "\x02\x0c\x00\xff\xff\xff\x01\x02\x03\x04\x05\x06\x07\x08", NULL }, + { bin14, bin15, NULL }, + { bin16, bin17, NULL }, }; static void test_encodeInt(DWORD dwEncoding) @@ -134,7 +149,7 @@ static void test_encodeInt(DWORD dwEncoding) */ for (i = 0; i < sizeof(bigInts) / sizeof(bigInts[0]); i++) { - blob.cbData = strlen(bigInts[i].val); + blob.cbData = strlen((const char*)bigInts[i].val); blob.pbData = (BYTE *)bigInts[i].val; ret = CryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, &blob, 0, NULL, NULL, &bufSize); @@ -157,8 +172,8 @@ static void test_encodeInt(DWORD dwEncoding) /* and, encode some uints */ for (i = 0; i < sizeof(bigUInts) / sizeof(bigUInts[0]); i++) { - blob.cbData = strlen(bigUInts[i].val); - blob.pbData = (BYTE *)bigUInts[i].val; + blob.cbData = strlen((const char*)bigUInts[i].val); + blob.pbData = (BYTE*)bigUInts[i].val; ret = CryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_UINT, &blob, 0, NULL, NULL, &bufSize); ok(ret, "Expected success, got %ld\n", GetLastError()); @@ -181,8 +196,8 @@ static void test_encodeInt(DWORD dwEncoding) static void test_decodeInt(DWORD dwEncoding) { - static const char bigInt[] = { 2, 5, 0xff, 0xfe, 0xff, 0xfe, 0xff }; - static const char testStr[] = { 0x16, 4, 't', 'e', 's', 't' }; + static const BYTE bigInt[] = { 2, 5, 0xff, 0xfe, 0xff, 0xfe, 0xff }; + static const BYTE testStr[] = { 0x16, 4, 't', 'e', 's', 't' }; static const BYTE longForm[] = { 2, 0x81, 0x01, 0x01 }; static const BYTE bigBogus[] = { 0x02, 0x84, 0x01, 0xff, 0xff, 0xf9 }; BYTE *buf = NULL; @@ -256,8 +271,8 @@ static void test_decodeInt(DWORD dwEncoding) { CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)buf; - ok(blob->cbData == strlen(bigInts[i].decoded), - "Expected len %d, got %ld\n", strlen(bigInts[i].decoded), + ok(blob->cbData == strlen((const char*)bigInts[i].decoded), + "Expected len %d, got %ld\n", strlen((const char*)bigInts[i].decoded), blob->cbData); ok(!memcmp(blob->pbData, bigInts[i].decoded, blob->cbData), "Unexpected value\n"); @@ -283,8 +298,8 @@ static void test_decodeInt(DWORD dwEncoding) { CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)buf; - ok(blob->cbData == strlen(bigUInts[i].val), - "Expected len %d, got %ld\n", strlen(bigUInts[i].val), + ok(blob->cbData == strlen((const char*)bigUInts[i].val), + "Expected len %d, got %ld\n", strlen((const char*)bigUInts[i].val), blob->cbData); ok(!memcmp(blob->pbData, bigUInts[i].val, blob->cbData), "Unexpected value\n"); diff --git a/dlls/rpcrt4/ndr_ole.c b/dlls/rpcrt4/ndr_ole.c index 7a8cdb55b6..a92b7544f0 100644 --- a/dlls/rpcrt4/ndr_ole.c +++ b/dlls/rpcrt4/ndr_ole.c @@ -113,7 +113,7 @@ static ULONG WINAPI RpcStream_Release(LPSTREAM iface) RpcStreamImpl *This = (RpcStreamImpl *)iface; if (!--(This->RefCount)) { TRACE("size=%ld\n", *This->size); - This->pMsg->Buffer = This->data + *This->size; + This->pMsg->Buffer = (unsigned char*)This->data + *This->size; HeapFree(GetProcessHeap(),0,This); return 0; } diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index 131258d8af..a3b5fec69e 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -595,39 +595,39 @@ RPC_STATUS WINAPI RpcStringBindingComposeA(unsigned char *ObjUuid, unsigned char LPSTR data; TRACE( "(%s,%s,%s,%s,%s,%p)\n", - debugstr_a( ObjUuid ), debugstr_a( Protseq ), - debugstr_a( NetworkAddr ), debugstr_a( Endpoint ), - debugstr_a( Options ), StringBinding ); + debugstr_a( (char*)ObjUuid ), debugstr_a( (char*)Protseq ), + debugstr_a( (char*)NetworkAddr ), debugstr_a( (char*)Endpoint ), + debugstr_a( (char*)Options ), StringBinding ); - if (ObjUuid && *ObjUuid) len += strlen(ObjUuid) + 1; - if (Protseq && *Protseq) len += strlen(Protseq) + 1; - if (NetworkAddr && *NetworkAddr) len += strlen(NetworkAddr); - if (Endpoint && *Endpoint) len += strlen(Endpoint) + 2; - if (Options && *Options) len += strlen(Options) + 2; + if (ObjUuid && *ObjUuid) len += strlen((char*)ObjUuid) + 1; + if (Protseq && *Protseq) len += strlen((char*)Protseq) + 1; + if (NetworkAddr && *NetworkAddr) len += strlen((char*)NetworkAddr); + if (Endpoint && *Endpoint) len += strlen((char*)Endpoint) + 2; + if (Options && *Options) len += strlen((char*)Options) + 2; data = HeapAlloc(GetProcessHeap(), 0, len); - *StringBinding = data; + *StringBinding = (unsigned char*)data; if (ObjUuid && *ObjUuid) { - data += RPCRT4_strcopyA(data, ObjUuid); + data += RPCRT4_strcopyA(data, (char*)ObjUuid); *data++ = '@'; } if (Protseq && *Protseq) { - data += RPCRT4_strcopyA(data, Protseq); + data += RPCRT4_strcopyA(data, (char*)Protseq); *data++ = ':'; } if (NetworkAddr && *NetworkAddr) - data += RPCRT4_strcopyA(data, NetworkAddr); + data += RPCRT4_strcopyA(data, (char*)NetworkAddr); if ((Endpoint && *Endpoint) || (Options && *Options)) { *data++ = '['; if (Endpoint && *Endpoint) { - data += RPCRT4_strcopyA(data, Endpoint); + data += RPCRT4_strcopyA(data, (char*)Endpoint); if (Options && *Options) *data++ = ','; } if (Options && *Options) { - data += RPCRT4_strcopyA(data, Options); + data += RPCRT4_strcopyA(data, (char*)Options); } *data++ = ']'; } @@ -699,7 +699,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned CHAR *data, *next; static const char ep_opt[] = "endpoint="; - TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_a(StringBinding), + TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_a((char*)StringBinding), ObjUuid, Protseq, NetworkAddr, Endpoint, Options); if (ObjUuid) *ObjUuid = NULL; @@ -708,17 +708,17 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned if (Endpoint) *Endpoint = NULL; if (Options) *Options = NULL; - data = StringBinding; + data = (char*) StringBinding; next = strchr(data, '@'); if (next) { - if (ObjUuid) *ObjUuid = RPCRT4_strndupA(data, next - data); + if (ObjUuid) *ObjUuid = (unsigned char*)RPCRT4_strndupA(data, next - data); data = next+1; } next = strchr(data, ':'); if (next) { - if (Protseq) *Protseq = RPCRT4_strndupA(data, next - data); + if (Protseq) *Protseq = (unsigned char*)RPCRT4_strndupA(data, next - data); data = next+1; } @@ -726,7 +726,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned if (next) { CHAR *close, *opt; - if (NetworkAddr) *NetworkAddr = RPCRT4_strndupA(data, next - data); + if (NetworkAddr) *NetworkAddr = (unsigned char*)RPCRT4_strndupA(data, next - data); data = next+1; close = strchr(data, ']'); if (!close) goto fail; @@ -744,21 +744,21 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned if (!next) { /* not an option, must be an endpoint */ if (*Endpoint) goto fail; - *Endpoint = opt; + *Endpoint = (unsigned char*) opt; } else { if (strncmp(opt, ep_opt, strlen(ep_opt)) == 0) { /* endpoint option */ if (*Endpoint) goto fail; - *Endpoint = RPCRT4_strdupA(next+1); + *Endpoint = (unsigned char*) RPCRT4_strdupA(next+1); HeapFree(GetProcessHeap(), 0, opt); } else { /* network option */ if (*Options) { /* FIXME: this is kind of inefficient */ - *Options = RPCRT4_strconcatA(*Options, opt); + *Options = (unsigned char*) RPCRT4_strconcatA( (char*)*Options, opt); HeapFree(GetProcessHeap(), 0, opt); } else - *Options = opt; + *Options = (unsigned char*) opt; } } } @@ -767,7 +767,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned if (*data) goto fail; } else if (NetworkAddr) - *NetworkAddr = RPCRT4_strdupA(data); + *NetworkAddr = (unsigned char*)RPCRT4_strdupA(data); return RPC_S_OK; @@ -933,7 +933,7 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( unsigned char *StringBinding, RP unsigned char *ObjectUuid, *Protseq, *NetworkAddr, *Endpoint, *Options; UUID Uuid; - TRACE("(%s,%p)\n", debugstr_a(StringBinding), Binding); + TRACE("(%s,%p)\n", debugstr_a((char*)StringBinding), Binding); ret = RpcStringBindingParseA(StringBinding, &ObjectUuid, &Protseq, &NetworkAddr, &Endpoint, &Options); @@ -942,11 +942,11 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( unsigned char *StringBinding, RP ret = UuidFromStringA(ObjectUuid, &Uuid); if (ret == RPC_S_OK) - ret = RPCRT4_CreateBindingA(&bind, FALSE, Protseq); + ret = RPCRT4_CreateBindingA(&bind, FALSE, (char*)Protseq); if (ret == RPC_S_OK) ret = RPCRT4_SetBindingObject(bind, &Uuid); if (ret == RPC_S_OK) - ret = RPCRT4_CompleteBindingA(bind, NetworkAddr, Endpoint, Options); + ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint, (char*)Options); RpcStringFreeA((unsigned char**)&Options); RpcStringFreeA((unsigned char**)&Endpoint); @@ -1015,8 +1015,8 @@ RPC_STATUS WINAPI RpcBindingToStringBindingA( RPC_BINDING_HANDLE Binding, unsign ret = UuidToStringA(&bind->ObjectUuid, (unsigned char**)&ObjectUuid); if (ret != RPC_S_OK) return ret; - ret = RpcStringBindingComposeA(ObjectUuid, bind->Protseq, bind->NetworkAddr, - bind->Endpoint, NULL, StringBinding); + ret = RpcStringBindingComposeA((unsigned char*) ObjectUuid, (unsigned char*)bind->Protseq, (unsigned char*) bind->NetworkAddr, + (unsigned char*) bind->Endpoint, NULL, StringBinding); RpcStringFreeA((unsigned char**)&ObjectUuid); @@ -1032,7 +1032,7 @@ RPC_STATUS WINAPI RpcBindingToStringBindingW( RPC_BINDING_HANDLE Binding, unsign unsigned char *str = NULL; TRACE("(%p,%p)\n", Binding, StringBinding); ret = RpcBindingToStringBindingA(Binding, &str); - *StringBinding = RPCRT4_strdupAtoW(str); + *StringBinding = RPCRT4_strdupAtoW((char*)str); RpcStringFreeA((unsigned char**)&str); return ret; } @@ -1062,7 +1062,7 @@ RPC_STATUS WINAPI RpcNetworkIsProtseqValidA(unsigned char *protseq) { if (!protseq) return RPC_S_INVALID_RPC_PROTSEQ; /* ? */ - if (RtlCreateUnicodeStringFromAsciiz(&protseqW, protseq)) { + if (RtlCreateUnicodeStringFromAsciiz(&protseqW, (char*)protseq)) { RPC_STATUS ret = RpcNetworkIsProtseqValidW(protseqW.Buffer); RtlFreeUnicodeString(&protseqW); return ret; diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c index d74c4bc17c..ce534715a3 100644 --- a/dlls/rpcrt4/tests/rpc.c +++ b/dlls/rpcrt4/tests/rpc.c @@ -91,13 +91,13 @@ static void UuidConversionAndComparison(void) { for (i1 = 0; i1 < 10; i1++) { Uuid1 = Uuid_Table[i1]; ok( (UuidToStringA(&Uuid1, (unsigned char**)&str) == RPC_S_OK), "Simple UUID->String copy\n" ); - ok( (UuidFromStringA(str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String\n" ); + ok( (UuidFromStringA((unsigned char*)str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String\n" ); ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform\n" ); /* invalid uuid tests -- size of valid UUID string=36 */ for (i2 = 0; i2 < 36; i2++) { x = str[i2]; str[i2] = 'g'; /* whatever, but "g" is a good boundary condition */ - ok( (UuidFromStringA(str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String\n" ); + ok( (UuidFromStringA((unsigned char*)str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String\n" ); str[i2] = x; /* change it back so remaining tests are interesting. */ } } @@ -138,10 +138,10 @@ static void TestDceErrorInqText (void) /* A random sample of DceErrorInqText */ /* 0 is success */ - ok ((DceErrorInqTextA (0, buffer) == RPC_S_OK), + ok ((DceErrorInqTextA (0, (unsigned char*)buffer) == RPC_S_OK), "DceErrorInqTextA(0...)\n"); /* A real RPC_S error */ - ok ((DceErrorInqTextA (RPC_S_INVALID_STRING_UUID, buffer) == RPC_S_OK), + ok ((DceErrorInqTextA (RPC_S_INVALID_STRING_UUID, (unsigned char*)buffer) == RPC_S_OK), "DceErrorInqTextA(valid...)\n"); if (dwCount) @@ -150,14 +150,14 @@ static void TestDceErrorInqText (void) * which should return RPC_S_OK and the * fixed "not valid" message */ - ok ((DceErrorInqTextA (35, buffer) == RPC_S_OK && + ok ((DceErrorInqTextA (35, (unsigned char*)buffer) == RPC_S_OK && strcmp (buffer, bufferInvalid) == 0), "DceErrorInqTextA(unformattable...)\n"); /* One for which FormatMessage should succeed but * DceErrorInqText should "fail" * 3814 is generally quite a long message */ - ok ((DceErrorInqTextA (3814, buffer) == RPC_S_OK && + ok ((DceErrorInqTextA (3814, (unsigned char*)buffer) == RPC_S_OK && strcmp (buffer, bufferInvalid) == 0), "DceErrorInqTextA(deviation...)\n"); } diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c index 9c175b7886..974d85ec0e 100644 --- a/dlls/uxtheme/system.c +++ b/dlls/uxtheme/system.c @@ -342,7 +342,7 @@ static void UXTHEME_RestoreSystemMetrics(void) DWORD count = sizeof(colorStr); if (RegQueryValueExA (colorKey, SysColorsNames[i], 0, - &type, colorStr, &count) == ERROR_SUCCESS) + &type, (LPBYTE) colorStr, &count) == ERROR_SUCCESS) { int r, g, b; if (sscanf (colorStr, "%d %d %d", &r, &g, &b) == 3) diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c index fd7027dc01..e859c0ae90 100644 --- a/programs/winhelp/hlpfile.c +++ b/programs/winhelp/hlpfile.c @@ -373,7 +373,7 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned off if (hlpfile->hasPhrases) { - HLPFILE_Uncompress2(title, end, page->lpszTitle, page->lpszTitle + titlesize); + HLPFILE_Uncompress2(title, end, (BYTE*)page->lpszTitle, (BYTE*)page->lpszTitle + titlesize); } else { @@ -830,7 +830,8 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne HLPFILE_PAGE *page; HLPFILE_PARAGRAPH *paragraph, **paragraphptr; UINT textsize; - BYTE *format, *format_end, *text, *text_end; + BYTE *format, *format_end; + char *text, *text_end; long size; unsigned short bits; unsigned nc, ncol = 1; @@ -848,7 +849,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne if (!text) return FALSE; if (hlpfile->hasPhrases) { - HLPFILE_Uncompress2(buf + GET_UINT(buf, 0x10), end, text, text + size); + HLPFILE_Uncompress2(buf + GET_UINT(buf, 0x10), end, (BYTE*)text, (BYTE*)text + size); } else { @@ -859,7 +860,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne } else { - text = buf + GET_UINT(buf, 0x10); + text = (char*)buf + GET_UINT(buf, 0x10); } } text_end = text + size; @@ -1070,7 +1071,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne case 0xCC: WINE_TRACE("macro => %s\n", format + 3); HLPFILE_FreeLink(attributes.link); - attributes.link = HLPFILE_AllocLink(hlp_link_macro, format + 3, + attributes.link = HLPFILE_AllocLink(hlp_link_macro, (const char*)format + 3, 0, !(*format & 4), -1); format += 3 + GET_USHORT(format, 1); break; @@ -1098,7 +1099,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne case 0xEE: case 0xEF: { - char* ptr = format + 8; + char* ptr = (char*) format + 8; BYTE type = format[3]; int wnd = -1; char* str; @@ -1134,7 +1135,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne } } } - if (text_end != buf + GET_UINT(buf, 0x10) + size) + if (text_end != (char*)buf + GET_UINT(buf, 0x10) + size) HeapFree(GetProcessHeap(), 0, text_end - size); return TRUE; } @@ -1300,9 +1301,10 @@ static BOOL HLPFILE_FindSubFile(LPCSTR name, BYTE **subbuf, BYTE **subend) ptr += 6; for (i = 0; i < nentries; i++) { - WINE_TRACE("<= %s\n", ptr); - if (strcmp(name, ptr) < 0) break; - ptr += strlen(ptr) + 1; + char *str = (char*) ptr; + WINE_TRACE("<= %s\n", str); + if (strcmp(name, str) < 0) break; + ptr += strlen(str) + 1; pglast = GET_USHORT(ptr, 0); ptr += 2; } @@ -1313,7 +1315,7 @@ static BOOL HLPFILE_FindSubFile(LPCSTR name, BYTE **subbuf, BYTE **subend) ptr += 8; for (i = 0; i < nentries; i++) { - char* fname = ptr; + char* fname = (char*)ptr; ptr += strlen(fname) + 1; WINE_TRACE("\\- %s\n", fname); if (strcmp(fname, name) == 0) @@ -1365,21 +1367,22 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) for (ptr = buf + 0x15; ptr + 4 <= end; ptr += GET_USHORT(ptr, 2) + 4) { + char *str = (char*) ptr + 4; switch (GET_USHORT(ptr, 0)) { case 1: if (hlpfile->lpszTitle) {WINE_WARN("title\n"); break;} - hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(ptr + 4) + 1); + hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); if (!hlpfile->lpszTitle) return FALSE; - lstrcpy(hlpfile->lpszTitle, ptr + 4); + lstrcpy(hlpfile->lpszTitle, str); WINE_TRACE("Title: %s\n", hlpfile->lpszTitle); break; case 2: if (hlpfile->lpszCopyright) {WINE_WARN("copyright\n"); break;} - hlpfile->lpszCopyright = HeapAlloc(GetProcessHeap(), 0, strlen(ptr + 4) + 1); + hlpfile->lpszCopyright = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); if (!hlpfile->lpszCopyright) return FALSE; - lstrcpy(hlpfile->lpszCopyright, ptr + 4); + lstrcpy(hlpfile->lpszCopyright, str); WINE_TRACE("Copyright: %s\n", hlpfile->lpszCopyright); break; @@ -1390,10 +1393,10 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) break; case 4: - macro = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_MACRO) + lstrlen(ptr + 4) + 1); + macro = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_MACRO) + lstrlen(str) + 1); if (!macro) break; p = (char*)macro + sizeof(HLPFILE_MACRO); - lstrcpy(p, (LPSTR)ptr + 4); + lstrcpy(p, str); macro->lpszMacro = p; macro->next = 0; for (m = &hlpfile->first_macro; *m; m = &(*m)->next); @@ -1415,11 +1418,11 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) unsigned flags = GET_USHORT(ptr, 4); HLPFILE_WINDOWINFO* wi = &hlpfile->windows[hlpfile->numWindows - 1]; - if (flags & 0x0001) strcpy(wi->type, ptr + 6); + if (flags & 0x0001) strcpy(wi->type, &str[2]); else wi->type[0] = '\0'; - if (flags & 0x0002) strcpy(wi->name, ptr + 16); + if (flags & 0x0002) strcpy(wi->name, &str[12]); else wi->name[0] = '\0'; - if (flags & 0x0004) strcpy(wi->caption, ptr + 25); + if (flags & 0x0004) strcpy(wi->caption, &str[23]); else lstrcpynA(wi->caption, hlpfile->lpszTitle, sizeof(wi->caption)); wi->origin.x = (flags & 0x0008) ? GET_USHORT(ptr, 76) : CW_USEDEFAULT; wi->origin.y = (flags & 0x0010) ? GET_USHORT(ptr, 78) : CW_USEDEFAULT; @@ -1527,7 +1530,7 @@ static BOOL HLPFILE_UncompressLZ77_Phrases(HLPFILE* hlpfile) for (i = 0; i <= num; i++) phrases.offsets[i] = GET_USHORT(buf, 0x11 + 2 * i) - 2 * num - 2; - HLPFILE_UncompressLZ77(buf + 0x13 + 2 * num, end, phrases.buffer); + HLPFILE_UncompressLZ77(buf + 0x13 + 2 * num, end, (BYTE*)phrases.buffer); hlpfile->hasPhrases = TRUE; return TRUE; @@ -1597,7 +1600,7 @@ static BOOL HLPFILE_Uncompress_Phrases40(HLPFILE* hlpfile) if (dec_size == cpr_size) memcpy(phrases.buffer, buf_phs + 9, dec_size); else - HLPFILE_UncompressLZ77(buf_phs + 9, end_phs, phrases.buffer); + HLPFILE_UncompressLZ77(buf_phs + 9, end_phs, (BYTE*)phrases.buffer); hlpfile->hasPhrases = FALSE; return TRUE; @@ -1637,7 +1640,7 @@ static BOOL HLPFILE_Uncompress_Topic(HLPFILE* hlpfile) topic.map = HeapAlloc(GetProcessHeap(), 0, topic.wMapLen * sizeof(topic.map[0]) + newsize); if (!topic.map) return FALSE; - newptr = (char*)(topic.map + topic.wMapLen); + newptr = (BYTE*)(topic.map + topic.wMapLen); topic.end = newptr + newsize; for (i = 0; i < topic.wMapLen; i++) @@ -1661,7 +1664,7 @@ static BOOL HLPFILE_Uncompress_Topic(HLPFILE* hlpfile) topic.map = HeapAlloc(GetProcessHeap(), 0, topic.wMapLen * (sizeof(topic.map[0]) + DST_LEN)); if (!topic.map) return FALSE; - newptr = (char*)(topic.map + topic.wMapLen); + newptr = (BYTE*)(topic.map + topic.wMapLen); topic.end = newptr + newsize; for (i = 0; i < topic.wMapLen; i++) @@ -1695,8 +1698,8 @@ static void HLPFILE_Uncompress2(const BYTE *ptr, const BYTE *end, BYTE *newptr, code = 0x100 * ptr[0] + ptr[1]; index = (code - 0x100) / 2; - phptr = phrases.buffer + phrases.offsets[index]; - phend = phrases.buffer + phrases.offsets[index + 1]; + phptr = (BYTE*)phrases.buffer + phrases.offsets[index]; + phend = (BYTE*)phrases.buffer + phrases.offsets[index + 1]; if (newptr + (phend - phptr) > newend) {