Robert Shearman : rpcrt4: Remove the BUFFER_PARANOIA overestimates for string memory sizes.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 16 06:25:10 CDT 2006


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

Author: Robert Shearman <rob at codeweavers.com>
Date:   Mon May 15 16:57:04 2006 +0100

rpcrt4: Remove the BUFFER_PARANOIA overestimates for string memory sizes.

---

 dlls/rpcrt4/ndr_marshall.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 1bf3811..c947ec5 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -43,8 +43,6 @@ #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
-#define BUFFER_PARANOIA 20
-
 #if defined(__i386__)
 # define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32) \
     (*((UINT32 *)(pchar)) = (uint32))
@@ -581,12 +579,12 @@ void WINAPI NdrConformantStringBufferSiz
   if (*pFormat == RPC_FC_C_CSTRING) {
     /* we need + 1 octet for '\0' */
     TRACE("string=%s\n", debugstr_a((char*)pMemory));
-    pStubMsg->BufferLength += strlen((char*)pMemory) + 1 + BUFFER_PARANOIA;
+    pStubMsg->BufferLength += strlen((char*)pMemory) + 1;
   }
   else if (*pFormat == RPC_FC_C_WSTRING) {
     /* we need + 2 octets for L'\0' */
     TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory));
-    pStubMsg->BufferLength += strlenW((LPWSTR)pMemory)*2 + 2 + BUFFER_PARANOIA;
+    pStubMsg->BufferLength += strlenW((LPWSTR)pMemory)*2 + 2;
   }
   else {
     ERR("Unhandled string type: %#x\n", *pFormat); 
@@ -652,7 +650,7 @@ unsigned char *WINAPI NdrConformantStrin
   len = pStubMsg->ActualCount;
 
   if (fMustAlloc || !*ppMemory)
-    *ppMemory = NdrAllocate(pStubMsg, len*esize + BUFFER_PARANOIA);
+    *ppMemory = NdrAllocate(pStubMsg, len*esize);
 
   memcpy(*ppMemory, pStubMsg->Buffer, len*esize);
 




More information about the wine-cvs mailing list