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/fpdfdoc/doc_ap.cpp | 14 +++++++------- core/fpdfdoc/doc_form.cpp | 2 +- core/fpdfdoc/doc_vt.cpp | 28 ++++++++++++++-------------- core/fpdfdoc/pdf_vt.h | 26 +++++++++++++------------- 4 files changed, 35 insertions(+), 35 deletions(-) (limited to 'core/fpdfdoc') diff --git a/core/fpdfdoc/doc_ap.cpp b/core/fpdfdoc/doc_ap.cpp index e64080dbd0..cdbdd1e9a8 100644 --- a/core/fpdfdoc/doc_ap.cpp +++ b/core/fpdfdoc/doc_ap.cpp @@ -136,7 +136,7 @@ CPVT_Provider::CPVT_Provider(IPVT_FontMap* pFontMap) : m_pFontMap(pFontMap) { } CPVT_Provider::~CPVT_Provider() {} int32_t CPVT_Provider::GetCharWidth(int32_t nFontIndex, - FX_WORD word, + uint16_t word, int32_t nWordStyle) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { FX_DWORD charcode = pPDFFont->CharCodeFromUnicode(word); @@ -158,7 +158,7 @@ int32_t CPVT_Provider::GetTypeDescent(int32_t nFontIndex) { } return 0; } -int32_t CPVT_Provider::GetWordFontIndex(FX_WORD word, +int32_t CPVT_Provider::GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex) { if (CPDF_Font* pDefFont = m_pFontMap->GetPDFFont(0)) { @@ -173,7 +173,7 @@ int32_t CPVT_Provider::GetWordFontIndex(FX_WORD word, } return -1; } -FX_BOOL CPVT_Provider::IsLatinWord(FX_WORD word) { +FX_BOOL CPVT_Provider::IsLatinWord(uint16_t word) { if ((word >= 0x61 && word <= 0x7A) || (word >= 0x41 && word <= 0x5A) || word == 0x2D || word == 0x27) { return TRUE; @@ -186,8 +186,8 @@ int32_t CPVT_Provider::GetDefaultFontIndex() { static CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, int32_t nFontIndex, - FX_WORD Word, - FX_WORD SubWord) { + uint16_t Word, + uint16_t SubWord) { CFX_ByteString sWord; if (SubWord > 0) { sWord.Format("%c", SubWord); @@ -485,7 +485,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, vt.SetMultiLine(TRUE); vt.SetAutoReturn(TRUE); } - FX_WORD subWord = 0; + uint16_t subWord = 0; if ((dwFlags >> 13) & 1) { subWord = '*'; vt.SetPasswordChar(subWord); @@ -721,7 +721,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP( IPDF_VariableText_Iterator* pIterator, const CFX_FloatPoint& ptOffset, FX_BOOL bContinuous, - FX_WORD SubWord, + uint16_t SubWord, const CPVT_WordRange* pVisible) { CFX_ByteTextBuf sEditStream, sLineStream, sWords; CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index 8329a5f68a..cecf6a8a5f 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -21,7 +21,7 @@ const int nMaxRecursion = 32; const struct SupportFieldEncoding { const FX_CHAR* m_name; - FX_WORD m_codePage; + uint16_t m_codePage; } g_fieldEncoding[] = { {"BigFive", 950}, {"GBK", 936}, diff --git a/core/fpdfdoc/doc_vt.cpp b/core/fpdfdoc/doc_vt.cpp index 3c08e46080..5ccba85b72 100644 --- a/core/fpdfdoc/doc_vt.cpp +++ b/core/fpdfdoc/doc_vt.cpp @@ -410,7 +410,7 @@ static const uint8_t special_chars[128] = { 0x01, 0x01, 0x01, 0x0C, 0x00, 0x08, 0x00, 0x00, }; -static bool IsLatin(FX_WORD word) { +static bool IsLatin(uint16_t word) { if (word <= 0x007F) return !!(special_chars[word] & 0x01); @@ -509,7 +509,7 @@ static bool IsOpenStylePunctuation(FX_DWORD word) { word == 0xFF3B || word == 0xFF5B || word == 0xFF62); } -static bool IsCurrencySymbol(FX_WORD word) { +static bool IsCurrencySymbol(uint16_t word) { return (word == 0x0024 || word == 0x0080 || word == 0x00A2 || word == 0x00A3 || word == 0x00A4 || word == 0x00A5 || (word >= 0x20A0 && word <= 0x20CF) || word == 0xFE69 || @@ -517,15 +517,15 @@ static bool IsCurrencySymbol(FX_WORD word) { word == 0xFFE5 || word == 0xFFE6); } -static bool IsPrefixSymbol(FX_WORD word) { +static bool IsPrefixSymbol(uint16_t word) { return IsCurrencySymbol(word) || word == 0x2116; } -static bool IsSpace(FX_WORD word) { +static bool IsSpace(uint16_t word) { return word == 0x0020 || word == 0x3000; } -static bool NeedDivision(FX_WORD prevWord, FX_WORD curWord) { +static bool NeedDivision(uint16_t prevWord, uint16_t curWord) { if ((IsLatin(prevWord) || IsDigit(prevWord)) && (IsLatin(curWord) || IsDigit(curWord))) { return false; @@ -819,7 +819,7 @@ void CPDF_VariableText::ResetAll() { ResetSectionArray(); } CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace& place, - FX_WORD word, + uint16_t word, int32_t charset, const CPVT_WordProps* pWordProps) { int32_t nTotlaWords = GetTotalWords(); @@ -896,7 +896,7 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place, CPVT_WordPlace wp = place; for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { CPVT_WordPlace oldwp = wp; - FX_WORD word = swText.GetAt(i); + uint16_t word = swText.GetAt(i); switch (word) { case 0x0D: if (m_bMultiLine) { @@ -974,7 +974,7 @@ void CPDF_VariableText::SetText(const FX_WCHAR* text, if (m_nCharArray > 0 && nCharCount >= m_nCharArray) { break; } - FX_WORD word = swText.GetAt(i); + uint16_t word = swText.GetAt(i); switch (word) { case 0x0D: if (m_bMultiLine) { @@ -1332,8 +1332,8 @@ int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo& WordInfo) { : WordInfo.nFontIndex; } FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, - FX_WORD Word, - FX_WORD SubWord, + uint16_t Word, + uint16_t SubWord, FX_FLOAT fCharSpace, int32_t nHorzScale, FX_FLOAT fFontSize, @@ -1612,8 +1612,8 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections( return rcRet; } int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex, - FX_WORD Word, - FX_WORD SubWord, + uint16_t Word, + uint16_t SubWord, int32_t nWordStyle) { if (!m_pVTProvider) { return 0; @@ -1629,7 +1629,7 @@ int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex) { int32_t CPDF_VariableText::GetTypeDescent(int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; } -int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, +int32_t CPDF_VariableText::GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex) { return m_pVTProvider @@ -1639,7 +1639,7 @@ int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, int32_t CPDF_VariableText::GetDefaultFontIndex() { return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; } -FX_BOOL CPDF_VariableText::IsLatinWord(FX_WORD word) { +FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) { return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE; } IPDF_VariableText_Iterator* CPDF_VariableText::GetIterator() { diff --git a/core/fpdfdoc/pdf_vt.h b/core/fpdfdoc/pdf_vt.h index 53c48af4ec..f97c48638f 100644 --- a/core/fpdfdoc/pdf_vt.h +++ b/core/fpdfdoc/pdf_vt.h @@ -115,7 +115,7 @@ struct CPVT_WordInfo { fWordTail(0.0f), nFontIndex(-1), pWordProps(NULL) {} - CPVT_WordInfo(FX_WORD word, + CPVT_WordInfo(uint16_t word, int32_t charset, int32_t fontIndex, CPVT_WordProps* pProps) @@ -152,7 +152,7 @@ struct CPVT_WordInfo { } } } - FX_WORD Word; + uint16_t Word; int32_t nCharset; FX_FLOAT fWordX; FX_FLOAT fWordY; @@ -349,7 +349,7 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { CPDF_EditContainer::SetPlateRect(rect); } void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; } - void SetPasswordChar(FX_WORD wSubWord = '*') override { + void SetPasswordChar(uint16_t wSubWord = '*') override { m_wSubWord = wSubWord; } void SetLimitChar(int32_t nLimitChar = 0) override { @@ -387,7 +387,7 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { const CPVT_SecProps* pSecProps = NULL, const CPVT_WordProps* pWordProps = NULL) override; CPVT_WordPlace InsertWord(const CPVT_WordPlace& place, - FX_WORD word, + uint16_t word, int32_t charset = 1, const CPVT_WordProps* pWordProps = NULL) override; CPVT_WordPlace InsertSection( @@ -409,7 +409,7 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { int32_t GetTotalWords() const override; FX_FLOAT GetFontSize() const override { return m_fFontSize; } int32_t GetAlignment() const override { return m_nAlignment; } - FX_WORD GetPasswordChar() const override { return GetSubWord(); } + uint16_t GetPasswordChar() const override { return GetSubWord(); } int32_t GetCharArray() const override { return m_nCharArray; } int32_t GetLimitChar() const override { return m_nLimitChar; } FX_BOOL IsMultiLine() const override { return m_bMultiLine; } @@ -435,18 +435,18 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; - FX_WORD GetSubWord() const { return m_wSubWord; } + uint16_t GetSubWord() const { return m_wSubWord; } private: int32_t GetCharWidth(int32_t nFontIndex, - FX_WORD Word, - FX_WORD SubWord, + uint16_t Word, + uint16_t SubWord, int32_t nWordStyle); int32_t GetTypeAscent(int32_t nFontIndex); int32_t GetTypeDescent(int32_t nFontIndex); - int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); + int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex); int32_t GetDefaultFontIndex(); - FX_BOOL IsLatinWord(FX_WORD word); + FX_BOOL IsLatinWord(uint16_t word); CPVT_WordPlace AddSection(const CPVT_WordPlace& place, const CPVT_SectionInfo& secinfo); @@ -463,8 +463,8 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo, FX_BOOL bFactFontSize = FALSE); FX_FLOAT GetWordWidth(int32_t nFontIndex, - FX_WORD Word, - FX_WORD SubWord, + uint16_t Word, + uint16_t SubWord, FX_FLOAT fCharSpace, int32_t nHorzScale, FX_FLOAT fFontSize, @@ -515,7 +515,7 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { FX_FLOAT m_fLineLeading; FX_FLOAT m_fCharSpace; int32_t m_nHorzScale; - FX_WORD m_wSubWord; + uint16_t m_wSubWord; FX_FLOAT m_fFontSize; private: -- cgit v1.2.3