ole32: fix for big-endian machines

Alexandre Julliard julliard at winehq.org
Sat Apr 23 13:18:37 CDT 2005


Juan Lang <juan_lang at yahoo.com> writes:

>  
>  void StorageUtl_ReadWord(const BYTE* buffer, ULONG offset, WORD* value)
>  {
> -  memcpy(value, buffer+offset, sizeof(WORD));
> +  *value = le16toh(*(WORD *)(buffer+offset));
>  }

Why are you removing the memcpy?  Are the offsets guaranteed to always
be properly aligned?

> +#ifdef WORDS_BIGENDIAN
> +
> +/* FIXME: more-optimal versions may be in <byteswap.h>, <sys/bswap.h>, or
> + * <sys/endian.h>.  Use config checks to find 'em.

No, you don't want config checks, what you want to use here is
RtlUshortByteSwap/RtlUlongByteSwap.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list