rpcrt4: Replace some usage of the long type.

This commit is contained in:
Michael Stefaniuc 2009-04-21 09:59:45 +02:00 committed by Alexandre Julliard
parent b7f6c1e103
commit 3b803f5390
2 changed files with 48 additions and 50 deletions

View File

@ -998,9 +998,8 @@ static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/*********************************************************************** /***********************************************************************
* PointerMemorySize [internal] * PointerMemorySize [internal]
*/ */
static unsigned long PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *Buffer, unsigned char *Buffer, PFORMAT_STRING pFormat)
PFORMAT_STRING pFormat)
{ {
unsigned type = pFormat[0], attr = pFormat[1]; unsigned type = pFormat[0], attr = pFormat[1];
PFORMAT_STRING desc; PFORMAT_STRING desc;
@ -1339,8 +1338,8 @@ static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/*********************************************************************** /***********************************************************************
* EmbeddedPointerMemorySize [internal] * EmbeddedPointerMemorySize [internal]
*/ */
static unsigned long EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, static ULONG EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
unsigned char *Mark = pStubMsg->BufferMark; unsigned char *Mark = pStubMsg->BufferMark;
unsigned rep, count, stride; unsigned rep, count, stride;
@ -2569,8 +2568,8 @@ typedef struct
} NDR_RANGE; } NDR_RANGE;
#include "poppack.h" #include "poppack.h"
static unsigned long EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
switch (*pFormat) { switch (*pFormat) {
case RPC_FC_STRUCT: case RPC_FC_STRUCT:
@ -2631,8 +2630,8 @@ static unsigned long EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg,
} }
static unsigned long EmbeddedComplexMemorySize(PMIDL_STUB_MESSAGE pStubMsg, static ULONG EmbeddedComplexMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
NDR_MEMORYSIZE m = NdrMemorySizer[*pFormat & NDR_TABLE_MASK]; NDR_MEMORYSIZE m = NdrMemorySizer[*pFormat & NDR_TABLE_MASK];
@ -2653,7 +2652,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
{ {
PFORMAT_STRING desc; PFORMAT_STRING desc;
NDR_MARSHALL m; NDR_MARSHALL m;
unsigned long size; ULONG size;
while (*pFormat != RPC_FC_END) { while (*pFormat != RPC_FC_END) {
switch (*pFormat) { switch (*pFormat) {
@ -2742,7 +2741,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2; pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat; desc = pFormat + *(const SHORT*)pFormat;
size = EmbeddedComplexSize(pStubMsg, desc); 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]; m = NdrMarshaller[*desc & NDR_TABLE_MASK];
if (m) if (m)
{ {
@ -2778,7 +2777,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
{ {
PFORMAT_STRING desc; PFORMAT_STRING desc;
NDR_UNMARSHALL m; NDR_UNMARSHALL m;
unsigned long size; ULONG size;
while (*pFormat != RPC_FC_END) { while (*pFormat != RPC_FC_END) {
switch (*pFormat) { switch (*pFormat) {
@ -2868,7 +2867,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2; pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat; desc = pFormat + *(const SHORT*)pFormat;
size = EmbeddedComplexSize(pStubMsg, desc); size = EmbeddedComplexSize(pStubMsg, desc);
TRACE("embedded complex (size=%ld) => %p\n", size, pMemory); TRACE("embedded complex (size=%d) => %p\n", size, pMemory);
if (fMustAlloc) if (fMustAlloc)
/* we can't pass fMustAlloc=TRUE into the marshaller for this type /* 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 * 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; PFORMAT_STRING desc;
NDR_BUFFERSIZE m; NDR_BUFFERSIZE m;
unsigned long size; ULONG size;
while (*pFormat != RPC_FC_END) { while (*pFormat != RPC_FC_END) {
switch (*pFormat) { switch (*pFormat) {
@ -3015,7 +3014,7 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg,
{ {
PFORMAT_STRING desc; PFORMAT_STRING desc;
NDR_FREE m; NDR_FREE m;
unsigned long size; ULONG size;
while (*pFormat != RPC_FC_END) { while (*pFormat != RPC_FC_END) {
switch (*pFormat) { switch (*pFormat) {
@ -3090,12 +3089,12 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg,
return pMemory; return pMemory;
} }
static unsigned long ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat, PFORMAT_STRING pFormat,
PFORMAT_STRING pPointer) PFORMAT_STRING pPointer)
{ {
PFORMAT_STRING desc; PFORMAT_STRING desc;
unsigned long size = 0; ULONG size = 0;
while (*pFormat != RPC_FC_END) { while (*pFormat != RPC_FC_END) {
switch (*pFormat) { switch (*pFormat) {
@ -3189,11 +3188,10 @@ static unsigned long ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
return size; return size;
} }
unsigned long ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
PFORMAT_STRING pFormat)
{ {
PFORMAT_STRING desc; PFORMAT_STRING desc;
unsigned long size = 0; ULONG size = 0;
while (*pFormat != RPC_FC_END) { while (*pFormat != RPC_FC_END) {
switch (*pFormat) { switch (*pFormat) {
@ -3274,7 +3272,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
{ {
int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers;
/* save buffer length */ /* 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 /* get the buffer pointer after complex array data, but before
* pointer data */ * pointer data */
@ -3304,7 +3302,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (conf_array) 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, array_compute_and_write_conformance(conf_array[0], pStubMsg,
pMemory + struct_size, conf_array); pMemory + struct_size, conf_array);
/* these could be changed in ComplexMarshall so save them for later */ /* 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 */ /* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = pStubMsg->Buffer; 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; pointer_buffer_mark_set = 1;
/* restore the original buffer */ /* restore the original buffer */
@ -3448,7 +3446,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
if(!pStubMsg->IgnoreEmbeddedPointers && !pStubMsg->PointerLength) if(!pStubMsg->IgnoreEmbeddedPointers && !pStubMsg->PointerLength)
{ {
int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; 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 /* get the buffer length after complex struct data, but before
* pointer data */ * pointer data */
@ -3459,7 +3457,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/* save it for use by embedded pointer code later */ /* save it for use by embedded pointer code later */
pStubMsg->PointerLength = pStubMsg->BufferLength; pStubMsg->PointerLength = pStubMsg->BufferLength;
pointer_length_set = 1; 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 */ /* restore the original buffer length */
pStubMsg->BufferLength = saved_buffer_length; pStubMsg->BufferLength = saved_buffer_length;
@ -3475,7 +3473,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
if (conf_array) 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, array_compute_and_size_conformance(conf_array[0], pStubMsg, pMemory + struct_size,
conf_array); 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 /* save buffer fields that may be changed by buffer sizer functions
* and that may be needed later on */ * and that may be needed later on */
int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers;
unsigned long saved_buffer_length = pStubMsg->BufferLength; ULONG saved_buffer_length = pStubMsg->BufferLength;
unsigned long saved_max_count = pStubMsg->MaxCount; ULONG_PTR saved_max_count = pStubMsg->MaxCount;
unsigned long saved_offset = pStubMsg->Offset; ULONG saved_offset = pStubMsg->Offset;
unsigned long saved_actual_count = pStubMsg->ActualCount; ULONG saved_actual_count = pStubMsg->ActualCount;
/* get the buffer pointer after complex array data, but before /* get the buffer pointer after complex array data, but before
* pointer data */ * pointer data */
@ -3925,7 +3923,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
size = pStubMsg->MemorySize; size = pStubMsg->MemorySize;
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded; 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) if (!pStubMsg->PointerBufferMark)
{ {
/* save it for use by embedded pointer code later */ /* 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 /* save buffer fields that may be changed by buffer sizer functions
* and that may be needed later on */ * and that may be needed later on */
int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; int saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers;
unsigned long saved_buffer_length = pStubMsg->BufferLength; ULONG saved_buffer_length = pStubMsg->BufferLength;
unsigned long saved_max_count = pStubMsg->MaxCount; ULONG_PTR saved_max_count = pStubMsg->MaxCount;
unsigned long saved_offset = pStubMsg->Offset; ULONG saved_offset = pStubMsg->Offset;
unsigned long saved_actual_count = pStubMsg->ActualCount; ULONG saved_actual_count = pStubMsg->ActualCount;
/* get the buffer pointer after complex array data, but before /* get the buffer pointer after complex array data, but before
* pointer data */ * pointer data */
@ -4247,7 +4245,7 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned index = *(const WORD*)&pFormat[2]; unsigned index = *(const WORD*)&pFormat[2];
DWORD bufsize = *(const WORD*)&pFormat[6]; DWORD bufsize = *(const WORD*)&pFormat[6];
USER_MARSHAL_CB umcb; USER_MARSHAL_CB umcb;
unsigned long saved_buffer_length = 0; ULONG saved_buffer_length = 0;
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
TRACE("index=%d\n", index); TRACE("index=%d\n", index);
@ -4901,7 +4899,7 @@ typedef struct
{ {
unsigned char type; unsigned char type;
unsigned char alignment; unsigned char alignment;
unsigned long total_size; ULONG total_size;
} NDR_LGFARRAY_FORMAT; } NDR_LGFARRAY_FORMAT;
#include "poppack.h" #include "poppack.h"
@ -4913,7 +4911,7 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)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); TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
@ -4956,7 +4954,7 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char fMustAlloc) unsigned char fMustAlloc)
{ {
const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat; const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat;
unsigned long total_size; ULONG total_size;
unsigned char *saved_buffer; unsigned char *saved_buffer;
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
@ -5011,7 +5009,7 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)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); 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, static PFORMAT_STRING get_arm_offset_from_union_arm_selector(PMIDL_STUB_MESSAGE pStubMsg,
unsigned long discriminant, ULONG discriminant,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
unsigned short num_arms, arm, type; 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) 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); RpcRaiseException(RPC_S_INVALID_TAG);
return NULL; return NULL;
} }
if(type == 0) 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; 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); 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) PFORMAT_STRING *ppFormat)
{ {
long discriminant = 0; LONG discriminant = 0;
switch(**ppFormat) switch(**ppFormat)
{ {
@ -5962,7 +5960,7 @@ unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pSt
PFORMAT_STRING pFormat, PFORMAT_STRING pFormat,
unsigned char fMustAlloc) unsigned char fMustAlloc)
{ {
long discriminant; LONG discriminant;
unsigned short size; unsigned short size;
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
@ -5970,7 +5968,7 @@ unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pSt
/* Unmarshall discriminant */ /* Unmarshall discriminant */
discriminant = unmarshall_discriminant(pStubMsg, &pFormat); discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
TRACE("unmarshalled discriminant %lx\n", discriminant); TRACE("unmarshalled discriminant %x\n", discriminant);
pFormat += *(const SHORT*)pFormat; pFormat += *(const SHORT*)pFormat;

View File

@ -62,6 +62,6 @@ extern const NDR_BUFFERSIZE NdrBufferSizer[];
extern const NDR_MEMORYSIZE NdrMemorySizer[]; extern const NDR_MEMORYSIZE NdrMemorySizer[];
extern const NDR_FREE NdrFreer[]; 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 */ #endif /* __WINE_NDR_MISC_H */