rpcrt4: Use macros to generate the code for unmarshaling base types.

This commit is contained in:
Robert Shearman 2006-05-19 16:02:59 +01:00 committed by Alexandre Julliard
parent 19fad8e710
commit a2767e8d71

View File

@ -4106,49 +4106,43 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
TRACE("*ppMemory: %p\n", *ppMemory); TRACE("*ppMemory: %p\n", *ppMemory);
#define BASE_TYPE_UNMARSHALL(type) \
ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \
**(type **)ppMemory = *(type *)pStubMsg->Buffer; \
pStubMsg->Buffer += sizeof(type);
switch(*pFormat) switch(*pFormat)
{ {
case RPC_FC_BYTE: case RPC_FC_BYTE:
case RPC_FC_CHAR: case RPC_FC_CHAR:
case RPC_FC_SMALL: case RPC_FC_SMALL:
case RPC_FC_USMALL: case RPC_FC_USMALL:
**(UCHAR **)ppMemory = *(UCHAR *)pStubMsg->Buffer; BASE_TYPE_UNMARSHALL(UCHAR);
pStubMsg->Buffer += sizeof(UCHAR);
TRACE("value: 0x%02x\n", **(UCHAR **)ppMemory); TRACE("value: 0x%02x\n", **(UCHAR **)ppMemory);
break; break;
case RPC_FC_WCHAR: case RPC_FC_WCHAR:
case RPC_FC_SHORT: case RPC_FC_SHORT:
case RPC_FC_USHORT: case RPC_FC_USHORT:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); BASE_TYPE_UNMARSHALL(USHORT);
**(USHORT **)ppMemory = *(USHORT *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(USHORT);
TRACE("value: 0x%04x\n", **(USHORT **)ppMemory); TRACE("value: 0x%04x\n", **(USHORT **)ppMemory);
break; break;
case RPC_FC_LONG: case RPC_FC_LONG:
case RPC_FC_ULONG: case RPC_FC_ULONG:
case RPC_FC_ERROR_STATUS_T: case RPC_FC_ERROR_STATUS_T:
case RPC_FC_ENUM32: case RPC_FC_ENUM32:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); BASE_TYPE_UNMARSHALL(ULONG);
**(ULONG **)ppMemory = *(ULONG *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(ULONG);
TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory); TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
break; break;
case RPC_FC_FLOAT: case RPC_FC_FLOAT:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(float)); BASE_TYPE_UNMARSHALL(float);
**(float **)ppMemory = *(float *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(float);
TRACE("value: %f\n", **(float **)ppMemory); TRACE("value: %f\n", **(float **)ppMemory);
break; break;
case RPC_FC_DOUBLE: case RPC_FC_DOUBLE:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(double)); BASE_TYPE_UNMARSHALL(double);
**(double **)ppMemory = *(double*)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(double);
TRACE("value: %f\n", **(double **)ppMemory); TRACE("value: %f\n", **(double **)ppMemory);
break; break;
case RPC_FC_HYPER: case RPC_FC_HYPER:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG)); BASE_TYPE_UNMARSHALL(ULONGLONG);
**(ULONGLONG **)ppMemory = *(ULONGLONG *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(ULONGLONG);
TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory)); TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory));
break; break;
case RPC_FC_ENUM16: case RPC_FC_ENUM16:
@ -4161,6 +4155,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
default: default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat); FIXME("Unhandled base type: 0x%02x\n", *pFormat);
} }
#undef BASE_TYPE_UNMARSHALL
/* FIXME: what is the correct return value? */ /* FIXME: what is the correct return value? */