From: Nikolay Sivov Subject: [PATCH 3/5] ole32: Get rid of casts in WORD serialization helper. Message-Id: <20191212104323.102298-3-nsivov@codeweavers.com> Date: Thu, 12 Dec 2019 13:43:21 +0300 In-Reply-To: <20191212104323.102298-1-nsivov@codeweavers.com> References: <20191212104323.102298-1-nsivov@codeweavers.com> Signed-off-by: Nikolay Sivov --- dlls/ole32/stg_prop.c | 7 +++---- dlls/ole32/storage32.c | 6 +++--- dlls/ole32/storage32.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index d6b0d6c215..79f1c20742 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -1708,9 +1708,8 @@ static void PropertyStorage_MakeHeader(PropertyStorage_impl *This, PROPERTYSETHEADER *hdr) { assert(hdr); - StorageUtl_WriteWord((BYTE *)&hdr->wByteOrder, 0, - PROPSETHDR_BYTEORDER_MAGIC); - StorageUtl_WriteWord((BYTE *)&hdr->wFormat, 0, This->format); + StorageUtl_WriteWord(&hdr->wByteOrder, 0, PROPSETHDR_BYTEORDER_MAGIC); + StorageUtl_WriteWord(&hdr->wFormat, 0, This->format); StorageUtl_WriteDWord(&hdr->dwOSVer, 0, This->originatorOS); StorageUtl_WriteGUID((BYTE *)&hdr->clsid, 0, &This->clsid); StorageUtl_WriteDWord(&hdr->reserved, 0, 1); @@ -1934,7 +1933,7 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This, { WORD wTemp; - StorageUtl_WriteWord((LPBYTE)&wTemp, 0, var->u.iVal); + StorageUtl_WriteWord(&wTemp, 0, var->u.iVal); hr = IStream_Write(This->stm, &wTemp, sizeof(wTemp), &count); bytesWritten = count; break; diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 08a1d2201f..6e0a9bb449 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -6948,10 +6948,10 @@ void StorageUtl_ReadWord(const BYTE* buffer, ULONG offset, WORD* value) *value = lendian16toh(tmp); } -void StorageUtl_WriteWord(BYTE* buffer, ULONG offset, WORD value) +void StorageUtl_WriteWord(void *buffer, ULONG offset, WORD value) { - value = htole16(value); - memcpy(buffer+offset, &value, sizeof(WORD)); + value = htole16(value); + memcpy((BYTE *)buffer + offset, &value, sizeof(WORD)); } void StorageUtl_ReadDWord(const BYTE* buffer, ULONG offset, DWORD* value) diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index a54871f55b..046334b98b 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -556,7 +556,7 @@ StgStreamImpl* StgStreamImpl_Construct( * worry about bit order */ void StorageUtl_ReadWord(const BYTE* buffer, ULONG offset, WORD* value) DECLSPEC_HIDDEN; -void StorageUtl_WriteWord(BYTE* buffer, ULONG offset, WORD value) DECLSPEC_HIDDEN; +void StorageUtl_WriteWord(void *buffer, ULONG offset, WORD value) DECLSPEC_HIDDEN; void StorageUtl_ReadDWord(const BYTE* buffer, ULONG offset, DWORD* value) DECLSPEC_HIDDEN; void StorageUtl_WriteDWord(void *buffer, ULONG offset, DWORD value) DECLSPEC_HIDDEN; void StorageUtl_ReadULargeInteger(const BYTE* buffer, ULONG offset, -- 2.24.0