From: Martin Storsjo Date: Sun, 19 May 2013 09:54:23 +0000 (+0300) Subject: halloc: Cast the offsetof macro to ptrdiff_t before negating X-Git-Tag: v1.3.0~1112^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf8c6207786bc64716186cb2ca8955344dde6307;p=libvpx halloc: Cast the offsetof macro to ptrdiff_t before negating This gets rid of the warning "C4146: unary minus applied to unsigned type, result still unsigned" with visual c++. Change-Id: I6eb24da983136d798221db4d3a5f50dc2857a03b --- diff --git a/nestegg/halloc/src/macros.h b/nestegg/halloc/src/macros.h index c36b516ee..1f84bc277 100644 --- a/nestegg/halloc/src/macros.h +++ b/nestegg/halloc/src/macros.h @@ -20,7 +20,7 @@ /* restore pointer to the structure by a pointer to its field */ -#define structof(p,t,f) ((t*)(- offsetof(t,f) + (char*)(p))) +#define structof(p,t,f) ((t*)(- (ptrdiff_t) offsetof(t,f) + (char*)(p))) /* * redefine for the target compiler