Add FX_ prefix to all fx_unicode.h global functions. Avoid polluting the global namespace until we someday get around to namespacing pdfium. Usually this isn't an issue because of C++ name mangling and idiosyncratic argument type names, but these just take uint32_t, so we ought not rely on that. Change-Id: I524d0c8679088ae0a549af7ecd37cda781392385 Reviewed-on: https://pdfium-review.googlesource.com/c/48092 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/cfx_char.cpp b/core/fxcrt/cfx_char.cpp index bc04b0f..33c4145 100644 --- a/core/fxcrt/cfx_char.cpp +++ b/core/fxcrt/cfx_char.cpp
@@ -33,5 +33,5 @@ CFX_Char::~CFX_Char() = default; FX_CHARTYPE CFX_Char::GetCharType() const { - return GetCharTypeFromProp(m_dwCharProps); + return FX_GetCharTypeFromProp(m_dwCharProps); }
diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp index 1d25bbd..97d93c2 100644 --- a/core/fxcrt/fx_unicode.cpp +++ b/core/fxcrt/fx_unicode.cpp
@@ -160,13 +160,13 @@ } #ifdef PDF_ENABLE_XFA -FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) { +FX_CHARTYPE FX_GetCharTypeFromProp(uint32_t prop) { uint32_t result = (prop & kCharTypeBitMask) >> kCharTypeBitPos; ASSERT(result <= static_cast<uint32_t>(FX_CHARTYPE::kArabic)); return static_cast<FX_CHARTYPE>(result); } -FX_BREAKPROPERTY GetBreakPropertyFromProp(uint32_t prop) { +FX_BREAKPROPERTY FX_GetBreakPropertyFromProp(uint32_t prop) { uint32_t result = (prop & kBreakTypeBitMask) >> kBreakTypeBitPos; ASSERT(result <= static_cast<uint32_t>(FX_BREAKPROPERTY::kTB)); return static_cast<FX_BREAKPROPERTY>(result);
diff --git a/core/fxcrt/fx_unicode.h b/core/fxcrt/fx_unicode.h index 8decdc3..9155aed 100644 --- a/core/fxcrt/fx_unicode.h +++ b/core/fxcrt/fx_unicode.h
@@ -95,15 +95,13 @@ FX_BIDICLASS FX_GetBidiClassFromProp(uint32_t prop); #ifdef PDF_ENABLE_XFA - -FX_CHARTYPE GetCharTypeFromProp(uint32_t prop); +FX_CHARTYPE FX_GetCharTypeFromProp(uint32_t prop); // Analagous to ULineBreak in icu's uchar.h, but permuted order, and a // subset lacking some more recent additions. -FX_BREAKPROPERTY GetBreakPropertyFromProp(uint32_t prop); +FX_BREAKPROPERTY FX_GetBreakPropertyFromProp(uint32_t prop); wchar_t FX_GetMirrorChar(wchar_t wch, uint32_t dwProps); - #endif // PDF_ENABLE_XFA #endif // CORE_FXCRT_FX_UNICODE_H_
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp index b598e9b..0026247 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -70,7 +70,7 @@ ASSERT(m_pCurLine); uint32_t dwProps = FX_GetUnicodeProperties(wch); - FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); + FX_CHARTYPE chartype = FX_GetCharTypeFromProp(dwProps); m_pCurLine->m_LineChars.emplace_back(wch, dwProps, m_iHorizontalScale, m_iVerticalScale); CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back(); @@ -610,7 +610,7 @@ pCur->m_nBreakType = FX_LBT_UNKNOWN; uint32_t nCodeProp = pCur->char_props(); - FX_BREAKPROPERTY nNext = GetBreakPropertyFromProp(nCodeProp); + FX_BREAKPROPERTY nNext = FX_GetBreakPropertyFromProp(nCodeProp); int32_t iCharWidth = pCur->m_iCharWidth; if (iCharWidth > 0) *pEndPos -= iCharWidth; @@ -618,7 +618,7 @@ while (iLength >= 0) { pCur = pCharArray + iLength; nCodeProp = pCur->char_props(); - FX_BREAKPROPERTY nCur = GetBreakPropertyFromProp(nCodeProp); + FX_BREAKPROPERTY nCur = FX_GetBreakPropertyFromProp(nCodeProp); bool bNeedBreak = false; FX_LINEBREAKTYPE eType; if (nCur == FX_BREAKPROPERTY::kTB) { @@ -657,7 +657,7 @@ if (iCharWidth > 0) *pEndPos -= iCharWidth; } - nNext = GetBreakPropertyFromProp(nCodeProp); + nNext = FX_GetBreakPropertyFromProp(nCodeProp); --iLength; } if (bOnlyBrk) @@ -754,7 +754,7 @@ wchar_t wch = pText->pStr[i]; int32_t iWidth = pText->pWidths[i]; uint32_t dwProps = FX_GetUnicodeProperties(wch); - FX_CHARTYPE dwCharType = GetCharTypeFromProp(dwProps); + FX_CHARTYPE dwCharType = FX_GetCharTypeFromProp(dwProps); if (iWidth == 0) { if (dwCharType == FX_CHARTYPE::kArabicAlef) wPrev = 0xFEFF;
diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp index b7ede87..e120fcb 100644 --- a/xfa/fgas/layout/cfx_txtbreak.cpp +++ b/xfa/fgas/layout/cfx_txtbreak.cpp
@@ -18,7 +18,7 @@ namespace { bool IsCtrlCode(wchar_t ch) { - FX_CHARTYPE dwRet = GetCharTypeFromProp(FX_GetUnicodeProperties(ch)); + FX_CHARTYPE dwRet = FX_GetCharTypeFromProp(FX_GetUnicodeProperties(ch)); return dwRet == FX_CHARTYPE::kTab || dwRet == FX_CHARTYPE::kControl; } @@ -225,7 +225,7 @@ CFX_BreakType CFX_TxtBreak::AppendChar(wchar_t wch) { uint32_t dwProps = FX_GetUnicodeProperties(wch); - FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); + FX_CHARTYPE chartype = FX_GetCharTypeFromProp(dwProps); m_pCurLine->m_LineChars.emplace_back(wch, dwProps, m_iHorizontalScale, m_iVerticalScale); CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back(); @@ -556,7 +556,7 @@ pCur->m_nBreakType = FX_LBT_UNKNOWN; nCodeProp = pCur->char_props(); - nNext = GetBreakPropertyFromProp(nCodeProp); + nNext = FX_GetBreakPropertyFromProp(nCodeProp); int32_t iCharWidth = pCur->m_iCharWidth; if (iCharWidth > 0) *pEndPos -= iCharWidth; @@ -564,7 +564,7 @@ while (iLength >= 0) { pCur = &chars[iLength]; nCodeProp = pCur->char_props(); - nCur = GetBreakPropertyFromProp(nCodeProp); + nCur = FX_GetBreakPropertyFromProp(nCodeProp); if (nNext == FX_BREAKPROPERTY::kSP) eType = FX_LBT_PROHIBITED_BRK; else @@ -592,7 +592,7 @@ if (iCharWidth > 0) *pEndPos -= iCharWidth; } - nNext = GetBreakPropertyFromProp(nCodeProp); + nNext = FX_GetBreakPropertyFromProp(nCodeProp); iLength--; } if (bOnlyBrk) @@ -715,7 +715,7 @@ } uint32_t dwProps = FX_GetUnicodeProperties(wch); - FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); + FX_CHARTYPE chartype = FX_GetCharTypeFromProp(dwProps); if (chartype == FX_CHARTYPE::kArabicAlef && iWidth == 0) { wPrev = 0xFEFF; wLast = wch; @@ -730,7 +730,7 @@ int32_t iNextAbsolute = iNext + pTxtRun->iStart; wNext = pEngine->GetChar(iNextAbsolute); dwProps = FX_GetUnicodeProperties(wNext); - if (GetCharTypeFromProp(dwProps) != FX_CHARTYPE::kCombination) + if (FX_GetCharTypeFromProp(dwProps) != FX_CHARTYPE::kCombination) break; iNext++; @@ -746,7 +746,8 @@ wNext = pStr[j]; dwProps = FX_GetUnicodeProperties(wNext); - } while (GetCharTypeFromProp(dwProps) == FX_CHARTYPE::kCombination); + } while (FX_GetCharTypeFromProp(dwProps) == + FX_CHARTYPE::kCombination); if (i + j >= iLength) wNext = 0xFEFF; } @@ -878,7 +879,8 @@ } if (wForm == wch && wLast != 0xFEFF) { uint32_t dwLastProps = FX_GetUnicodeProperties(wLast); - if (GetCharTypeFromProp(dwLastProps) == FX_CHARTYPE::kCombination) { + if (FX_GetCharTypeFromProp(dwLastProps) == + FX_CHARTYPE::kCombination) { FX_RECT rtBox; if (pFont->GetCharBBox(wLast, &rtBox)) pCharPos->m_Origin.y -= fFontSize * rtBox.Height() / iMaxHeight;