Nikolay Sivov : rpcrt4: Use a helper to skip conformance.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Mar 10 10:10:02 CDT 2015
Module: wine
Branch: master
Commit: e1d1057232b91d10dea9ba4224c7b01e3a3a9476
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1d1057232b91d10dea9ba4224c7b01e3a3a9476
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Mar 9 12:42:45 2015 +0300
rpcrt4: Use a helper to skip conformance.
---
dlls/rpcrt4/ndr_marshall.c | 40 ++++++++++------------------------------
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 89c2c7b..8a84ed7 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -440,6 +440,11 @@ static inline BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
return (*(const ULONG *)pFormat != -1);
}
+static inline PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
+{
+ return pStubMsg->fHasNewCorrDesc ? pFormat + 6 : pFormat + 4;
+}
+
static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
{
align_pointer(&pStubMsg->Buffer, 4);
@@ -448,10 +453,7 @@ static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRIN
pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount);
- if (pStubMsg->fHasNewCorrDesc)
- return pFormat+6;
- else
- return pFormat+4;
+ return SkipConformance(pStubMsg, pFormat);
}
static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, ULONG MaxValue)
@@ -483,10 +485,7 @@ static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_S
}
done:
- if (pStubMsg->fHasNewCorrDesc)
- return pFormat+6;
- else
- return pFormat+4;
+ return SkipConformance(pStubMsg, pFormat);
}
/* writes the conformance value to the buffer */
@@ -664,20 +663,8 @@ done_conf_grab:
finish_conf:
TRACE("resulting conformance is %ld\n", *pCount);
- if (pStubMsg->fHasNewCorrDesc)
- return pFormat+6;
- else
- return pFormat+4;
-}
-static inline PFORMAT_STRING SkipConformance(PMIDL_STUB_MESSAGE pStubMsg,
- PFORMAT_STRING pFormat)
-{
- if (pStubMsg->fHasNewCorrDesc)
- pFormat += 6;
- else
- pFormat += 4;
- return pFormat;
+ return SkipConformance(pStubMsg, pFormat);
}
static inline PFORMAT_STRING SkipVariance(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
@@ -2785,11 +2772,7 @@ static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg,
}
case RPC_FC_NON_ENCAPSULATED_UNION:
pFormat += 2;
- if (pStubMsg->fHasNewCorrDesc)
- pFormat += 6;
- else
- pFormat += 4;
-
+ pFormat = SkipConformance(pStubMsg, pFormat);
pFormat += *(const SHORT*)pFormat;
return *(const SHORT*)pFormat;
case RPC_FC_IP:
@@ -6186,10 +6169,7 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg,
}
(*ppFormat)++;
- if (pStubMsg->fHasNewCorrDesc)
- *ppFormat += 6;
- else
- *ppFormat += 4;
+ *ppFormat = SkipConformance(pStubMsg, *ppFormat);
return discriminant;
}
More information about the wine-cvs
mailing list