Add compile assertions to enforce the sizes of all structs and enums in the C API. Adjust some structs to make their sizes consistent across architectures. Note that some structs contain pointers, so are difficult to make consistent between 32-bit and 64-bit. Those types are in test_struct_sizes.c. Other types have a compile assertion immediately after their definition.
This was broken off from a bigger CL:
http://codereview.chromium.org/5340003/
BUG=61004,92983
TEST=test_struct_sizes.c, compile assertions throughout
See this CL for the code that helped generate the static assertions and find affected interfaces:
http://codereview.chromium.org/5730003
Review URL: http://codereview.chromium.org/5674004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69038 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/c/ppb_image_data.h b/ppapi/c/ppb_image_data.h
index 6387941..ce9356f 100644
--- a/ppapi/c/ppb_image_data.h
+++ b/ppapi/c/ppb_image_data.h
@@ -6,6 +6,7 @@
#define PPAPI_C_PPB_IMAGE_DATA_H_
#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_size.h"
@@ -15,6 +16,7 @@
PP_IMAGEDATAFORMAT_BGRA_PREMUL,
PP_IMAGEDATAFORMAT_RGBA_PREMUL
} PP_ImageDataFormat;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4);
struct PP_ImageDataDesc {
PP_ImageDataFormat format;
@@ -26,6 +28,7 @@
// may be padding at the end of the lines.
int32_t stride;
};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ImageDataDesc, 16);
#define PPB_IMAGEDATA_INTERFACE "PPB_ImageData;0.2"