From 62a70f90c49cf7714c960186eb063ad55333e6f3 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 21 Mar 2016 15:00:20 -0700 Subject: Remove FX_WORD in favor of uint16_t. It isn't buying us anthing, and it looks strange in a struct when other uint types are already present. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1821043003 . --- core/fxcodec/lbmp/fx_bmp.cpp | 12 ++++++------ core/fxcodec/lbmp/fx_bmp.h | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'core/fxcodec/lbmp') diff --git a/core/fxcodec/lbmp/fx_bmp.cpp b/core/fxcodec/lbmp/fx_bmp.cpp index 15384d56ff..90d8fe1247 100644 --- a/core/fxcodec/lbmp/fx_bmp.cpp +++ b/core/fxcodec/lbmp/fx_bmp.cpp @@ -26,10 +26,10 @@ void SetDWord_LSBFirst(uint8_t* p, FX_DWORD v) { } } // namespace -FX_WORD GetWord_LSBFirst(uint8_t* p) { +uint16_t GetWord_LSBFirst(uint8_t* p) { return p[0] | (p[1] << 8); } -void SetWord_LSBFirst(uint8_t* p, FX_WORD v) { +void SetWord_LSBFirst(uint8_t* p, uint16_t v) { p[0] = (uint8_t)v; p[1] = (uint8_t)(v >> 8); } @@ -145,7 +145,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { bmp_ptr->skip_size = skip_size_org; return 2; } - FX_WORD biPlanes; + uint16_t biPlanes; bmp_ptr->width = GetDWord_LSBFirst((uint8_t*)&bmp_info_header_ptr->biWidth); bmp_ptr->height = @@ -340,7 +340,7 @@ int32_t bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) { } } break; case 16: { - FX_WORD* buf = (FX_WORD*)des_buf; + uint16_t* buf = (uint16_t*)des_buf; uint8_t blue_bits = 0; uint8_t green_bits = 0; uint8_t red_bits = 0; @@ -551,7 +551,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { } } break; default: { - uint8_t size = (uint8_t)(((FX_WORD)(*first_byte_ptr) + 1) >> 1); + uint8_t size = (uint8_t)(((uint16_t)(*first_byte_ptr) + 1) >> 1); if ((int32_t)*first_byte_ptr >= bmp_ptr->out_row_bytes - bmp_ptr->col_num) { if (size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) { @@ -584,7 +584,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { } if ((int32_t)*first_byte_ptr > bmp_ptr->out_row_bytes - bmp_ptr->col_num) { - uint8_t size = (uint8_t)(((FX_WORD)(*first_byte_ptr) + 1) >> 1); + uint8_t size = (uint8_t)(((uint16_t)(*first_byte_ptr) + 1) >> 1); if (size + (bmp_ptr->col_num >> 1) > bmp_ptr->src_row_bytes) { bmp_error(bmp_ptr, "The Bmp File Is Corrupt"); return 0; diff --git a/core/fxcodec/lbmp/fx_bmp.h b/core/fxcodec/lbmp/fx_bmp.h index 2ef0c0a8b0..1c269c6507 100644 --- a/core/fxcodec/lbmp/fx_bmp.h +++ b/core/fxcodec/lbmp/fx_bmp.h @@ -35,25 +35,25 @@ #define BMP_MAX_ERROR_SIZE 256 #pragma pack(1) typedef struct tagBmpFileHeader { - FX_WORD bfType; + uint16_t bfType; FX_DWORD bfSize; - FX_WORD bfReserved1; - FX_WORD bfReserved2; + uint16_t bfReserved1; + uint16_t bfReserved2; FX_DWORD bfOffBits; } BmpFileHeader, *BmpFileHeaderPtr; typedef struct tagBmpCoreHeader { FX_DWORD bcSize; - FX_WORD bcWidth; - FX_WORD bcHeight; - FX_WORD bcPlanes; - FX_WORD bcBitCount; + uint16_t bcWidth; + uint16_t bcHeight; + uint16_t bcPlanes; + uint16_t bcBitCount; } BmpCoreHeader, *BmpCoreHeaderPtr; typedef struct tagBmpInfoHeader { FX_DWORD biSize; int32_t biWidth; int32_t biHeight; - FX_WORD biPlanes; - FX_WORD biBitCount; + uint16_t biPlanes; + uint16_t biBitCount; FX_DWORD biCompression; FX_DWORD biSizeImage; int32_t biXPelsPerMeter; @@ -82,7 +82,7 @@ struct tag_bmp_decompress_struct { int32_t src_row_bytes; int32_t out_row_bytes; uint8_t* out_row_buffer; - FX_WORD bitCounts; + uint16_t bitCounts; FX_DWORD color_used; FX_BOOL imgTB_flag; int32_t pal_num; @@ -139,7 +139,7 @@ struct tag_bmp_compress_struct { FX_DWORD src_width; FX_BOOL src_free; FX_DWORD* pal_ptr; - FX_WORD pal_num; + uint16_t pal_num; uint8_t bit_type; }; @@ -149,7 +149,7 @@ FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, FX_DWORD& dst_size); -FX_WORD GetWord_LSBFirst(uint8_t* p); -void SetWord_LSBFirst(uint8_t* p, FX_WORD v); +uint16_t GetWord_LSBFirst(uint8_t* p); +void SetWord_LSBFirst(uint8_t* p, uint16_t v); #endif // CORE_FXCODEC_LBMP_FX_BMP_H_ -- cgit v1.2.3