rpcrt4: Use BOOL type where appropriate
Frédéric Delanoy
frederic.delanoy at gmail.com
Fri Nov 29 18:50:07 CST 2013
---
dlls/rpcrt4/ndr_clientserver.c | 54 ++++++++++++++---------------
dlls/rpcrt4/ndr_marshall.c | 78 +++++++++++++++++++++---------------------
dlls/rpcrt4/rpcrt4_main.c | 5 +--
3 files changed, 69 insertions(+), 68 deletions(-)
diff --git a/dlls/rpcrt4/ndr_clientserver.c b/dlls/rpcrt4/ndr_clientserver.c
index 502faa1..cf812e0 100644
--- a/dlls/rpcrt4/ndr_clientserver.c
+++ b/dlls/rpcrt4/ndr_clientserver.c
@@ -65,7 +65,7 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
pStubMsg->ReuseBuffer = FALSE;
pStubMsg->pAllocAllNodesContext = NULL;
pStubMsg->pPointerQueueState = NULL;
- pStubMsg->IgnoreEmbeddedPointers = 0;
+ pStubMsg->IgnoreEmbeddedPointers = FALSE;
pStubMsg->PointerBufferMark = NULL;
pStubMsg->CorrDespIncrement = 0;
pStubMsg->uFlags = 0;
@@ -76,19 +76,19 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
pStubMsg->StubDesc = pStubDesc;
pStubMsg->FullPtrRefId = 0;
pStubMsg->PointerLength = 0;
- pStubMsg->fInDontFree = 0;
- pStubMsg->fDontCallFreeInst = 0;
- pStubMsg->fInOnlyParam = 0;
- pStubMsg->fHasReturn = 0;
- pStubMsg->fHasExtensions = 0;
- pStubMsg->fHasNewCorrDesc = 0;
- pStubMsg->fIsIn = 0;
- pStubMsg->fIsOut = 0;
- pStubMsg->fIsOicf = 0;
- pStubMsg->fBufferValid = 0;
- pStubMsg->fHasMemoryValidateCallback = 0;
- pStubMsg->fInFree = 0;
- pStubMsg->fNeedMCCP = 0;
+ pStubMsg->fInDontFree = FALSE;
+ pStubMsg->fDontCallFreeInst = FALSE;
+ pStubMsg->fInOnlyParam = FALSE;
+ pStubMsg->fHasReturn = FALSE;
+ pStubMsg->fHasExtensions = FALSE;
+ pStubMsg->fHasNewCorrDesc = FALSE;
+ pStubMsg->fIsIn = FALSE;
+ pStubMsg->fIsOut = FALSE;
+ pStubMsg->fIsOicf = FALSE;
+ pStubMsg->fBufferValid = FALSE;
+ pStubMsg->fHasMemoryValidateCallback = FALSE;
+ pStubMsg->fInFree = FALSE;
+ pStubMsg->fNeedMCCP = FALSE;
pStubMsg->fUnused = 0;
pStubMsg->dwDestContext = MSHCTX_DIFFERENTMACHINE;
pStubMsg->pvDestContext = NULL;
@@ -118,7 +118,7 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M
pStubMsg->ReuseBuffer = FALSE;
pStubMsg->pAllocAllNodesContext = NULL;
pStubMsg->pPointerQueueState = NULL;
- pStubMsg->IgnoreEmbeddedPointers = 0;
+ pStubMsg->IgnoreEmbeddedPointers = FALSE;
pStubMsg->PointerBufferMark = NULL;
pStubMsg->uFlags = 0;
pStubMsg->UniquePtrCount = 0;
@@ -129,18 +129,18 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M
pStubMsg->FullPtrXlatTables = NULL;
pStubMsg->FullPtrRefId = 0;
pStubMsg->PointerLength = 0;
- pStubMsg->fInDontFree = 0;
- pStubMsg->fDontCallFreeInst = 0;
- pStubMsg->fInOnlyParam = 0;
- pStubMsg->fHasReturn = 0;
- pStubMsg->fHasExtensions = 0;
- pStubMsg->fHasNewCorrDesc = 0;
- pStubMsg->fIsIn = 0;
- pStubMsg->fIsOut = 0;
- pStubMsg->fIsOicf = 0;
- pStubMsg->fHasMemoryValidateCallback = 0;
- pStubMsg->fInFree = 0;
- pStubMsg->fNeedMCCP = 0;
+ pStubMsg->fInDontFree = FALSE;
+ pStubMsg->fDontCallFreeInst = FALSE;
+ pStubMsg->fInOnlyParam = FALSE;
+ pStubMsg->fHasReturn = FALSE;
+ pStubMsg->fHasExtensions = FALSE;
+ pStubMsg->fHasNewCorrDesc = FALSE;
+ pStubMsg->fIsIn = FALSE;
+ pStubMsg->fIsOut = FALSE;
+ pStubMsg->fIsOicf = FALSE;
+ pStubMsg->fHasMemoryValidateCallback = FALSE;
+ pStubMsg->fInFree = FALSE;
+ pStubMsg->fNeedMCCP = FALSE;
pStubMsg->fUnused = 0;
pStubMsg->dwDestContext = MSHCTX_DIFFERENTMACHINE;
pStubMsg->pvDestContext = NULL;
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index ca73aea..6a1fb42 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -807,7 +807,7 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING desc;
NDR_MARSHALL m;
ULONG pointer_id;
- int pointer_needs_marshaling;
+ BOOL pointer_needs_marshaling;
TRACE("(%p,%p,%p,%p)\n", pStubMsg, Buffer, Pointer, pFormat);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
@@ -822,14 +822,14 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
ERR("NULL ref pointer is not allowed\n");
RpcRaiseException(RPC_X_NULL_REF_POINTER);
}
- pointer_needs_marshaling = 1;
+ pointer_needs_marshaling = TRUE;
break;
case RPC_FC_UP: /* unique pointer */
case RPC_FC_OP: /* object pointer - same as unique here */
if (Pointer)
- pointer_needs_marshaling = 1;
+ pointer_needs_marshaling = TRUE;
else
- pointer_needs_marshaling = 0;
+ pointer_needs_marshaling = FALSE;
pointer_id = Pointer ? NDR_POINTER_ID(pStubMsg) : 0;
TRACE("writing 0x%08x to buffer\n", pointer_id);
NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
@@ -875,7 +875,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING desc;
NDR_UNMARSHALL m;
DWORD pointer_id = 0;
- int pointer_needs_unmarshaling;
+ BOOL pointer_needs_unmarshaling;
TRACE("(%p,%p,%p,%p,%p,%d)\n", pStubMsg, Buffer, pPointer, pSrcPointer, pFormat, fMustAlloc);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
@@ -885,16 +885,16 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
- pointer_needs_unmarshaling = 1;
+ pointer_needs_unmarshaling = TRUE;
break;
case RPC_FC_UP: /* unique pointer */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
if (pointer_id)
- pointer_needs_unmarshaling = 1;
+ pointer_needs_unmarshaling = TRUE;
else {
*pPointer = NULL;
- pointer_needs_unmarshaling = 0;
+ pointer_needs_unmarshaling = FALSE;
}
break;
case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
@@ -906,11 +906,11 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
fMustAlloc = TRUE;
}
if (pointer_id)
- pointer_needs_unmarshaling = 1;
+ pointer_needs_unmarshaling = TRUE;
else
{
*pPointer = NULL;
- pointer_needs_unmarshaling = 0;
+ pointer_needs_unmarshaling = FALSE;
}
break;
case RPC_FC_FP:
@@ -990,7 +990,7 @@ static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned type = pFormat[0], attr = pFormat[1];
PFORMAT_STRING desc;
NDR_BUFFERSIZE m;
- int pointer_needs_sizing;
+ BOOL pointer_needs_sizing;
ULONG pointer_id;
TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
@@ -1045,7 +1045,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING desc;
NDR_MEMORYSIZE m;
DWORD pointer_id = 0;
- int pointer_needs_sizing;
+ BOOL pointer_needs_sizing;
TRACE("(%p,%p,%p)\n", pStubMsg, Buffer, pFormat);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
@@ -1055,16 +1055,16 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */
- pointer_needs_sizing = 1;
+ pointer_needs_sizing = TRUE;
break;
case RPC_FC_UP: /* unique pointer */
case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
if (pointer_id)
- pointer_needs_sizing = 1;
+ pointer_needs_sizing = TRUE;
else
- pointer_needs_sizing = 0;
+ pointer_needs_sizing = FALSE;
break;
case RPC_FC_FP:
{
@@ -2892,7 +2892,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
case RPC_FC_POINTER:
{
unsigned char *saved_buffer;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
TRACE("pointer=%p <= %p\n", *(unsigned char**)pMemory, pMemory);
TRACE("pStubMsg->Buffer before %p\n", pStubMsg->Buffer);
if (*pFormat != RPC_FC_POINTER)
@@ -2904,7 +2904,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
{
pStubMsg->Buffer = pStubMsg->PointerBufferMark;
pStubMsg->PointerBufferMark = NULL;
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
}
else if (*pPointer != RPC_FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
@@ -3061,7 +3061,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
case RPC_FC_POINTER:
{
unsigned char *saved_buffer;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
TRACE("pointer => %p\n", pMemory);
if (*pFormat != RPC_FC_POINTER)
pPointer = pFormat;
@@ -3072,7 +3072,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
{
pStubMsg->Buffer = pStubMsg->PointerBufferMark;
pStubMsg->PointerBufferMark = NULL;
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
}
else if (*pPointer != RPC_FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
@@ -3426,7 +3426,7 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
case RPC_FC_POINTER:
{
unsigned char *saved_buffer;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
if (*pFormat != RPC_FC_POINTER)
pPointer = pFormat;
if (*pPointer != RPC_FC_RP)
@@ -3436,7 +3436,7 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
{
pStubMsg->Buffer = pStubMsg->PointerBufferMark;
pStubMsg->PointerBufferMark = NULL;
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
}
else if (*pPointer != RPC_FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
@@ -3582,7 +3582,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING conf_array = NULL;
PFORMAT_STRING pointer_desc = NULL;
unsigned char *OldMemory = pStubMsg->Memory;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
ULONG count = 0;
ULONG max_count = 0;
ULONG offset = 0;
@@ -3598,14 +3598,14 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* get the buffer pointer after complex array data, but before
* pointer data */
pStubMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
- pStubMsg->IgnoreEmbeddedPointers = 1;
+ pStubMsg->IgnoreEmbeddedPointers = TRUE;
NdrComplexStructBufferSize(pStubMsg, pMemory, pFormat);
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
/* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength;
TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->PointerBufferMark - pStubMsg->Buffer));
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
/* restore the original buffer length */
pStubMsg->BufferLength = saved_buffer_length;
@@ -3668,7 +3668,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING conf_array = NULL;
PFORMAT_STRING pointer_desc = NULL;
unsigned char *pMemory;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
ULONG count = 0;
ULONG max_count = 0;
ULONG offset = 0;
@@ -3684,14 +3684,14 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* get the buffer pointer after complex array data, but before
* pointer data */
- pStubMsg->IgnoreEmbeddedPointers = 1;
+ pStubMsg->IgnoreEmbeddedPointers = TRUE;
NdrComplexStructMemorySize(pStubMsg, pFormat);
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
/* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = pStubMsg->Buffer;
TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->PointerBufferMark - saved_buffer));
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
/* restore the original buffer */
pStubMsg->Buffer = saved_buffer;
@@ -3771,7 +3771,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/* get the buffer length after complex struct data, but before
* pointer data */
- pStubMsg->IgnoreEmbeddedPointers = 1;
+ pStubMsg->IgnoreEmbeddedPointers = TRUE;
NdrComplexStructBufferSize(pStubMsg, pMemory, pFormat);
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
@@ -4131,7 +4131,7 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
@@ -4155,14 +4155,14 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* get the buffer pointer after complex array data, but before
* pointer data */
pStubMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
- pStubMsg->IgnoreEmbeddedPointers = 1;
+ pStubMsg->IgnoreEmbeddedPointers = TRUE;
NdrComplexArrayBufferSize(pStubMsg, pMemory, pFormat);
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
/* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength;
TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer));
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
/* restore fields */
pStubMsg->ActualCount = saved_actual_count;
@@ -4195,7 +4195,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char fMustAlloc)
{
unsigned char *saved_buffer;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
int saved_ignore_embedded;
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
@@ -4212,7 +4212,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
saved_buffer = pStubMsg->Buffer;
/* get the buffer pointer after complex array data, but before
* pointer data */
- pStubMsg->IgnoreEmbeddedPointers = 1;
+ pStubMsg->IgnoreEmbeddedPointers = TRUE;
pStubMsg->MemorySize = 0;
NdrComplexArrayMemorySize(pStubMsg, pFormat);
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
@@ -4222,7 +4222,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
{
/* save it for use by embedded pointer code later */
pStubMsg->PointerBufferMark = pStubMsg->Buffer;
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
}
/* restore the original buffer */
pStubMsg->Buffer = saved_buffer;
@@ -4270,7 +4270,7 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/* get the buffer pointer after complex array data, but before
* pointer data */
- pStubMsg->IgnoreEmbeddedPointers = 1;
+ pStubMsg->IgnoreEmbeddedPointers = TRUE;
NdrComplexArrayBufferSize(pStubMsg, pMemory, pFormat);
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
@@ -5720,7 +5720,7 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c
if (m)
{
unsigned char *saved_buffer = NULL;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
switch(*desc)
{
case RPC_FC_RP:
@@ -5733,7 +5733,7 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c
{
pStubMsg->Buffer = pStubMsg->PointerBufferMark;
pStubMsg->PointerBufferMark = NULL;
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
}
else
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
@@ -5788,7 +5788,7 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (m)
{
unsigned char *saved_buffer = NULL;
- int pointer_buffer_mark_set = 0;
+ BOOL pointer_buffer_mark_set = FALSE;
switch(*desc)
{
case RPC_FC_RP:
@@ -5801,7 +5801,7 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg,
{
pStubMsg->Buffer = pStubMsg->PointerBufferMark;
pStubMsg->PointerBufferMark = NULL;
- pointer_buffer_mark_set = 1;
+ pointer_buffer_mark_set = TRUE;
}
else
pStubMsg->Buffer += 4; /* for pointer ID */
diff --git a/dlls/rpcrt4/rpcrt4_main.c b/dlls/rpcrt4/rpcrt4_main.c
index 21c1c13..ef78b03 100644
--- a/dlls/rpcrt4/rpcrt4_main.c
+++ b/dlls/rpcrt4/rpcrt4_main.c
@@ -390,7 +390,8 @@ static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address)
*/
RPC_STATUS WINAPI UuidCreateSequential(UUID *Uuid)
{
- static int initialised, count;
+ static BOOL initialised;
+ static int count;
ULONGLONG time;
static ULONGLONG timelast;
@@ -409,7 +410,7 @@ RPC_STATUS WINAPI UuidCreateSequential(UUID *Uuid)
sequence &= 0x1fff;
status = RPC_UuidGetNodeAddress(address);
- initialised = 1;
+ initialised = TRUE;
}
/* Generate time element of the UUID. Account for going faster
--
1.8.5
More information about the wine-patches
mailing list