Fix typos for the word palette.
Also expand another variable name used nearby that has palette
abbreviated as "pal" for consistency.
Change-Id: I2875f80501eaeb05fed306045e46b802e0ade0f5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72332
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/gif/cfx_gif.h b/core/fxcodec/gif/cfx_gif.h
index c0c9d00..497f400 100644
--- a/core/fxcodec/gif/cfx_gif.h
+++ b/core/fxcodec/gif/cfx_gif.h
@@ -126,7 +126,7 @@
std::vector<CFX_GifPalette> local_palettes;
std::vector<uint8_t, FxAllocAllocator<uint8_t>> row_buffer;
CFX_CFX_GifImageInfo image_info;
- uint8_t local_pallette_exp;
+ uint8_t local_palette_exp;
uint8_t code_exp;
uint32_t data_pos;
int32_t row_num;
diff --git a/core/fxcodec/gif/cfx_gifcontext.cpp b/core/fxcodec/gif/cfx_gifcontext.cpp
index 6fc16aa..bbeb8e1 100644
--- a/core/fxcodec/gif/cfx_gifcontext.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext.cpp
@@ -233,11 +233,12 @@
return CFX_GifDecodeStatus::Unfinished;
}
- if (!lzw_decompressor_.get())
+ if (!lzw_decompressor_.get()) {
lzw_decompressor_ = CFX_LZWDecompressor::Create(
- !gif_image->local_palettes.empty() ? gif_image->local_pallette_exp
- : global_pal_exp_,
+ !gif_image->local_palettes.empty() ? gif_image->local_palette_exp
+ : global_palette_exp_,
gif_image->code_exp);
+ }
SaveDecodingStatus(GIF_D_STATUS_IMG_DATA);
img_row_offset_ += img_row_avail_size_;
img_row_avail_size_ = gif_img_row_bytes - img_row_offset_;
@@ -273,12 +274,13 @@
return CFX_GifDecodeStatus::Unfinished;
}
- if (!lzw_decompressor_.get())
- lzw_decompressor_ = CFX_LZWDecompressor::Create(
- !gif_image->local_palettes.empty()
- ? gif_image->local_pallette_exp
- : global_pal_exp_,
- gif_image->code_exp);
+ if (!lzw_decompressor_.get()) {
+ lzw_decompressor_ =
+ CFX_LZWDecompressor::Create(!gif_image->local_palettes.empty()
+ ? gif_image->local_palette_exp
+ : global_palette_exp_,
+ gif_image->code_exp);
+ }
SaveDecodingStatus(GIF_D_STATUS_IMG_DATA);
img_row_offset_ += img_row_avail_size_;
img_row_avail_size_ = gif_img_row_bytes - img_row_offset_;
@@ -389,7 +391,7 @@
return CFX_GifDecodeStatus::Unfinished;
}
- global_pal_exp_ = lsd.global_flags.pal_bits;
+ global_palette_exp_ = lsd.global_flags.pal_bits;
global_sort_flag_ = lsd.global_flags.sort_flag;
global_color_resolution_ = lsd.global_flags.color_resolution;
std::swap(global_palette_, palette);
@@ -484,7 +486,7 @@
CFX_GifLocalFlags* gif_img_info_lf = &img_info.local_flags;
if (gif_img_info_lf->local_pal) {
- gif_image->local_pallette_exp = gif_img_info_lf->pal_bits;
+ gif_image->local_palette_exp = gif_img_info_lf->pal_bits;
uint32_t loc_pal_count = unsigned(2 << gif_img_info_lf->pal_bits);
std::vector<CFX_GifPalette> loc_pal(loc_pal_count);
if (!ReadAllOrNone(reinterpret_cast<uint8_t*>(loc_pal.data()),
@@ -512,8 +514,8 @@
// in the palette being used.
if (graphic_control_extension_->trans_index >=
2 << (gif_image->local_palettes.empty()
- ? global_pal_exp_
- : gif_image->local_pallette_exp))
+ ? global_palette_exp_
+ : gif_image->local_palette_exp))
return CFX_GifDecodeStatus::Error;
}
gif_image->image_GCE = std::move(graphic_control_extension_);
diff --git a/core/fxcodec/gif/cfx_gifcontext.h b/core/fxcodec/gif/cfx_gifcontext.h
index c6c9925..7533d7b 100644
--- a/core/fxcodec/gif/cfx_gifcontext.h
+++ b/core/fxcodec/gif/cfx_gifcontext.h
@@ -47,7 +47,7 @@
UnownedPtr<GifDecoder::Delegate> const delegate_;
std::vector<CFX_GifPalette> global_palette_;
- uint8_t global_pal_exp_ = 0;
+ uint8_t global_palette_exp_ = 0;
uint32_t img_row_offset_ = 0;
uint32_t img_row_avail_size_ = 0;
int32_t decode_status_ = GIF_D_STATUS_SIG;
diff --git a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
index 6ad6784..4cbeeb5 100644
--- a/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext_unittest.cpp
@@ -211,7 +211,7 @@
EXPECT_EQ(0x000A, context.width_);
EXPECT_EQ(0x0F00, context.height_);
EXPECT_EQ(1u, context.bc_index_);
- EXPECT_EQ(1u, context.global_pal_exp_);
+ EXPECT_EQ(1u, context.global_palette_exp_);
EXPECT_EQ(1, context.global_sort_flag_);
EXPECT_EQ(2, context.global_color_resolution_);
EXPECT_EQ(0, memcmp(data.palette, context.global_palette_.data(),
@@ -294,7 +294,7 @@
EXPECT_EQ(0x000A, context.width_);
EXPECT_EQ(0x0F00, context.height_);
EXPECT_EQ(1u, context.bc_index_);
- EXPECT_EQ(1u, context.global_pal_exp_);
+ EXPECT_EQ(1u, context.global_palette_exp_);
EXPECT_EQ(1, context.global_sort_flag_);
EXPECT_EQ(2, context.global_color_resolution_);
EXPECT_EQ(0, memcmp(data.palette, context.global_palette_.data(),
diff --git a/core/fxcodec/gif/gif_decoder.cpp b/core/fxcodec/gif/gif_decoder.cpp
index 24a7b37..7b6f4dd 100644
--- a/core/fxcodec/gif/gif_decoder.cpp
+++ b/core/fxcodec/gif/gif_decoder.cpp
@@ -34,7 +34,7 @@
*width = context->width_;
*height = context->height_;
- *pal_num = (2 << context->global_pal_exp_);
+ *pal_num = (2 << context->global_palette_exp_);
*pal_pp = context->global_palette_.empty() ? nullptr
: context->global_palette_.data();
*bg_index = context->bc_index_;