From 3b803f5390483c6ae3065284693baecc343bd8b9 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Tue, 21 Apr 2009 09:59:45 +0200 Subject: [PATCH] rpcrt4: Replace some usage of the long type. --- dlls/rpcrt4/ndr_marshall.c | 96 +++++++++++++++++++------------------- dlls/rpcrt4/ndr_misc.h | 2 +- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index d39af8593a3..1dfb661cc7d 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -998,9 +998,8 @@ static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, /*********************************************************************** * PointerMemorySize [internal] */ -static unsigned long PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, - unsigned char *Buffer, - PFORMAT_STRING pFormat) +static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, + unsigned char *Buffer, PFORMAT_STRING pFormat) { unsigned type = pFormat[0], attr = pFormat[1]; PFORMAT_STRING desc; @@ -1339,8 +1338,8 @@ static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, /*********************************************************************** * EmbeddedPointerMemorySize [internal] */ -static unsigned long EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, - PFORMAT_STRING pFormat) +static ULONG EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, + PFORMAT_STRING pFormat) { unsigned char *Mark = pStubMsg->BufferMark; unsigned rep, count, stride; @@ -2569,8 +2568,8 @@ typedef struct } NDR_RANGE; #include "poppack.h" -static unsigned long EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, - PFORMAT_STRING pFormat) +static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, + PFORMAT_STRING pFormat) { switch (*pFormat) { case RPC_FC_STRUCT: @@ -2631,8 +2630,8 @@ static unsigned long EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, } -static unsigned long EmbeddedComplexMemorySize(PMIDL_STUB_MESSAGE pStubMsg, - PFORMAT_STRING pFormat) +static ULONG EmbeddedComplexMemorySize(PMIDL_STUB_MESSAGE pStubMsg, + PFORMAT_STRING pFormat) { NDR_MEMORYSIZE m = NdrMemorySizer[*pFormat & NDR_TABLE_MASK]; @@ -2653,7 +2652,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, { PFORMAT_STRING desc; NDR_MARSHALL m; - unsigned long size; + ULONG size; while (*pFormat != RPC_FC_END) { switch (*pFormat) { @@ -2742,7 +2741,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; size = EmbeddedComplexSize(pStubMsg, desc); - TRACE("embedded complex (size=%ld) <= %p\n", size, pMemory); + TRACE("embedded complex (size=%d) <= %p\n", size, pMemory); m = NdrMarshaller[*desc & NDR_TABLE_MASK]; if (m) { @@ -2778,7 +2777,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, { PFORMAT_STRING desc; NDR_UNMARSHALL m; - unsigned long size; + ULONG size; while (*pFormat != RPC_FC_END) { switch (*pFormat) { @@ -2868,7 +2867,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pFormat += 2; desc = pFormat + *(const SHORT*)pFormat; size = EmbeddedComplexSize(pStubMsg, desc); - TRACE("embedded complex (size=%ld) => %p\n", size, pMemory); + TRACE("embedded complex (size=%d) => %p\n", size, pMemory); if (fMustAlloc) /* we can't pass fMustAlloc=TRUE into the marshaller for this type * since the type is part of the memory block that is encompassed by @@ -2910,7 +2909,7 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, { PFORMAT_STRING desc; NDR_BUFFERSIZE m; - unsigned long size; + ULONG size; while (*pFormat != RPC_FC_END) { switch (*pFormat) { @@ -3015,7 +3014,7 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, { PFORMAT_STRING desc; NDR_FREE m; - unsigned long size; + ULONG size; while (*pFormat != RPC_FC_END) { switch (*pFormat) { @@ -3090,12 +3089,12 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, return pMemory; } -static unsigned long ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, - PFORMAT_STRING pFormat, - PFORMAT_STRING pPointer) +static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, + PFORMAT_STRING pFormat, + PFORMAT_STRING pPointer) { PFORMAT_STRING desc; - unsigned long size = 0; + ULONG size = 0; while (*pFormat != RPC_FC_END) { switch (*pFormat) { @@ -3189,11 +3188,10 @@ static unsigned long ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, return size; } -unsigned long ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, - PFORMAT_STRING pFormat) +ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { PFORMAT_STRING desc; - unsigned long size = 0; + ULONG size = 0; while (*pFormat != RPC_FC_END) { switch (*pFormat) { @@ -3274,7 +3272,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, { int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; /* save buffer length */ - unsigned long saved_buffer_length = pStubMsg->BufferLength; + ULONG saved_buffer_length = pStubMsg->BufferLength; /* get the buffer pointer after complex array data, but before * pointer data */ @@ -3304,7 +3302,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (conf_array) { - unsigned long struct_size = ComplexStructSize(pStubMsg, pFormat); + ULONG struct_size = ComplexStructSize(pStubMsg, pFormat); array_compute_and_write_conformance(conf_array[0], pStubMsg, pMemory + struct_size, conf_array); /* these could be changed in ComplexMarshall so save them for later */ @@ -3371,7 +3369,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, /* save it for use by embedded pointer code later */ pStubMsg->PointerBufferMark = pStubMsg->Buffer; - TRACE("difference = 0x%lx\n", (unsigned long)(pStubMsg->PointerBufferMark - saved_buffer)); + TRACE("difference = 0x%x\n", pStubMsg->PointerBufferMark - saved_buffer); pointer_buffer_mark_set = 1; /* restore the original buffer */ @@ -3448,7 +3446,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, if(!pStubMsg->IgnoreEmbeddedPointers && !pStubMsg->PointerLength) { int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; - unsigned long saved_buffer_length = pStubMsg->BufferLength; + ULONG saved_buffer_length = pStubMsg->BufferLength; /* get the buffer length after complex struct data, but before * pointer data */ @@ -3459,7 +3457,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, /* save it for use by embedded pointer code later */ pStubMsg->PointerLength = pStubMsg->BufferLength; pointer_length_set = 1; - TRACE("difference = 0x%lx\n", pStubMsg->PointerLength - saved_buffer_length); + TRACE("difference = 0x%x\n", pStubMsg->PointerLength - saved_buffer_length); /* restore the original buffer length */ pStubMsg->BufferLength = saved_buffer_length; @@ -3475,7 +3473,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, if (conf_array) { - unsigned long struct_size = ComplexStructSize(pStubMsg, pFormat); + ULONG struct_size = ComplexStructSize(pStubMsg, pFormat); array_compute_and_size_conformance(conf_array[0], pStubMsg, pMemory + struct_size, conf_array); @@ -3833,10 +3831,10 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, /* save buffer fields that may be changed by buffer sizer functions * and that may be needed later on */ int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; - unsigned long saved_buffer_length = pStubMsg->BufferLength; - unsigned long saved_max_count = pStubMsg->MaxCount; - unsigned long saved_offset = pStubMsg->Offset; - unsigned long saved_actual_count = pStubMsg->ActualCount; + ULONG saved_buffer_length = pStubMsg->BufferLength; + ULONG_PTR saved_max_count = pStubMsg->MaxCount; + ULONG saved_offset = pStubMsg->Offset; + ULONG saved_actual_count = pStubMsg->ActualCount; /* get the buffer pointer after complex array data, but before * pointer data */ @@ -3925,7 +3923,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, size = pStubMsg->MemorySize; pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded; - TRACE("difference = 0x%lx\n", (unsigned long)(pStubMsg->Buffer - saved_buffer)); + TRACE("difference = 0x%x\n", pStubMsg->Buffer - saved_buffer); if (!pStubMsg->PointerBufferMark) { /* save it for use by embedded pointer code later */ @@ -3989,10 +3987,10 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, /* save buffer fields that may be changed by buffer sizer functions * and that may be needed later on */ int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; - unsigned long saved_buffer_length = pStubMsg->BufferLength; - unsigned long saved_max_count = pStubMsg->MaxCount; - unsigned long saved_offset = pStubMsg->Offset; - unsigned long saved_actual_count = pStubMsg->ActualCount; + ULONG saved_buffer_length = pStubMsg->BufferLength; + ULONG_PTR saved_max_count = pStubMsg->MaxCount; + ULONG saved_offset = pStubMsg->Offset; + ULONG saved_actual_count = pStubMsg->ActualCount; /* get the buffer pointer after complex array data, but before * pointer data */ @@ -4247,7 +4245,7 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned index = *(const WORD*)&pFormat[2]; DWORD bufsize = *(const WORD*)&pFormat[6]; USER_MARSHAL_CB umcb; - unsigned long saved_buffer_length = 0; + ULONG saved_buffer_length = 0; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); TRACE("index=%d\n", index); @@ -4901,7 +4899,7 @@ typedef struct { unsigned char type; unsigned char alignment; - unsigned long total_size; + ULONG total_size; } NDR_LGFARRAY_FORMAT; #include "poppack.h" @@ -4913,7 +4911,7 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat; - unsigned long total_size; + ULONG total_size; TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); @@ -4956,7 +4954,7 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char fMustAlloc) { const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat; - unsigned long total_size; + ULONG total_size; unsigned char *saved_buffer; TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); @@ -5011,7 +5009,7 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat; - unsigned long total_size; + ULONG total_size; TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); @@ -5423,7 +5421,7 @@ static ULONG get_discriminant(unsigned char fc, const unsigned char *pMemory) } static PFORMAT_STRING get_arm_offset_from_union_arm_selector(PMIDL_STUB_MESSAGE pStubMsg, - unsigned long discriminant, + ULONG discriminant, PFORMAT_STRING pFormat) { unsigned short num_arms, arm, type; @@ -5446,13 +5444,13 @@ static PFORMAT_STRING get_arm_offset_from_union_arm_selector(PMIDL_STUB_MESSAGE { if(type == 0xffff) { - ERR("no arm for 0x%lx and no default case\n", discriminant); + ERR("no arm for 0x%x and no default case\n", discriminant); RpcRaiseException(RPC_S_INVALID_TAG); return NULL; } if(type == 0) { - TRACE("falling back to empty default case for 0x%lx\n", discriminant); + TRACE("falling back to empty default case for 0x%x\n", discriminant); return NULL; } } @@ -5906,10 +5904,10 @@ unsigned char * WINAPI NdrNonEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStub return union_arm_marshall(pStubMsg, pMemory, pStubMsg->MaxCount, pFormat + *(const SHORT*)pFormat); } -static long unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, +static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING *ppFormat) { - long discriminant = 0; + LONG discriminant = 0; switch(**ppFormat) { @@ -5962,7 +5960,7 @@ unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pSt PFORMAT_STRING pFormat, unsigned char fMustAlloc) { - long discriminant; + LONG discriminant; unsigned short size; TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); @@ -5970,7 +5968,7 @@ unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pSt /* Unmarshall discriminant */ discriminant = unmarshall_discriminant(pStubMsg, &pFormat); - TRACE("unmarshalled discriminant %lx\n", discriminant); + TRACE("unmarshalled discriminant %x\n", discriminant); pFormat += *(const SHORT*)pFormat; diff --git a/dlls/rpcrt4/ndr_misc.h b/dlls/rpcrt4/ndr_misc.h index c3beff4d725..b0150c3a2eb 100644 --- a/dlls/rpcrt4/ndr_misc.h +++ b/dlls/rpcrt4/ndr_misc.h @@ -62,6 +62,6 @@ extern const NDR_BUFFERSIZE NdrBufferSizer[]; extern const NDR_MEMORYSIZE NdrMemorySizer[]; extern const NDR_FREE NdrFreer[]; -unsigned long ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat); +ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat); #endif /* __WINE_NDR_MISC_H */