Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: ppapi/c/ppb_var.h

Issue 5674004: Add compile assertions to enforce the sizes of all structs and enums in the C... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/c/ppb_var.h
===================================================================
--- ppapi/c/ppb_var.h (revision 68603)
+++ ppapi/c/ppb_var.h (working copy)
@@ -13,7 +13,7 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
-#define PPB_VAR_INTERFACE "PPB_Var;0.2"
+#define PPB_VAR_INTERFACE "PPB_Var;0.3"
/**
* @file
@@ -33,6 +33,7 @@
PP_OBJECTPROPERTY_MODIFIER_DONTDELETE = 1 << 2,
PP_OBJECTPROPERTY_MODIFIER_HASVALUE = 1 << 3
};
+PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_ObjectProperty_Modifier, 4);
struct PP_ObjectProperty {
struct PP_Var name;
@@ -40,7 +41,16 @@
struct PP_Var getter;
struct PP_Var setter;
uint32_t modifiers;
+
+ /** Ensure that this struct is 72 bytes wide by padding the end. In some
+ * compilers, PP_Var is 8-byte aligned, so those compilers align this struct
+ * on 8-byte boundaries as well and pad it to 72 bytes even without this
+ * padding attribute. This padding makes its size consistent across
+ * compilers.
+ */
+ int32_t padding;
};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ObjectProperty, 72);
/**
* PPB_Var API

Powered by Google App Engine
This is Rietveld 408576698