From b91e5302a5cc2b5d8036367d4e42e4020a4c64a5 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 2 Apr 2010 21:54:55 +0200 Subject: [PATCH] rpcrt4: Replace the alignment macros by inline functions. --- dlls/rpcrt4/ndr_marshall.c | 292 +++++++++++++++++++------------------ 1 file changed, 149 insertions(+), 143 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 62f5847a189..ac720551b73 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -91,17 +91,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); LITTLE_ENDIAN_UINT32_READ(pchar) #endif -/* _Align must be the desired alignment, - * e.g. ALIGN_LENGTH(len, 4) to align on a dword boundary. */ -#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align)-1)&~((ULONG_PTR)(_Align)-1)) -#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align)) -#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align) -#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align) -#define ALIGN_POINTER_CLEAR(_Ptr, _Align) \ - do { \ - memset((_Ptr), 0, ((_Align) - (ULONG_PTR)(_Ptr)) & ((_Align) - 1)); \ - ALIGN_POINTER(_Ptr, _Align); \ - } while(0) +static inline void align_length( ULONG *len, unsigned int align ) +{ + *len = (*len + align - 1) & ~(align - 1); +} + +static inline void align_pointer( unsigned char **ptr, unsigned int align ) +{ + ULONG_PTR mask = align - 1; + *ptr = (unsigned char *)(((ULONG_PTR)*ptr + mask) & ~mask); +} + +static inline void align_pointer_clear( unsigned char **ptr, unsigned int align ) +{ + ULONG_PTR mask = align - 1; + memset( *ptr, 0, (align - (ULONG_PTR)*ptr) & mask ); + *ptr = (unsigned char *)(((ULONG_PTR)*ptr + mask) & ~mask); +} #define STD_OVERFLOW_CHECK(_Msg) do { \ TRACE("buffer=%d/%d\n", (ULONG)(_Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer), _Msg->BufferLength); \ @@ -377,7 +383,7 @@ void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len) void *p; NDR_MEMORY_LIST *mem_list; - aligned_len = ALIGNED_LENGTH(len, 8); + aligned_len = (len + 7) & ~7; adjusted_len = aligned_len + sizeof(NDR_MEMORY_LIST); /* check for overflow */ if (adjusted_len < len) @@ -414,7 +420,7 @@ static inline BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat) static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 4 > pStubMsg->BufferEnd) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); @@ -435,7 +441,7 @@ static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_S goto done; } - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 8 > pStubMsg->BufferEnd) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->Offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); @@ -464,7 +470,7 @@ done: /* writes the conformance value to the buffer */ static inline void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 4 > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount); @@ -474,7 +480,7 @@ static inline void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg) /* writes the variance values to the buffer */ static inline void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 8 > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset); @@ -486,7 +492,7 @@ static inline void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg) /* requests buffer space for the conformance value */ static inline void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); if (pStubMsg->BufferLength + 4 < pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->BufferLength += 4; @@ -495,7 +501,7 @@ static inline void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg) /* requests buffer space for the variance values */ static inline void SizeVariance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); if (pStubMsg->BufferLength + 8 < pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->BufferLength += 8; @@ -1047,7 +1053,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, } if (attr & RPC_FC_P_DEREF) { - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void*)); + align_length(&pStubMsg->MemorySize, sizeof(void*)); pStubMsg->MemorySize += sizeof(void*); TRACE("deref\n"); } @@ -1482,7 +1488,7 @@ unsigned char * WINAPI NdrPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, * the buffer, and shouldn't write any additional pointer data to the wire */ if (*pFormat != RPC_FC_RP) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); Buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, 4); } @@ -1524,7 +1530,7 @@ unsigned char * WINAPI NdrPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, * as that is used by embedded pointers which already handle the incrementing * the buffer, and shouldn't read any additional pointer data from the * buffer */ - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); Buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, 4); } @@ -1548,7 +1554,7 @@ void WINAPI NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, * length, and shouldn't write anything more to the wire */ if (*pFormat != RPC_FC_RP) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); } @@ -1564,10 +1570,10 @@ ULONG WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer = pStubMsg->Buffer; if (*pFormat != RPC_FC_RP) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); safe_buffer_increment(pStubMsg, 4); } - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void *)); + align_length(&pStubMsg->MemorySize, sizeof(void *)); return PointerMemorySize(pStubMsg, Buffer, pFormat); } @@ -1604,7 +1610,7 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* unsigned char FormatChar ) { #define BASE_TYPE_UNMARSHALL(type) \ - ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \ + align_pointer(&pStubMsg->Buffer, sizeof(type)); \ TRACE("pMemory: %p\n", pMemory); \ *(type *)pMemory = *(type *)pStubMsg->Buffer; \ pStubMsg->Buffer += sizeof(type); @@ -1644,7 +1650,7 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG *)pMemory)); break; case RPC_FC_ENUM16: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); TRACE("pMemory: %p\n", pMemory); /* 16-bits on the wire, but int in memory */ *(UINT *)pMemory = *(USHORT *)pStubMsg->Buffer; @@ -1669,7 +1675,7 @@ unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer_clear(&pStubMsg->Buffer, pFormat[1] + 1); pStubMsg->BufferMark = pStubMsg->Buffer; safe_copy_to_buffer(pStubMsg, pMemory, size); @@ -1692,7 +1698,7 @@ unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *saved_buffer; TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); if (fMustAlloc) *ppMemory = NdrAllocate(pStubMsg, size); @@ -1725,7 +1731,7 @@ void WINAPI NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1); + align_length(&pStubMsg->BufferLength, pFormat[1] + 1); safe_buffer_length_increment(pStubMsg, size); if (pFormat[0] != RPC_FC_STRUCT) @@ -1742,7 +1748,7 @@ ULONG WINAPI NdrSimpleStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p)\n", pStubMsg, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); pStubMsg->MemorySize += size; safe_buffer_increment(pStubMsg, size); @@ -1822,7 +1828,7 @@ static inline void array_buffer_size( pFormat = SkipConformance(pStubMsg, pFormat + 4); - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + align_length(&pStubMsg->BufferLength, alignment); size = safe_multiply(esize, pStubMsg->MaxCount); /* conformance value plus array */ @@ -1840,7 +1846,7 @@ static inline void array_buffer_size( SizeVariance(pStubMsg); - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + align_length(&pStubMsg->BufferLength, alignment); size = safe_multiply(esize, pStubMsg->ActualCount); safe_buffer_length_increment(pStubMsg, size); @@ -1922,7 +1928,7 @@ static inline void array_write_variance_and_marshall( pFormat = SkipConformance(pStubMsg, pFormat + 4); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); + align_pointer_clear(&pStubMsg->Buffer, alignment); size = safe_multiply(esize, pStubMsg->MaxCount); if (fHasPointers) @@ -1943,7 +1949,7 @@ static inline void array_write_variance_and_marshall( WriteVariance(pStubMsg); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); + align_pointer_clear(&pStubMsg->Buffer, alignment); size = safe_multiply(esize, pStubMsg->ActualCount); @@ -2026,7 +2032,7 @@ static inline ULONG array_read_variance_and_unmarshall( pFormat = SkipConformance(pStubMsg, pFormat + 4); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); if (fUnmarshall) { @@ -2058,7 +2064,7 @@ static inline ULONG array_read_variance_and_unmarshall( pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); bufsize = safe_multiply(esize, pStubMsg->ActualCount); memsize = safe_multiply(esize, pStubMsg->MaxCount); @@ -2158,7 +2164,7 @@ static inline void array_memory_size( bufsize = memsize = safe_multiply(esize, pStubMsg->MaxCount); pStubMsg->MemorySize += memsize; - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); if (fHasPointers) pStubMsg->BufferMark = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, bufsize); @@ -2178,7 +2184,7 @@ static inline void array_memory_size( memsize = safe_multiply(esize, pStubMsg->MaxCount); pStubMsg->MemorySize += memsize; - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); if (fHasPointers) pStubMsg->BufferMark = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, bufsize); @@ -2724,7 +2730,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (*pFormat != RPC_FC_POINTER) pPointer = pFormat; if (*pPointer != RPC_FC_RP) - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -2752,13 +2758,13 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, break; } case RPC_FC_ALIGNM2: - ALIGN_POINTER(pMemory, 2); + align_pointer(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 4); + align_pointer(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 8); + align_pointer(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -2871,7 +2877,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (*pFormat != RPC_FC_POINTER) pPointer = pFormat; if (*pPointer != RPC_FC_RP) - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -2899,13 +2905,13 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, break; } case RPC_FC_ALIGNM2: - ALIGN_POINTER_CLEAR(pMemory, 2); + align_pointer_clear(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER_CLEAR(pMemory, 4); + align_pointer_clear(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER_CLEAR(pMemory, 8); + align_pointer_clear(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3017,7 +3023,7 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, } if (*pPointer != RPC_FC_RP) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); } if (*pFormat == RPC_FC_POINTER) @@ -3027,13 +3033,13 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pMemory += sizeof(void*); break; case RPC_FC_ALIGNM2: - ALIGN_POINTER(pMemory, 2); + align_pointer(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 4); + align_pointer(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 8); + align_pointer(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3124,13 +3130,13 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, pMemory += sizeof(void *); break; case RPC_FC_ALIGNM2: - ALIGN_POINTER(pMemory, 2); + align_pointer(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 4); + align_pointer(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 8); + align_pointer(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3221,7 +3227,7 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, if (*pFormat != RPC_FC_POINTER) pPointer = pFormat; if (*pPointer != RPC_FC_RP) - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -3250,13 +3256,13 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, break; } case RPC_FC_ALIGNM2: - ALIGN_LENGTH(size, 2); + align_length(&size, 2); break; case RPC_FC_ALIGNM4: - ALIGN_LENGTH(size, 4); + align_length(&size, 4); break; case RPC_FC_ALIGNM8: - ALIGN_LENGTH(size, 8); + align_length(&size, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3324,13 +3330,13 @@ ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) pFormat += 4; break; case RPC_FC_ALIGNM2: - ALIGN_LENGTH(size, 2); + align_length(&size, 2); break; case RPC_FC_ALIGNM4: - ALIGN_LENGTH(size, 4); + align_length(&size, 4); break; case RPC_FC_ALIGNM8: - ALIGN_LENGTH(size, 8); + align_length(&size, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3398,7 +3404,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = saved_buffer_length; } - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer_clear(&pStubMsg->Buffer, pFormat[1] + 1); pFormat += 4; if (*(const SHORT*)pFormat) conf_array = pFormat + *(const SHORT*)pFormat; @@ -3484,7 +3490,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->Buffer = saved_buffer; } - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); pFormat += 4; if (*(const SHORT*)pFormat) conf_array = pFormat + *(const SHORT*)pFormat; @@ -3549,7 +3555,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1); + align_length(&pStubMsg->BufferLength, pFormat[1] + 1); if(!pStubMsg->IgnoreEmbeddedPointers && !pStubMsg->PointerLength) { @@ -3627,7 +3633,7 @@ ULONG WINAPI NdrComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p)\n", pStubMsg, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); pFormat += 4; if (*(const SHORT*)pFormat) conf_array = pFormat + *(const SHORT*)pFormat; @@ -3977,7 +3983,7 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (variance_present) WriteVariance(pStubMsg); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); + align_pointer_clear(&pStubMsg->Buffer, alignment); count = pStubMsg->ActualCount; for (i = 0; i < count; i++) @@ -4051,7 +4057,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (fMustAlloc) *ppMemory = NdrAllocate(pStubMsg, size); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); pMemory = *ppMemory; count = pStubMsg->ActualCount; @@ -4130,7 +4136,7 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, if (variance_present) SizeVariance(pStubMsg); - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + align_length(&pStubMsg->BufferLength, alignment); count = pStubMsg->ActualCount; for (i = 0; i < count; i++) @@ -4168,7 +4174,7 @@ ULONG WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pFormat = ReadConformance(pStubMsg, pFormat); pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); SavedMemorySize = pStubMsg->MemorySize; @@ -4255,7 +4261,7 @@ unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, USER_MARSHAL_PTR_PREFIX); pStubMsg->Buffer += 4; if (pStubMsg->PointerBufferMark) @@ -4264,10 +4270,10 @@ unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->Buffer = pStubMsg->PointerBufferMark; pStubMsg->PointerBufferMark = NULL; } - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 8); + align_pointer_clear(&pStubMsg->Buffer, 8); } else - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, (flags & 0xf) + 1); + align_pointer_clear(&pStubMsg->Buffer, (flags & 0xf) + 1); pStubMsg->Buffer = pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnMarshall( @@ -4306,7 +4312,7 @@ unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); /* skip pointer prefix */ pStubMsg->Buffer += 4; if (pStubMsg->PointerBufferMark) @@ -4315,10 +4321,10 @@ unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->Buffer = pStubMsg->PointerBufferMark; pStubMsg->PointerBufferMark = NULL; } - ALIGN_POINTER(pStubMsg->Buffer, 8); + align_pointer(&pStubMsg->Buffer, 8); } else - ALIGN_POINTER(pStubMsg->Buffer, (flags & 0xf) + 1); + align_pointer(&pStubMsg->Buffer, (flags & 0xf) + 1); if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; @@ -4362,7 +4368,7 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); /* skip pointer prefix */ safe_buffer_length_increment(pStubMsg, 4); if (pStubMsg->IgnoreEmbeddedPointers) @@ -4373,10 +4379,10 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = pStubMsg->PointerLength; pStubMsg->PointerLength = 0; } - ALIGN_LENGTH(pStubMsg->BufferLength, 8); + align_length(&pStubMsg->BufferLength, 8); } else - ALIGN_LENGTH(pStubMsg->BufferLength, (flags & 0xf) + 1); + align_length(&pStubMsg->BufferLength, (flags & 0xf) + 1); if (bufsize) { TRACE("size=%d\n", bufsize); @@ -4413,15 +4419,15 @@ ULONG WINAPI NdrUserMarshalMemorySize(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); /* skip pointer prefix */ pStubMsg->Buffer += 4; if (pStubMsg->IgnoreEmbeddedPointers) return pStubMsg->MemorySize; - ALIGN_POINTER(pStubMsg->Buffer, 8); + align_pointer(&pStubMsg->Buffer, 8); } else - ALIGN_POINTER(pStubMsg->Buffer, (flags & 0xf) + 1); + align_pointer(&pStubMsg->Buffer, (flags & 0xf) + 1); if (!bufsize) FIXME("not implemented for varying buffer size\n"); @@ -4578,7 +4584,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, WriteConformance(pStubMsg); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pCStructFormat->alignment + 1); + align_pointer_clear(&pStubMsg->Buffer, pCStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCStructFormat->memory_size); @@ -4633,7 +4639,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs pCArrayFormat = ReadConformance(pStubMsg, pCArrayFormat + 4); - ALIGN_POINTER(pStubMsg->Buffer, pCStructFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pCStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCStructFormat->memory_size); @@ -4702,7 +4708,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pCArrayFormat = ComputeConformance(pStubMsg, pMemory + pCStructFormat->memory_size, pCArrayFormat+4, 0); SizeConformance(pStubMsg); - ALIGN_LENGTH(pStubMsg->BufferLength, pCStructFormat->alignment + 1); + align_length(&pStubMsg->BufferLength, pCStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCStructFormat->memory_size); @@ -4791,7 +4797,7 @@ unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pS pMemory + pCVStructFormat->memory_size, pCVArrayFormat); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pCVStructFormat->alignment + 1); + align_pointer_clear(&pStubMsg->Buffer, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -4839,7 +4845,7 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE memsize = array_read_conformance(*pCVArrayFormat, pStubMsg, pCVArrayFormat); - ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -4913,7 +4919,7 @@ void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pMemory + pCVStructFormat->memory_size, pCVArrayFormat); - ALIGN_LENGTH(pStubMsg->BufferLength, pCVStructFormat->alignment + 1); + align_length(&pStubMsg->BufferLength, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -4949,7 +4955,7 @@ ULONG WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pCVStructFormat->offset_to_array_description; array_read_conformance(*pCVArrayFormat, pStubMsg, pCVArrayFormat); - ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -5031,7 +5037,7 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, return NULL; } - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); + align_pointer_clear(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5075,7 +5081,7 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, return NULL; } - ALIGN_POINTER(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5129,7 +5135,7 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, return; } - ALIGN_LENGTH(pStubMsg->BufferLength, pSmFArrayFormat->alignment + 1); + align_length(&pStubMsg->BufferLength, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5166,7 +5172,7 @@ ULONG WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, return 0; } - ALIGN_POINTER(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5269,7 +5275,7 @@ unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, WriteVariance(pStubMsg); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); + align_pointer_clear(&pStubMsg->Buffer, alignment); bufsize = safe_multiply(esize, pStubMsg->ActualCount); pStubMsg->BufferMark = pStubMsg->Buffer; @@ -5328,7 +5334,7 @@ unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pFormat = ReadVariance(pStubMsg, pFormat, elements); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); bufsize = safe_multiply(esize, pStubMsg->ActualCount); offset = pStubMsg->Offset; @@ -5397,7 +5403,7 @@ void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, SizeVariance(pStubMsg); - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + align_length(&pStubMsg->BufferLength, alignment); safe_buffer_length_increment(pStubMsg, safe_multiply(esize, pStubMsg->ActualCount)); @@ -5447,7 +5453,7 @@ ULONG WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pFormat = ReadVariance(pStubMsg, pFormat, elements); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); safe_buffer_increment(pStubMsg, safe_multiply(esize, pStubMsg->ActualCount)); pStubMsg->MemorySize += size; @@ -5595,7 +5601,7 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -5663,7 +5669,7 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -5729,7 +5735,7 @@ static void union_arm_buffer_size(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); /* for pointer ID */ if (!pStubMsg->IgnoreEmbeddedPointers) { @@ -5783,10 +5789,10 @@ static ULONG union_arm_memory_size(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, 4); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void *)); + align_length(&pStubMsg->MemorySize, sizeof(void *)); pStubMsg->MemorySize += sizeof(void *); if (!pStubMsg->IgnoreEmbeddedPointers) PointerMemorySize(pStubMsg, saved_buffer, pFormat); @@ -5855,7 +5861,7 @@ unsigned char * WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, increment); + align_pointer_clear(&pStubMsg->Buffer, increment); switch_value = get_discriminant(switch_type, pMemory); TRACE("got switch value 0x%x\n", switch_value); @@ -5887,7 +5893,7 @@ unsigned char * WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubM increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_POINTER(pStubMsg->Buffer, increment); + align_pointer(&pStubMsg->Buffer, increment); switch_value = get_discriminant(switch_type, pStubMsg->Buffer); TRACE("got switch value 0x%x\n", switch_value); @@ -5929,7 +5935,7 @@ void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_LENGTH(pStubMsg->BufferLength, increment); + align_length(&pStubMsg->BufferLength, increment); switch_value = get_discriminant(switch_type, pMemory); TRACE("got switch value 0x%x\n", switch_value); @@ -5954,7 +5960,7 @@ ULONG WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg, increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_POINTER(pStubMsg->Buffer, increment); + align_pointer(&pStubMsg->Buffer, increment); switch_value = get_discriminant(switch_type, pStubMsg->Buffer); TRACE("got switch value 0x%x\n", switch_value); @@ -6034,7 +6040,7 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_USHORT: { USHORT d; - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_copy_from_buffer(pStubMsg, &d, sizeof(d)); discriminant = d; break; @@ -6043,7 +6049,7 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_ULONG: { ULONG d; - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); + align_pointer(&pStubMsg->Buffer, sizeof(ULONG)); safe_copy_from_buffer(pStubMsg, &d, sizeof(d)); discriminant = d; break; @@ -6313,7 +6319,7 @@ unsigned char *WINAPI NdrRangeUnmarshall( #define RANGE_UNMARSHALL(mem_type, wire_type, format_spec) \ do \ { \ - ALIGN_POINTER(pStubMsg->Buffer, sizeof(wire_type)); \ + align_pointer(&pStubMsg->Buffer, sizeof(wire_type)); \ if (!fMustAlloc && !*ppMemory) \ fMustAlloc = TRUE; \ if (fMustAlloc) \ @@ -6461,7 +6467,7 @@ static unsigned char *WINAPI NdrBaseTypeMarshall( case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(USHORT)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(USHORT)); TRACE("value: 0x%04x\n", *(USHORT *)pMemory); break; @@ -6469,20 +6475,20 @@ static unsigned char *WINAPI NdrBaseTypeMarshall( case RPC_FC_ULONG: case RPC_FC_ERROR_STATUS_T: case RPC_FC_ENUM32: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(ULONG)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONG)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONG)); TRACE("value: 0x%08x\n", *(ULONG *)pMemory); break; case RPC_FC_FLOAT: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(float)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(float)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float)); break; case RPC_FC_DOUBLE: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(double)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(double)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(double)); break; case RPC_FC_HYPER: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(ULONGLONG)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONGLONG)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONGLONG)); TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory)); break; @@ -6490,7 +6496,7 @@ static unsigned char *WINAPI NdrBaseTypeMarshall( /* only 16-bits on the wire, so do a sanity check */ if (*(UINT *)pMemory > SHRT_MAX) RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(USHORT)); if (pStubMsg->Buffer + sizeof(USHORT) > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); *(USHORT *)pStubMsg->Buffer = *(UINT *)pMemory; @@ -6519,7 +6525,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false"); #define BASE_TYPE_UNMARSHALL(type) \ - ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \ + align_pointer(&pStubMsg->Buffer, sizeof(type)); \ if (!fMustAlloc && !pStubMsg->IsClient && !*ppMemory) \ { \ *ppMemory = pStubMsg->Buffer; \ @@ -6569,7 +6575,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory)); break; case RPC_FC_ENUM16: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; if (fMustAlloc) @@ -6616,29 +6622,29 @@ static void WINAPI NdrBaseTypeBufferSize( case RPC_FC_SHORT: case RPC_FC_USHORT: case RPC_FC_ENUM16: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(USHORT)); + align_length(&pStubMsg->BufferLength, sizeof(USHORT)); safe_buffer_length_increment(pStubMsg, sizeof(USHORT)); break; case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONG)); + align_length(&pStubMsg->BufferLength, sizeof(ULONG)); safe_buffer_length_increment(pStubMsg, sizeof(ULONG)); break; case RPC_FC_FLOAT: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(float)); + align_length(&pStubMsg->BufferLength, sizeof(float)); safe_buffer_length_increment(pStubMsg, sizeof(float)); break; case RPC_FC_DOUBLE: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(double)); + align_length(&pStubMsg->BufferLength, sizeof(double)); safe_buffer_length_increment(pStubMsg, sizeof(double)); break; case RPC_FC_HYPER: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONGLONG)); + align_length(&pStubMsg->BufferLength, sizeof(ULONGLONG)); safe_buffer_length_increment(pStubMsg, sizeof(ULONGLONG)); break; case RPC_FC_ERROR_STATUS_T: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(error_status_t)); + align_length(&pStubMsg->BufferLength, sizeof(error_status_t)); safe_buffer_length_increment(pStubMsg, sizeof(error_status_t)); break; case RPC_FC_IGNORE: @@ -6669,51 +6675,51 @@ static ULONG WINAPI NdrBaseTypeMemorySize( case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_buffer_increment(pStubMsg, sizeof(USHORT)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(USHORT)); + align_length(&pStubMsg->MemorySize, sizeof(USHORT)); pStubMsg->MemorySize += sizeof(USHORT); return sizeof(USHORT); case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); + align_pointer(&pStubMsg->Buffer, sizeof(ULONG)); safe_buffer_increment(pStubMsg, sizeof(ULONG)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(ULONG)); + align_length(&pStubMsg->MemorySize, sizeof(ULONG)); pStubMsg->MemorySize += sizeof(ULONG); return sizeof(ULONG); case RPC_FC_FLOAT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(float)); + align_pointer(&pStubMsg->Buffer, sizeof(float)); safe_buffer_increment(pStubMsg, sizeof(float)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(float)); + align_length(&pStubMsg->MemorySize, sizeof(float)); pStubMsg->MemorySize += sizeof(float); return sizeof(float); case RPC_FC_DOUBLE: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(double)); + align_pointer(&pStubMsg->Buffer, sizeof(double)); safe_buffer_increment(pStubMsg, sizeof(double)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(double)); + align_length(&pStubMsg->MemorySize, sizeof(double)); pStubMsg->MemorySize += sizeof(double); return sizeof(double); case RPC_FC_HYPER: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG)); + align_pointer(&pStubMsg->Buffer, sizeof(ULONGLONG)); safe_buffer_increment(pStubMsg, sizeof(ULONGLONG)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(ULONGLONG)); + align_length(&pStubMsg->MemorySize, sizeof(ULONGLONG)); pStubMsg->MemorySize += sizeof(ULONGLONG); return sizeof(ULONGLONG); case RPC_FC_ERROR_STATUS_T: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(error_status_t)); + align_pointer(&pStubMsg->Buffer, sizeof(error_status_t)); safe_buffer_increment(pStubMsg, sizeof(error_status_t)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(error_status_t)); + align_length(&pStubMsg->MemorySize, sizeof(error_status_t)); pStubMsg->MemorySize += sizeof(error_status_t); return sizeof(error_status_t); case RPC_FC_ENUM16: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_buffer_increment(pStubMsg, sizeof(USHORT)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(UINT)); + align_length(&pStubMsg->MemorySize, sizeof(UINT)); pStubMsg->MemorySize += sizeof(UINT); return sizeof(UINT); case RPC_FC_IGNORE: - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void *)); + align_length(&pStubMsg->MemorySize, sizeof(void *)); pStubMsg->MemorySize += sizeof(void *); return sizeof(void *); default: @@ -6749,7 +6755,7 @@ static void WINAPI NdrContextHandleBufferSize( ERR("invalid format type %x\n", *pFormat); RpcRaiseException(RPC_S_INTERNAL_ERROR); } - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, cbNDRContext); } @@ -6835,7 +6841,7 @@ void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p, %d)\n", pStubMsg, ContextHandle, fCheck); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6860,7 +6866,7 @@ void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p, %p)\n", pStubMsg, pContextHandle, BindHandle); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > pStubMsg->BufferEnd) RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -6879,7 +6885,7 @@ void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p, %p)\n", pStubMsg, ContextHandle, RundownRoutine); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6900,7 +6906,7 @@ NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg) TRACE("(%p)\n", pStubMsg); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6958,7 +6964,7 @@ void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p, %p)\n", pStubMsg, ContextHandle, RundownRoutine, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6991,7 +6997,7 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p)\n", pStubMsg, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {