diff options
author | dmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 20:04:31 +0000 |
---|---|---|
committer | dmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 20:04:31 +0000 |
commit | 1ad2a1dbcde42412bb92c83fe5e0d6999ed00311 (patch) | |
tree | bec94376d42b1943e2830e695956252232283b4d /ppapi/c/dev/ppp_printing_dev.h | |
parent | f68fbd1b300401c79df8df9773bbe7aa36ff6062 (diff) | |
download | chromium_src-1ad2a1dbcde42412bb92c83fe5e0d6999ed00311.zip chromium_src-1ad2a1dbcde42412bb92c83fe5e0d6999ed00311.tar.gz chromium_src-1ad2a1dbcde42412bb92c83fe5e0d6999ed00311.tar.bz2 |
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
Diffstat (limited to 'ppapi/c/dev/ppp_printing_dev.h')
-rw-r--r-- | ppapi/c/dev/ppp_printing_dev.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ppapi/c/dev/ppp_printing_dev.h b/ppapi/c/dev/ppp_printing_dev.h index affecc8..00b5e6b 100644 --- a/ppapi/c/dev/ppp_printing_dev.h +++ b/ppapi/c/dev/ppp_printing_dev.h @@ -7,6 +7,7 @@ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" @@ -17,12 +18,14 @@ typedef enum { PP_PRINTORIENTATION_ROTATED_180 = 2, PP_PRINTORIENTATION_ROTATED_90_CCW = 3 } PP_PrintOrientation_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); typedef enum { PP_PRINTOUTPUTFORMAT_RASTER = 0, PP_PRINTOUTPUTFORMAT_PDF = 1, PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 2 } PP_PrintOutputFormat_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); struct PP_PrintSettings_Dev { // This is the size of the printable area in points (1/72 of an inch) @@ -32,6 +35,7 @@ struct PP_PrintSettings_Dev { PP_Bool grayscale; PP_PrintOutputFormat_Dev format; }; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32); // Specifies a contiguous range of page numbers to be printed. // The page numbers use a zero-based index. @@ -39,6 +43,7 @@ struct PP_PrintPageNumberRange_Dev { uint32_t first_page_number; uint32_t last_page_number; }; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); // Interface for the plugin to implement printing. #define PPP_PRINTING_DEV_INTERFACE "PPP_Printing(Dev);0.2" |