Commit d1682198 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Fix gcc 4.0 warnings.

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