Robert Shearman : rpcrt4: Don' t call NdrBaseTypeMemorySize from within NdrBaseTypeUnmarshall.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 5 07:28:13 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: cd19c992847d8669006f94285c72c7fced87fd49
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=cd19c992847d8669006f94285c72c7fced87fd49

Author: Robert Shearman <rob at codeweavers.com>
Date:   Mon Jun  5 01:41:18 2006 +0100

rpcrt4: Don't call NdrBaseTypeMemorySize from within NdrBaseTypeUnmarshall.

---

 dlls/rpcrt4/ndr_marshall.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 02c3583..af20c0a 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -4153,19 +4153,11 @@ static unsigned char *WINAPI NdrBaseType
 {
     TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false");
 
-    if (fMustAlloc || !*ppMemory)
-    {
-        unsigned char *Buffer = pStubMsg->Buffer;
-        unsigned long MemorySize = pStubMsg->MemorySize;
-        *ppMemory = NdrAllocate(pStubMsg, NdrBaseTypeMemorySize(pStubMsg, pFormat));
-        pStubMsg->MemorySize = MemorySize;
-        pStubMsg->Buffer = Buffer;
-    }
-
-    TRACE("*ppMemory: %p\n", *ppMemory);
-
 #define BASE_TYPE_UNMARSHALL(type) \
         ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \
+        if (fMustAlloc || !*ppMemory) \
+            *ppMemory = NdrAllocate(pStubMsg, sizeof(type)); \
+        TRACE("*ppMemory: %p\n", *ppMemory); \
         **(type **)ppMemory = *(type *)pStubMsg->Buffer; \
         pStubMsg->Buffer += sizeof(type);
 
@@ -4205,6 +4197,9 @@ #define BASE_TYPE_UNMARSHALL(type) \
         break;
     case RPC_FC_ENUM16:
         ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
+        if (fMustAlloc || !*ppMemory)
+            *ppMemory = NdrAllocate(pStubMsg, sizeof(UINT));
+        TRACE("*ppMemory: %p\n", *ppMemory);
         /* 16-bits on the wire, but int in memory */
         **(UINT **)ppMemory = *(USHORT *)pStubMsg->Buffer;
         pStubMsg->Buffer += sizeof(USHORT);




More information about the wine-cvs mailing list