From a2c06e4a667a45a267f9382d0d90ab689c89d0cf Mon Sep 17 00:00:00 2001 From: weili Date: Fri, 20 May 2016 17:09:48 -0700 Subject: Use enum type for char type variables The mixed use of enum and uint32_t causes warnings. And it is more meaningful to use enum for char type variables. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/2001733002 --- core/fxcrt/fx_arabic.cpp | 2 +- core/fxcrt/include/fx_ucd.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'core/fxcrt') diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index 01a1a2a15e..cf0056ede2 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -122,7 +122,7 @@ const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC, wChar = 0xFEFF; return nullptr; } - eType = (FX_CHARTYPE)pTC->GetCharType(); + eType = pTC->GetCharType(); wChar = (FX_WCHAR)pTC->m_wCharCode; const FX_ARBFORMTABLE* pFT = FX_GetArabicFormTable(wChar); if (!pFT || eType >= FX_CHARTYPE_ArabicNormal) diff --git a/core/fxcrt/include/fx_ucd.h b/core/fxcrt/include/fx_ucd.h index 90f89486f1..0eb159d703 100644 --- a/core/fxcrt/include/fx_ucd.h +++ b/core/fxcrt/include/fx_ucd.h @@ -107,6 +107,9 @@ enum FX_CHARTYPE { FX_CHARTYPE_ArabicForm = (11 << FX_CHARTYPEBITS), FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS), }; +inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) { + return static_cast(prop & FX_CHARTYPEBITSMASK); +} FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, @@ -133,7 +136,9 @@ class CFX_Char { m_iCharWidth(0), m_iHorizontalScale(100), m_iVertialScale(100) {} - uint32_t GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } + + FX_CHARTYPE GetCharType() const { return GetCharTypeFromProp(m_dwCharProps); } + uint16_t m_wCharCode; uint8_t m_nBreakType; int8_t m_nRotation; -- cgit v1.2.3