[PATCH v4 1/3] storage.dll16: Fix negation in IStream::Seek.

Huw Davies huw at codeweavers.com
Mon Feb 13 02:45:33 CST 2017


On Sun, Feb 12, 2017 at 12:03:20PM -0600, Zebediah Figura wrote:
> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
> ---
>  dlls/storage.dll16/storage.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/dlls/storage.dll16/storage.c b/dlls/storage.dll16/storage.c
> index 74aa7f9..7a5b367 100644
> --- a/dlls/storage.dll16/storage.c
> +++ b/dlls/storage.dll16/storage.c
> @@ -1196,9 +1196,8 @@ HRESULT CDECL IStream16_fnSeek(IStream16 *iface, LARGE_INTEGER offset, DWORD whe
>  		break;
>  	case SEEK_CUR:
>  		if (offset.u.HighPart < 0) {
> -			/* FIXME: is this negation correct ? */
> -			offset.u.HighPart = -offset.u.HighPart;
> -			offset.u.LowPart = (0xffffffff ^ offset.u.LowPart)+1;
> +			offset.u.HighPart = ~offset.u.HighPart + (offset.u.LowPart ? 0 : 1);
> +			offset.u.LowPart = -offset.u.LowPart;
>  
>  			assert(offset.u.HighPart==0);
>  			assert(This->offset.u.LowPart >= offset.u.LowPart);
> -- 

Couldn't you just replace the whole SEEK_CUR branch with:
    This->offset.QuadPart += offset.QuadPart;

Huw.



More information about the wine-devel mailing list