]> granicus.if.org Git - libvpx/commitdiff
halloc: Cast the offsetof macro to ptrdiff_t before negating
authorMartin Storsjo <martin@martin.st>
Sun, 19 May 2013 09:54:23 +0000 (12:54 +0300)
committerMartin Storsjo <martin@martin.st>
Fri, 7 Jun 2013 07:18:59 +0000 (10:18 +0300)
This gets rid of the warning
"C4146: unary minus applied to unsigned type, result still unsigned"
with visual c++.

Change-Id: I6eb24da983136d798221db4d3a5f50dc2857a03b

nestegg/halloc/src/macros.h

index c36b516eed38c5728761b6c82d2829bcccc3324f..1f84bc2779363aacb31c010c4ea10f82f3060f2a 100644 (file)
@@ -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