diff options
Diffstat (limited to 'xfa/fgas')
-rw-r--r-- | xfa/fgas/crt/cfgas_formatstring.cpp | 302 | ||||
-rw-r--r-- | xfa/fgas/crt/cfgas_formatstring.h | 74 | ||||
-rw-r--r-- | xfa/fgas/crt/cfgas_formatstring_unittest.cpp | 24 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.cpp | 64 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.h | 28 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_gefont.cpp | 14 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_gefont.h | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_breakline.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_breakline.h | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_breakpiece.cpp | 4 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_breakpiece.h | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak.h | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak_unittest.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_txtbreak.h | 2 |
14 files changed, 258 insertions, 266 deletions
diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp index df95a3588a..87b07691a4 100644 --- a/xfa/fgas/crt/cfgas_formatstring.cpp +++ b/xfa/fgas/crt/cfgas_formatstring.cpp @@ -97,10 +97,10 @@ int32_t ConvertHex(int32_t iKeyValue, wchar_t ch) { return iKeyValue; } -CFX_WideString GetLiteralText(const wchar_t* pStrPattern, - int32_t* iPattern, - int32_t iLenPattern) { - CFX_WideString wsOutput; +WideString GetLiteralText(const wchar_t* pStrPattern, + int32_t* iPattern, + int32_t iLenPattern) { + WideString wsOutput; if (pStrPattern[*iPattern] != '\'') return wsOutput; @@ -135,9 +135,9 @@ CFX_WideString GetLiteralText(const wchar_t* pStrPattern, return wsOutput; } -CFX_WideString GetLiteralTextReverse(const wchar_t* pStrPattern, - int32_t* iPattern) { - CFX_WideString wsOutput; +WideString GetLiteralTextReverse(const wchar_t* pStrPattern, + int32_t* iPattern) { + WideString wsOutput; if (pStrPattern[*iPattern] != '\'') return wsOutput; @@ -173,8 +173,8 @@ CFX_WideString GetLiteralTextReverse(const wchar_t* pStrPattern, return wsOutput; } -bool GetNumericDotIndex(const CFX_WideString& wsNum, - const CFX_WideString& wsDotSymbol, +bool GetNumericDotIndex(const WideString& wsNum, + const WideString& wsDotSymbol, int32_t* iDotIndex) { int32_t ccf = 0; int32_t iLenf = wsNum.GetLength(); @@ -221,8 +221,8 @@ bool ExtractCountDigitsWithOptional(const wchar_t* str, return true; } -bool ParseLocaleDate(const CFX_WideString& wsDate, - const CFX_WideString& wsDatePattern, +bool ParseLocaleDate(const WideString& wsDate, + const WideString& wsDatePattern, IFX_Locale* pLocale, CFX_DateTime* datetime, int32_t* cc) { @@ -234,10 +234,10 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, int32_t len = wsDate.GetLength(); const wchar_t* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); - CFX_WideStringC wsDateSymbols(gs_wsDateSymbols); + WideStringView wsDateSymbols(gs_wsDateSymbols); while (*cc < len && ccf < lenf) { if (strf[ccf] == '\'') { - CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); + WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (*cc + iLiteralLen > len || wcsncmp(str + *cc, wsLiteral.c_str(), iLiteralLen)) { @@ -254,7 +254,7 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -273,7 +273,7 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, return false; } else if (symbol == L"MMM" || symbol == L"MMMM") { for (uint16_t i = 0; i < 12; i++) { - CFX_WideString wsMonthName = pLocale->GetMonthName(i, symbol == L"MMM"); + WideString wsMonthName = pLocale->GetMonthName(i, symbol == L"MMM"); if (wsMonthName.IsEmpty()) continue; if (!wcsncmp(wsMonthName.c_str(), str + *cc, wsMonthName.GetLength())) { @@ -284,7 +284,7 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, } } else if (symbol == L"EEE" || symbol == L"EEEE") { for (uint16_t i = 0; i < 7; i++) { - CFX_WideString wsDayName = pLocale->GetDayName(i, symbol == L"EEE"); + WideString wsDayName = pLocale->GetDayName(i, symbol == L"EEE"); if (wsDayName.IsEmpty()) continue; if (!wcsncmp(wsDayName.c_str(), str + *cc, wsDayName.GetLength())) { @@ -338,8 +338,8 @@ void ResolveZone(FX_TIMEZONE tzDiff, *wMinute = iMinuteDiff % 60; } -bool ParseLocaleTime(const CFX_WideString& wsTime, - const CFX_WideString& wsTimePattern, +bool ParseLocaleTime(const WideString& wsTime, + const WideString& wsTimePattern, IFX_Locale* pLocale, CFX_DateTime* datetime, int32_t* cc) { @@ -354,10 +354,10 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, int lenf = wsTimePattern.GetLength(); bool bHasA = false; bool bPM = false; - CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols); + WideStringView wsTimeSymbols(gs_wsTimeSymbols); while (*cc < len && ccf < lenf) { if (strf[ccf] == '\'') { - CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); + WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (*cc + iLiteralLen > len || wcsncmp(str + *cc, wsLiteral.c_str(), iLiteralLen)) { @@ -375,7 +375,7 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -415,16 +415,16 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, if (!ExtractCountDigits(str, len, 3, cc, &millisecond)) return false; } else if (symbol == L"A") { - CFX_WideString wsAM = pLocale->GetMeridiemName(true); - CFX_WideString wsPM = pLocale->GetMeridiemName(false); + WideString wsAM = pLocale->GetMeridiemName(true); + WideString wsPM = pLocale->GetMeridiemName(false); if ((*cc + pdfium::base::checked_cast<int32_t>(wsAM.GetLength()) <= len) && - (CFX_WideStringC(str + *cc, wsAM.GetLength()) == wsAM)) { + (WideStringView(str + *cc, wsAM.GetLength()) == wsAM)) { *cc += wsAM.GetLength(); bHasA = true; } else if ((*cc + pdfium::base::checked_cast<int32_t>(wsPM.GetLength()) <= len) && - (CFX_WideStringC(str + *cc, wsPM.GetLength()) == wsPM)) { + (WideStringView(str + *cc, wsPM.GetLength()) == wsPM)) { *cc += wsPM.GetLength(); bHasA = true; bPM = true; @@ -433,7 +433,7 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, if (*cc + 3 > len) continue; - CFX_WideString tz(str[(*cc)++]); + WideString tz(str[(*cc)++]); tz += str[(*cc)++]; tz += str[(*cc)++]; if (tz == L"GMT") { @@ -480,7 +480,7 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, return !!(*cc); } -int32_t GetNumTrailingLimit(const CFX_WideString& wsFormat, +int32_t GetNumTrailingLimit(const WideString& wsFormat, int iDotPos, bool* bTrimTailZeros) { if (iDotPos < 0) @@ -553,23 +553,23 @@ uint16_t GetWeekOfYear(uint16_t year, uint16_t month, uint16_t day) { return week_index; } -CFX_WideString NumToString(size_t fmt_size, int32_t value) { - CFX_WideString str; +WideString NumToString(size_t fmt_size, int32_t value) { + WideString str; str.Format(fmt_size == 1 ? L"%d" : fmt_size == 2 ? L"%02d" : L"%03d", value); return str; } -CFX_WideString DateFormat(const CFX_WideString& wsDatePattern, - IFX_Locale* pLocale, - const CFX_DateTime& datetime) { - CFX_WideString wsResult; +WideString DateFormat(const WideString& wsDatePattern, + IFX_Locale* pLocale, + const CFX_DateTime& datetime) { + WideString wsResult; int32_t year = datetime.GetYear(); uint8_t month = datetime.GetMonth(); uint8_t day = datetime.GetDay(); int32_t ccf = 0; const wchar_t* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); - CFX_WideStringC wsDateSymbols(gs_wsDateSymbols); + WideStringView wsDateSymbols(gs_wsDateSymbols); while (ccf < lenf) { if (strf[ccf] == '\'') { wsResult += GetLiteralText(strf, &ccf, lenf); @@ -581,7 +581,7 @@ CFX_WideString DateFormat(const CFX_WideString& wsDatePattern, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -621,10 +621,10 @@ CFX_WideString DateFormat(const CFX_WideString& wsDatePattern, return wsResult; } -CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, - IFX_Locale* pLocale, - const CFX_DateTime& datetime) { - CFX_WideString wsResult; +WideString TimeFormat(const WideString& wsTimePattern, + IFX_Locale* pLocale, + const CFX_DateTime& datetime) { + WideString wsResult; uint8_t hour = datetime.GetHour(); uint8_t minute = datetime.GetMinute(); uint8_t second = datetime.GetSecond(); @@ -639,7 +639,7 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, bPM = true; } - CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols); + WideStringView wsTimeSymbols(gs_wsTimeSymbols); while (ccf < lenf) { if (strf[ccf] == '\'') { wsResult += GetLiteralText(strf, &ccf, lenf); @@ -651,7 +651,7 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -685,7 +685,7 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, if (tz.tzHour != 0 || tz.tzMinute != 0) { wsResult += tz.tzHour < 0 ? L"-" : L"+"; - CFX_WideString wsTimezone; + WideString wsTimezone; wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute); wsResult += wsTimezone; } @@ -694,16 +694,16 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, return wsResult; } -CFX_WideString FormatDateTimeInternal(const CFX_DateTime& dt, - const CFX_WideString& wsDatePattern, - const CFX_WideString& wsTimePattern, - bool bDateFirst, - IFX_Locale* pLocale) { - CFX_WideString wsDateOut; +WideString FormatDateTimeInternal(const CFX_DateTime& dt, + const WideString& wsDatePattern, + const WideString& wsTimePattern, + bool bDateFirst, + IFX_Locale* pLocale) { + WideString wsDateOut; if (!wsDatePattern.IsEmpty()) wsDateOut = DateFormat(wsDatePattern, pLocale, dt); - CFX_WideString wsTimeOut; + WideString wsTimeOut; if (!wsTimePattern.IsEmpty()) wsTimeOut = TimeFormat(wsTimePattern, pLocale, dt); @@ -712,8 +712,7 @@ CFX_WideString FormatDateTimeInternal(const CFX_DateTime& dt, } // namespace -bool FX_DateFromCanonical(const CFX_WideString& wsDate, - CFX_DateTime* datetime) { +bool FX_DateFromCanonical(const WideString& wsDate, CFX_DateTime* datetime) { const wchar_t* str = wsDate.c_str(); int len = wsDate.GetLength(); if (len > 10) @@ -762,7 +761,7 @@ bool FX_DateFromCanonical(const CFX_WideString& wsDate, return true; } -bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, +bool FX_TimeFromCanonical(const WideStringView& wsTime, CFX_DateTime* datetime, IFX_Locale* pLocale) { if (wsTime.GetLength() == 0) @@ -840,8 +839,8 @@ CFGAS_FormatString::CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr) CFGAS_FormatString::~CFGAS_FormatString() {} void CFGAS_FormatString::SplitFormatString( - const CFX_WideString& wsFormatString, - std::vector<CFX_WideString>* wsPatterns) { + const WideString& wsFormatString, + std::vector<WideString>* wsPatterns) { int32_t iStrLen = wsFormatString.GetLength(); const wchar_t* pStr = wsFormatString.c_str(); const wchar_t* pToken = pStr; @@ -849,32 +848,31 @@ void CFGAS_FormatString::SplitFormatString( bool iQuote = false; while (true) { if (pStr >= pEnd) { - wsPatterns->push_back(CFX_WideString(pToken, pStr - pToken)); + wsPatterns->push_back(WideString(pToken, pStr - pToken)); return; } if (*pStr == '\'') { iQuote = !iQuote; } else if (*pStr == L'|' && !iQuote) { - wsPatterns->push_back(CFX_WideString(pToken, pStr - pToken)); + wsPatterns->push_back(WideString(pToken, pStr - pToken)); pToken = pStr + 1; } pStr++; } } -FX_LOCALECATEGORY CFGAS_FormatString::GetCategory( - const CFX_WideString& wsPattern) { +FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(const WideString& wsPattern) { FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const wchar_t* pStr = wsPattern.c_str(); bool bBraceOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); + WideStringView wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { GetLiteralText(pStr, &ccf, iLenf); } else if (!bBraceOpen && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsCategory(pStr[ccf]); + WideString wsCategory(pStr[ccf]); ccf++; while (true) { if (ccf == iLenf) @@ -889,7 +887,7 @@ FX_LOCALECATEGORY CFGAS_FormatString::GetCategory( ccf++; } - uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringC(), false); + uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringView(), false); if (dwHash == FX_LOCALECATEGORY_DateHash) { if (eCategory == FX_LOCALECATEGORY_Time) return FX_LOCALECATEGORY_DateTime; @@ -917,22 +915,21 @@ FX_LOCALECATEGORY CFGAS_FormatString::GetCategory( return eCategory; } -CFX_WideString CFGAS_FormatString::GetTextFormat( - const CFX_WideString& wsPattern, - const CFX_WideStringC& wsCategory) { +WideString CFGAS_FormatString::GetTextFormat(const WideString& wsPattern, + const WideStringView& wsCategory) { int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const wchar_t* pStr = wsPattern.c_str(); bool bBrackOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); - CFX_WideString wsPurgePattern; + WideStringView wsConstChars(gs_wsConstChars); + WideString wsPurgePattern; while (ccf < iLenf) { if (pStr[ccf] == '\'') { int32_t iCurChar = ccf; GetLiteralText(pStr, &ccf, iLenf); - wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1); + wsPurgePattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1); } else if (!bBrackOpen && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsSearchCategory(pStr[ccf]); + WideString wsSearchCategory(pStr[ccf]); ccf++; while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' && pStr[ccf] != '(') { @@ -965,11 +962,10 @@ CFX_WideString CFGAS_FormatString::GetTextFormat( return wsPurgePattern; } -IFX_Locale* CFGAS_FormatString::GetNumericFormat( - const CFX_WideString& wsPattern, - int32_t* iDotIndex, - uint32_t* dwStyle, - CFX_WideString* wsPurgePattern) { +IFX_Locale* CFGAS_FormatString::GetNumericFormat(const WideString& wsPattern, + int32_t* iDotIndex, + uint32_t* dwStyle, + WideString* wsPurgePattern) { *dwStyle = 0; IFX_Locale* pLocale = nullptr; int32_t ccf = 0; @@ -977,14 +973,14 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( const wchar_t* pStr = wsPattern.c_str(); bool bFindDot = false; bool bBrackOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); + WideStringView wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { int32_t iCurChar = ccf; GetLiteralText(pStr, &ccf, iLenf); - *wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1); + *wsPurgePattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1); } else if (!bBrackOpen && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsCategory(pStr[ccf]); + WideString wsCategory(pStr[ccf]); ccf++; while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' && pStr[ccf] != '(') { @@ -999,7 +995,7 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( while (ccf < iLenf) { if (pStr[ccf] == '(') { ccf++; - CFX_WideString wsLCID; + WideString wsLCID; while (ccf < iLenf && pStr[ccf] != ')') wsLCID += pStr[ccf++]; @@ -1008,13 +1004,13 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( bBrackOpen = true; break; } else if (pStr[ccf] == '.') { - CFX_WideString wsSubCategory; + WideString wsSubCategory; ccf++; while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') wsSubCategory += pStr[ccf++]; uint32_t dwSubHash = - FX_HashCode_GetW(wsSubCategory.AsStringC(), false); + FX_HashCode_GetW(wsSubCategory.AsStringView(), false); FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal; for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) { if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) { @@ -1068,14 +1064,14 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( return pLocale; } -bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue) { +bool CFGAS_FormatString::ParseText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsValue) { wsValue->clear(); if (wsSrcText.IsEmpty() || wsPattern.IsEmpty()) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); if (wsTextFormat.IsEmpty()) return false; @@ -1088,7 +1084,7 @@ bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText, while (iPattern < iLenPattern && iText < iLenText) { switch (pStrPattern[iPattern]) { case '\'': { - CFX_WideString wsLiteral = + WideString wsLiteral = GetLiteralText(pStrPattern, &iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || @@ -1141,28 +1137,28 @@ bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText, return iPattern == iLenPattern && iText == iLenText; } -bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue) { +bool CFGAS_FormatString::ParseNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsValue) { wsValue->clear(); if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) return false; int32_t dot_index_f = -1; uint32_t dwFormatStyle = 0; - CFX_WideString wsNumFormat; + WideString wsNumFormat; IFX_Locale* pLocale = GetNumericFormat(wsPattern, &dot_index_f, &dwFormatStyle, &wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) return false; int32_t iExponent = 0; - CFX_WideString wsDotSymbol = + WideString wsDotSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal); - CFX_WideString wsGroupSymbol = + WideString wsGroupSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping); int32_t iGroupLen = wsGroupSymbol.GetLength(); - CFX_WideString wsMinus = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus); + WideString wsMinus = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus); int32_t iMinusLen = wsMinus.GetLength(); const wchar_t* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); @@ -1192,7 +1188,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, while (ccf >= 0 && cc >= 0) { switch (strf[ccf]) { case '\'': { - CFX_WideString wsLiteral = GetLiteralTextReverse(strf, &ccf); + WideString wsLiteral = GetLiteralTextReverse(strf, &ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; if (cc < 0 || wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) @@ -1265,7 +1261,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, break; } case '$': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; @@ -1307,7 +1303,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case '%': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; @@ -1371,7 +1367,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, while (cc < len && ccf < lenf) { switch (strf[ccf]) { case '\'': { - CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); + WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { @@ -1441,7 +1437,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, break; } case '$': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol); int32_t iSymbolLen = wsSymbol.GetLength(); if (cc + iSymbolLen > len || @@ -1483,7 +1479,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'v': return false; case '%': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent); int32_t iSysmbolLen = wsSymbol.GetLength(); if (cc + iSysmbolLen <= len && @@ -1532,7 +1528,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, return false; } if (iExponent || bHavePercentSymbol) { - CFX_Decimal decimal = CFX_Decimal(wsValue->AsStringC()); + CFX_Decimal decimal = CFX_Decimal(wsValue->AsStringView()); if (iExponent) { decimal = decimal * CFX_Decimal(FXSYS_pow(10, static_cast<float>(iExponent)), 3); @@ -1549,27 +1545,27 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( - const CFX_WideString& wsPattern, + const WideString& wsPattern, IFX_Locale** pLocale, - CFX_WideString* wsDatePattern, - CFX_WideString* wsTimePattern) { + WideString* wsDatePattern, + WideString* wsTimePattern) { *pLocale = nullptr; - CFX_WideString wsTempPattern; + WideString wsTempPattern; FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const wchar_t* pStr = wsPattern.c_str(); int32_t iFindCategory = 0; bool bBraceOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); + WideStringView wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { int32_t iCurChar = ccf; GetLiteralText(pStr, &ccf, iLenf); - wsTempPattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1); + wsTempPattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1); } else if (!bBraceOpen && iFindCategory != 3 && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsCategory(pStr[ccf]); + WideString wsCategory(pStr[ccf]); ccf++; while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' && pStr[ccf] != '(') { @@ -1602,7 +1598,7 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( while (ccf < iLenf) { if (pStr[ccf] == '(') { ccf++; - CFX_WideString wsLCID; + WideString wsLCID; while (ccf < iLenf && pStr[ccf] != ')') wsLCID += pStr[ccf++]; @@ -1611,13 +1607,13 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( bBraceOpen = true; break; } else if (pStr[ccf] == '.') { - CFX_WideString wsSubCategory; + WideString wsSubCategory; ccf++; while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') wsSubCategory += pStr[ccf++]; uint32_t dwSubHash = - FX_HashCode_GetW(wsSubCategory.AsStringC(), false); + FX_HashCode_GetW(wsSubCategory.AsStringView(), false); FX_LOCALEDATETIMESUBCATEGORY eSubCategory = FX_LOCALEDATETIMESUBCATEGORY_Medium; for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) { @@ -1685,16 +1681,16 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( return (FX_DATETIMETYPE)iFindCategory; } -bool CFGAS_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, +bool CFGAS_FormatString::ParseDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, CFX_DateTime* dtValue) { dtValue->Reset(); if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) return false; - CFX_WideString wsDatePattern; - CFX_WideString wsTimePattern; + WideString wsDatePattern; + WideString wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, &pLocale, &wsDatePattern, &wsTimePattern); @@ -1730,9 +1726,9 @@ bool CFGAS_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, return true; } -bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern) { - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); +bool CFGAS_FormatString::ParseZero(const WideString& wsSrcText, + const WideString& wsPattern) { + WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); int32_t iText = 0; int32_t iPattern = 0; @@ -1742,7 +1738,7 @@ bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText, int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { - CFX_WideString wsLiteral = + WideString wsLiteral = GetLiteralText(pStrPattern, &iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || @@ -1762,9 +1758,9 @@ bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText, return iPattern == iLenPattern && iText == iLenText; } -bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern) { - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); +bool CFGAS_FormatString::ParseNull(const WideString& wsSrcText, + const WideString& wsPattern) { + WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); int32_t iText = 0; int32_t iPattern = 0; @@ -1774,7 +1770,7 @@ bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText, int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { - CFX_WideString wsLiteral = + WideString wsLiteral = GetLiteralText(pStrPattern, &iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || @@ -1794,9 +1790,9 @@ bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText, return iPattern == iLenPattern && iText == iLenText; } -bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsOutput) { if (wsPattern.IsEmpty()) return false; @@ -1804,7 +1800,7 @@ bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText, if (iLenText == 0) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); int32_t iText = 0; int32_t iPattern = 0; @@ -1856,15 +1852,15 @@ bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText, return iText == iLenText; } -bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatStrNum(const WideStringView& wsInputNum, + const WideString& wsPattern, + WideString* wsOutput) { if (wsInputNum.IsEmpty() || wsPattern.IsEmpty()) return false; int32_t dot_index_f = -1; uint32_t dwNumStyle = 0; - CFX_WideString wsNumFormat; + WideString wsNumFormat; IFX_Locale* pLocale = GetNumericFormat(wsPattern, &dot_index_f, &dwNumStyle, &wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) @@ -1873,12 +1869,12 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, int32_t cc = 0, ccf = 0; const wchar_t* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); - CFX_WideString wsSrcNum(wsInputNum); + WideString wsSrcNum(wsInputNum); wsSrcNum.TrimLeft('0'); if (wsSrcNum.IsEmpty() || wsSrcNum[0] == '.') wsSrcNum.InsertAtFront('0'); - CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringC()); + CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringView()); if (dwNumStyle & FX_NUMSTYLE_Percent) { decimal = decimal * CFX_Decimal(100); wsSrcNum = decimal; @@ -1937,7 +1933,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsSrcNum.TrimRight(L"."); } - CFX_WideString wsGroupSymbol = + WideString wsGroupSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping); bool bNeg = false; if (wsSrcNum[0] == '-') { @@ -2010,7 +2006,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, ccf--; break; case 'E': { - CFX_WideString wsExp; + WideString wsExp; wsExp.Format(L"E%+d", exponent); *wsOutput = wsExp + *wsOutput; ccf--; @@ -2114,7 +2110,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return true; } - CFX_WideString wsDotSymbol = + WideString wsDotSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal); if (strf[dot_index_f] == 'V') { *wsOutput += wsDotSymbol; @@ -2168,7 +2164,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, ccf++; break; case 'E': { - CFX_WideString wsExp; + WideString wsExp; wsExp.Format(L"E%+d", exponent); *wsOutput += wsExp; ccf++; @@ -2247,23 +2243,23 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return true; } -bool CFGAS_FormatString::FormatNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsOutput) { if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) return false; - return FormatStrNum(wsSrcNum.AsStringC(), wsPattern, wsOutput); + return FormatStrNum(wsSrcNum.AsStringView(), wsPattern, wsOutput); } -bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, +bool CFGAS_FormatString::FormatDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, - CFX_WideString* wsOutput) { + WideString* wsOutput) { if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) return false; - CFX_WideString wsDatePattern; - CFX_WideString wsTimePattern; + WideString wsDatePattern; + WideString wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, &pLocale, &wsDatePattern, &wsTimePattern); @@ -2290,15 +2286,15 @@ bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, return true; } if (eCategory == FX_DATETIMETYPE_Time && - FX_TimeFromCanonical(wsSrcDateTime.AsStringC(), &dt, pLocale)) { + FX_TimeFromCanonical(wsSrcDateTime.AsStringView(), &dt, pLocale)) { *wsOutput = FormatDateTimeInternal(dt, wsDatePattern, wsTimePattern, true, pLocale); return true; } } else { - CFX_WideString wsSrcDate(wsSrcDateTime.c_str(), iT.value()); - CFX_WideStringC wsSrcTime(wsSrcDateTime.c_str() + iT.value() + 1, - wsSrcDateTime.GetLength() - iT.value() - 1); + WideString wsSrcDate(wsSrcDateTime.c_str(), iT.value()); + WideStringView wsSrcTime(wsSrcDateTime.c_str() + iT.value() + 1, + wsSrcDateTime.GetLength() - iT.value() - 1); if (wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty()) return false; if (FX_DateFromCanonical(wsSrcDate, &dt) && @@ -2312,12 +2308,12 @@ bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, return false; } -bool CFGAS_FormatString::FormatZero(const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatZero(const WideString& wsPattern, + WideString* wsOutput) { if (wsPattern.IsEmpty()) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); int32_t iPattern = 0; const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); @@ -2334,12 +2330,12 @@ bool CFGAS_FormatString::FormatZero(const CFX_WideString& wsPattern, return true; } -bool CFGAS_FormatString::FormatNull(const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatNull(const WideString& wsPattern, + WideString* wsOutput) { if (wsPattern.IsEmpty()) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); int32_t iPattern = 0; const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); diff --git a/xfa/fgas/crt/cfgas_formatstring.h b/xfa/fgas/crt/cfgas_formatstring.h index c91f43598e..5eae25dca5 100644 --- a/xfa/fgas/crt/cfgas_formatstring.h +++ b/xfa/fgas/crt/cfgas_formatstring.h @@ -12,8 +12,8 @@ #include "core/fxcrt/ifx_locale.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime); -bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, +bool FX_DateFromCanonical(const WideString& wsDate, CFX_DateTime* datetime); +bool FX_TimeFromCanonical(const WideStringView& wsTime, CFX_DateTime* datetime, IFX_Locale* pLocale); @@ -22,52 +22,50 @@ class CFGAS_FormatString { explicit CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr); ~CFGAS_FormatString(); - void SplitFormatString(const CFX_WideString& wsFormatString, - std::vector<CFX_WideString>* wsPatterns); - FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern); + void SplitFormatString(const WideString& wsFormatString, + std::vector<WideString>* wsPatterns); + FX_LOCALECATEGORY GetCategory(const WideString& wsPattern); - bool ParseText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue); - bool ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue); - bool ParseDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, + bool ParseText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsValue); + bool ParseNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsValue); + bool ParseDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, CFX_DateTime* dtValue); - bool ParseZero(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern); - bool ParseNull(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern); + bool ParseZero(const WideString& wsSrcText, const WideString& wsPattern); + bool ParseNull(const WideString& wsSrcText, const WideString& wsPattern); - bool FormatText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput); - bool FormatNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput); - bool FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, + bool FormatText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsOutput); + bool FormatNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsOutput); + bool FormatDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, - CFX_WideString* wsOutput); - bool FormatZero(const CFX_WideString& wsPattern, CFX_WideString* wsOutput); - bool FormatNull(const CFX_WideString& wsPattern, CFX_WideString* wsOutput); + WideString* wsOutput); + bool FormatZero(const WideString& wsPattern, WideString* wsOutput); + bool FormatNull(const WideString& wsPattern, WideString* wsOutput); private: - CFX_WideString GetTextFormat(const CFX_WideString& wsPattern, - const CFX_WideStringC& wsCategory); - IFX_Locale* GetNumericFormat(const CFX_WideString& wsPattern, + WideString GetTextFormat(const WideString& wsPattern, + const WideStringView& wsCategory); + IFX_Locale* GetNumericFormat(const WideString& wsPattern, int32_t* iDotIndex, uint32_t* dwStyle, - CFX_WideString* wsPurgePattern); - bool FormatStrNum(const CFX_WideStringC& wsInputNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput); - FX_DATETIMETYPE GetDateTimeFormat(const CFX_WideString& wsPattern, + WideString* wsPurgePattern); + bool FormatStrNum(const WideStringView& wsInputNum, + const WideString& wsPattern, + WideString* wsOutput); + FX_DATETIMETYPE GetDateTimeFormat(const WideString& wsPattern, IFX_Locale** pLocale, - CFX_WideString* wsDatePattern, - CFX_WideString* wsTimePattern); + WideString* wsDatePattern, + WideString* wsTimePattern); CXFA_LocaleMgr* m_pLocaleMgr; }; diff --git a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp index 3adcedf7b2..b3d42f655e 100644 --- a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp +++ b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp @@ -43,7 +43,7 @@ class CFGAS_FormatStringTest : public testing::Test { // Note, this re-creates the fmt on each call. If you need to multiple // times store it locally. - CFGAS_FormatString* fmt(const CFX_WideString& locale) { + CFGAS_FormatString* fmt(const WideString& locale) { mgr_ = pdfium::MakeUnique<CXFA_LocaleMgr>(nullptr, locale); fmt_ = pdfium::MakeUnique<CFGAS_FormatString>(mgr_.get()); return fmt_.get(); @@ -112,7 +112,7 @@ TEST_F(CFGAS_FormatStringTest, DateFormat) { // of DDD, DDDD, MMM, MMMM, E, e, gg, YYY, YYYYY. for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatDateTime(tests[i].input, tests[i].pattern, FX_DATETIMETYPE_Date, &result)); @@ -161,7 +161,7 @@ TEST_F(CFGAS_FormatStringTest, TimeFormat) { SetTZ("UTC+2"); for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatDateTime(tests[i].input, tests[i].pattern, FX_DATETIMETYPE_Time, &result)); @@ -191,7 +191,7 @@ TEST_F(CFGAS_FormatStringTest, DateTimeFormat) { L"At 10:30 GMT on Jul 16, 1999"}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatDateTime(tests[i].input, tests[i].pattern, FX_DATETIMETYPE_TimeDate, &result)); @@ -288,7 +288,7 @@ TEST_F(CFGAS_FormatStringTest, DateParse) { // } TEST_F(CFGAS_FormatStringTest, SplitFormatString) { - std::vector<CFX_WideString> results; + std::vector<WideString> results; fmt(L"en")->SplitFormatString( L"null{'No data'} | null{} | text{999*9999} | text{999*999*9999}", &results); @@ -416,7 +416,7 @@ TEST_F(CFGAS_FormatStringTest, NumParse) { }; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->ParseNum(tests[i].input, tests[i].pattern, &result)) << " TEST: " << i; @@ -512,7 +512,7 @@ TEST_F(CFGAS_FormatStringTest, NumFormat) { }; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatNum(tests[i].input, tests[i].pattern, &result)) << " TEST: " << i; @@ -538,7 +538,7 @@ TEST_F(CFGAS_FormatStringTest, TextParse) { {L"en", L"A1C-1234-D text", L"000-9999-X 'text'", L"A1C1234D"}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->ParseText(tests[i].input, tests[i].pattern, &result)); EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i; @@ -547,7 +547,7 @@ TEST_F(CFGAS_FormatStringTest, TextParse) { TEST_F(CFGAS_FormatStringTest, InvalidTextParse) { // Input does not match mask. - CFX_WideString result; + WideString result; EXPECT_FALSE(fmt(L"en")->ParseText(L"123-4567-8", L"AAA-9999-X", &result)); } @@ -568,7 +568,7 @@ TEST_F(CFGAS_FormatStringTest, TextFormat) { }; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatText(tests[i].input, tests[i].pattern, &result)); EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i; @@ -599,7 +599,7 @@ TEST_F(CFGAS_FormatStringTest, NullFormat) { } tests[] = {{L"en", L"null{'n/a'}", L"n/a"}, {L"en", L"null{}", L""}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale)->FormatNull(tests[i].pattern, &result)); EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i; } @@ -635,7 +635,7 @@ TEST_F(CFGAS_FormatStringTest, ZeroFormat) { {L"en", L"0", L"zero{}", L""}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE( fmt(tests[i].locale) ->FormatZero(/* tests[i].input,*/ tests[i].pattern, &result)); diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 9cb772ecba..f2405e9844 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -172,14 +172,14 @@ uint32_t GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles) { uint32_t GetFontFamilyHash(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - CFX_WideString wsFont(pszFontFamily); + WideString wsFont(pszFontFamily); if (dwFontStyles & FX_FONTSTYLE_Bold) wsFont += L"Bold"; if (dwFontStyles & FX_FONTSTYLE_Italic) wsFont += L"Italic"; wsFont += wCodePage; - return FX_HashCode_GetW(wsFont.AsStringC(), false); + return FX_HashCode_GetW(wsFont.AsStringView(), false); } } // namespace @@ -307,8 +307,8 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( void* buffer[3] = {pSrcFont.Get(), (void*)(uintptr_t)dwFontStyles, (void*)(uintptr_t)wCodePage}; - uint32_t dwHash = FX_HashCode_GetA( - CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false); + uint32_t dwHash = + FX_HashCode_GetA(ByteStringView((uint8_t*)buffer, sizeof(buffer)), false); auto it = m_DeriveFonts.find(dwHash); if (it != m_DeriveFonts.end() && it->second) return it->second; @@ -627,7 +627,7 @@ CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {} -CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { +ByteString CFX_FontSourceEnum_File::GetNextFile() { FX_FileHandle* pCurHandle = !m_FolderQueue.empty() ? m_FolderQueue.back().pFileHandle : nullptr; if (!pCurHandle) { @@ -639,10 +639,10 @@ CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { hpp.bsParentPath = m_FolderPaths.back(); m_FolderQueue.push_back(hpp); } - CFX_ByteString bsName; + ByteString bsName; bool bFolder; - CFX_ByteString bsFolderSeparator = - CFX_ByteString::FromUnicode(CFX_WideString(kFolderSeparator)); + ByteString bsFolderSeparator = + ByteString::FromUnicode(WideString(kFolderSeparator)); while (true) { if (!FX_GetNextFile(pCurHandle, &bsName, &bFolder)) { FX_CloseFolder(pCurHandle); @@ -684,7 +684,7 @@ CFX_RetainPtr<CFX_CRTFileAccess> CFX_FontSourceEnum_File::GetNext() { if (m_wsNext.GetLength() == 0) return nullptr; - auto pAccess = pdfium::MakeRetain<CFX_CRTFileAccess>(m_wsNext.AsStringC()); + auto pAccess = pdfium::MakeRetain<CFX_CRTFileAccess>(m_wsNext.AsStringView()); m_wsNext = GetNextFile().UTF8Decode(); return pAccess; } @@ -722,8 +722,8 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { if (!pFontStream) continue; - CFX_WideString wsFaceName = - CFX_WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); + WideString wsFaceName = + WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); RegisterFaces(pFontStream, &wsFaceName); } return !m_InstalledFonts.empty(); @@ -759,10 +759,10 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { - CFX_ByteString bsHash; + ByteString bsHash; bsHash.Format("%d, %d", wCodePage, dwFontStyles); - bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily)); - uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); + bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); + uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash]; if (!pFontArray->empty()) return (*pFontArray)[0]; @@ -773,7 +773,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>(); sortedFontInfos = pNewFonts.get(); MatchFonts(sortedFontInfos, wCodePage, dwFontStyles, - CFX_WideString(pszFontFamily), 0); + WideString(pszFontFamily), 0); m_Hash2CandidateList[dwHash] = std::move(pNewFonts); } if (sortedFontInfos->empty()) @@ -800,13 +800,13 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode); uint16_t wCodePage = x ? x->wCodePage : 0xFFFF; uint16_t wBitField = x ? x->wBitField : 0x03E7; - CFX_ByteString bsHash; + ByteString bsHash; if (wCodePage == 0xFFFF) bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles); else bsHash.Format("%d, %d", wCodePage, dwFontStyles); - bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily)); - uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); + bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); + uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFonts = &m_Hash2Fonts[dwHash]; for (size_t i = 0; i < pFonts->size(); ++i) { if (VerifyUnicode((*pFonts)[i], wUnicode)) @@ -818,7 +818,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>(); sortedFontInfos = pNewFonts.get(); MatchFonts(sortedFontInfos, wCodePage, dwFontStyles, - CFX_WideString(pszFontFamily), wUnicode); + WideString(pszFontFamily), wUnicode); m_Hash2CandidateList[dwHash] = std::move(pNewFonts); } for (const auto& info : *sortedFontInfos) { @@ -876,7 +876,7 @@ bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, } CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const CFX_WideString& wsFaceName, + const WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); @@ -993,7 +993,7 @@ CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( } CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( - const CFX_ByteString& bsFaceName) { + const ByteString& bsFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); if (!pFontMapper) @@ -1015,7 +1015,7 @@ void CFGAS_FontMgr::MatchFonts( std::vector<CFX_FontDescriptorInfo>* pMatchedFonts, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode) { pMatchedFonts->clear(); for (const auto& pFont : m_InstalledFonts) { @@ -1033,7 +1033,7 @@ void CFGAS_FontMgr::MatchFonts( int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode) { int32_t nPenalty = 30000; if (FontName.GetLength() != 0) { @@ -1122,8 +1122,7 @@ void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pEFont) { } } -void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, - const CFX_WideString* pFaceName) { +void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, const WideString* pFaceName) { if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0) return; @@ -1147,18 +1146,17 @@ void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, table.clear(); } GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames); - pFont->m_wsFamilyNames.push_back( - CFX_ByteString(pFace->family_name).UTF8Decode()); + pFont->m_wsFamilyNames.push_back(ByteString(pFace->family_name).UTF8Decode()); pFont->m_wsFaceName = pFaceName ? *pFaceName - : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); + : WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); pFont->m_nFaceIndex = pFace->face_index; m_InstalledFonts.push_back(std::move(pFont)); } void CFGAS_FontMgr::RegisterFaces( const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, - const CFX_WideString* pFaceName) { + const WideString* pFaceName) { int32_t index = 0; int32_t num_faces = 0; do { @@ -1194,12 +1192,12 @@ uint32_t CFGAS_FontMgr::GetFlags(FXFT_Face pFace) { } void CFGAS_FontMgr::GetNames(const uint8_t* name_table, - std::vector<CFX_WideString>& Names) { + std::vector<WideString>& Names) { if (!name_table) return; uint8_t* lpTable = (uint8_t*)name_table; - CFX_WideString wsFamily; + WideString wsFamily; uint8_t* sp = lpTable + 2; uint8_t* lpNameRecord = lpTable + 6; uint16_t nNameCount = GetUInt16(sp); @@ -1267,8 +1265,8 @@ void CFGAS_FontMgr::GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB) { CSB[1] = pOS2->ulCodePageRange2; } -int32_t CFGAS_FontMgr::IsPartName(const CFX_WideString& Name1, - const CFX_WideString& Name2) { +int32_t CFGAS_FontMgr::IsPartName(const WideString& Name1, + const WideString& Name2) { if (Name1.Contains(Name2.c_str())) return 1; return 0; diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index ca3cf1c710..8e970361b4 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -131,8 +131,8 @@ class CFX_FontDescriptor { ~CFX_FontDescriptor(); int32_t m_nFaceIndex; - CFX_WideString m_wsFaceName; - std::vector<CFX_WideString> m_wsFamilyNames; + WideString m_wsFaceName; + std::vector<WideString> m_wsFamilyNames; uint32_t m_dwFontStyles; uint32_t m_dwUsb[4]; uint32_t m_dwCsb[2]; @@ -161,7 +161,7 @@ struct FX_HandleParentPath { bsParentPath = x.bsParentPath; } FX_FileHandle* pFileHandle; - CFX_ByteString bsParentPath; + ByteString bsParentPath; }; class CFX_FontSourceEnum_File { @@ -173,11 +173,11 @@ class CFX_FontSourceEnum_File { CFX_RetainPtr<CFX_CRTFileAccess> GetNext(); private: - CFX_ByteString GetNextFile(); + ByteString GetNextFile(); - CFX_WideString m_wsNext; + WideString m_wsNext; std::vector<FX_HandleParentPath> m_FolderQueue; - std::vector<CFX_ByteString> m_FolderPaths; + std::vector<ByteString> m_FolderPaths; }; class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { @@ -203,28 +203,28 @@ class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { bool EnumFonts(); bool EnumFontsFromFontMapper(); bool EnumFontsFromFiles(); - void RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName); + void RegisterFace(FXFT_Face pFace, const WideString* pFaceName); void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, - const CFX_WideString* pFaceName); - void GetNames(const uint8_t* name_table, std::vector<CFX_WideString>& Names); + const WideString* pFaceName); + void GetNames(const uint8_t* name_table, std::vector<WideString>& Names); std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode); bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode); - int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); + int32_t IsPartName(const WideString& Name1, const WideString& Name2); void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode = 0xFFFE); int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode = 0xFFFE); - CFX_RetainPtr<CFGAS_GEFont> LoadFont(const CFX_WideString& wsFaceName, + CFX_RetainPtr<CFGAS_GEFont> LoadFont(const WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount); FXFT_Face LoadFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, @@ -234,7 +234,7 @@ class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { IFX_SystemFontInfo* pSystemFontInfo, uint32_t index); CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( - const CFX_ByteString& bsFaceName); + const ByteString& bsFaceName); CFX_FontSourceEnum_File* const m_pFontSource; std::vector<std::unique_ptr<CFX_FontDescriptor>> m_InstalledFonts; diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp index 151aec7d9e..c710ed96b0 100644 --- a/xfa/fgas/font/cfgas_gefont.cpp +++ b/xfa/fgas/font/cfgas_gefont.cpp @@ -102,9 +102,9 @@ bool CFGAS_GEFont::LoadFontInternal(const wchar_t* pszFontFamily, uint16_t wCodePage) { if (m_pFont) return false; - CFX_ByteString csFontFamily; + ByteString csFontFamily; if (pszFontFamily) - csFontFamily = CFX_ByteString::FromUnicode(pszFontFamily); + csFontFamily = ByteString::FromUnicode(pszFontFamily); uint32_t dwFlags = 0; if (dwFontStyles & FX_FONTSTYLE_FixedPitch) dwFlags |= FXFONT_FIXED_PITCH; @@ -173,13 +173,13 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::Derive(uint32_t dwFontStyles, return pdfium::MakeRetain<CFGAS_GEFont>(pFont, dwFontStyles); } -CFX_WideString CFGAS_GEFont::GetFamilyName() const { +WideString CFGAS_GEFont::GetFamilyName() const { if (!m_pFont->GetSubstFont() || m_pFont->GetSubstFont()->m_Family.GetLength() == 0) { - return CFX_WideString::FromLocal(m_pFont->GetFamilyName().AsStringC()); + return WideString::FromLocal(m_pFont->GetFamilyName().AsStringView()); } - return CFX_WideString::FromLocal( - m_pFont->GetSubstFont()->m_Family.AsStringC()); + return WideString::FromLocal( + m_pFont->GetSubstFont()->m_Family.AsStringView()); } uint32_t CFGAS_GEFont::GetFontStyles() const { @@ -330,7 +330,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, if (!m_pFontMgr || !bRecursive) return 0xFFFF; - CFX_WideString wsFamily = GetFamilyName(); + WideString wsFamily = GetFamilyName(); CFX_RetainPtr<CFGAS_GEFont> pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), wsFamily.c_str()); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h index cc9e56a110..13ac48f9cb 100644 --- a/xfa/fgas/font/cfgas_gefont.h +++ b/xfa/fgas/font/cfgas_gefont.h @@ -89,7 +89,7 @@ class CFGAS_GEFont : public CFX_Retainable { bool bRecursive, CFX_RetainPtr<CFGAS_GEFont>* ppFont, bool bCharCode = false); - CFX_WideString GetFamilyName() const; + WideString GetFamilyName() const; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ bool m_bUseLogFontStyle; diff --git a/xfa/fgas/layout/cfx_breakline.cpp b/xfa/fgas/layout/cfx_breakline.cpp index 9eb0211119..d3fce06d6f 100644 --- a/xfa/fgas/layout/cfx_breakline.cpp +++ b/xfa/fgas/layout/cfx_breakline.cpp @@ -35,7 +35,7 @@ const CFX_BreakPiece* CFX_BreakLine::GetPiece(int32_t index) const { return &m_LinePieces[index]; } -void CFX_BreakLine::GetString(CFX_WideString& wsStr) const { +void CFX_BreakLine::GetString(WideString& wsStr) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_LineChars); wchar_t* pBuf = wsStr.GetBuffer(iCount); for (int32_t i = 0; i < iCount; i++) diff --git a/xfa/fgas/layout/cfx_breakline.h b/xfa/fgas/layout/cfx_breakline.h index 138ee3104e..8826976517 100644 --- a/xfa/fgas/layout/cfx_breakline.h +++ b/xfa/fgas/layout/cfx_breakline.h @@ -24,7 +24,7 @@ class CFX_BreakLine { int32_t CountPieces() const; const CFX_BreakPiece* GetPiece(int32_t index) const; - void GetString(CFX_WideString& wsStr) const; + void GetString(WideString& wsStr) const; int32_t GetLineEnd() const; void Clear(); diff --git a/xfa/fgas/layout/cfx_breakpiece.cpp b/xfa/fgas/layout/cfx_breakpiece.cpp index 70ac66e8ba..364c117e89 100644 --- a/xfa/fgas/layout/cfx_breakpiece.cpp +++ b/xfa/fgas/layout/cfx_breakpiece.cpp @@ -34,8 +34,8 @@ CFX_Char* CFX_BreakPiece::GetChar(int32_t index) const { return &(*m_pChars)[m_iStartChar + index]; } -CFX_WideString CFX_BreakPiece::GetString() const { - CFX_WideString ret; +WideString CFX_BreakPiece::GetString() const { + WideString ret; ret.Reserve(m_iChars); for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++) ret += static_cast<wchar_t>((*m_pChars)[i].char_code()); diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h index 668245f3c0..bbf4558eb1 100644 --- a/xfa/fgas/layout/cfx_breakpiece.h +++ b/xfa/fgas/layout/cfx_breakpiece.h @@ -25,7 +25,7 @@ class CFX_BreakPiece { int32_t GetLength() const { return m_iChars; } CFX_Char* GetChar(int32_t index) const; - CFX_WideString GetString() const; + WideString GetString() const; std::vector<int32_t> GetWidths() const; CFX_BreakType m_dwStatus; diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h index 699815ab98..f5ad90838f 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.h +++ b/xfa/fgas/layout/cfx_rtfbreak.h @@ -31,7 +31,7 @@ struct FX_RTFTEXTOBJ { FX_RTFTEXTOBJ(); ~FX_RTFTEXTOBJ(); - CFX_WideString pStr; + WideString pStr; std::vector<int32_t> pWidths; CFX_RetainPtr<CFGAS_GEFont> pFont; const CFX_RectF* pRect; diff --git a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp index 8997edc083..bda52fc76a 100644 --- a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp @@ -39,7 +39,7 @@ class CFX_RTFBreakTest : public testing::Test { TEST_F(CFX_RTFBreakTest, AddChars) { auto b = CreateBreak(FX_LAYOUTSTYLE_ExpandTab); - CFX_WideString str(L"Input String."); + WideString str(L"Input String."); for (const auto& c : str) EXPECT_EQ(CFX_BreakType::None, b->AppendChar(c)); diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h index 72614bc2e7..959cd8eb48 100644 --- a/xfa/fgas/layout/cfx_txtbreak.h +++ b/xfa/fgas/layout/cfx_txtbreak.h @@ -41,7 +41,7 @@ struct FX_TXTRUN { CFDE_TextEditEngine* pEdtEngine; const FDE_TEXTEDITPIECE* pIdentity; - CFX_WideString wsStr; + WideString wsStr; int32_t* pWidths; int32_t iLength; CFX_RetainPtr<CFGAS_GEFont> pFont; |