Rename Left() and Right() in {Byte,Wide}String{,View} classes
Rename to First() and Last().
Bug: pdfium:1406
Change-Id: I786313c4ea044c9e27e532d9d25ba6c26f9228f4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65613
Auto-Submit: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index 96bf30b..62c3df5 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -211,9 +211,9 @@
// Color RGB values used are integers divided by 255.
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /",
- pathString.Left(48));
+ pathString.First(48));
EXPECT_EQ(" gs 1 0 0 1 0 0 cm 1 2 m 3 4 l 5 6 l h B Q\n",
- pathString.Right(43));
+ pathString.Last(43));
ASSERT_GT(pathString.GetLength(), 91U);
CPDF_Dictionary* externalGS =
TestGetResource(&generator, "ExtGState",
@@ -228,9 +228,9 @@
TestProcessPath(&generator, &buf, pPathObj.get());
ByteString pathString2(buf);
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG 10.5 w /",
- pathString2.Left(55));
+ pathString2.First(55));
EXPECT_EQ(" gs 1 0 0 1 0 0 cm 1 2 m 3 4 l 5 6 l h B Q\n",
- pathString2.Right(43));
+ pathString2.Last(43));
// Compare with the previous (should use same dictionary for gs)
EXPECT_EQ(pathString.GetLength() + 7, pathString2.GetLength());
@@ -273,12 +273,12 @@
auto secondResourceAt = textString.ReverseFind('/');
ASSERT_TRUE(secondResourceAt.has_value());
secondResourceAt = secondResourceAt.value() + 1;
- ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString firstString = textString.First(firstResourceAt.value());
ByteString midString =
textString.Substr(firstResourceAt.value(),
secondResourceAt.value() - firstResourceAt.value());
ByteString lastString =
- textString.Right(textString.GetLength() - secondResourceAt.value());
+ textString.Last(textString.GetLength() - secondResourceAt.value());
// q and Q must be outside the BT .. ET operations
ByteString compareString1 =
"q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /";
@@ -288,18 +288,18 @@
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength() +
compareString3.GetLength(),
textString.GetLength());
- EXPECT_EQ(compareString1, firstString.Left(compareString1.GetLength()));
- EXPECT_EQ(compareString2, midString.Right(compareString2.GetLength()));
- EXPECT_EQ(compareString3, lastString.Right(compareString3.GetLength()));
+ EXPECT_EQ(compareString1, firstString.First(compareString1.GetLength()));
+ EXPECT_EQ(compareString2, midString.Last(compareString2.GetLength()));
+ EXPECT_EQ(compareString3, lastString.Last(compareString3.GetLength()));
CPDF_Dictionary* externalGS = TestGetResource(
&generator, "ExtGState",
- midString.Left(midString.GetLength() - compareString2.GetLength()));
+ midString.First(midString.GetLength() - compareString2.GetLength()));
ASSERT_TRUE(externalGS);
EXPECT_EQ(0.5f, externalGS->GetNumberFor("ca"));
EXPECT_EQ(0.8f, externalGS->GetNumberFor("CA"));
CPDF_Dictionary* fontDict = TestGetResource(
&generator, "Font",
- lastString.Left(lastString.GetLength() - compareString3.GetLength()));
+ lastString.First(lastString.GetLength() - compareString3.GetLength()));
ASSERT_TRUE(fontDict);
EXPECT_EQ("Font", fontDict->GetStringFor("Type"));
EXPECT_EQ("Type1", fontDict->GetStringFor("Subtype"));
@@ -346,16 +346,16 @@
auto firstResourceAt = textString.Find('/');
ASSERT_TRUE(firstResourceAt.has_value());
firstResourceAt = firstResourceAt.value() + 1;
- ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString firstString = textString.First(firstResourceAt.value());
ByteString lastString =
- textString.Right(textString.GetLength() - firstResourceAt.value());
+ textString.Last(textString.GetLength() - firstResourceAt.value());
// q and Q must be outside the BT .. ET operations
ByteString compareString1 = "q BT 1 0 0 1 0 0 Tm /";
ByteString compareString2 = " 15.5 Tf <4920616D20696E646972656374> Tj ET Q\n";
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength(),
textString.GetLength());
- EXPECT_EQ(compareString1, textString.Left(compareString1.GetLength()));
- EXPECT_EQ(compareString2, textString.Right(compareString2.GetLength()));
+ EXPECT_EQ(compareString1, textString.First(compareString1.GetLength()));
+ EXPECT_EQ(compareString2, textString.Last(compareString2.GetLength()));
CPDF_Dictionary* fontDict = TestGetResource(
&generator, "Font",
textString.Substr(compareString1.GetLength(),
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index 35cf8bb..9d1603b 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -184,7 +184,7 @@
const PredefinedCMap* GetPredefinedCMap(const ByteString& bsPredefinedName) {
ByteString cmapid = bsPredefinedName;
if (cmapid.GetLength() > 2)
- cmapid = cmapid.Left(cmapid.GetLength() - 2);
+ cmapid = cmapid.First(cmapid.GetLength() - 2);
for (const auto& map : kPredefinedCMaps) {
if (cmapid == ByteStringView(map.m_pName))
return ↦
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp
index 653af0c..4129716 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.cpp
+++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp
@@ -16,7 +16,7 @@
RetainPtr<const CPDF_CMap> LoadPredefinedCMap(ByteString name) {
if (!name.IsEmpty() && name[0] == '/')
- name = name.Right(name.GetLength() - 1);
+ name = name.Last(name.GetLength() - 1);
return pdfium::MakeRetain<CPDF_CMap>(name);
}
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 2f44dd9..7407a42 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -21,7 +21,7 @@
ByteStringView CMap_GetString(ByteStringView word) {
if (word.GetLength() <= 2)
return ByteStringView();
- return word.Right(word.GetLength() - 2);
+ return word.Last(word.GetLength() - 2);
}
} // namespace
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 106ab6a..326bc6e 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -315,7 +315,7 @@
ByteString type = pFontDict->GetStringFor("Subtype");
RetainPtr<CPDF_Font> pFont;
if (type == "TrueType") {
- ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
+ ByteString tag = pFontDict->GetStringFor("BaseFont").First(4);
for (size_t i = 0; i < FX_ArraySize(kChineseFontNames); ++i) {
if (tag == ByteString(kChineseFontNames[i], kChineseFontNameSize)) {
const CPDF_Dictionary* pFontDesc =
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 9371678..c0fd4e0 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -213,7 +213,7 @@
}
if (m_pFontFile) {
if (m_BaseFontName.GetLength() > 8 && m_BaseFontName[7] == '+')
- m_BaseFontName = m_BaseFontName.Right(m_BaseFontName.GetLength() - 8);
+ m_BaseFontName = m_BaseFontName.Last(m_BaseFontName.GetLength() - 8);
} else {
LoadSubstFont();
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 420bf70..a18bead 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -612,7 +612,7 @@
break;
}
auto word = m_pSyntax->GetWord();
- ByteString key(word.Right(word.GetLength() - 1));
+ ByteString key(word.Last(word.GetLength() - 1));
auto pObj = m_pSyntax->ReadNextObject(false, false, 0);
if (!key.IsEmpty()) {
if (pObj && !pObj->IsInline()) {
@@ -1168,7 +1168,7 @@
if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") {
ByteString defname = "Default";
- defname += name.Right(name.GetLength() - 7);
+ defname += name.Last(name.GetLength() - 7);
const CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname);
if (!pDefObj) {
if (name == "DeviceGray")
@@ -1533,7 +1533,7 @@
break;
case CPDF_StreamParser::Name: {
auto word = syntax.GetWord();
- AddNameParam(word.Right(word.GetLength() - 1));
+ AddNameParam(word.Last(word.GetLength() - 1));
break;
}
default:
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index 70d6d5e..506e176 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -70,7 +70,7 @@
return WideString();
#if defined(OS_MACOSX)
- if (filepath.Left(sizeof("/Mac") - 1) == WideStringView(L"/Mac"))
+ if (filepath.First(sizeof("/Mac") - 1) == WideStringView(L"/Mac"))
return ChangeSlashToPlatform(filepath.c_str() + 1);
return ChangeSlashToPlatform(filepath.c_str());
#elif defined(OS_WIN)
@@ -191,7 +191,7 @@
return L'/' + ChangeSlashToPDF(filepath.c_str());
return ChangeSlashToPDF(filepath.c_str());
#elif defined(OS_MACOSX)
- if (filepath.Left(sizeof("Mac") - 1).EqualsASCII("Mac"))
+ if (filepath.First(sizeof("Mac") - 1).EqualsASCII("Mac"))
return L'/' + ChangeSlashToPDF(filepath.c_str());
return ChangeSlashToPDF(filepath.c_str());
#else
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index 001ff1d..f822f3b 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -156,7 +156,7 @@
if (ch != L')' && ch != L',' && ch != L'>' && ch != L'.')
break;
- strBeCheck = strBeCheck.Left(strBeCheck.GetLength() - 1);
+ strBeCheck = strBeCheck.First(strBeCheck.GetLength() - 1);
nCount--;
}
@@ -249,7 +249,7 @@
// End extracting for other invalid chars, '.' at the beginning, or
// consecutive '.'.
size_t removed_len = i == pPos ? i + 1 : i;
- *str = str->Right(str->GetLength() - removed_len);
+ *str = str->Last(str->GetLength() - removed_len);
break;
}
// Found a valid '.'.
@@ -282,7 +282,7 @@
size_t host_end = i == pPos + 1 ? i - 2 : i - 1;
if (pPos > 0 && host_end - aPos.value() >= 3) {
// Trim the ending invalid chars if there is at least one '.' and name.
- *str = str->Left(host_end + 1);
+ *str = str->First(host_end + 1);
break;
}
return false;
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index d409670..3df499f 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -147,13 +147,13 @@
continue;
}
if (pos > 0)
- findwhat_array.push_back(word->Left(pos));
+ findwhat_array.push_back(word->First(pos));
findwhat_array.push_back(curStr);
if (pos == word->GetLength() - 1) {
word->clear();
break;
}
- word.emplace(word->Right(word->GetLength() - pos - 1));
+ word.emplace(word->Last(word->GetLength() - pos - 1));
pos = 0;
continue;
}
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index a353064..0778bc2 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -490,13 +490,13 @@
return dest;
}
-ByteString ByteString::Left(size_t count) const {
+ByteString ByteString::First(size_t count) const {
if (count == 0 || !IsValidLength(count))
return ByteString();
return Substr(0, count);
}
-ByteString ByteString::Right(size_t count) const {
+ByteString ByteString::Last(size_t count) const {
if (count == 0 || !IsValidLength(count))
return ByteString();
return Substr(GetLength() - count, count);
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index c017087..7c7f2ee 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -164,8 +164,8 @@
void ReleaseBuffer(size_t nNewLength);
ByteString Substr(size_t first, size_t count) const;
- ByteString Left(size_t count) const;
- ByteString Right(size_t count) const;
+ ByteString First(size_t count) const;
+ ByteString Last(size_t count) const;
Optional<size_t> Find(ByteStringView subStr, size_t start = 0) const;
Optional<size_t> Find(char ch, size_t start = 0) const;
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index 61b4ae1..e2e87f0 100644
--- a/core/fxcrt/bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -626,34 +626,34 @@
EXPECT_EQ("", empty.Substr(0, 0));
}
-TEST(ByteString, Left) {
+TEST(ByteString, First) {
ByteString fred("FRED");
- EXPECT_EQ("", fred.Left(0));
- EXPECT_EQ("F", fred.Left(1));
- EXPECT_EQ("FR", fred.Left(2));
- EXPECT_EQ("FRE", fred.Left(3));
- EXPECT_EQ("FRED", fred.Left(4));
+ EXPECT_EQ("", fred.First(0));
+ EXPECT_EQ("F", fred.First(1));
+ EXPECT_EQ("FR", fred.First(2));
+ EXPECT_EQ("FRE", fred.First(3));
+ EXPECT_EQ("FRED", fred.First(4));
- EXPECT_EQ("", fred.Left(5));
+ EXPECT_EQ("", fred.First(5));
ByteString empty;
- EXPECT_EQ("", empty.Left(0));
- EXPECT_EQ("", empty.Left(1));
+ EXPECT_EQ("", empty.First(0));
+ EXPECT_EQ("", empty.First(1));
}
-TEST(ByteString, Right) {
+TEST(ByteString, Last) {
ByteString fred("FRED");
- EXPECT_EQ("", fred.Right(0));
- EXPECT_EQ("D", fred.Right(1));
- EXPECT_EQ("ED", fred.Right(2));
- EXPECT_EQ("RED", fred.Right(3));
- EXPECT_EQ("FRED", fred.Right(4));
+ EXPECT_EQ("", fred.Last(0));
+ EXPECT_EQ("D", fred.Last(1));
+ EXPECT_EQ("ED", fred.Last(2));
+ EXPECT_EQ("RED", fred.Last(3));
+ EXPECT_EQ("FRED", fred.Last(4));
- EXPECT_EQ("", fred.Right(5));
+ EXPECT_EQ("", fred.Last(5));
ByteString empty;
- EXPECT_EQ("", empty.Right(0));
- EXPECT_EQ("", empty.Right(1));
+ EXPECT_EQ("", empty.Last(0));
+ EXPECT_EQ("", empty.Last(1));
}
TEST(ByteString, Find) {
diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h
index 4db1cea..e27f43a 100644
--- a/core/fxcrt/fx_string.h
+++ b/core/fxcrt/fx_string.h
@@ -39,8 +39,8 @@
Optional<size_t> index = remaining.Find(ch);
if (!index.has_value())
break;
- result.emplace_back(remaining.Left(index.value()));
- remaining = remaining.Right(remaining.GetLength() - index.value() - 1);
+ result.emplace_back(remaining.First(index.value()));
+ remaining = remaining.Last(remaining.GetLength() - index.value() - 1);
}
result.emplace_back(remaining);
return result;
diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h
index f4180f7..e50a71d 100644
--- a/core/fxcrt/string_view_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -21,7 +21,7 @@
// An immutable string with caller-provided storage which must outlive the
// string itself. These are not necessarily nul-terminated, so that substring
-// extraction (via the Substr(), Left(), and Right() methods) is copy-free.
+// extraction (via the Substr(), First(), and Last() methods) is copy-free.
//
// String view arguments should be passed by value, since they are small,
// rather than const-ref, even if they are not modified.
@@ -213,13 +213,13 @@
return StringViewTemplate(m_Span.data() + first, count);
}
- StringViewTemplate Left(size_t count) const {
+ StringViewTemplate First(size_t count) const {
if (count == 0 || !IsValidLength(count))
return StringViewTemplate();
return Substr(0, count);
}
- StringViewTemplate Right(size_t count) const {
+ StringViewTemplate Last(size_t count) const {
if (count == 0 || !IsValidLength(count))
return StringViewTemplate();
return Substr(GetLength() - count, count);
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 79fe3b0..10a31c3 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -715,13 +715,13 @@
return dest;
}
-WideString WideString::Left(size_t count) const {
+WideString WideString::First(size_t count) const {
if (count == 0 || !IsValidLength(count))
return WideString();
return Substr(0, count);
}
-WideString WideString::Right(size_t count) const {
+WideString WideString::Last(size_t count) const {
if (count == 0 || !IsValidLength(count))
return WideString();
return Substr(GetLength() - count, count);
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index d240a9d..58e7544 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -151,8 +151,8 @@
int CompareNoCase(const wchar_t* str) const;
WideString Substr(size_t first, size_t count) const;
- WideString Left(size_t count) const;
- WideString Right(size_t count) const;
+ WideString First(size_t count) const;
+ WideString Last(size_t count) const;
size_t Insert(size_t index, wchar_t ch);
size_t InsertAtFront(wchar_t ch) { return Insert(0, ch); }
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index b71c937..2445a47 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -634,34 +634,34 @@
EXPECT_EQ(L"", empty.Substr(0, 0));
}
-TEST(WideString, Left) {
+TEST(WideString, First) {
WideString fred(L"FRED");
- EXPECT_EQ(L"", fred.Left(0));
- EXPECT_EQ(L"F", fred.Left(1));
- EXPECT_EQ(L"FR", fred.Left(2));
- EXPECT_EQ(L"FRE", fred.Left(3));
- EXPECT_EQ(L"FRED", fred.Left(4));
+ EXPECT_EQ(L"", fred.First(0));
+ EXPECT_EQ(L"F", fred.First(1));
+ EXPECT_EQ(L"FR", fred.First(2));
+ EXPECT_EQ(L"FRE", fred.First(3));
+ EXPECT_EQ(L"FRED", fred.First(4));
- EXPECT_EQ(L"", fred.Left(5));
+ EXPECT_EQ(L"", fred.First(5));
WideString empty;
- EXPECT_EQ(L"", empty.Left(0));
- EXPECT_EQ(L"", empty.Left(1));
+ EXPECT_EQ(L"", empty.First(0));
+ EXPECT_EQ(L"", empty.First(1));
}
-TEST(WideString, Right) {
+TEST(WideString, Last) {
WideString fred(L"FRED");
- EXPECT_EQ(L"", fred.Right(0));
- EXPECT_EQ(L"D", fred.Right(1));
- EXPECT_EQ(L"ED", fred.Right(2));
- EXPECT_EQ(L"RED", fred.Right(3));
- EXPECT_EQ(L"FRED", fred.Right(4));
+ EXPECT_EQ(L"", fred.Last(0));
+ EXPECT_EQ(L"D", fred.Last(1));
+ EXPECT_EQ(L"ED", fred.Last(2));
+ EXPECT_EQ(L"RED", fred.Last(3));
+ EXPECT_EQ(L"FRED", fred.Last(4));
- EXPECT_EQ(L"", fred.Right(5));
+ EXPECT_EQ(L"", fred.Last(5));
WideString empty;
- EXPECT_EQ(L"", empty.Right(0));
- EXPECT_EQ(L"", empty.Right(1));
+ EXPECT_EQ(L"", empty.Last(0));
+ EXPECT_EQ(L"", empty.Last(1));
}
TEST(WideString, Find) {
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index a294b5f..b999f5c 100644
--- a/core/fxcrt/xml/cfx_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -40,13 +40,13 @@
WideString CFX_XMLElement::GetLocalTagName() const {
auto pos = name_.Find(L':');
- return pos.has_value() ? name_.Right(name_.GetLength() - pos.value() - 1)
+ return pos.has_value() ? name_.Last(name_.GetLength() - pos.value() - 1)
: name_;
}
WideString CFX_XMLElement::GetNamespacePrefix() const {
auto pos = name_.Find(L':');
- return pos.has_value() ? name_.Left(pos.value()) : WideString();
+ return pos.has_value() ? name_.First(pos.value()) : WideString();
}
WideString CFX_XMLElement::GetNamespaceURI() const {
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 2420ea5..b5e7a20 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -370,7 +370,7 @@
if (filename == "." || filename == "..")
continue;
} else {
- ByteString ext = filename.Right(4);
+ ByteString ext = filename.Last(4);
ext.MakeLower();
if (ext != ".ttf" && ext != ".ttc" && ext != ".otf")
continue;
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index 05d7ec9..032d4de 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -154,7 +154,7 @@
if (filename == "." || filename == "..")
continue;
} else {
- ByteString ext = filename.Right(4);
+ ByteString ext = filename.Last(4);
ext.MakeLower();
if (ext != ".ttf" && ext != ".ttc" && ext != ".otf")
continue;
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 04fb77d..3b0bcae 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -168,7 +168,7 @@
norm.Remove(',');
auto pos = norm.Find('+');
if (pos.has_value() && pos.value() != 0)
- norm = norm.Left(pos.value());
+ norm = norm.First(pos.value());
norm.MakeLower();
return norm;
}
@@ -230,10 +230,10 @@
continue;
if (bReverse) {
- if (bsStyle.Right(pStyle->len).Compare(pStyle->name) == 0)
+ if (bsStyle.Last(pStyle->len).Compare(pStyle->name) == 0)
return std::make_tuple(true, pStyle->style, pStyle->len);
} else {
- if (bsStyle.Left(pStyle->len).Compare(pStyle->name) == 0)
+ if (bsStyle.First(pStyle->len).Compare(pStyle->name) == 0)
return std::make_tuple(true, pStyle->style, pStyle->len);
}
}
@@ -399,7 +399,7 @@
ByteString SubstName = name;
SubstName.Remove(' ');
if (bTrueType && name.GetLength() > 0 && name[0] == '@')
- SubstName = name.Right(name.GetLength() - 1);
+ SubstName = name.Last(name.GetLength() - 1);
GetStandardFontName(&SubstName);
if (SubstName == "Symbol" && !bTrueType) {
pSubstFont->m_Family = "Chrome Symbol";
@@ -419,9 +419,9 @@
{
Optional<size_t> pos = SubstName.Find(",", 0);
if (pos.has_value()) {
- family = SubstName.Left(pos.value());
+ family = SubstName.First(pos.value());
GetStandardFontName(&family);
- style = SubstName.Right(SubstName.GetLength() - (pos.value() + 1));
+ style = SubstName.Last(SubstName.GetLength() - (pos.value() + 1));
bHasComma = true;
} else {
family = SubstName;
@@ -448,8 +448,8 @@
if (!bHasComma) {
Optional<size_t> pos = family.ReverseFind('-');
if (pos.has_value()) {
- style = family.Right(family.GetLength() - (pos.value() + 1));
- family = family.Left(pos.value());
+ style = family.Last(family.GetLength() - (pos.value() + 1));
+ family = family.First(pos.value());
bHasHyphen = true;
}
}
@@ -460,7 +460,7 @@
size_t len;
std::tie(hasStyleType, styleType, len) = GetStyleType(family, true);
if (hasStyleType) {
- family = family.Left(nLen - len);
+ family = family.First(nLen - len);
nStyle |= styleType;
}
}
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 9c38d58..58cb504 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -442,12 +442,12 @@
for (size_t i = 0; i < m_pMapper->m_InstalledTTFonts.size(); ++i) {
ByteString thisname = m_pMapper->m_InstalledTTFonts[i];
- if (thisname.Left(name.GetLength()) == name)
+ if (thisname.First(name.GetLength()) == name)
return m_pMapper->m_InstalledTTFonts[i];
}
for (size_t i = 0; i < m_pMapper->m_LocalizedTTFonts.size(); ++i) {
ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first;
- if (thisname.Left(name.GetLength()) == name)
+ if (thisname.First(name.GetLength()) == name)
return m_pMapper->m_LocalizedTTFonts[i].second;
}
return ByteString();
diff --git a/fpdfsdk/fpdf_ppo.cpp b/fpdfsdk/fpdf_ppo.cpp
index 3cdf3d5..819ba05 100644
--- a/fpdfsdk/fpdf_ppo.cpp
+++ b/fpdfsdk/fpdf_ppo.cpp
@@ -228,7 +228,7 @@
if (nDashPosition) {
size_t nMid = nDashPosition.value();
uint32_t nStartPageNum = pdfium::base::checked_cast<uint32_t>(
- atoi(cbMidRange.Left(nMid).c_str()));
+ atoi(cbMidRange.First(nMid).c_str()));
if (nStartPageNum == 0)
return false;
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index 078bc93..5edbf27 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -351,7 +351,7 @@
WideString str = textpage->GetPageText(start_index, char_count);
if (str.GetLength() > static_cast<size_t>(char_count))
- str = str.Left(static_cast<size_t>(char_count));
+ str = str.First(static_cast<size_t>(char_count));
// UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
// the number of items to stay the same.
diff --git a/fxbarcode/cbc_eancode.cpp b/fxbarcode/cbc_eancode.cpp
index f073545..6e44f81 100644
--- a/fxbarcode/cbc_eancode.cpp
+++ b/fxbarcode/cbc_eancode.cpp
@@ -57,7 +57,7 @@
str += '0' + checksum;
encoded_contents = WideString::FromUTF8(str.AsStringView());
} else {
- encoded_contents = encoded_contents.Left(max_length + 1);
+ encoded_contents = encoded_contents.First(max_length + 1);
}
return encoded_contents;
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index a0c682d..fbc4262 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -132,7 +132,7 @@
return WideString();
if (msg.Back() == kMacroTrailer) {
- WideString left = msg.Left(6);
+ WideString left = msg.First(6);
if (left == kMacro05Header) {
context.writeCodeword(kMacro05);
context.setSkipAtEnd(2);
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 2a82a66..f2e88dd 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -196,7 +196,7 @@
static_cast<float>(iFontSize), affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
- tempStr = str.Left(1);
+ tempStr = str.First(1);
length = tempStr.GetLength();
strWidth = multiple * 7;
strWidth = (int32_t)(strWidth * m_outputHScale);
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 0f28bf8..62c760c 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -138,7 +138,7 @@
ByteString str = FX_UTF8Encode(contents);
size_t iLength = str.GetLength();
std::vector<TextCharPos> charpos(iLength);
- ByteString tempStr = str.Left(4);
+ ByteString tempStr = str.First(4);
size_t iLen = tempStr.GetLength();
int32_t strWidth = 7 * multiple * 4;
float blank = 0.0;
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index cbe0ef6..666b037 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -180,7 +180,7 @@
static_cast<float>(iFontSize), affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
}
- tempStr = str.Left(1);
+ tempStr = str.First(1);
length = tempStr.GetLength();
strWidth = (float)multiple * 7;
strWidth = strWidth * m_outputHScale;
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index ba0aa1e..b6aa9bb 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -148,7 +148,7 @@
return;
}
WideString suffixal =
- strFieldNameParsed.Right(reverse_it - strFieldNameParsed.rbegin());
+ strFieldNameParsed.Last(reverse_it - strFieldNameParsed.rbegin());
iControlNo = FXSYS_wtoi(suffixal.c_str());
if (iControlNo == 0) {
suffixal.TrimRight(L' ');
@@ -159,7 +159,7 @@
}
}
strFieldName =
- strFieldNameParsed.Left(strFieldNameParsed.rend() - reverse_it - 1);
+ strFieldNameParsed.First(strFieldNameParsed.rend() - reverse_it - 1);
}
std::vector<CPDF_FormField*> GetFormFieldsForName(
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 0666a64..8eed97d 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -124,11 +124,11 @@
WideString CalcMergedString(const CJS_EventRecorder* event,
const WideString& value,
const WideString& change) {
- WideString prefix = value.Left(event->SelStart());
+ WideString prefix = value.First(event->SelStart());
WideString postfix;
int end = event->SelEnd();
if (end >= 0 && static_cast<size_t>(end) < value.GetLength())
- postfix = value.Right(value.GetLength() - static_cast<size_t>(end));
+ postfix = value.Last(value.GetLength() - static_cast<size_t>(end));
return prefix + change + postfix;
}
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index 37d3932..1f95c31 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -112,7 +112,7 @@
Optional<size_t> offset_end = unsafe_fmt_string.Find(L"%", offset + 1);
if (!offset_end.has_value()) {
unsafe_conversion_specifiers.push_back(
- unsafe_fmt_string.Right(unsafe_fmt_string.GetLength() - offset));
+ unsafe_fmt_string.Last(unsafe_fmt_string.GetLength() - offset));
break;
}
@@ -154,7 +154,7 @@
DCHECK_EQ(L'S', result[0]);
auto result_view = result.AsStringView();
return CJS_Result::Success(
- pRuntime->NewString(result_view.Right(result_view.GetLength() - 1)));
+ pRuntime->NewString(result_view.Last(result_view.GetLength() - 1)));
}
CJS_Result CJS_Util::printd(CJS_Runtime* pRuntime,
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index 7ac440d..9be2498 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -414,7 +414,7 @@
if (pObject->IsNode()) {
if (wsPropNameView[0] == '#')
- wsPropNameView = wsPropNameView.Right(wsPropNameView.GetLength() - 1);
+ wsPropNameView = wsPropNameView.Last(wsPropNameView.GetLength() - 1);
CXFA_Node* pNode = ToNode(pObject);
CXFA_Node* pPropOrChild = nullptr;
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index a12736e..7a6796c 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -324,19 +324,19 @@
std::pair<bool, uint32_t> PatternStringType(ByteStringView bsPattern) {
WideString wsPattern = WideString::FromUTF8(bsPattern);
- if (L"datetime" == wsPattern.Left(8))
+ if (L"datetime" == wsPattern.First(8))
return {true, XFA_VT_DATETIME};
- if (L"date" == wsPattern.Left(4)) {
+ if (L"date" == wsPattern.First(4)) {
auto pos = wsPattern.Find(L"time");
uint32_t type =
pos.has_value() && pos.value() != 0 ? XFA_VT_DATETIME : XFA_VT_DATE;
return {true, type};
}
- if (L"time" == wsPattern.Left(4))
+ if (L"time" == wsPattern.First(4))
return {true, XFA_VT_TIME};
- if (L"text" == wsPattern.Left(4))
+ if (L"text" == wsPattern.First(4))
return {true, XFA_VT_TEXT};
- if (L"num" == wsPattern.Left(3)) {
+ if (L"num" == wsPattern.First(3)) {
uint32_t type;
if (L"integer" == wsPattern.Substr(4, 7)) {
type = XFA_VT_INTEGER;
@@ -1963,7 +1963,7 @@
args.GetReturnValue()->SetInteger(0);
return;
}
- bsArg = bsArg.Right(bsArg.GetLength() - (pos.value() + 1));
+ bsArg = bsArg.Last(bsArg.GetLength() - (pos.value() + 1));
CXFA_LocaleValue timeValue(XFA_VT_TIME,
WideString::FromUTF8(bsArg.AsStringView()), pMgr);
@@ -3688,12 +3688,11 @@
return;
}
WideString wsDatePattern(L"date{");
- wsDatePattern += wsPattern.Left(iTChar.value()) + L"} ";
+ wsDatePattern += wsPattern.First(iTChar.value()) + L"} ";
WideString wsTimePattern(L"time{");
wsTimePattern +=
- wsPattern.Right(wsPattern.GetLength() - (iTChar.value() + 1)) +
- L"}";
+ wsPattern.Last(wsPattern.GetLength() - (iTChar.value() + 1)) + L"}";
wsPattern = wsDatePattern + wsTimePattern;
} break;
case XFA_VT_DATE: {
@@ -3753,7 +3752,7 @@
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- args.GetReturnValue()->SetString(bsSource.Left(count).AsStringView());
+ args.GetReturnValue()->SetString(bsSource.First(count).AsStringView());
}
// static
@@ -3875,11 +3874,11 @@
args.GetReturnValue()->SetString("");
return;
}
- WideString wsDatePattern(L"date{" + wsPattern.Left(iTChar.value()) +
+ WideString wsDatePattern(L"date{" + wsPattern.First(iTChar.value()) +
L"} ");
WideString wsTimePattern(
L"time{" +
- wsPattern.Right(wsPattern.GetLength() - (iTChar.value() + 1)) + L"}");
+ wsPattern.Last(wsPattern.GetLength() - (iTChar.value() + 1)) + L"}");
wsPattern = wsDatePattern + wsTimePattern;
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
@@ -4043,7 +4042,7 @@
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- args.GetReturnValue()->SetString(bsSource.Right(count).AsStringView());
+ args.GetReturnValue()->SetString(bsSource.Last(count).AsStringView());
}
// static
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.cpp b/fxjs/xfa/cfxjse_resolveprocessor.cpp
index 31d75be..89883d6 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.cpp
+++ b/fxjs/xfa/cfxjse_resolveprocessor.cpp
@@ -33,9 +33,9 @@
ASSERT(iFoundCount == pRnd->m_Objects.size());
WideString wsExpression;
CXFA_Script::Type eLangType = CXFA_Script::Type::Unknown;
- if (wsCondition.Left(2).EqualsASCII(".[") && wsCondition.Back() == L']')
+ if (wsCondition.First(2).EqualsASCII(".[") && wsCondition.Back() == L']')
eLangType = CXFA_Script::Type::Formcalc;
- else if (wsCondition.Left(2).EqualsASCII(".(") && wsCondition.Back() == L')')
+ else if (wsCondition.First(2).EqualsASCII(".(") && wsCondition.Back() == L')')
eLangType = CXFA_Script::Type::Javascript;
else
return;
@@ -128,7 +128,7 @@
const bool bClassName = !wsName.IsEmpty() && wsName[0] == '#';
CXFA_Node* const pChild =
bClassName
- ? pParent->GetOneChildOfClass(wsName.Right(wsName.GetLength() - 1))
+ ? pParent->GetOneChildOfClass(wsName.Last(wsName.GetLength() - 1))
: pParent->GetOneChildNamed(wsName);
if (!pChild)
return false;
@@ -162,7 +162,7 @@
return false;
XFA_HashCode dwNameHash = static_cast<XFA_HashCode>(
- FX_HashCode_GetW(wsName.AsStringView().Right(iNameLen - 1), false));
+ FX_HashCode_GetW(wsName.AsStringView().Last(iNameLen - 1), false));
if (dwNameHash == XFA_HASHCODE_Xfa) {
rnd.m_Objects.emplace_back(rnd.m_pSC->GetDocument()->GetRoot());
} else {
@@ -186,7 +186,7 @@
CFXJSE_ResolveNodeData rndFind(rnd.m_pSC.Get());
rndFind.m_CurObject = datasets;
- rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
+ rndFind.m_wsName = rnd.m_wsName.Last(rnd.m_wsName.GetLength() - 1);
rndFind.m_uHashName = static_cast<XFA_HashCode>(
FX_HashCode_GetW(rndFind.m_wsName.AsStringView(), false));
rndFind.m_nLevel = rnd.m_nLevel + 1;
@@ -200,7 +200,7 @@
}
bool CFXJSE_ResolveProcessor::ResolveNumberSign(CFXJSE_ResolveNodeData& rnd) {
- WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
+ WideString wsName = rnd.m_wsName.Last(rnd.m_wsName.GetLength() - 1);
WideString wsCondition = rnd.m_wsCondition;
CXFA_Node* curNode = ToNode(rnd.m_CurObject.Get());
if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringView()))
diff --git a/fxjs/xfa/cjx_instancemanager.cpp b/fxjs/xfa/cjx_instancemanager.cpp
index 7ea4ba2..160c4a5 100644
--- a/fxjs/xfa/cjx_instancemanager.cpp
+++ b/fxjs/xfa/cjx_instancemanager.cpp
@@ -59,7 +59,7 @@
WideString wsInstanceName = WideString(
wsInstManagerName.IsEmpty()
? wsInstManagerName
- : wsInstManagerName.Right(wsInstManagerName.GetLength() - 1));
+ : wsInstManagerName.Last(wsInstManagerName.GetLength() - 1));
uint32_t dInstanceNameHash =
FX_HashCode_GetW(wsInstanceName.AsStringView(), false);
CXFA_Node* pPrevSibling = iDesired == 0
diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp
index 8dd192a..8a72b5b 100644
--- a/fxjs/xfa/cjx_subform.cpp
+++ b/fxjs/xfa/cjx_subform.cpp
@@ -115,7 +115,7 @@
WideString wsInstMgrName =
pNode->JSObject()->GetCData(XFA_Attribute::Name);
if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName[0] == '_' &&
- wsInstMgrName.Right(wsInstMgrName.GetLength() - 1) == wsName) {
+ wsInstMgrName.Last(wsInstMgrName.GetLength() - 1) == wsName) {
pInstanceMgr = pNode;
}
break;
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 281f978..957b6ff 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -242,7 +242,7 @@
++chars_exceeding_size;
--length;
- temp = temp.Left(length);
+ temp = temp.First(length);
}
return chars_exceeding_size;
diff --git a/xfa/fgas/crt/cfgas_decimal_unittest.cpp b/xfa/fgas/crt/cfgas_decimal_unittest.cpp
index 5b714e3..816045e 100644
--- a/xfa/fgas/crt/cfgas_decimal_unittest.cpp
+++ b/xfa/fgas/crt/cfgas_decimal_unittest.cpp
@@ -42,17 +42,17 @@
// Precision may not be the same on all platforms.
EXPECT_EQ(big_expected.GetLength(), big.GetLength());
- EXPECT_STREQ(big_expected.Left(8).c_str(), big.Left(8).c_str());
+ EXPECT_STREQ(big_expected.First(8).c_str(), big.First(8).c_str());
WideString tiny = CFGAS_Decimal(1e20f, 0).ToWideString();
WideString tiny_expected = L"100000000000000000000";
EXPECT_EQ(tiny_expected.GetLength(), tiny.GetLength());
- EXPECT_STREQ(tiny_expected.Left(8).c_str(), tiny.Left(8).c_str());
+ EXPECT_STREQ(tiny_expected.First(8).c_str(), tiny.First(8).c_str());
WideString teeny = CFGAS_Decimal(1e14f, 4).ToWideString();
WideString teeny_expected = L"100000000000000.0000";
EXPECT_EQ(teeny_expected.GetLength(), teeny.GetLength());
- EXPECT_STREQ(teeny_expected.Left(8).c_str(), teeny.Left(8).c_str());
+ EXPECT_STREQ(teeny_expected.First(8).c_str(), teeny.First(8).c_str());
}
TEST(CFGAS_Decimal, FromFloatFractional) {
@@ -61,7 +61,7 @@
// Precision may not be the same on all platforms.
EXPECT_EQ(case1_expected.GetLength(), case1.GetLength());
- EXPECT_STREQ(case1_expected.Left(8).c_str(), case1.Left(8).c_str());
+ EXPECT_STREQ(case1_expected.First(8).c_str(), case1.First(8).c_str());
}
TEST(CFGAS_Decimal, FromString) {
diff --git a/xfa/fgas/crt/cfgas_stringformatter.cpp b/xfa/fgas/crt/cfgas_stringformatter.cpp
index 4344fd5..1c640b9 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter.cpp
@@ -1562,8 +1562,8 @@
while (ccf < m_spPattern.size() && m_spPattern[ccf] != '{' &&
m_spPattern[ccf] != '.' && m_spPattern[ccf] != '(') {
if (m_spPattern[ccf] == 'T') {
- *wsDatePattern = m_wsPattern.Left(ccf);
- *wsTimePattern = m_wsPattern.Right(m_wsPattern.GetLength() - ccf);
+ *wsDatePattern = m_wsPattern.First(ccf);
+ *wsTimePattern = m_wsPattern.Last(m_wsPattern.GetLength() - ccf);
wsTimePattern->SetAt(0, ' ');
if (!*pLocale)
*pLocale = m_pLocaleMgr->GetDefLocale();
@@ -2047,7 +2047,7 @@
}
if (dot_index.value() < spSrcNum.size()) {
*wsOutput += pLocale->GetDecimalSymbol();
- *wsOutput += wsSrcNum.Right(spSrcNum.size() - dot_index.value() - 1);
+ *wsOutput += wsSrcNum.Last(spSrcNum.size() - dot_index.value() - 1);
}
if (bNeg)
*wsOutput = pLocale->GetMinusSymbol() + *wsOutput;
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp
index b67c449..b342237 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.cpp
+++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp
@@ -149,7 +149,7 @@
return false;
if (iDifferLength > 1) {
- ByteString bsDRTailer = bsDRName.Right(iDifferLength);
+ ByteString bsDRTailer = bsDRName.Last(iDifferLength);
if (bsDRTailer == "MT" || bsDRTailer == "PSMT" ||
bsDRTailer == "Regular" || bsDRTailer == "Reg") {
return true;
@@ -160,17 +160,17 @@
bool bMatch = false;
switch (bsPsName[iPsLen - 1]) {
case 'L':
- if (bsDRName.Right(5) == "Light")
+ if (bsDRName.Last(5) == "Light")
bMatch = true;
break;
case 'R':
- if (bsDRName.Right(7) == "Regular" || bsDRName.Right(3) == "Reg")
+ if (bsDRName.Last(7) == "Regular" || bsDRName.Last(3) == "Reg")
bMatch = true;
break;
case 'M':
- if (bsDRName.Right(5) == "Medium")
+ if (bsDRName.Last(5) == "Medium")
bMatch = true;
break;
default:
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 2a80bd3..1f265b5 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -954,9 +954,9 @@
return false;
int32_t nLen = wsText.GetLength();
- WideString l = wsText.Left(m_CursorPosition);
- WideString r = wsText.Right(nLen - m_CursorPosition);
- WideString wsNew = l + cNum + r;
+ WideString first = wsText.First(m_CursorPosition);
+ WideString last = wsText.Last(nLen - m_CursorPosition);
+ WideString wsNew = first + cNum + last;
return wsNew.GetInteger() <= m_iMax;
}
diff --git a/xfa/fxfa/cxfa_eventparam.cpp b/xfa/fxfa/cxfa_eventparam.cpp
index e6eab2c..c3f229d 100644
--- a/xfa/fxfa/cxfa_eventparam.cpp
+++ b/xfa/fxfa/cxfa_eventparam.cpp
@@ -20,6 +20,6 @@
CXFA_EventParam& CXFA_EventParam::operator=(CXFA_EventParam&& other) = default;
WideString CXFA_EventParam::GetNewText() const {
- return m_wsPrevText.Left(m_iSelStart) + m_wsChange +
- m_wsPrevText.Right(m_wsPrevText.GetLength() - m_iSelEnd);
+ return m_wsPrevText.First(m_iSelStart) + m_wsChange +
+ m_wsPrevText.Last(m_wsPrevText.GetLength() - m_iSelEnd);
}
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
index 6fbe21d..a87ecca 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
@@ -24,7 +24,7 @@
return WideString();
if (ident[0] != L'!')
return WideString(ident);
- return L"pfm__excl__" + ident.Right(ident.GetLength() - 1);
+ return L"pfm__excl__" + ident.Last(ident.GetLength() - 1);
}
} // namespace
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
index 64b99f1..e94f55a 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp
@@ -171,8 +171,7 @@
else if (m_wsIdentifier.EqualsASCII("$template"))
*js << "xfa.template";
else if (m_wsIdentifier[0] == L'!')
- *js << "pfm__excl__"
- << m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1);
+ *js << "pfm__excl__" << m_wsIdentifier.Last(m_wsIdentifier.GetLength() - 1);
else
*js << m_wsIdentifier;
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
index 54a9f33..dcfdd47 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
@@ -199,12 +199,12 @@
if (wsExpr[0] == '#') {
CXFA_Node* pNode = pDocument->GetNodeByID(
ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)),
- wsExpr.Right(wsExpr.GetLength() - 1).AsStringView());
+ wsExpr.Last(wsExpr.GetLength() - 1).AsStringView());
if (pNode)
return pNode;
} else if (bNewExprStyle) {
WideString wsProcessedTarget = wsExpr;
- if (wsExpr.Left(4).EqualsASCII("som(") && wsExpr.Back() == L')')
+ if (wsExpr.First(4).EqualsASCII("som(") && wsExpr.Back() == L')')
wsProcessedTarget = wsExpr.Substr(4, wsExpr.GetLength() - 5);
XFA_RESOLVENODE_RS rs;
diff --git a/xfa/fxfa/parser/cxfa_barcode.cpp b/xfa/fxfa/parser/cxfa_barcode.cpp
index ae3f9e2..a7dbb71 100644
--- a/xfa/fxfa/parser/cxfa_barcode.cpp
+++ b/xfa/fxfa/parser/cxfa_barcode.cpp
@@ -162,12 +162,12 @@
return {static_cast<int8_t>(FXSYS_wtoi(wsWideNarrowRatio->c_str()))};
int32_t fB = FXSYS_wtoi(
- wsWideNarrowRatio->Right(wsWideNarrowRatio->GetLength() - (*ptPos + 1))
+ wsWideNarrowRatio->Last(wsWideNarrowRatio->GetLength() - (*ptPos + 1))
.c_str());
if (!fB)
return {0};
- int32_t fA = FXSYS_wtoi(wsWideNarrowRatio->Left(*ptPos).c_str());
+ int32_t fA = FXSYS_wtoi(wsWideNarrowRatio->First(*ptPos).c_str());
float result = static_cast<float>(fA) / static_cast<float>(fB);
return {static_cast<int8_t>(result)};
}
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index acefd25..e210b94 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -59,7 +59,7 @@
if (eMatchFlags & XFA_XDPPACKET_FLAGS_NOMATCH)
return true;
if (eMatchFlags & XFA_XDPPACKET_FLAGS_PREFIXMATCH) {
- return wsNodeStr.Left(wsNamespaceURIPrefix.GetLength()) ==
+ return wsNodeStr.First(wsNamespaceURIPrefix.GetLength()) ==
wsNamespaceURIPrefix;
}
@@ -74,7 +74,7 @@
wsLocalAttrName = std::move(wsAttrName);
return false;
}
- wsLocalAttrName = wsAttrName.Right(wsAttrName.GetLength() - pos.value() - 1);
+ wsLocalAttrName = wsAttrName.Last(wsAttrName.GetLength() - pos.value() - 1);
return true;
}
@@ -84,8 +84,8 @@
WideString& wsNamespaceURI) {
WideString wsNSPrefix;
if (GetAttributeLocalName(wsAttrName.AsStringView(), wsLocalAttrName)) {
- wsNSPrefix = wsAttrName.Left(wsAttrName.GetLength() -
- wsLocalAttrName.GetLength() - 1);
+ wsNSPrefix = wsAttrName.First(wsAttrName.GetLength() -
+ wsLocalAttrName.GetLength() - 1);
}
if (wsLocalAttrName.EqualsASCII("xmlns") || wsNSPrefix.EqualsASCII("xmlns") ||
wsNSPrefix.EqualsASCII("xml")) {
@@ -111,10 +111,10 @@
continue;
} else {
if (wsLocalAttributeName !=
- it.first.Right(it.first.GetLength() - pos.value() - 1)) {
+ it.first.Last(it.first.GetLength() - pos.value() - 1)) {
continue;
}
- wsNSPrefix = it.first.Left(pos.value());
+ wsNSPrefix = it.first.First(pos.value());
}
if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix,
&wsAttrNS) ||
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index 859e933..0663d38 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -58,8 +58,8 @@
if (!nSplitIndex.has_value())
return false;
- wsDate = wsDateTime.Left(nSplitIndex.value());
- wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex.value() - 1);
+ wsDate = wsDateTime.First(nSplitIndex.value());
+ wsTime = wsDateTime.Last(wsDateTime.GetLength() - nSplitIndex.value() - 1);
return true;
}
diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp
index d4e326f..3ce13e6 100644
--- a/xfa/fxfa/parser/cxfa_measurement.cpp
+++ b/xfa/fxfa/parser/cxfa_measurement.cpp
@@ -39,7 +39,7 @@
}
if (wsMeasure[0] == L'=')
- wsMeasure = wsMeasure.Right(wsMeasure.GetLength() - 1);
+ wsMeasure = wsMeasure.Last(wsMeasure.GetLength() - 1);
int32_t iUsedLen = 0;
float fValue = FXSYS_wcstof(wsMeasure.unterminated_c_str(),
@@ -47,7 +47,7 @@
if (!std::isfinite(fValue))
fValue = 0.0f;
- wsMeasure = wsMeasure.Right(wsMeasure.GetLength() - iUsedLen);
+ wsMeasure = wsMeasure.Last(wsMeasure.GetLength() - iUsedLen);
Set(fValue, GetUnitFromString(wsMeasure));
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index a1b2093..05c6061 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -491,8 +491,8 @@
}
} else {
WideString wsURL = wsHref;
- if (!(wsURL.Left(7).EqualsASCII("http://") ||
- wsURL.Left(6).EqualsASCII("ftp://"))) {
+ if (!(wsURL.First(7).EqualsASCII("http://") ||
+ wsURL.First(6).EqualsASCII("ftp://"))) {
RetainPtr<CFX_DIBitmap> pBitmap =
pDoc->GetPDFNamedImage(wsURL.AsStringView(), iImageXDpi, iImageYDpi);
if (pBitmap) {
@@ -525,14 +525,14 @@
if (!nSplitIndex.has_value())
return false;
- wsDate = wsDateTime.Left(nSplitIndex.value());
+ wsDate = wsDateTime.First(nSplitIndex.value());
if (!wsDate.IsEmpty()) {
if (!std::any_of(wsDate.begin(), wsDate.end(),
[](wchar_t c) { return FXSYS_IsDecimalDigit(c); })) {
return false;
}
}
- wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex.value() - 1);
+ wsTime = wsDateTime.Last(wsDateTime.GetLength() - nSplitIndex.value() - 1);
if (!wsTime.IsEmpty()) {
if (!std::any_of(wsTime.begin(), wsTime.end(),
[](wchar_t c) { return FXSYS_IsDecimalDigit(c); })) {
@@ -674,7 +674,7 @@
}
if (dot_index.value() < wsSrcNum.GetLength()) {
wsOutput += pLocale->GetDecimalSymbol();
- wsOutput += wsSrcNum.Right(wsSrcNum.GetLength() - dot_index.value() - 1);
+ wsOutput += wsSrcNum.Last(wsSrcNum.GetLength() - dot_index.value() - 1);
}
if (bNeg)
return pLocale->GetMinusSymbol() + wsOutput;
@@ -1727,7 +1727,7 @@
WideString wsInstName =
pNode->JSObject()->GetCData(XFA_Attribute::Name);
if (wsInstName.GetLength() > 0 && wsInstName[0] == '_' &&
- wsInstName.Right(wsInstName.GetLength() - 1) == wsName) {
+ wsInstName.Last(wsInstName.GetLength() - 1) == wsName) {
pInstanceMgr = pNode;
}
break;
@@ -1817,7 +1817,7 @@
WideString wsName = pNode->JSObject()->GetCData(XFA_Attribute::Name);
WideString wsInstName = JSObject()->GetCData(XFA_Attribute::Name);
if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' ||
- wsInstName.Right(wsInstName.GetLength() - 1) != wsName) {
+ wsInstName.Last(wsInstName.GetLength() - 1) != wsName) {
return nullptr;
}
dwNameHash = pNode->GetNameHash();
@@ -1848,7 +1848,7 @@
WideString wsName = pNode->JSObject()->GetCData(XFA_Attribute::Name);
WideString wsInstName = JSObject()->GetCData(XFA_Attribute::Name);
if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' ||
- wsInstName.Right(wsInstName.GetLength() - 1) != wsName) {
+ wsInstName.Last(wsInstName.GetLength() - 1) != wsName) {
return iCount;
}
dwNameHash = pNode->GetNameHash();
diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp
index 28d7aff..dde90bc 100644
--- a/xfa/fxfa/parser/cxfa_nodehelper.cpp
+++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp
@@ -69,13 +69,13 @@
bool bIsClassName = false;
bool bResult = false;
if (!wsNameView.IsEmpty() && wsNameView[0] == '!') {
- wsNameView = wsNameView.Right(wsNameView.GetLength() - 1);
+ wsNameView = wsNameView.Last(wsNameView.GetLength() - 1);
m_pCreateParent = ToNode(
pScriptContext->GetDocument()->GetXFAObject(XFA_HASHCODE_Datasets));
}
if (!wsNameView.IsEmpty() && wsNameView[0] == '#') {
bIsClassName = true;
- wsNameView = wsNameView.Right(wsNameView.GetLength() - 1);
+ wsNameView = wsNameView.Last(wsNameView.GetLength() - 1);
}
if (wsNameView.IsEmpty())
return false;