summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-27 22:46:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 22:46:28 +0000
commit7c7f78a432a41b7074d225a91a590185e02aacf7 (patch)
tree391e7f4922444d11eb3ec48834ae7e677eda839e /core
parent743cfe00e32fc70540f06e41a613087929a5d4ac (diff)
downloadpdfium-7c7f78a432a41b7074d225a91a590185e02aacf7.tar.xz
Use C++ style struct syntax (file already has other C++ features). Assert that things have packed as intended since they map to known layouts. Order these asserts in the same order as .h file. Change-Id: I0a006c4b5789fb544783f488d5b4e609e32c7ec1 Reviewed-on: https://pdfium-review.googlesource.com/31654 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fxcodec/gif/cfx_gif.cpp20
-rw-r--r--core/fxcodec/gif/cfx_gif.h44
2 files changed, 38 insertions, 26 deletions
diff --git a/core/fxcodec/gif/cfx_gif.cpp b/core/fxcodec/gif/cfx_gif.cpp
index e87b9df975..18d474ba9a 100644
--- a/core/fxcodec/gif/cfx_gif.cpp
+++ b/core/fxcodec/gif/cfx_gif.cpp
@@ -9,15 +9,23 @@
const char kGifSignature87[] = "GIF87a";
const char kGifSignature89[] = "GIF89a";
+static_assert(sizeof(CFX_GifGlobalFlags) == 1,
+ "CFX_GifGlobalFlags should have a size of 1");
+static_assert(sizeof(CFX_GifLocalFlags) == 1,
+ "CFX_GifLocalFlags should have a size of 1");
+static_assert(sizeof(CFX_GifHeader) == 6,
+ "CFX_GifHeader should have a size of 6");
+static_assert(sizeof(CFX_GifLocalScreenDescriptor) == 7,
+ "CFX_GifLocalScreenDescriptor should have a size of 7");
static_assert(sizeof(CFX_CFX_GifImageInfo) == 9,
"CFX_CFX_GifImageInfo should have a size of 9");
-static_assert(sizeof(CFX_GifPalette) == 3,
- "CFX_GifPalette should have a size of 3");
+static_assert(sizeof(CFX_GifControlExtensionFlags) == 1,
+ "CFX_GifControlExtensionFlags should have a size of 1");
static_assert(sizeof(CFX_GifPlainTextExtension) == 13,
"CFX_GifPlainTextExtension should have a size of 13");
static_assert(sizeof(CFX_GifGraphicControlExtension) == 5,
"CFX_GifGraphicControlExtension should have a size of 5");
-static_assert(sizeof(CFX_GifHeader) == 6,
- "CFX_GifHeader should have a size of 6");
-static_assert(sizeof(CFX_GifLocalScreenDescriptor) == 7,
- "CFX_GifLocalScreenDescriptor should have a size of 7");
+static_assert(sizeof(GifApplicationExtension) == 12,
+ "GifApplicationExtension should have a size of 12");
+static_assert(sizeof(CFX_GifPalette) == 3,
+ "CFX_GifPalette should have a size of 3");
diff --git a/core/fxcodec/gif/cfx_gif.h b/core/fxcodec/gif/cfx_gif.h
index 5abe1ad33f..bba2d9c911 100644
--- a/core/fxcodec/gif/cfx_gif.h
+++ b/core/fxcodec/gif/cfx_gif.h
@@ -36,74 +36,78 @@ extern const char kGifSignature89[];
#define GIF_D_STATUS_IMG_DATA 0x0A
#pragma pack(1)
-typedef struct {
+struct CFX_GifGlobalFlags {
uint8_t pal_bits : 3;
uint8_t sort_flag : 1;
uint8_t color_resolution : 3;
uint8_t global_pal : 1;
-} CFX_GifGlobalFlags;
+};
-typedef struct {
+struct CFX_GifLocalFlags {
uint8_t pal_bits : 3;
uint8_t reserved : 2;
uint8_t sort_flag : 1;
uint8_t interlace : 1;
uint8_t local_pal : 1;
-} CFX_GifLocalFlags;
+};
-typedef struct { char signature[6]; } CFX_GifHeader;
+struct CFX_GifHeader {
+ char signature[6];
+};
-typedef struct {
+struct CFX_GifLocalScreenDescriptor {
uint16_t width;
uint16_t height;
CFX_GifGlobalFlags global_flags;
uint8_t bc_index;
uint8_t pixel_aspect;
-} CFX_GifLocalScreenDescriptor;
+};
-typedef struct {
+struct CFX_CFX_GifImageInfo {
uint16_t left;
uint16_t top;
uint16_t width;
uint16_t height;
CFX_GifLocalFlags local_flags;
-} CFX_CFX_GifImageInfo;
+};
-typedef struct {
+struct CFX_GifControlExtensionFlags {
uint8_t transparency : 1;
uint8_t user_input : 1;
uint8_t disposal_method : 3;
uint8_t reserved : 3;
-} CFX_GifControlExtensionFlags;
+};
-typedef struct {
+struct CFX_GifGraphicControlExtension {
uint8_t block_size;
CFX_GifControlExtensionFlags gce_flags;
uint16_t delay_time;
uint8_t trans_index;
-} CFX_GifGraphicControlExtension;
+};
-typedef struct {
+struct CFX_GifPlainTextExtension {
uint8_t block_size;
uint16_t grid_left;
uint16_t grid_top;
uint16_t grid_width;
uint16_t grid_height;
-
uint8_t char_width;
uint8_t char_height;
-
uint8_t fc_index;
uint8_t bc_index;
-} CFX_GifPlainTextExtension;
+};
-typedef struct {
+struct GifApplicationExtension {
uint8_t block_size;
uint8_t app_identify[8];
uint8_t app_authentication[3];
-} GifApplicationExtension;
+};
-typedef struct { uint8_t r, g, b; } CFX_GifPalette;
+struct CFX_GifPalette {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+};
#pragma pack()
enum class CFX_GifDecodeStatus {