Move third_party/base/stl_util.h to core/fxcrt/.
Now that everything copied from Chromium's base/ directory has been
moved out of stl_util.h, the remaining bits are PDFium-specific. Move
these to core/fxcrt/.
Change-Id: I62dbf07d764665a6733df689d96f2765c34c0779
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/82196
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 504d5c0..9a97a80 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -24,9 +24,9 @@
#include "core/fxcrt/fx_memory_wrappers.h"
#include "core/fxcrt/fx_random.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/containers/contains.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -394,7 +394,7 @@
}
if (m_iStage == Stage::kWriteXrefsIncremental82) {
ByteString str;
- uint32_t iCount = pdfium::CollectionSize<uint32_t>(m_NewObjNumArray);
+ uint32_t iCount = fxcrt::CollectionSize<uint32_t>(m_NewObjNumArray);
uint32_t i = m_CurObjNum;
while (i < iCount) {
size_t j = i;
diff --git a/core/fpdfapi/font/cfx_cttgsubtable.cpp b/core/fpdfapi/font/cfx_cttgsubtable.cpp
index a566f98..cb96bf4 100644
--- a/core/fpdfapi/font/cfx_cttgsubtable.cpp
+++ b/core/fpdfapi/font/cfx_cttgsubtable.cpp
@@ -8,8 +8,8 @@
#include <utility>
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fontmapper.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -70,7 +70,7 @@
const TFeatureRecord& feature,
uint32_t glyphnum) const {
for (int index : feature.LookupListIndices) {
- if (!pdfium::IndexInBounds(LookupList, index))
+ if (!fxcrt::IndexInBounds(LookupList, index))
continue;
if (LookupList[index].LookupType != 1)
continue;
@@ -97,7 +97,7 @@
case 2: {
auto* tbl2 = static_cast<TSubTable2*>(subTable.get());
int index = GetCoverageIndex(tbl2->Coverage.get(), glyphnum);
- if (pdfium::IndexInBounds(tbl2->Substitutes, index)) {
+ if (fxcrt::IndexInBounds(tbl2->Substitutes, index)) {
return tbl2->Substitutes[index];
}
break;
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index b05bfbc..87c0491 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -24,13 +24,13 @@
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_unicode.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/fx_font.h"
#include "third_party/base/check.h"
#include "third_party/base/check_op.h"
#include "third_party/base/cxx17_backports.h"
#include "third_party/base/numerics/ranges.h"
#include "third_party/base/span.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -227,7 +227,7 @@
if (width_status != 1)
return;
if (first_code > std::numeric_limits<int>::max() -
- pdfium::CollectionSize<int>(*pObjArray)) {
+ fxcrt::CollectionSize<int>(*pObjArray)) {
width_status = 0;
continue;
}
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 8edccbd..d85eff2 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -26,13 +26,13 @@
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
#include "third_party/base/check.h"
#include "third_party/base/cxx17_backports.h"
#include "third_party/base/numerics/ranges.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -391,7 +391,7 @@
}
int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode) {
- if (!pdfium::IndexInBounds(m_FontFallbacks, fallbackFont))
+ if (!fxcrt::IndexInBounds(m_FontFallbacks, fallbackFont))
return -1;
WideString str = UnicodeFromCharCode(charcode);
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index 0ff6718..c8ca89d 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -34,13 +34,13 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/maybe_owned.h"
#include "core/fxcrt/scoped_set_insertion.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/check_op.h"
#include "third_party/base/containers/contains.h"
#include "third_party/base/cxx17_backports.h"
#include "third_party/base/notreached.h"
#include "third_party/base/numerics/ranges.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -1043,8 +1043,8 @@
if (m_pCache.empty()) {
m_pCache =
- pdfium::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(nMaxColors, 3);
- auto temp_src = pdfium::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(
+ fxcrt::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(nMaxColors, 3);
+ auto temp_src = fxcrt::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(
nMaxColors, nComponents);
size_t src_index = 0;
for (int i = 0; i < nMaxColors; i++) {
@@ -1164,7 +1164,7 @@
return 0;
m_nBaseComponents = m_pBaseCS->CountComponents();
- m_pCompMinMax = pdfium::Vector2D<float>(m_nBaseComponents, 2);
+ m_pCompMinMax = fxcrt::Vector2D<float>(m_nBaseComponents, 2);
float defvalue;
for (uint32_t i = 0; i < m_nBaseComponents; i++) {
m_pBaseCS->GetDefaultValue(i, &defvalue, &m_pCompMinMax[i * 2],
diff --git a/core/fpdfapi/page/cpdf_expintfunc.cpp b/core/fpdfapi/page/cpdf_expintfunc.cpp
index 5be0ac6..0e946f5 100644
--- a/core/fpdfapi/page/cpdf_expintfunc.cpp
+++ b/core/fpdfapi/page/cpdf_expintfunc.cpp
@@ -10,7 +10,7 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fxcrt/fx_safe_types.h"
-#include "third_party/base/stl_util.h"
+#include "core/fxcrt/stl_util.h"
CPDF_ExpIntFunc::CPDF_ExpIntFunc()
: CPDF_Function(Type::kType2ExponentialInterpolation) {}
@@ -36,8 +36,8 @@
m_nOutputs = 1;
const CPDF_Array* pArray1 = pDict->GetArrayFor("C1");
- m_BeginValues = pdfium::Vector2D<float>(m_nOutputs, 2);
- m_EndValues = pdfium::Vector2D<float>(m_nOutputs, 2);
+ m_BeginValues = fxcrt::Vector2D<float>(m_nOutputs, 2);
+ m_EndValues = fxcrt::Vector2D<float>(m_nOutputs, 2);
for (uint32_t i = 0; i < m_nOutputs; i++) {
m_BeginValues[i] = pArray0 ? pArray0->GetNumberAt(i) : 0.0f;
m_EndValues[i] = pArray1 ? pArray1->GetNumberAt(i) : 1.0f;
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
index a919117..3cb302c 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
@@ -16,9 +16,9 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/check_op.h"
-#include "third_party/base/stl_util.h"
bool GraphicsData::operator<(const GraphicsData& other) const {
if (!FXSYS_SafeEQ(fillAlpha, other.fillAlpha))
@@ -127,7 +127,7 @@
CPDF_PageObject* CPDF_PageObjectHolder::GetPageObjectByIndex(
size_t index) const {
- return pdfium::IndexInBounds(m_PageObjectList, index)
+ return fxcrt::IndexInBounds(m_PageObjectList, index)
? m_PageObjectList[index].get()
: nullptr;
}
@@ -138,7 +138,7 @@
}
bool CPDF_PageObjectHolder::RemovePageObject(CPDF_PageObject* pPageObj) {
- pdfium::FakeUniquePtr<CPDF_PageObject> p(pPageObj);
+ fxcrt::FakeUniquePtr<CPDF_PageObject> p(pPageObj);
auto it =
std::find(std::begin(m_PageObjectList), std::end(m_PageObjectList), p);
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 7f692e3..a223904 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -27,12 +27,12 @@
#include "core/fxcrt/autorestorer.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/compiler_specific.h"
#include "third_party/base/containers/contains.h"
#include "third_party/base/notreached.h"
#include "third_party/base/numerics/safe_conversions.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -639,7 +639,7 @@
if (level >= kMaxPageRecursionDepth)
return false;
- int32_t iSize = pdfium::CollectionSize<int32_t>(pageNode.m_ChildNodes);
+ int32_t iSize = fxcrt::CollectionSize<int32_t>(pageNode.m_ChildNodes);
if (iSize <= 0 || iPage >= iSize) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 32f231e..572623f 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -17,9 +17,9 @@
#include "core/fxcodec/jbig2/JBig2_DocumentContext.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/scoped_set_insertion.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/containers/contains.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -277,7 +277,7 @@
}
CPDF_Dictionary* CPDF_Document::GetPageDictionary(int iPage) {
- if (!pdfium::IndexInBounds(m_PageList, iPage))
+ if (!fxcrt::IndexInBounds(m_PageList, iPage))
return nullptr;
const uint32_t objnum = m_PageList[iPage];
@@ -331,7 +331,7 @@
int found_index = FindPageIndex(pPages, &skip_count, objnum, &start_index, 0);
// Corrupt page tree may yield out-of-range results.
- if (!pdfium::IndexInBounds(m_PageList, found_index))
+ if (!fxcrt::IndexInBounds(m_PageList, found_index))
return -1;
// Only update |m_PageList| when |objnum| points to a /Page object.
@@ -341,7 +341,7 @@
}
int CPDF_Document::GetPageCount() const {
- return pdfium::CollectionSize<int>(m_PageList);
+ return fxcrt::CollectionSize<int>(m_PageList);
}
int CPDF_Document::RetrievePageCount() {
diff --git a/core/fpdfapi/parser/cpdf_seekablemultistream.cpp b/core/fpdfapi/parser/cpdf_seekablemultistream.cpp
index dc7df59..578db3e 100644
--- a/core/fpdfapi/parser/cpdf_seekablemultistream.cpp
+++ b/core/fpdfapi/parser/cpdf_seekablemultistream.cpp
@@ -9,8 +9,8 @@
#include <algorithm>
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/notreached.h"
-#include "third_party/base/stl_util.h"
CPDF_SeekableMultiStream::CPDF_SeekableMultiStream(
const std::vector<const CPDF_Stream*>& streams) {
@@ -32,7 +32,7 @@
bool CPDF_SeekableMultiStream::ReadBlockAtOffset(void* buffer,
FX_FILESIZE offset,
size_t size) {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_Data);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(m_Data);
int32_t index = 0;
while (index < iCount) {
const auto& acc = m_Data[index];
diff --git a/core/fpdfdoc/cpdf_bafontmap.cpp b/core/fpdfdoc/cpdf_bafontmap.cpp
index 2fbc390..ab92dc9 100644
--- a/core/fpdfdoc/cpdf_bafontmap.cpp
+++ b/core/fpdfdoc/cpdf_bafontmap.cpp
@@ -24,11 +24,11 @@
#include "core/fpdfdoc/cpdf_formfield.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_substfont.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -89,13 +89,13 @@
CPDF_BAFontMap::~CPDF_BAFontMap() = default;
RetainPtr<CPDF_Font> CPDF_BAFontMap::GetPDFFont(int32_t nFontIndex) {
- if (pdfium::IndexInBounds(m_Data, nFontIndex))
+ if (fxcrt::IndexInBounds(m_Data, nFontIndex))
return m_Data[nFontIndex]->pFont;
return nullptr;
}
ByteString CPDF_BAFontMap::GetPDFFontAlias(int32_t nFontIndex) {
- if (pdfium::IndexInBounds(m_Data, nFontIndex))
+ if (fxcrt::IndexInBounds(m_Data, nFontIndex))
return m_Data[nFontIndex]->sFontName;
return ByteString();
}
@@ -133,7 +133,7 @@
}
int32_t CPDF_BAFontMap::CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) {
- if (!pdfium::IndexInBounds(m_Data, nFontIndex))
+ if (!fxcrt::IndexInBounds(m_Data, nFontIndex))
return -1;
Data* pData = m_Data[nFontIndex].get();
@@ -320,7 +320,7 @@
}
bool CPDF_BAFontMap::KnowWord(int32_t nFontIndex, uint16_t word) {
- return pdfium::IndexInBounds(m_Data, nFontIndex) &&
+ return fxcrt::IndexInBounds(m_Data, nFontIndex) &&
CharCodeFromUnicode(nFontIndex, word) >= 0;
}
@@ -351,7 +351,7 @@
pNewData->sFontName = sFontAlias;
pNewData->nCharset = nCharset;
m_Data.push_back(std::move(pNewData));
- return pdfium::CollectionSize<int32_t>(m_Data) - 1;
+ return fxcrt::CollectionSize<int32_t>(m_Data) - 1;
}
ByteString CPDF_BAFontMap::EncodeFontAlias(const ByteString& sFontName,
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index aa2687f..3989829 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -27,9 +27,9 @@
#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fpdfdoc/cpdf_generateap.h"
#include "core/fpdfdoc/cpdf_interactiveform.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/containers/contains.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -220,7 +220,7 @@
}
int CPDF_FormField::CountControls() const {
- return pdfium::CollectionSize<int>(GetControls());
+ return fxcrt::CollectionSize<int>(GetControls());
}
CPDF_FormControl* CPDF_FormField::GetControl(int index) const {
diff --git a/core/fpdfdoc/cpvt_section.cpp b/core/fpdfdoc/cpvt_section.cpp
index 6af10a1..f7c62c5 100644
--- a/core/fpdfdoc/cpvt_section.cpp
+++ b/core/fpdfdoc/cpvt_section.cpp
@@ -10,9 +10,9 @@
#include "core/fpdfdoc/cpvt_variabletext.h"
#include "core/fpdfdoc/cpvt_wordinfo.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/numerics/ranges.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -224,7 +224,7 @@
CPVT_WordPlace CPVT_Section::AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo) {
int32_t nWordIndex = pdfium::clamp(
- place.nWordIndex, 0, pdfium::CollectionSize<int32_t>(m_WordArray));
+ place.nWordIndex, 0, fxcrt::CollectionSize<int32_t>(m_WordArray));
m_WordArray.insert(m_WordArray.begin() + nWordIndex,
std::make_unique<CPVT_WordInfo>(wordinfo));
return place;
@@ -263,7 +263,7 @@
if (place.nLineIndex < 0)
return GetBeginWordPlace();
- if (place.nLineIndex >= pdfium::CollectionSize<int32_t>(m_LineArray))
+ if (place.nLineIndex >= fxcrt::CollectionSize<int32_t>(m_LineArray))
return GetEndWordPlace();
Line* pLine = m_LineArray[place.nLineIndex].get();
@@ -273,7 +273,7 @@
if (place.nWordIndex >= pLine->m_LineInfo.nBeginWordIndex)
return pLine->GetPrevWordPlace(place);
- if (!pdfium::IndexInBounds(m_LineArray, place.nLineIndex - 1))
+ if (!fxcrt::IndexInBounds(m_LineArray, place.nLineIndex - 1))
return place;
return m_LineArray[place.nLineIndex - 1]->GetEndWordPlace();
@@ -284,14 +284,14 @@
if (place.nLineIndex < 0)
return GetBeginWordPlace();
- if (place.nLineIndex >= pdfium::CollectionSize<int32_t>(m_LineArray))
+ if (place.nLineIndex >= fxcrt::CollectionSize<int32_t>(m_LineArray))
return GetEndWordPlace();
Line* pLine = m_LineArray[place.nLineIndex].get();
if (place.nWordIndex < pLine->m_LineInfo.nEndWordIndex)
return pLine->GetNextWordPlace(place);
- if (!pdfium::IndexInBounds(m_LineArray, place.nLineIndex + 1))
+ if (!fxcrt::IndexInBounds(m_LineArray, place.nLineIndex + 1))
return place;
return m_LineArray[place.nLineIndex + 1]->GetBeginWordPlace();
@@ -299,7 +299,7 @@
void CPVT_Section::UpdateWordPlace(CPVT_WordPlace& place) const {
int32_t nLeft = 0;
- int32_t nRight = pdfium::CollectionSize<int32_t>(m_LineArray) - 1;
+ int32_t nRight = fxcrt::CollectionSize<int32_t>(m_LineArray) - 1;
int32_t nMid = (nLeft + nRight) / 2;
while (nLeft <= nRight) {
Line* pLine = m_LineArray[nMid].get();
@@ -321,8 +321,8 @@
bool bUp = true;
bool bDown = true;
int32_t nLeft = 0;
- int32_t nRight = pdfium::CollectionSize<int32_t>(m_LineArray) - 1;
- int32_t nMid = pdfium::CollectionSize<int32_t>(m_LineArray) / 2;
+ int32_t nRight = fxcrt::CollectionSize<int32_t>(m_LineArray) - 1;
+ int32_t nMid = fxcrt::CollectionSize<int32_t>(m_LineArray) / 2;
while (nLeft <= nRight) {
Line* pLine = m_LineArray[nMid].get();
float fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent -
@@ -359,7 +359,7 @@
CPVT_WordPlace CPVT_Section::SearchWordPlace(
float fx,
const CPVT_WordPlace& lineplace) const {
- if (!pdfium::IndexInBounds(m_LineArray, lineplace.nLineIndex))
+ if (!fxcrt::IndexInBounds(m_LineArray, lineplace.nLineIndex))
return GetBeginWordPlace();
Line* pLine = m_LineArray[lineplace.nLineIndex].get();
@@ -385,7 +385,7 @@
nMid--;
break;
}
- if (!pdfium::IndexInBounds(m_WordArray, nMid))
+ if (!fxcrt::IndexInBounds(m_WordArray, nMid))
break;
CPVT_WordInfo* pWord = m_WordArray[nMid].get();
if (fx > pWord->fWordX + m_pVT->GetWordWidth(*pWord) * 0.5f) {
@@ -396,7 +396,7 @@
nRight = nMid;
nMid = (nLeft + nRight) / 2;
}
- if (pdfium::IndexInBounds(m_WordArray, nMid)) {
+ if (fxcrt::IndexInBounds(m_WordArray, nMid)) {
CPVT_WordInfo* pWord = m_WordArray[nMid].get();
if (fx > pWord->fWordX + m_pVT->GetWordWidth(*pWord) * 0.5f)
wordplace.nWordIndex = nMid;
@@ -405,29 +405,29 @@
}
int32_t CPVT_Section::GetLineArraySize() const {
- return pdfium::CollectionSize<int32_t>(m_LineArray);
+ return fxcrt::CollectionSize<int32_t>(m_LineArray);
}
const CPVT_Section::Line* CPVT_Section::GetLineFromArray(int32_t index) const {
- if (!pdfium::IndexInBounds(m_LineArray, index))
+ if (!fxcrt::IndexInBounds(m_LineArray, index))
return nullptr;
return m_LineArray[index].get();
}
int32_t CPVT_Section::GetWordArraySize() const {
- return pdfium::CollectionSize<int32_t>(m_WordArray);
+ return fxcrt::CollectionSize<int32_t>(m_WordArray);
}
const CPVT_WordInfo* CPVT_Section::GetWordFromArray(int32_t index) const {
- if (!pdfium::IndexInBounds(m_WordArray, index))
+ if (!fxcrt::IndexInBounds(m_WordArray, index))
return nullptr;
return m_WordArray[index].get();
}
void CPVT_Section::EraseWordsFrom(int32_t index) {
- if (!pdfium::IndexInBounds(m_WordArray, index))
+ if (!fxcrt::IndexInBounds(m_WordArray, index))
return;
m_WordArray.erase(m_WordArray.begin() + index, m_WordArray.end());
@@ -453,23 +453,23 @@
break;
case 1:
nStart = (m_pVT->GetCharArray() -
- pdfium::CollectionSize<int32_t>(m_WordArray)) /
+ fxcrt::CollectionSize<int32_t>(m_WordArray)) /
2;
pLine->m_LineInfo.fLineX = fNodeWidth * nStart - fNodeWidth * 0.5f;
break;
case 2:
nStart =
- m_pVT->GetCharArray() - pdfium::CollectionSize<int32_t>(m_WordArray);
+ m_pVT->GetCharArray() - fxcrt::CollectionSize<int32_t>(m_WordArray);
pLine->m_LineInfo.fLineX = fNodeWidth * nStart - fNodeWidth * 0.5f;
break;
}
- for (int32_t w = 0, sz = pdfium::CollectionSize<int32_t>(m_WordArray); w < sz;
+ for (int32_t w = 0, sz = fxcrt::CollectionSize<int32_t>(m_WordArray); w < sz;
w++) {
if (w >= m_pVT->GetCharArray())
break;
float fNextWidth = 0;
- if (pdfium::IndexInBounds(m_WordArray, w + 1)) {
+ if (fxcrt::IndexInBounds(m_WordArray, w + 1)) {
CPVT_WordInfo* pNextWord = m_WordArray[w + 1].get();
pNextWord->fWordTail = 0;
fNextWidth = m_pVT->GetWordWidth(*pNextWord);
@@ -485,7 +485,7 @@
if (w == 0) {
pLine->m_LineInfo.fLineX = x;
}
- if (w != pdfium::CollectionSize<int32_t>(m_WordArray) - 1) {
+ if (w != fxcrt::CollectionSize<int32_t>(m_WordArray) - 1) {
pWord->fWordTail = (fNodeWidth - (fWordWidth + fNextWidth) * 0.5f > 0
? fNodeWidth - (fWordWidth + fNextWidth) * 0.5f
: 0);
@@ -498,7 +498,7 @@
}
pLine->m_LineInfo.nBeginWordIndex = 0;
pLine->m_LineInfo.nEndWordIndex =
- pdfium::CollectionSize<int32_t>(m_WordArray) - 1;
+ fxcrt::CollectionSize<int32_t>(m_WordArray) - 1;
pLine->m_LineInfo.fLineY = y;
pLine->m_LineInfo.fLineWidth = x - pLine->m_LineInfo.fLineX;
pLine->m_LineInfo.fLineAscent = fLineAscent;
@@ -553,7 +553,7 @@
float fWordWidth = 0;
float fTypesetWidth =
std::max(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(), 0.0f);
- int32_t nTotalWords = pdfium::CollectionSize<int32_t>(m_WordArray);
+ int32_t nTotalWords = fxcrt::CollectionSize<int32_t>(m_WordArray);
bool bOpened = false;
int32_t i = 0;
while (i < nTotalWords) {
@@ -676,7 +676,7 @@
float fMaxX = fMinX + rect.Width();
float fMinY = 0.0f;
float fMaxY = rect.Height();
- int32_t nTotalLines = pdfium::CollectionSize<int32_t>(m_LineArray);
+ int32_t nTotalLines = fxcrt::CollectionSize<int32_t>(m_LineArray);
if (nTotalLines > 0) {
float fPosX = 0.0f;
float fPosY = 0.0f;
@@ -701,7 +701,7 @@
pLine->m_LineInfo.fLineY = fPosY - fMinY;
for (int32_t w = pLine->m_LineInfo.nBeginWordIndex;
w <= pLine->m_LineInfo.nEndWordIndex; w++) {
- if (pdfium::IndexInBounds(m_WordArray, w)) {
+ if (fxcrt::IndexInBounds(m_WordArray, w)) {
CPVT_WordInfo* pWord = m_WordArray[w].get();
pWord->fWordX = fPosX - fMinX;
pWord->fWordY = fPosY - fMinY;
@@ -717,22 +717,22 @@
void CPVT_Section::ClearLeftWords(int32_t nWordIndex) {
for (int32_t i = nWordIndex; i >= 0; i--) {
- if (pdfium::IndexInBounds(m_WordArray, i))
+ if (fxcrt::IndexInBounds(m_WordArray, i))
m_WordArray.erase(m_WordArray.begin() + i);
}
}
void CPVT_Section::ClearRightWords(int32_t nWordIndex) {
- int32_t sz = pdfium::CollectionSize<int32_t>(m_WordArray);
+ int32_t sz = fxcrt::CollectionSize<int32_t>(m_WordArray);
for (int32_t i = sz - 1; i > nWordIndex; i--) {
- if (pdfium::IndexInBounds(m_WordArray, i))
+ if (fxcrt::IndexInBounds(m_WordArray, i))
m_WordArray.erase(m_WordArray.begin() + i);
}
}
void CPVT_Section::ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex) {
for (int32_t i = nEndIndex; i > nBeginIndex; i--) {
- if (pdfium::IndexInBounds(m_WordArray, i))
+ if (fxcrt::IndexInBounds(m_WordArray, i))
m_WordArray.erase(m_WordArray.begin() + i);
}
}
@@ -755,6 +755,6 @@
}
void CPVT_Section::ClearWord(const CPVT_WordPlace& place) {
- if (pdfium::IndexInBounds(m_WordArray, place.nWordIndex))
+ if (fxcrt::IndexInBounds(m_WordArray, place.nWordIndex))
m_WordArray.erase(m_WordArray.begin() + place.nWordIndex);
}
diff --git a/core/fpdfdoc/cpvt_variabletext.cpp b/core/fpdfdoc/cpvt_variabletext.cpp
index e458e94..5d2ecab 100644
--- a/core/fpdfdoc/cpvt_variabletext.cpp
+++ b/core/fpdfdoc/cpvt_variabletext.cpp
@@ -15,10 +15,10 @@
#include "core/fpdfdoc/cpvt_wordinfo.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/compiler_specific.h"
#include "third_party/base/numerics/ranges.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -102,7 +102,7 @@
}
bool CPVT_VariableText::Iterator::NextLine() {
- if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
return false;
CPVT_Section* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
@@ -111,7 +111,7 @@
return true;
}
if (m_CurPos.nSecIndex <
- pdfium::CollectionSize<int32_t>(m_pVT->m_SectionArray) - 1) {
+ fxcrt::CollectionSize<int32_t>(m_pVT->m_SectionArray) - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
return true;
}
@@ -120,7 +120,7 @@
bool CPVT_VariableText::Iterator::GetWord(CPVT_Word& word) const {
word.WordPlace = m_CurPos;
- if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
return false;
CPVT_Section* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
@@ -147,7 +147,7 @@
bool CPVT_VariableText::Iterator::GetLine(CPVT_Line& line) const {
DCHECK(m_pVT);
line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
- if (!pdfium::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_pVT->m_SectionArray, m_CurPos.nSecIndex))
return false;
CPVT_Section* pSection = m_pVT->m_SectionArray[m_CurPos.nSecIndex].get();
@@ -217,14 +217,14 @@
CPVT_WordPlace wordplace = place;
UpdateWordPlace(wordplace);
- if (!pdfium::IndexInBounds(m_SectionArray, wordplace.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, wordplace.nSecIndex))
return place;
CPVT_Section* pSection = m_SectionArray[wordplace.nSecIndex].get();
CPVT_WordPlace NewPlace(wordplace.nSecIndex + 1, 0, -1);
AddSection(NewPlace);
CPVT_WordPlace result = NewPlace;
- if (pdfium::IndexInBounds(m_SectionArray, NewPlace.nSecIndex)) {
+ if (fxcrt::IndexInBounds(m_SectionArray, NewPlace.nSecIndex)) {
CPVT_Section* pNewSection = m_SectionArray[NewPlace.nSecIndex].get();
for (int32_t w = wordplace.nWordIndex + 1; w < pSection->GetWordArraySize();
++w) {
@@ -239,7 +239,7 @@
CPVT_WordPlace CPVT_VariableText::DeleteWords(
const CPVT_WordRange& PlaceRange) {
bool bLastSecPos =
- pdfium::IndexInBounds(m_SectionArray, PlaceRange.EndPos.nSecIndex) &&
+ fxcrt::IndexInBounds(m_SectionArray, PlaceRange.EndPos.nSecIndex) &&
PlaceRange.EndPos ==
m_SectionArray[PlaceRange.EndPos.nSecIndex]->GetEndWordPlace();
@@ -305,11 +305,11 @@
void CPVT_VariableText::UpdateWordPlace(CPVT_WordPlace& place) const {
if (place.nSecIndex < 0)
place = GetBeginWordPlace();
- if (place.nSecIndex >= pdfium::CollectionSize<int32_t>(m_SectionArray))
+ if (place.nSecIndex >= fxcrt::CollectionSize<int32_t>(m_SectionArray))
place = GetEndWordPlace();
place = PrevLineHeaderPlace(place);
- if (pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
m_SectionArray[place.nSecIndex]->UpdateWordPlace(place);
}
@@ -320,14 +320,14 @@
int32_t nIndex = 0;
int32_t i = 0;
int32_t sz = 0;
- for (i = 0, sz = pdfium::CollectionSize<int32_t>(m_SectionArray);
+ for (i = 0, sz = fxcrt::CollectionSize<int32_t>(m_SectionArray);
i < sz && i < newplace.nSecIndex; i++) {
CPVT_Section* pSection = m_SectionArray[i].get();
nIndex += pSection->GetWordArraySize();
if (i != sz - 1)
nIndex += kReturnLength;
}
- if (pdfium::IndexInBounds(m_SectionArray, i))
+ if (fxcrt::IndexInBounds(m_SectionArray, i))
nIndex += newplace.nWordIndex + kReturnLength;
return nIndex;
}
@@ -337,7 +337,7 @@
int32_t nOldIndex = 0;
int32_t nIndex = 0;
bool bFound = false;
- for (int32_t i = 0, sz = pdfium::CollectionSize<int32_t>(m_SectionArray);
+ for (int32_t i = 0, sz = fxcrt::CollectionSize<int32_t>(m_SectionArray);
i < sz; i++) {
CPVT_Section* pSection = m_SectionArray[i].get();
nIndex += pSection->GetWordArraySize();
@@ -376,13 +376,13 @@
const CPVT_WordPlace& place) const {
if (place.nSecIndex < 0)
return GetBeginWordPlace();
- if (place.nSecIndex >= pdfium::CollectionSize<int32_t>(m_SectionArray))
+ if (place.nSecIndex >= fxcrt::CollectionSize<int32_t>(m_SectionArray))
return GetEndWordPlace();
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
if (place > pSection->GetBeginWordPlace())
return pSection->GetPrevWordPlace(place);
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex - 1))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex - 1))
return GetBeginWordPlace();
return m_SectionArray[place.nSecIndex - 1]->GetEndWordPlace();
}
@@ -391,13 +391,13 @@
const CPVT_WordPlace& place) const {
if (place.nSecIndex < 0)
return GetBeginWordPlace();
- if (place.nSecIndex >= pdfium::CollectionSize<int32_t>(m_SectionArray))
+ if (place.nSecIndex >= fxcrt::CollectionSize<int32_t>(m_SectionArray))
return GetEndWordPlace();
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
if (place < pSection->GetEndWordPlace())
return pSection->GetNextWordPlace(place);
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex + 1))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex + 1))
return GetEndWordPlace();
return m_SectionArray[place.nSecIndex + 1]->GetBeginWordPlace();
}
@@ -407,12 +407,12 @@
CFX_PointF pt = OutToIn(point);
CPVT_WordPlace place = GetBeginWordPlace();
int32_t nLeft = 0;
- int32_t nRight = pdfium::CollectionSize<int32_t>(m_SectionArray) - 1;
- int32_t nMid = pdfium::CollectionSize<int32_t>(m_SectionArray) / 2;
+ int32_t nRight = fxcrt::CollectionSize<int32_t>(m_SectionArray) - 1;
+ int32_t nMid = fxcrt::CollectionSize<int32_t>(m_SectionArray) / 2;
bool bUp = true;
bool bDown = true;
while (nLeft <= nRight) {
- if (!pdfium::IndexInBounds(m_SectionArray, nMid))
+ if (!fxcrt::IndexInBounds(m_SectionArray, nMid))
break;
CPVT_Section* pSection = m_SectionArray[nMid].get();
if (IsFloatBigger(pt.y, pSection->GetRect().top))
@@ -444,7 +444,7 @@
CPVT_WordPlace CPVT_VariableText::GetUpWordPlace(
const CPVT_WordPlace& place,
const CFX_PointF& point) const {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
@@ -454,7 +454,7 @@
return pSection->SearchWordPlace(pt.x - pSection->GetRect().left, temp);
}
if (temp.nSecIndex-- > 0) {
- if (pdfium::IndexInBounds(m_SectionArray, temp.nSecIndex)) {
+ if (fxcrt::IndexInBounds(m_SectionArray, temp.nSecIndex)) {
CPVT_Section* pLastSection = m_SectionArray[temp.nSecIndex].get();
temp.nLineIndex = pLastSection->GetLineArraySize() - 1;
return pLastSection->SearchWordPlace(pt.x - pLastSection->GetRect().left,
@@ -467,7 +467,7 @@
CPVT_WordPlace CPVT_VariableText::GetDownWordPlace(
const CPVT_WordPlace& place,
const CFX_PointF& point) const {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
@@ -477,7 +477,7 @@
return pSection->SearchWordPlace(pt.x - pSection->GetRect().left, temp);
}
temp.AdvanceSection();
- if (!pdfium::IndexInBounds(m_SectionArray, temp.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, temp.nSecIndex))
return place;
return m_SectionArray[temp.nSecIndex]->SearchWordPlace(
@@ -491,7 +491,7 @@
CPVT_WordPlace CPVT_VariableText::GetLineEndPlace(
const CPVT_WordPlace& place) const {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
@@ -510,7 +510,7 @@
CPVT_WordPlace CPVT_VariableText::GetSectionEndPlace(
const CPVT_WordPlace& place) const {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
return m_SectionArray[place.nSecIndex]->GetEndWordPlace();
@@ -529,7 +529,7 @@
return place;
int32_t nSecIndex = pdfium::clamp(
- place.nSecIndex, 0, pdfium::CollectionSize<int32_t>(m_SectionArray));
+ place.nSecIndex, 0, fxcrt::CollectionSize<int32_t>(m_SectionArray));
auto pSection = std::make_unique<CPVT_Section>(this);
pSection->SetRect(CPVT_FloatRect());
@@ -541,7 +541,7 @@
CPVT_WordPlace CPVT_VariableText::AddLine(const CPVT_WordPlace& place,
const CPVT_LineInfo& lineinfo) {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
return m_SectionArray[place.nSecIndex]->AddLine(lineinfo);
@@ -555,7 +555,7 @@
CPVT_WordPlace newplace = place;
newplace.nSecIndex =
pdfium::clamp(newplace.nSecIndex, 0,
- pdfium::CollectionSize<int32_t>(m_SectionArray) - 1);
+ fxcrt::CollectionSize<int32_t>(m_SectionArray) - 1);
return m_SectionArray[newplace.nSecIndex]->AddWord(newplace, wordinfo);
}
@@ -642,7 +642,7 @@
void CPVT_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) {
CPVT_WordPlace wordplace = PrevLineHeaderPlace(place);
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return;
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
@@ -667,7 +667,7 @@
if (place.nSecIndex == 0 && m_SectionArray.size() == 1)
return false;
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return false;
if (m_SectionArray[place.nSecIndex]->GetWordArraySize() != 0)
@@ -688,11 +688,11 @@
void CPVT_VariableText::LinkLatterSection(const CPVT_WordPlace& place) {
CPVT_WordPlace oldplace = PrevLineHeaderPlace(place);
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex + 1))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex + 1))
return;
CPVT_Section* pNextSection = m_SectionArray[place.nSecIndex + 1].get();
- if (pdfium::IndexInBounds(m_SectionArray, oldplace.nSecIndex)) {
+ if (fxcrt::IndexInBounds(m_SectionArray, oldplace.nSecIndex)) {
CPVT_Section* pSection = m_SectionArray[oldplace.nSecIndex].get();
for (int32_t i = 0; i < pNextSection->GetWordArraySize(); ++i) {
oldplace.nWordIndex++;
@@ -708,13 +708,13 @@
NewRange.EndPos = PrevLineHeaderPlace(PlaceRange.EndPos);
for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex;
s--) {
- if (pdfium::IndexInBounds(m_SectionArray, s))
+ if (fxcrt::IndexInBounds(m_SectionArray, s))
m_SectionArray[s]->ClearWords(NewRange);
}
}
CPVT_WordPlace CPVT_VariableText::ClearLeftWord(const CPVT_WordPlace& place) {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
@@ -734,7 +734,7 @@
}
CPVT_WordPlace CPVT_VariableText::ClearRightWord(const CPVT_WordPlace& place) {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
+ if (!fxcrt::IndexInBounds(m_SectionArray, place.nSecIndex))
return place;
CPVT_Section* pSection = m_SectionArray[place.nSecIndex].get();
@@ -811,7 +811,7 @@
const CPVT_WordRange& PlaceRange) {
float fPosY = 0;
CPVT_FloatRect rcRet;
- for (int32_t s = 0, sz = pdfium::CollectionSize<int32_t>(m_SectionArray);
+ for (int32_t s = 0, sz = fxcrt::CollectionSize<int32_t>(m_SectionArray);
s < sz; s++) {
CPVT_WordPlace place;
place.nSecIndex = s;
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index e9541b2..154e664 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -25,9 +25,9 @@
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_memory_wrappers.h"
#include "core/fxcrt/fx_unicode.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/check_op.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -329,7 +329,7 @@
}
int CPDF_TextPage::CountChars() const {
- return pdfium::CollectionSize<int>(m_CharList);
+ return fxcrt::CollectionSize<int>(m_CharList);
}
int CPDF_TextPage::CharIndexFromTextIndex(int text_index) const {
@@ -543,11 +543,11 @@
return -1;
m_SelRects = GetRectArray(start, nCount);
- return pdfium::CollectionSize<int>(m_SelRects);
+ return fxcrt::CollectionSize<int>(m_SelRects);
}
bool CPDF_TextPage::GetRect(int rectIndex, CFX_FloatRect* pRect) const {
- if (!pdfium::IndexInBounds(m_SelRects, rectIndex))
+ if (!fxcrt::IndexInBounds(m_SelRects, rectIndex))
return false;
*pRect = m_SelRects[rectIndex];
@@ -941,7 +941,7 @@
int iBufStartAppend) {
DCHECK(!m_TempCharList.empty());
int i = iCharListStartAppend;
- int j = pdfium::CollectionSize<int>(m_TempCharList) - 1;
+ int j = fxcrt::CollectionSize<int>(m_TempCharList) - 1;
for (; i < j; ++i, --j) {
std::swap(m_TempCharList[i], m_TempCharList[j]);
std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index);
@@ -950,7 +950,7 @@
pdfium::span<wchar_t> temp_span = m_TempTextBuf.GetWideSpan();
DCHECK(!temp_span.empty());
i = iBufStartAppend;
- j = pdfium::CollectionSize<int>(temp_span) - 1;
+ j = fxcrt::CollectionSize<int>(temp_span) - 1;
for (; i < j; ++i, --j)
std::swap(temp_span[i], temp_span[j]);
}
@@ -1038,8 +1038,7 @@
const bool bIsBidiAndMirrorInverse =
bR2L && (matrix.a * matrix.d - matrix.b * matrix.c) < 0;
int32_t iBufStartAppend = m_TempTextBuf.GetLength();
- int32_t iCharListStartAppend =
- pdfium::CollectionSize<int32_t>(m_TempCharList);
+ int32_t iCharListStartAppend = fxcrt::CollectionSize<int32_t>(m_TempCharList);
float spacing = 0;
const size_t nItems = pTextObj->CountItems();
@@ -1135,12 +1134,12 @@
}
int nTotal = wstrItem.GetLength();
bool bDel = false;
- const int count = std::min(pdfium::CollectionSize<int>(m_TempCharList), 7);
+ const int count = std::min(fxcrt::CollectionSize<int>(m_TempCharList), 7);
constexpr float kTextCharRatioGapDelta = 0.07f;
float threshold = charinfo.m_Matrix.TransformXDistance(
kTextCharRatioGapDelta * pTextObj->GetFontSize());
- for (int n = pdfium::CollectionSize<int>(m_TempCharList);
- n > pdfium::CollectionSize<int>(m_TempCharList) - count; --n) {
+ for (int n = fxcrt::CollectionSize<int>(m_TempCharList);
+ n > fxcrt::CollectionSize<int>(m_TempCharList) - count; --n) {
const CharInfo& charinfo1 = m_TempCharList[n - 1];
CFX_PointF diff = charinfo1.m_Origin - charinfo.m_Origin;
if (charinfo1.m_CharCode == charinfo.m_CharCode &&
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 8c30d7a..bc91c4c 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -15,9 +15,9 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/fx_unicode.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -218,7 +218,7 @@
if (m_findNextStart.value() > strLen - 1)
return false;
- int nCount = pdfium::CollectionSize<int>(m_csFindWhatArray);
+ int nCount = fxcrt::CollectionSize<int>(m_csFindWhatArray);
Optional<size_t> nResultPos = 0;
size_t nStartPos = m_findNextStart.value();
bool bSpaceStart = false;
diff --git a/core/fxcodec/fax/faxmodule.cpp b/core/fxcodec/fax/faxmodule.cpp
index 9129249..bb07b13 100644
--- a/core/fxcodec/fax/faxmodule.cpp
+++ b/core/fxcodec/fax/faxmodule.cpp
@@ -16,10 +16,10 @@
#include "core/fxcodec/scanlinedecoder.h"
#include "core/fxcrt/cfx_binarybuf.h"
#include "core/fxcrt/fx_memory_wrappers.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/check_op.h"
#include "third_party/base/numerics/ranges.h"
-#include "third_party/base/stl_util.h"
namespace fxcodec {
@@ -694,8 +694,7 @@
m_Pitch(pitch),
m_pSrcBuf(src_buf),
m_RefLine(pitch, 0xff),
- m_LineBuf(
- pdfium::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(8, pitch)) {
+ m_LineBuf(fxcrt::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(8, pitch)) {
m_DestBuf.SetAllocStep(10240);
}
diff --git a/core/fxcodec/gif/cfx_gifcontext.cpp b/core/fxcodec/gif/cfx_gifcontext.cpp
index af8e175..f845bcf 100644
--- a/core/fxcodec/gif/cfx_gifcontext.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext.cpp
@@ -10,8 +10,8 @@
#include <utility>
#include "core/fxcodec/cfx_codec_memory.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/cxx17_backports.h"
-#include "third_party/base/stl_util.h"
namespace fxcodec {
@@ -155,7 +155,7 @@
}
GifDecoder::Status CFX_GifContext::LoadFrame(int32_t frame_num) {
- if (!pdfium::IndexInBounds(images_, frame_num))
+ if (!fxcrt::IndexInBounds(images_, frame_num))
return GifDecoder::Status::kError;
CFX_GifImage* gif_image = images_[static_cast<size_t>(frame_num)].get();
diff --git a/core/fxcrt/BUILD.gn b/core/fxcrt/BUILD.gn
index c3220b7..cdbf119 100644
--- a/core/fxcrt/BUILD.gn
+++ b/core/fxcrt/BUILD.gn
@@ -64,6 +64,7 @@
"retained_tree_node.h",
"scoped_set_insertion.h",
"shared_copy_on_write.h",
+ "stl_util.h",
"string_data_template.cpp",
"string_data_template.h",
"string_pool_template.h",
diff --git a/third_party/base/stl_util.h b/core/fxcrt/stl_util.h
similarity index 90%
rename from third_party/base/stl_util.h
rename to core/fxcrt/stl_util.h
index f831ee5..37156af 100644
--- a/third_party/base/stl_util.h
+++ b/core/fxcrt/stl_util.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef THIRD_PARTY_BASE_STL_UTIL_H_
-#define THIRD_PARTY_BASE_STL_UTIL_H_
+#ifndef CORE_FXCRT_STL_UTIL_H_
+#define CORE_FXCRT_STL_UTIL_H_
#include <memory>
#include <vector>
@@ -11,7 +11,7 @@
#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/numerics/safe_math.h"
-namespace pdfium {
+namespace fxcrt {
// Means of generating a key for searching STL collections of std::unique_ptr
// that avoids the side effect of deleting the pointer.
@@ -44,6 +44,6 @@
return std::vector<T, A>(safe_size.ValueOrDie());
}
-} // namespace pdfium
+} // namespace fxcrt
-#endif // THIRD_PARTY_BASE_STL_UTIL_H_
+#endif // CORE_FXCRT_STL_UTIL_H_
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index cd78988..afe9a89 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -17,6 +17,7 @@
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_memory_wrappers.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_substfont.h"
#include "core/fxge/fx_font.h"
@@ -24,7 +25,6 @@
#include "third_party/base/check.h"
#include "third_party/base/containers/contains.h"
#include "third_party/base/cxx17_backports.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -354,12 +354,12 @@
ByteString CFX_FontMapper::MatchInstalledFonts(const ByteString& norm_name) {
LoadInstalledFonts();
int i;
- for (i = pdfium::CollectionSize<int>(m_InstalledTTFonts) - 1; i >= 0; i--) {
+ for (i = fxcrt::CollectionSize<int>(m_InstalledTTFonts) - 1; i >= 0; i--) {
ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i].c_str());
if (norm1 == norm_name)
return m_InstalledTTFonts[i];
}
- for (i = pdfium::CollectionSize<int>(m_LocalizedTTFonts) - 1; i >= 0; i--) {
+ for (i = fxcrt::CollectionSize<int>(m_LocalizedTTFonts) - 1; i >= 0; i--) {
ByteString norm1 = TT_NormalizeName(m_LocalizedTTFonts[i].first.c_str());
if (norm1 == norm_name)
return m_LocalizedTTFonts[i].second;
@@ -686,7 +686,7 @@
}
int CFX_FontMapper::GetFaceSize() const {
- return pdfium::CollectionSize<int>(m_FaceArray);
+ return fxcrt::CollectionSize<int>(m_FaceArray);
}
bool CFX_FontMapper::HasInstalledFont(ByteStringView name) const {
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index fd6dffc..d166826 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -15,6 +15,7 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfdoc/cpdf_nametree.h"
#include "core/fxcrt/fx_memory_wrappers.h"
+#include "core/fxcrt/stl_util.h"
#include "fpdfsdk/cpdfsdk_actionhandler.h"
#include "fpdfsdk/cpdfsdk_annothandlermgr.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
@@ -26,7 +27,6 @@
#include "fpdfsdk/formfiller/cffl_privatedata.h"
#include "fxjs/ijs_runtime.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
static_assert(FXCT_ARROW ==
static_cast<int>(IPWL_SystemHandler::CursorStyle::kArrow),
@@ -427,7 +427,7 @@
#ifdef PDF_ENABLE_XFA
int CPDFSDK_FormFillEnvironment::GetPageViewCount() const {
- return pdfium::CollectionSize<int>(m_PageMap);
+ return fxcrt::CollectionSize<int>(m_PageMap);
}
void CPDFSDK_FormFillEnvironment::DisplayCaret(IPDF_Page* page,
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index 73be990..0de6c6b 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -29,6 +29,7 @@
#include "core/fpdfdoc/cpdf_generateap.h"
#include "core/fpdfdoc/cpdf_interactiveform.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_color.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
@@ -36,7 +37,6 @@
#include "third_party/base/check.h"
#include "third_party/base/cxx17_backports.h"
#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -1312,7 +1312,7 @@
if (!pFormFillEnv)
return -1;
- return pdfium::CollectionSize<int>(pFormFillEnv->GetFocusableAnnotSubtypes());
+ return fxcrt::CollectionSize<int>(pFormFillEnv->GetFocusableAnnotSubtypes());
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
diff --git a/fpdfsdk/fpdf_editpath.cpp b/fpdfsdk/fpdf_editpath.cpp
index 035fa83..bb9eb3b 100644
--- a/fpdfsdk/fpdf_editpath.cpp
+++ b/fpdfsdk/fpdf_editpath.cpp
@@ -10,9 +10,9 @@
#include "core/fpdfapi/page/cpdf_path.h"
#include "core/fpdfapi/page/cpdf_pathobject.h"
#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/stl_util.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "third_party/base/span.h"
-#include "third_party/base/stl_util.h"
// These checks are here because core/ and public/ cannot depend on each other.
static_assert(CFX_GraphStateData::LineCapButt == FPDF_LINECAP_BUTT,
@@ -75,7 +75,7 @@
auto* pPathObj = CPDFPathObjectFromFPDFPageObject(path);
if (!pPathObj)
return -1;
- return pdfium::CollectionSize<int>(pPathObj->path().GetPoints());
+ return fxcrt::CollectionSize<int>(pPathObj->path().GetPoints());
}
FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
@@ -85,7 +85,7 @@
return nullptr;
pdfium::span<const CFX_Path::Point> points = pPathObj->path().GetPoints();
- if (!pdfium::IndexInBounds(points, index))
+ if (!fxcrt::IndexInBounds(points, index))
return nullptr;
return FPDFPathSegmentFromFXPathPoint(&points[index]);
diff --git a/fpdfsdk/fpdf_signature.cpp b/fpdfsdk/fpdf_signature.cpp
index d241986..b18ce5a 100644
--- a/fpdfsdk/fpdf_signature.cpp
+++ b/fpdfsdk/fpdf_signature.cpp
@@ -9,8 +9,8 @@
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fxcrt/stl_util.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -44,7 +44,7 @@
if (!doc)
return -1;
- return pdfium::CollectionSize<int>(CollectSignatures(doc));
+ return fxcrt::CollectionSize<int>(CollectSignatures(doc));
}
FPDF_EXPORT FPDF_SIGNATURE FPDF_CALLCONV
@@ -54,7 +54,7 @@
return nullptr;
std::vector<CPDF_Dictionary*> signatures = CollectSignatures(doc);
- if (!pdfium::IndexInBounds(signatures, index))
+ if (!fxcrt::IndexInBounds(signatures, index))
return nullptr;
return FPDFSignatureFromCPDFDictionary(signatures[index]);
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index 7bdf296..dc6a457 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -18,10 +18,10 @@
#include "core/fpdftext/cpdf_linkextract.h"
#include "core/fpdftext/cpdf_textpage.h"
#include "core/fpdftext/cpdf_textpagefind.h"
+#include "core/fxcrt/stl_util.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "third_party/base/check.h"
#include "third_party/base/numerics/safe_conversions.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -483,7 +483,7 @@
return 0;
CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page);
- return pdfium::CollectionSize<int>(pageLink->GetRects(link_index));
+ return fxcrt::CollectionSize<int>(pageLink->GetRects(link_index));
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetRect(FPDF_PAGELINK link_page,
@@ -498,7 +498,7 @@
CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page);
std::vector<CFX_FloatRect> rectArray = pageLink->GetRects(link_index);
- if (rect_index >= pdfium::CollectionSize<int>(rectArray))
+ if (rect_index >= fxcrt::CollectionSize<int>(rectArray))
return false;
*left = rectArray[rect_index].left;
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 81d3c98..45625ad 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -21,11 +21,11 @@
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fillrenderoptions.h"
#include "core/fxge/cfx_path.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "third_party/base/span.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -334,8 +334,7 @@
return -1;
}
- return pdfium::CollectionSize<int>(
- pClipPath->GetPath(path_index).GetPoints());
+ return fxcrt::CollectionSize<int>(pClipPath->GetPath(path_index).GetPoints());
}
FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
@@ -353,7 +352,7 @@
pdfium::span<const CFX_Path::Point> points =
pClipPath->GetPath(path_index).GetPoints();
- if (!pdfium::IndexInBounds(points, segment_index))
+ if (!fxcrt::IndexInBounds(points, segment_index))
return nullptr;
return FPDFPathSegmentFromFXPathPoint(&points[segment_index]);
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 571d2a4..29b5c65 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -36,6 +36,7 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_stream.h"
#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_gemodule.h"
@@ -49,7 +50,6 @@
#include "public/fpdf_formfill.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/span.h"
-#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_V8
#include "fxjs/cfx_v8.h"
@@ -1186,7 +1186,7 @@
if (!doc)
return -1;
- return pdfium::CollectionSize<int>(
+ return fxcrt::CollectionSize<int>(
GetXFAPackets(GetXFAEntryFromDocument(doc)));
}
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index abeae95..d3707e5 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -15,6 +15,7 @@
#include "core/fpdfapi/parser/cpdf_seekablemultistream.h"
#include "core/fxcrt/autonuller.h"
#include "core/fxcrt/fx_memory_wrappers.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlparser.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
@@ -27,7 +28,6 @@
#include "public/fpdf_formfill.h"
#include "third_party/base/check.h"
#include "third_party/base/notreached.h"
-#include "third_party/base/stl_util.h"
#include "v8/include/cppgc/allocation.h"
#include "xfa/fgas/font/cfgas_gemodule.h"
#include "xfa/fxfa/cxfa_eventparam.h"
@@ -212,7 +212,7 @@
if (page_index < 0)
return nullptr;
- if (pdfium::IndexInBounds(m_XFAPageList, page_index)) {
+ if (fxcrt::IndexInBounds(m_XFAPageList, page_index)) {
if (m_XFAPageList[page_index])
return m_XFAPageList[page_index];
} else {
@@ -224,14 +224,14 @@
if (!pPage->LoadPage())
return nullptr;
- if (pdfium::IndexInBounds(m_XFAPageList, page_index))
+ if (fxcrt::IndexInBounds(m_XFAPageList, page_index))
m_XFAPageList[page_index] = pPage;
return pPage;
}
RetainPtr<CPDFXFA_Page> CPDFXFA_Context::GetXFAPage(int page_index) {
- if (!pdfium::IndexInBounds(m_XFAPageList, page_index))
+ if (!fxcrt::IndexInBounds(m_XFAPageList, page_index))
return nullptr;
return m_XFAPageList[page_index];
@@ -265,7 +265,7 @@
// if it's a valid page in the document.
m_pPDFDoc->DeletePage(page_index);
- if (pdfium::IndexInBounds(m_XFAPageList, page_index))
+ if (fxcrt::IndexInBounds(m_XFAPageList, page_index))
m_XFAPageList[page_index].Reset();
}
diff --git a/fpdfsdk/pwl/cpwl_list_ctrl.cpp b/fpdfsdk/pwl/cpwl_list_ctrl.cpp
index 80d6bd1..cd0faf5 100644
--- a/fpdfsdk/pwl/cpwl_list_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_list_ctrl.cpp
@@ -11,9 +11,9 @@
#include "core/fpdfdoc/cpvt_word.h"
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "fpdfsdk/pwl/cpwl_edit_impl.h"
#include "fpdfsdk/pwl/cpwl_list_box.h"
-#include "third_party/base/stl_util.h"
CPWL_ListCtrl::NotifyIface::~NotifyIface() = default;
@@ -569,7 +569,7 @@
}
int32_t CPWL_ListCtrl::GetCount() const {
- return pdfium::CollectionSize<int32_t>(m_ListItems);
+ return fxcrt::CollectionSize<int32_t>(m_ListItems);
}
float CPWL_ListCtrl::GetFirstHeight() const {
@@ -623,7 +623,7 @@
}
bool CPWL_ListCtrl::IsValid(int32_t nItemIndex) const {
- return pdfium::IndexInBounds(m_ListItems, nItemIndex);
+ return fxcrt::IndexInBounds(m_ListItems, nItemIndex);
}
WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const {
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 2a3dbd4..a4eda99 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -11,13 +11,13 @@
#include <vector>
#include "build/build_config.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_renderdevice.h"
#include "fpdfsdk/pwl/cpwl_scroll_bar.h"
#include "public/fpdf_fwlevent.h"
#include "third_party/base/check.h"
#include "third_party/base/check_op.h"
#include "third_party/base/containers/contains.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -390,7 +390,7 @@
void CPWL_Wnd::RemoveChild(CPWL_Wnd* pWnd) {
DCHECK_EQ(pWnd->m_pParent, this);
auto it = std::find(m_Children.begin(), m_Children.end(),
- pdfium::FakeUniquePtr<CPWL_Wnd>(pWnd));
+ fxcrt::FakeUniquePtr<CPWL_Wnd>(pWnd));
if (it == m_Children.end())
return;
diff --git a/fxbarcode/common/BC_CommonBitMatrix.cpp b/fxbarcode/common/BC_CommonBitMatrix.cpp
index b0180cc..7a91865 100644
--- a/fxbarcode/common/BC_CommonBitMatrix.cpp
+++ b/fxbarcode/common/BC_CommonBitMatrix.cpp
@@ -22,8 +22,8 @@
#include "fxbarcode/common/BC_CommonBitMatrix.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
CBC_CommonBitMatrix::CBC_CommonBitMatrix() = default;
@@ -31,7 +31,7 @@
m_width = width;
m_height = height;
m_rowSize = (width + 31) >> 5;
- m_bits = pdfium::Vector2D<int32_t>(m_rowSize, m_height);
+ m_bits = fxcrt::Vector2D<int32_t>(m_rowSize, m_height);
}
CBC_CommonBitMatrix::~CBC_CommonBitMatrix() = default;
diff --git a/fxbarcode/common/BC_CommonByteMatrix.cpp b/fxbarcode/common/BC_CommonByteMatrix.cpp
index 795593d..d299d4b 100644
--- a/fxbarcode/common/BC_CommonByteMatrix.cpp
+++ b/fxbarcode/common/BC_CommonByteMatrix.cpp
@@ -23,12 +23,12 @@
#include <algorithm>
#include <iterator>
-#include "third_party/base/stl_util.h"
+#include "core/fxcrt/stl_util.h"
CBC_CommonByteMatrix::CBC_CommonByteMatrix(int32_t width, int32_t height)
: m_width(width), m_height(height) {
m_bytes =
- pdfium::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(m_height, m_width);
+ fxcrt::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(m_height, m_width);
clear(0xff);
}
diff --git a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index 99fed1c..c4fa16a 100644
--- a/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -26,9 +26,9 @@
#include <utility>
#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/stl_util.h"
#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(
CBC_ReedSolomonGF256* field,
@@ -62,7 +62,7 @@
}
int32_t CBC_ReedSolomonGF256Poly::GetDegree() const {
- return pdfium::CollectionSize<int32_t>(m_coefficients) - 1;
+ return fxcrt::CollectionSize<int32_t>(m_coefficients) - 1;
}
bool CBC_ReedSolomonGF256Poly::IsZero() const {
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
index 5444d41..6ce2b63 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
@@ -24,6 +24,7 @@
#include <memory>
+#include "core/fxcrt/stl_util.h"
#include "fxbarcode/BC_TwoDimWriter.h"
#include "fxbarcode/BC_Writer.h"
#include "fxbarcode/common/BC_CommonBitMatrix.h"
@@ -42,7 +43,6 @@
#include "fxbarcode/datamatrix/BC_TextEncoder.h"
#include "fxbarcode/datamatrix/BC_X12Encoder.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -140,8 +140,8 @@
*pOutWidth = bytematrix->GetWidth();
*pOutHeight = bytematrix->GetHeight();
- results = pdfium::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(*pOutWidth,
- *pOutHeight);
+ results = fxcrt::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(*pOutWidth,
+ *pOutHeight);
memcpy(results.data(), bytematrix->GetArray().data(),
*pOutWidth * *pOutHeight);
return results;
diff --git a/fxbarcode/pdf417/BC_PDF417Writer.cpp b/fxbarcode/pdf417/BC_PDF417Writer.cpp
index 4ef6b7e..295432b 100644
--- a/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ b/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -25,11 +25,11 @@
#include <algorithm>
#include <utility>
+#include "core/fxcrt/stl_util.h"
#include "fxbarcode/BC_TwoDimWriter.h"
#include "fxbarcode/common/BC_CommonBitMatrix.h"
#include "fxbarcode/pdf417/BC_PDF417.h"
#include "fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h"
-#include "third_party/base/stl_util.h"
CBC_PDF417Writer::CBC_PDF417Writer() : CBC_TwoDimWriter(false) {}
@@ -72,8 +72,8 @@
}
*pOutWidth = matrixWidth;
*pOutHeight = matrixHeight;
- results = pdfium::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(*pOutWidth,
- *pOutHeight);
+ results = fxcrt::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(*pOutWidth,
+ *pOutHeight);
memcpy(results.data(), matrixData.data(), *pOutWidth * *pOutHeight);
return results;
}
diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
index cae71bc..646e7e0 100644
--- a/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -22,6 +22,7 @@
#include "fxbarcode/qrcode/BC_QRCodeWriter.h"
+#include "core/fxcrt/stl_util.h"
#include "fxbarcode/common/BC_CommonByteMatrix.h"
#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
#include "fxbarcode/qrcode/BC_QRCoder.h"
@@ -29,7 +30,6 @@
#include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
#include "fxbarcode/qrcode/BC_QRCoderMode.h"
#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
-#include "third_party/base/stl_util.h"
CBC_QRCodeWriter::CBC_QRCodeWriter() : CBC_TwoDimWriter(true) {}
@@ -72,8 +72,8 @@
*pOutWidth = qr.GetMatrixWidth();
*pOutHeight = qr.GetMatrixWidth();
- results = pdfium::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(*pOutWidth,
- *pOutHeight);
+ results = fxcrt::Vector2D<uint8_t, FxAllocAllocator<uint8_t>>(*pOutWidth,
+ *pOutHeight);
memcpy(results.data(), qr.GetMatrix()->GetArray().data(),
*pOutWidth * *pOutHeight);
return results;
diff --git a/fxjs/cfx_globaldata.cpp b/fxjs/cfx_globaldata.cpp
index 3ad8294..26e30bf 100644
--- a/fxjs/cfx_globaldata.cpp
+++ b/fxjs/cfx_globaldata.cpp
@@ -9,7 +9,7 @@
#include <utility>
#include "core/fdrm/fx_crypt.h"
-#include "third_party/base/stl_util.h"
+#include "core/fxcrt/stl_util.h"
namespace {
@@ -241,7 +241,7 @@
}
int32_t CFX_GlobalData::GetSize() const {
- return pdfium::CollectionSize<int32_t>(m_arrayGlobalData);
+ return fxcrt::CollectionSize<int32_t>(m_arrayGlobalData);
}
CFX_GlobalData::Element* CFX_GlobalData::GetAt(int index) {
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index a4cee9f..50e67ef 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -9,13 +9,13 @@
#include <memory>
#include <utility>
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/unowned_ptr.h"
#include "fxjs/cjs_object.h"
#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_runtimedata.h"
#include "third_party/base/check.h"
#include "third_party/base/check_op.h"
-#include "third_party/base/stl_util.h"
#include "v8/include/v8-util.h"
class CFXJS_PerObjectData;
@@ -337,7 +337,7 @@
FXJS_PerIsolateData::~FXJS_PerIsolateData() = default;
uint32_t FXJS_PerIsolateData::CurrentMaxObjDefinitionID() const {
- return pdfium::CollectionSize<uint32_t>(m_ObjectDefnArray);
+ return fxcrt::CollectionSize<uint32_t>(m_ObjectDefnArray);
}
CFXJS_ObjDefinition* FXJS_PerIsolateData::ObjDefinitionForID(
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp
index 80d9224..f96323b 100644
--- a/fxjs/cjs_app.cpp
+++ b/fxjs/cjs_app.cpp
@@ -8,13 +8,13 @@
#include <utility>
+#include "core/fxcrt/stl_util.h"
#include "fpdfsdk/cpdfsdk_interactiveform.h"
#include "fxjs/cjs_document.h"
#include "fxjs/cjs_timerobj.h"
#include "fxjs/global_timer.h"
#include "fxjs/ijs_event_context.h"
#include "fxjs/js_resources.h"
-#include "third_party/base/stl_util.h"
#define JS_STR_VIEWERTYPE L"pdfium"
#define JS_STR_VIEWERVARIATION L"Full"
@@ -393,7 +393,7 @@
}
void CJS_App::CancelProc(GlobalTimer* pTimer) {
- m_Timers.erase(pdfium::FakeUniquePtr<GlobalTimer>(pTimer));
+ m_Timers.erase(fxcrt::FakeUniquePtr<GlobalTimer>(pTimer));
}
void CJS_App::RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript) {
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index e333100..205b862 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -11,6 +11,7 @@
#include "core/fxcrt/autorestorer.h"
#include "core/fxcrt/cfx_widetextbuf.h"
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "fxjs/cjs_runtime.h"
#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_class.h"
@@ -22,7 +23,6 @@
#include "fxjs/xfa/cfxjse_value.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/containers/contains.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
@@ -688,7 +688,7 @@
findObjects.emplace_back(refObject ? refObject : m_pDocument->GetRoot());
int32_t nNodes = 0;
while (true) {
- nNodes = pdfium::CollectionSize<int32_t>(findObjects);
+ nNodes = fxcrt::CollectionSize<int32_t>(findObjects);
int32_t i = 0;
rndFind.m_dwStyles = dwStyles;
m_ResolveProcessor->SetCurStart(nStart);
@@ -766,7 +766,7 @@
}
findObjects.clear();
- nNodes = pdfium::CollectionSize<int32_t>(retObjects);
+ nNodes = fxcrt::CollectionSize<int32_t>(retObjects);
if (nNodes < 1) {
if (dwStyles & XFA_RESOLVENODE_CreateNode) {
bNextCreate = true;
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 42c8299..90f5deb 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -619,7 +619,6 @@
"base/numerics/safe_math_shared_impl.h",
"base/optional.h",
"base/span.h",
- "base/stl_util.h",
"base/sys_byteorder.h",
"base/template_util.h",
]
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 78c7f80..0d77522 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -13,6 +13,7 @@
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_path.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -21,7 +22,6 @@
#include "core/fxge/fx_font.h"
#include "core/fxge/text_char_pos.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/cfgas_txtbreak.h"
@@ -417,13 +417,13 @@
void CFDE_TextOut::AppendPiece(const Piece& piece,
bool bNeedReload,
bool bEnd) {
- if (m_iCurLine >= pdfium::CollectionSize<int32_t>(m_ttoLines)) {
+ if (m_iCurLine >= fxcrt::CollectionSize<int32_t>(m_ttoLines)) {
Line ttoLine;
ttoLine.set_new_reload(bNeedReload);
m_iCurPiece = ttoLine.AddPiece(m_iCurPiece, piece);
m_ttoLines.push_back(ttoLine);
- m_iCurLine = pdfium::CollectionSize<int32_t>(m_ttoLines) - 1;
+ m_iCurLine = fxcrt::CollectionSize<int32_t>(m_ttoLines) - 1;
} else {
Line* pLine = &m_ttoLines[m_iCurLine];
pLine->set_new_reload(bNeedReload);
@@ -542,12 +542,12 @@
const CFDE_TextOut::Piece* CFDE_TextOut::Line::GetPieceAtIndex(
size_t index) const {
- CHECK(pdfium::IndexInBounds(pieces_, index));
+ CHECK(fxcrt::IndexInBounds(pieces_, index));
return &pieces_[index];
}
CFDE_TextOut::Piece* CFDE_TextOut::Line::GetPieceAtIndex(size_t index) {
- CHECK(pdfium::IndexInBounds(pieces_, index));
+ CHECK(fxcrt::IndexInBounds(pieces_, index));
return &pieces_[index];
}
diff --git a/xfa/fgas/layout/cfgas_break.cpp b/xfa/fgas/layout/cfgas_break.cpp
index 13b3904..363a7c5 100644
--- a/xfa/fgas/layout/cfgas_break.cpp
+++ b/xfa/fgas/layout/cfgas_break.cpp
@@ -10,7 +10,7 @@
#include <vector>
#include "core/fxcrt/fx_safe_types.h"
-#include "third_party/base/stl_util.h"
+#include "core/fxcrt/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
const float CFGAS_Break::kConversionFactor = 20000.0f;
@@ -125,10 +125,10 @@
bool bOmitChar,
bool bRichText) const {
std::vector<CFGAS_Char>& tca = m_pCurLine->m_LineChars;
- if (!pdfium::IndexInBounds(tca, index))
+ if (!fxcrt::IndexInBounds(tca, index))
return nullptr;
- int32_t iStart = pdfium::CollectionSize<int32_t>(tca) - 1;
+ int32_t iStart = fxcrt::CollectionSize<int32_t>(tca) - 1;
while (iStart > -1) {
CFGAS_Char* pTC = &tca[iStart--];
if (((bRichText && pTC->m_iCharWidth < 0) || bOmitChar) &&
@@ -142,7 +142,7 @@
}
int32_t CFGAS_Break::CountBreakPieces() const {
- return HasLine() ? pdfium::CollectionSize<int32_t>(
+ return HasLine() ? fxcrt::CollectionSize<int32_t>(
m_Lines[m_iReadyLineIndex].m_LinePieces)
: 0;
}
@@ -151,7 +151,7 @@
int32_t index) const {
if (!HasLine())
return nullptr;
- if (!pdfium::IndexInBounds(m_Lines[m_iReadyLineIndex].m_LinePieces, index))
+ if (!fxcrt::IndexInBounds(m_Lines[m_iReadyLineIndex].m_LinePieces, index))
return nullptr;
return &m_Lines[m_iReadyLineIndex].m_LinePieces[index];
}
diff --git a/xfa/fgas/layout/cfgas_breakline.cpp b/xfa/fgas/layout/cfgas_breakline.cpp
index effd109..cd5340c 100644
--- a/xfa/fgas/layout/cfgas_breakline.cpp
+++ b/xfa/fgas/layout/cfgas_breakline.cpp
@@ -6,15 +6,15 @@
#include "xfa/fgas/layout/cfgas_breakline.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
CFGAS_BreakLine::CFGAS_BreakLine() = default;
CFGAS_BreakLine::~CFGAS_BreakLine() = default;
CFGAS_Char* CFGAS_BreakLine::GetChar(int32_t index) {
- DCHECK(pdfium::IndexInBounds(m_LineChars, index));
+ DCHECK(fxcrt::IndexInBounds(m_LineChars, index));
return &m_LineChars[index];
}
diff --git a/xfa/fgas/layout/cfgas_char.cpp b/xfa/fgas/layout/cfgas_char.cpp
index e060aae..8563097 100644
--- a/xfa/fgas/layout/cfgas_char.cpp
+++ b/xfa/fgas/layout/cfgas_char.cpp
@@ -9,9 +9,9 @@
#include <algorithm>
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/cxx17_backports.h"
-#include "third_party/base/stl_util.h"
namespace {
@@ -269,7 +269,7 @@
void ReverseString(std::vector<CFGAS_Char>* chars,
size_t iStart,
size_t iCount) {
- DCHECK(pdfium::IndexInBounds(*chars, iStart));
+ DCHECK(fxcrt::IndexInBounds(*chars, iStart));
DCHECK(iStart + iCount <= chars->size());
std::reverse(chars->begin() + iStart, chars->begin() + iStart + iCount);
diff --git a/xfa/fgas/layout/cfgas_rtfbreak.cpp b/xfa/fgas/layout/cfgas_rtfbreak.cpp
index df1bf68..ff3e53e 100644
--- a/xfa/fgas/layout/cfgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfgas_rtfbreak.cpp
@@ -11,11 +11,11 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/text_char_pos.h"
#include "third_party/base/check.h"
#include "third_party/base/containers/adapters.h"
#include "third_party/base/numerics/safe_math.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/cfgas_textpiece.h"
@@ -372,7 +372,7 @@
tp.m_pChars = &m_pCurLine->m_LineChars;
bool bNew = true;
uint32_t dwIdentity = static_cast<uint32_t>(-1);
- int32_t iLast = pdfium::CollectionSize<int32_t>(m_pCurLine->m_LineChars) - 1;
+ int32_t iLast = fxcrt::CollectionSize<int32_t>(m_pCurLine->m_LineChars) - 1;
int32_t j = 0;
for (int32_t i = 0; i <= iLast;) {
const CFGAS_Char* pTC = pCurChars + i;
@@ -445,7 +445,7 @@
uint32_t dwIdentity = static_cast<uint32_t>(-1);
int32_t i = 0;
int32_t j = 0;
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_pCurLine->m_LineChars);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(m_pCurLine->m_LineChars);
while (i < iCount) {
pTC = &chars[i];
if (iBidiLevel < 0) {
@@ -582,7 +582,7 @@
bool bAllChars,
bool bOnlyBrk,
int32_t* pEndPos) {
- int32_t iLength = pdfium::CollectionSize<int32_t>(tca) - 1;
+ int32_t iLength = fxcrt::CollectionSize<int32_t>(tca) - 1;
if (iLength < 1)
return iLength;
@@ -690,7 +690,7 @@
iCharPos = 0;
++iCharPos;
- if (iCharPos >= pdfium::CollectionSize<int32_t>(pCurLine->m_LineChars)) {
+ if (iCharPos >= fxcrt::CollectionSize<int32_t>(pCurLine->m_LineChars)) {
pNextLine->Clear();
curChars[iCharPos - 1].m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
return;
diff --git a/xfa/fgas/layout/cfgas_txtbreak.cpp b/xfa/fgas/layout/cfgas_txtbreak.cpp
index f91b00d..54a4523 100644
--- a/xfa/fgas/layout/cfgas_txtbreak.cpp
+++ b/xfa/fgas/layout/cfgas_txtbreak.cpp
@@ -11,10 +11,10 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxge/text_char_pos.h"
#include "third_party/base/check.h"
#include "third_party/base/containers/adapters.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/fgas_arabic.h"
@@ -323,7 +323,7 @@
int32_t iCharWidth;
int32_t i = 0;
int32_t j = -1;
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_pCurLine->m_LineChars);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(m_pCurLine->m_LineChars);
while (i < iCount) {
pTC = &chars[i];
if (iBidiLevel < 0) {
@@ -505,7 +505,7 @@
bool bOnlyBrk,
int32_t* pEndPos) {
std::vector<CFGAS_Char>& chars = *pChars;
- int32_t iLength = pdfium::CollectionSize<int32_t>(chars) - 1;
+ int32_t iLength = fxcrt::CollectionSize<int32_t>(chars) - 1;
if (iLength < 1)
return iLength;
@@ -601,7 +601,7 @@
iCharPos = 0;
iCharPos++;
- if (iCharPos >= pdfium::CollectionSize<int32_t>(pCurLine->m_LineChars)) {
+ if (iCharPos >= fxcrt::CollectionSize<int32_t>(pCurLine->m_LineChars)) {
pNextLine->Clear();
CFGAS_Char* pTC = &curChars[iCharPos - 1];
pTC->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 7306225..0f74968 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -10,8 +10,8 @@
#include <memory>
#include <utility>
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/numerics/ranges.h"
-#include "third_party/base/stl_util.h"
#include "v8/include/cppgc/visitor.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_app.h"
@@ -838,7 +838,7 @@
}
int32_t CFWL_ListBox::CountItems(const CFWL_Widget* pWidget) const {
- return pdfium::CollectionSize<int32_t>(m_ItemArray);
+ return fxcrt::CollectionSize<int32_t>(m_ItemArray);
}
CFWL_ListBox::Item* CFWL_ListBox::GetItem(const CFWL_Widget* pWidget,
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index 89bbaae..307e6e1 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -11,10 +11,10 @@
#include <utility>
#include "core/fxcrt/cfx_datetime.h"
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/containers/contains.h"
#include "third_party/base/notreached.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fwl/cfwl_datetimepicker.h"
#include "xfa/fwl/cfwl_messagemouse.h"
@@ -217,7 +217,7 @@
params.m_matrix = mtMatrix;
IFWL_ThemeProvider* pTheme = GetThemeProvider();
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_DateArray);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(m_DateArray);
for (int32_t j = 0; j < iCount; j++) {
DATEINFO* pDataInfo = m_DateArray[j].get();
if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Selected) {
@@ -280,7 +280,7 @@
params.m_matrix = mtMatrix;
IFWL_ThemeProvider* pTheme = GetThemeProvider();
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_DateArray);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(m_DateArray);
for (int32_t j = 0; j < iCount; j++) {
DATEINFO* pDataInfo = m_DateArray[j].get();
params.m_wsText = pDataInfo->wsDay;
@@ -308,7 +308,7 @@
if (m_iMonth != m_iCurMonth || m_iYear != m_iCurYear)
return;
- if (m_iDay < 1 || m_iDay > pdfium::CollectionSize<int32_t>(m_DateArray))
+ if (m_iDay < 1 || m_iDay > fxcrt::CollectionSize<int32_t>(m_DateArray))
return;
DATEINFO* pDate = m_DateArray[m_iDay - 1].get();
@@ -533,7 +533,7 @@
}
void CFWL_MonthCalendar::RemoveSelDay() {
- int32_t iDatesCount = pdfium::CollectionSize<int32_t>(m_DateArray);
+ int32_t iDatesCount = fxcrt::CollectionSize<int32_t>(m_DateArray);
for (int32_t iSelDay : m_SelDayArray) {
if (iSelDay <= iDatesCount)
m_DateArray[iSelDay - 1]->dwStates &= ~FWL_ITEMSTATE_MCD_Selected;
@@ -547,7 +547,7 @@
return;
RemoveSelDay();
- if (iDay <= pdfium::CollectionSize<int32_t>(m_DateArray))
+ if (iDay <= fxcrt::CollectionSize<int32_t>(m_DateArray))
m_DateArray[iDay - 1]->dwStates |= FWL_ITEMSTATE_MCD_Selected;
m_SelDayArray.push_back(iDay);
@@ -594,7 +594,7 @@
}
CFX_RectF CFWL_MonthCalendar::GetDayRect(int32_t iDay) {
- if (iDay <= 0 || iDay > pdfium::CollectionSize<int32_t>(m_DateArray))
+ if (iDay <= 0 || iDay > fxcrt::CollectionSize<int32_t>(m_DateArray))
return CFX_RectF();
DATEINFO* pDateInfo = m_DateArray[iDay - 1].get();
@@ -679,8 +679,7 @@
if (iCurSel > 0) {
DATEINFO* pDateInfo = m_DateArray[iCurSel - 1].get();
CFX_RectF rtInvalidate(pDateInfo->rect);
- if (iOldSel > 0 &&
- iOldSel <= pdfium::CollectionSize<int32_t>(m_DateArray)) {
+ if (iOldSel > 0 && iOldSel <= fxcrt::CollectionSize<int32_t>(m_DateArray)) {
pDateInfo = m_DateArray[iOldSel - 1].get();
rtInvalidate.Union(pDateInfo->rect);
}
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 20b6206..4e007b4 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -10,12 +10,12 @@
#include <utility>
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "fxjs/gc/container_trace.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/check_op.h"
#include "third_party/base/containers/contains.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffbarcode.h"
#include "xfa/fxfa/cxfa_ffcheckbutton.h"
@@ -155,7 +155,7 @@
}
void CXFA_FFDocView::ShowNullTestMsg() {
- int32_t iCount = pdfium::CollectionSize<int32_t>(m_NullTestMsgArray);
+ int32_t iCount = fxcrt::CollectionSize<int32_t>(m_NullTestMsgArray);
CXFA_FFApp* pApp = m_pDoc->GetApp();
CXFA_FFApp::CallbackIface* pAppProvider = pApp->GetAppProvider();
if (pAppProvider && iCount) {
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index 9c33637..f6d2e02 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -10,8 +10,8 @@
#include <utility>
#include <vector>
+#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
#include "v8/include/cppgc/visitor.h"
#include "xfa/fwl/cfwl_listbox.h"
#include "xfa/fwl/cfwl_notedriver.h"
@@ -104,7 +104,7 @@
bool CXFA_FFListBox::IsDataChanged() {
std::vector<int32_t> iSelArray = m_pNode->GetSelectedItems();
- int32_t iOldSels = pdfium::CollectionSize<int32_t>(iSelArray);
+ int32_t iOldSels = fxcrt::CollectionSize<int32_t>(iSelArray);
auto* pListBox = ToListBox(GetNormalWidget());
int32_t iSels = pListBox->CountSelItems();
if (iOldSels != iSels)
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index ae4f75f..527acfe 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -10,11 +10,11 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/stl_util.h"
#include "fxjs/gc/container_trace.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/check.h"
#include "third_party/base/containers/contains.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffcheckbutton.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
@@ -358,8 +358,8 @@
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToFirst() {
- for (int32_t i = 0;
- i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
+ for (int32_t i = 0; i < fxcrt::CollectionSize<int32_t>(m_TabOrderWidgetArray);
+ i++) {
if (PageWidgetFilter(m_TabOrderWidgetArray[i]->GetFFWidget(), m_dwFilter,
true, m_bIgnoreRelevant)) {
m_iCurWidget = i;
@@ -370,7 +370,7 @@
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToLast() {
- for (int32_t i = pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1;
+ for (int32_t i = fxcrt::CollectionSize<int32_t>(m_TabOrderWidgetArray) - 1;
i >= 0; i--) {
if (PageWidgetFilter(m_TabOrderWidgetArray[i]->GetFFWidget(), m_dwFilter,
true, m_bIgnoreRelevant)) {
@@ -383,7 +383,7 @@
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::MoveToNext() {
for (int32_t i = m_iCurWidget + 1;
- i < pdfium::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
+ i < fxcrt::CollectionSize<int32_t>(m_TabOrderWidgetArray); i++) {
if (PageWidgetFilter(m_TabOrderWidgetArray[i]->GetFFWidget(), m_dwFilter,
true, m_bIgnoreRelevant)) {
m_iCurWidget = i;
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index 2670f6e..66f0ecc 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -11,6 +11,7 @@
#include "core/fxcrt/css/cfx_csscomputedstyle.h"
#include "core/fxcrt/css/cfx_cssstyleselector.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "core/fxcrt/xml/cfx_xmltext.h"
@@ -22,7 +23,6 @@
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/check.h"
#include "third_party/base/notreached.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/layout/cfgas_linkuserdata.h"
@@ -634,7 +634,7 @@
for (size_t j = 0; j < pPieceLine->m_textPieces.size(); ++j) {
const TextPiece* pPiece = pPieceLine->m_textPieces[j].get();
int32_t iChars = pPiece->iChars;
- if (pdfium::CollectionSize<int32_t>(char_pos) < iChars)
+ if (fxcrt::CollectionSize<int32_t>(char_pos) < iChars)
char_pos.resize(iChars);
RenderString(pFxDevice, pPieceLine, j, &char_pos, mtDoc2Device);
}
@@ -961,14 +961,14 @@
if (!m_pTabstopContext || m_pTabstopContext->m_tabstops.empty())
return;
- int32_t iPieces = pdfium::CollectionSize<int32_t>(pPieceLine->m_textPieces);
+ int32_t iPieces = fxcrt::CollectionSize<int32_t>(pPieceLine->m_textPieces);
if (iPieces == 0)
return;
TextPiece* pPiece = pPieceLine->m_textPieces[iPieces - 1].get();
int32_t& iTabstopsIndex = m_pTabstopContext->m_iTabIndex;
int32_t iCount = m_pTextParser->CountTabs(pStyle);
- if (!pdfium::IndexInBounds(m_pTabstopContext->m_tabstops, iTabstopsIndex))
+ if (!fxcrt::IndexInBounds(m_pTabstopContext->m_tabstops, iTabstopsIndex))
return;
if (iCount > 0) {
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
index 8f0d030..b7a13ec 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
@@ -10,13 +10,13 @@
#include <utility>
#include <vector>
+#include "core/fxcrt/stl_util.h"
#include "fxjs/gc/container_trace.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/check.h"
#include "third_party/base/compiler_specific.h"
#include "third_party/base/containers/adapters.h"
#include "third_party/base/notreached.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
@@ -1078,12 +1078,12 @@
if (pContext && pContext->m_prgSpecifiedColumnWidths) {
int32_t iColSpan =
m_pCurChildNode->JSObject()->GetInteger(XFA_Attribute::ColSpan);
- if (iColSpan <= pdfium::CollectionSize<int32_t>(
+ if (iColSpan <= fxcrt::CollectionSize<int32_t>(
*pContext->m_prgSpecifiedColumnWidths) -
iColIndex) {
pContext->m_fCurColumnWidth = 0.0f;
if (iColSpan == -1) {
- iColSpan = pdfium::CollectionSize<int32_t>(
+ iColSpan = fxcrt::CollectionSize<int32_t>(
*pContext->m_prgSpecifiedColumnWidths);
}
for (int32_t i = 0; iColIndex + i < iColSpan; ++i) {
@@ -1195,7 +1195,7 @@
}
int32_t iSpecifiedColumnCount =
- pdfium::CollectionSize<int32_t>(m_rgSpecifiedColumnWidths);
+ fxcrt::CollectionSize<int32_t>(m_rgSpecifiedColumnWidths);
Context layoutContext;
layoutContext.m_prgSpecifiedColumnWidths = &m_rgSpecifiedColumnWidths;
Context* pLayoutContext =
@@ -1254,7 +1254,7 @@
}
}
- iRowCount = pdfium::CollectionSize<int32_t>(rgRowItems);
+ iRowCount = fxcrt::CollectionSize<int32_t>(rgRowItems);
iColCount = 0;
bool bMoreColumns = true;
while (bMoreColumns) {
@@ -1286,9 +1286,8 @@
continue;
if (iColCount >= iSpecifiedColumnCount) {
- int32_t c =
- iColCount + 1 -
- pdfium::CollectionSize<int32_t>(m_rgSpecifiedColumnWidths);
+ int32_t c = iColCount + 1 -
+ fxcrt::CollectionSize<int32_t>(m_rgSpecifiedColumnWidths);
for (int32_t j = 0; j < c; j++)
m_rgSpecifiedColumnWidths.push_back(0);
}
@@ -1304,7 +1303,7 @@
continue;
float fFinalColumnWidth = 0.0f;
- if (pdfium::IndexInBounds(m_rgSpecifiedColumnWidths, iColCount))
+ if (fxcrt::IndexInBounds(m_rgSpecifiedColumnWidths, iColCount))
fFinalColumnWidth = m_rgSpecifiedColumnWidths[iColCount];
for (int32_t i = 0; i < iRowCount; ++i) {
@@ -1924,7 +1923,7 @@
float fGroupWidths[3] = {0, 0, 0};
int32_t nTotalLength = 0;
for (int32_t i = 0; i < 3; i++) {
- nGroupLengths[i] = pdfium::CollectionSize<int32_t>(rgCurLineLayoutItems[i]);
+ nGroupLengths[i] = fxcrt::CollectionSize<int32_t>(rgCurLineLayoutItems[i]);
for (int32_t c = nGroupLengths[i], j = 0; j < c; j++) {
nTotalLength++;
if (rgCurLineLayoutItems[i][j]->GetFormNode()->PresenceRequiresSpace())
diff --git a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
index 7617d40..843d790 100644
--- a/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
@@ -8,11 +8,11 @@
#include <utility>
+#include "core/fxcrt/stl_util.h"
#include "fxjs/gc/container_trace.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/layout/cxfa_contentlayoutitem.h"
@@ -685,7 +685,7 @@
CXFA_ViewRecord* pNewRecord,
CXFA_Node* pNewPageArea) {
CXFA_ViewLayoutItem* pNewPageAreaLayoutItem = nullptr;
- if (pdfium::IndexInBounds(m_PageArray, m_nAvailPages)) {
+ if (fxcrt::IndexInBounds(m_PageArray, m_nAvailPages)) {
CXFA_ViewLayoutItem* pViewItem = m_PageArray[m_nAvailPages];
pViewItem->SetFormNode(pNewPageArea);
m_nAvailPages++;
@@ -746,11 +746,11 @@
}
int32_t CXFA_ViewLayoutProcessor::GetPageCount() const {
- return pdfium::CollectionSize<int32_t>(m_PageArray);
+ return fxcrt::CollectionSize<int32_t>(m_PageArray);
}
CXFA_ViewLayoutItem* CXFA_ViewLayoutProcessor::GetPage(int32_t index) const {
- if (!pdfium::IndexInBounds(m_PageArray, index))
+ if (!fxcrt::IndexInBounds(m_PageArray, index))
return nullptr;
return m_PageArray[index].Get();
}
@@ -1912,7 +1912,7 @@
}
}
- int32_t nPage = pdfium::CollectionSize<int32_t>(m_PageArray);
+ int32_t nPage = fxcrt::CollectionSize<int32_t>(m_PageArray);
for (int32_t i = nPage - 1; i >= m_nAvailPages; i--) {
CXFA_ViewLayoutItem* pPage = m_PageArray[i];
m_PageArray.erase(m_PageArray.begin() + i);
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index aab083c..588faef 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -10,6 +10,7 @@
#include <utility>
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "fxjs/gc/container_trace.h"
@@ -19,7 +20,6 @@
#include "third_party/base/check_op.h"
#include "third_party/base/compiler_specific.h"
#include "third_party/base/notreached.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cscript_datawindow.h"
@@ -1041,7 +1041,7 @@
if (iCurRepeatIndex == 0 && !bAccessedDataDOM) {
int32_t iLimit = iMax;
if (pInstMgrNode && pTemplateNode->GetNameHash() == 0) {
- iLimit = pdfium::CollectionSize<int32_t>(subformArray);
+ iLimit = fxcrt::CollectionSize<int32_t>(subformArray);
if (iLimit < iMin)
iLimit = iInit;
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 75697c3..aa1fbbc 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -17,6 +17,7 @@
#include "core/fxcrt/cfx_readonlymemorystream.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
@@ -33,7 +34,6 @@
#include "third_party/base/containers/contains.h"
#include "third_party/base/notreached.h"
#include "third_party/base/span.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/crt/cfgas_decimal.h"
#include "xfa/fgas/crt/locale_iface.h"
@@ -4273,7 +4273,7 @@
int32_t CXFA_Node::CountSelectedItems() {
std::vector<WideString> wsValueArray = GetSelectedItemsValue();
if (IsListBox() || !IsChoiceListAllowTextEntry())
- return pdfium::CollectionSize<int32_t>(wsValueArray);
+ return fxcrt::CollectionSize<int32_t>(wsValueArray);
int32_t iSelected = 0;
std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
@@ -4286,7 +4286,7 @@
int32_t CXFA_Node::GetSelectedItem(int32_t nIndex) {
std::vector<WideString> wsValueArray = GetSelectedItemsValue();
- if (!pdfium::IndexInBounds(wsValueArray, nIndex))
+ if (!fxcrt::IndexInBounds(wsValueArray, nIndex))
return -1;
std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
@@ -4319,7 +4319,7 @@
bool CXFA_Node::GetItemState(int32_t nIndex) {
std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
- return pdfium::IndexInBounds(wsSaveTextArray, nIndex) &&
+ return fxcrt::IndexInBounds(wsSaveTextArray, nIndex) &&
pdfium::Contains(GetSelectedItemsValue(), wsSaveTextArray[nIndex]);
}
@@ -4329,7 +4329,7 @@
bool bScriptModify,
bool bSyncData) {
std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
- if (!pdfium::IndexInBounds(wsSaveTextArray, nIndex))
+ if (!fxcrt::IndexInBounds(wsSaveTextArray, nIndex))
return;
int32_t iSel = -1;
@@ -4377,7 +4377,7 @@
bool bScriptModify,
bool bSyncData) {
WideString wsValue;
- int32_t iSize = pdfium::CollectionSize<int32_t>(iSelArray);
+ int32_t iSize = fxcrt::CollectionSize<int32_t>(iSelArray);
if (iSize >= 1) {
std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true);
WideString wsItemValue;
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index b0ea770..6141841 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -13,13 +13,13 @@
#include "core/fxcrt/cfx_widetextbuf.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/xml/cfx_xmlchardata.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "core/fxcrt/xml/cfx_xmltext.h"
#include "fxjs/xfa/cjx_object.h"
#include "third_party/base/check.h"
-#include "third_party/base/stl_util.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
@@ -225,7 +225,7 @@
buf << "<";
buf << bodyTagName;
buf << " xmlns=\"\"\n>";
- for (int32_t i = 0; i < pdfium::CollectionSize<int32_t>(wsSelTextArray);
+ for (int32_t i = 0; i < fxcrt::CollectionSize<int32_t>(wsSelTextArray);
i++) {
buf << "<value\n>";
buf << ExportEncodeContent(wsSelTextArray[i]);