Nikolay Sivov : ole32: Get rid of casts in WORD serialization helper.

Alexandre Julliard julliard at winehq.org
Thu Dec 12 16:29:42 CST 2019


Module: wine
Branch: master
Commit: 4d605e8683b1bbf22ac6ea15cd9c9d1de7d75a55
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4d605e8683b1bbf22ac6ea15cd9c9d1de7d75a55

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Dec 12 13:43:21 2019 +0300

ole32: Get rid of casts in WORD serialization helper.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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,




More information about the wine-cvs mailing list