summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-20 17:09:48 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-20 17:09:48 -0700
commita2c06e4a667a45a267f9382d0d90ab689c89d0cf (patch)
tree8b9290f82e906a665446b6a606da9139aba2fb85 /core
parentf0a128283aeaeb75ee2f62d0f25ba42ac5b07073 (diff)
downloadpdfium-a2c06e4a667a45a267f9382d0d90ab689c89d0cf.tar.xz
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
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/fx_arabic.cpp2
-rw-r--r--core/fxcrt/include/fx_ucd.h7
2 files changed, 7 insertions, 2 deletions
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<FX_CHARTYPE>(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;