Fix -Wc++11-narrowing warnings
authorColin Cross <ccross@android.com>
Mon, 17 Oct 2016 22:49:30 +0000 (15:49 -0700)
committerColin Cross <ccross@android.com>
Mon, 17 Oct 2016 23:07:24 +0000 (16:07 -0700)
The platform default -std=gnu++14 is going to be applied to NDK modules,
cast DE_OFFSET_OF to deUint32 instead of int to prevent a new -Werror
failure.

Test: mma -j
Change-Id: Ief5620089bc069006664d39d68090ea8310344ac

external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp
framework/delibs/debase/deDefs.h

index c849598..3ef3976 100644 (file)
@@ -92,8 +92,8 @@ enum LimitType
        LIMIT_TYPE_LAST
 };
 
-#define LIMIT(_X_)             (deUint32)DE_OFFSET_OF(VkPhysicalDeviceLimits, _X_), (const char*)(#_X_)
-#define FEATURE(_X_)   (deUint32)DE_OFFSET_OF(VkPhysicalDeviceFeatures, _X_)
+#define LIMIT(_X_)             DE_OFFSET_OF(VkPhysicalDeviceLimits, _X_), (const char*)(#_X_)
+#define FEATURE(_X_)   DE_OFFSET_OF(VkPhysicalDeviceFeatures, _X_)
 
 bool validateFeatureLimits(VkPhysicalDeviceProperties* properties, VkPhysicalDeviceFeatures* features, TestLog& log)
 {
index 9bd2663..c6d987a 100644 (file)
@@ -330,7 +330,7 @@ DE_INLINE deBool deGetTrue (void) { return DE_TRUE; }
 #define DE_SWAP(TYPE, A, B) do { TYPE _tmp_ = (A); (A) = (B); (B) = _tmp_; } while(deGetFalse())
 
 /** Offset of a struct member. */
-#define DE_OFFSET_OF(STRUCT, MEMBER) ((int)(deUintptr)(deUint8*)&(((STRUCT*)0)->MEMBER))
+#define DE_OFFSET_OF(STRUCT, MEMBER) ((deUint32)(deUintptr)(deUint8*)&(((STRUCT*)0)->MEMBER))
 
 /* Pointer size. */
 #if defined(DE_PTR_SIZE)