Module: wine Branch: refs/heads/master Commit: e6120f20296481d450ca9221aaa3b5b10c82c4ca URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=e6120f20296481d450ca9221...
Author: Robert Shearman rob@codeweavers.com Date: Mon May 15 16:56:27 2006 +0100
rpcrt4: Don't duplicate the conformance calculating code, just use the common ComputeConformance function to store the result in pStubMsg->MaxCount (as this is what callback function store the conformance value into anyway).
---
dlls/rpcrt4/ndr_marshall.c | 58 ++++++++++++++------------------------------ 1 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 7b3cc02..4b7f6e0 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -3386,46 +3386,15 @@ static PFORMAT_STRING get_arm_offset_fro }
static PFORMAT_STRING get_non_encapsulated_union_arm(PMIDL_STUB_MESSAGE pStubMsg, - unsigned char *pMemory, + ULONG value, PFORMAT_STRING pFormat) { - ULONG value; - - pFormat = ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, - 0, &value); - TRACE("got switch value %lx\n", value); pFormat += *(const SHORT*)pFormat; pFormat += 2;
return get_arm_offset_from_union_arm_selector(pStubMsg, value, pFormat); }
-static unsigned char *get_conformance_address(PMIDL_STUB_MESSAGE pStubMsg, - unsigned char *pMemory, - PFORMAT_STRING pFormat) -{ - short ofs = *(short *)&pFormat[2]; - LPVOID ptr = NULL; - - switch (pFormat[0] & 0xf0) - { - case RPC_FC_NORMAL_CONFORMANCE: - ptr = pMemory; - break; - default: - FIXME("Conformance type %x\n", pFormat[0]); - return NULL; - } - - if(pFormat[1]) - { - FIXME("Conformance op %x\n", pFormat[1]); - return NULL; - } - - return (unsigned char *)ptr + ofs; -} - /*********************************************************************** * NdrNonEncapsulatedUnionMarshall [RPCRT4.@] */ @@ -3433,18 +3402,21 @@ unsigned char * WINAPI NdrNonEncapsulat unsigned char *pMemory, PFORMAT_STRING pFormat) { - unsigned char *discriminant; unsigned short type; + unsigned char switch_type;
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); pFormat++;
- /* Marshall discriminant */ - discriminant = get_conformance_address(pStubMsg, pMemory, pFormat + 1); - NdrBaseTypeMarshall(pStubMsg, discriminant, pFormat); + switch_type = *pFormat; pFormat++;
- pFormat = get_non_encapsulated_union_arm(pStubMsg, pMemory, pFormat); + pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0); + TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount); + /* Marshall discriminant */ + NdrBaseTypeMarshall(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type); + + pFormat = get_non_encapsulated_union_arm(pStubMsg, pStubMsg->MaxCount, pFormat); if(!pFormat) return NULL;
@@ -3591,14 +3563,20 @@ void WINAPI NdrNonEncapsulatedUnionBuffe PFORMAT_STRING pFormat) { unsigned short type; + unsigned char switch_type; + TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); + pFormat++;
+ switch_type = *pFormat; pFormat++; + + pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0); + TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount); /* Add discriminant size */ - NdrBaseTypeBufferSize(pStubMsg, pMemory, pFormat); - pFormat++; + NdrBaseTypeBufferSize(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type);
- pFormat = get_non_encapsulated_union_arm(pStubMsg, pMemory, pFormat); + pFormat = get_non_encapsulated_union_arm(pStubMsg, pStubMsg->MaxCount, pFormat); if(!pFormat) return;