Robert Shearman : rpcrt4: Save pStubMsg->
ActualCount in a local variable in the complex
Alexandre Julliard
julliard at wine.codeweavers.com
Mon May 15 09:42:53 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 2479aec4af44ea3498b7334111fdcbb06d5f5c5e
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=2479aec4af44ea3498b7334111fdcbb06d5f5c5e
Author: Robert Shearman <rob at codeweavers.com>
Date: Mon May 15 13:35:51 2006 +0100
rpcrt4: Save pStubMsg->ActualCount in a local variable in the complex
array functions, before calling a function that could change it and
cause the wrong number of loop iterations.
---
dlls/rpcrt4/ndr_marshall.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 3d34b8a..6156e0f 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -2283,7 +2283,7 @@ unsigned char * WINAPI NdrComplexArrayMa
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
- ULONG count, def;
+ ULONG i, count, def;
BOOL variance_present;
unsigned char alignment;
@@ -2314,7 +2314,8 @@ unsigned char * WINAPI NdrComplexArrayMa
ALIGN_POINTER(pStubMsg->Buffer, alignment);
- for (count = 0; count < pStubMsg->ActualCount; count++)
+ count = pStubMsg->ActualCount;
+ for (i = 0; i < count; i++)
pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL);
STD_OVERFLOW_CHECK(pStubMsg);
@@ -2330,7 +2331,7 @@ unsigned char * WINAPI NdrComplexArrayUn
PFORMAT_STRING pFormat,
unsigned char fMustAlloc)
{
- ULONG count, esize;
+ ULONG i, count, esize;
unsigned char alignment;
unsigned char *pMemory;
unsigned char *Buffer;
@@ -2364,7 +2365,8 @@ unsigned char * WINAPI NdrComplexArrayUn
ALIGN_POINTER(pStubMsg->Buffer, alignment);
pMemory = *ppMemory;
- for (count = 0; count < pStubMsg->ActualCount; count++)
+ count = pStubMsg->ActualCount;
+ for (i = 0; i < count; i++)
pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL, fMustAlloc);
return NULL;
@@ -2377,7 +2379,7 @@ void WINAPI NdrComplexArrayBufferSize(PM
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
- ULONG count, def;
+ ULONG i, count, def;
unsigned char alignment;
BOOL variance_present;
@@ -2408,7 +2410,8 @@ void WINAPI NdrComplexArrayBufferSize(PM
ALIGN_LENGTH(pStubMsg->BufferLength, alignment);
- for (count=0; count < pStubMsg->ActualCount; count++)
+ count = pStubMsg->ActualCount;
+ for (i = 0; i < count; i++)
pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL);
}
@@ -2418,7 +2421,7 @@ void WINAPI NdrComplexArrayBufferSize(PM
unsigned long WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
- ULONG count, esize;
+ ULONG i, count, esize;
unsigned char alignment;
unsigned char *Buffer;
unsigned long SavedMemorySize;
@@ -2450,7 +2453,8 @@ unsigned long WINAPI NdrComplexArrayMemo
MemorySize = esize * pStubMsg->MaxCount;
- for (count = 0; count < pStubMsg->ActualCount; count++)
+ count = pStubMsg->ActualCount;
+ for (i = 0; i < count; i++)
ComplexStructMemorySize(pStubMsg, pFormat);
pStubMsg->MemorySize = SavedMemorySize;
@@ -2466,7 +2470,7 @@ void WINAPI NdrComplexArrayFree(PMIDL_ST
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
- ULONG count, def;
+ ULONG i, count, def;
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
@@ -2486,7 +2490,8 @@ void WINAPI NdrComplexArrayFree(PMIDL_ST
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
TRACE("variance = %ld\n", pStubMsg->ActualCount);
- for (count=0; count < pStubMsg->ActualCount; count++)
+ count = pStubMsg->ActualCount;
+ for (i = 0; i < count; i++)
pMemory = ComplexFree(pStubMsg, pMemory, pFormat, NULL);
}
More information about the wine-cvs
mailing list