Remove fxcrt::CollectionSize() usage in CFX_FontMapper::GetFaceSize().
Return size_t instead, and use size_t consistently in related code.
Change-Id: I6c9c2d8ed4f226f2e4ed24c39da6c8c4a9511173
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/86350
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Hui Yingst <nigi@chromium.org>
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index ad7f291..5e894b1 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -689,8 +689,8 @@
return face;
}
-int CFX_FontMapper::GetFaceSize() const {
- return fxcrt::CollectionSize<int>(m_FaceArray);
+size_t CFX_FontMapper::GetFaceSize() const {
+ return m_FaceArray.size();
}
bool CFX_FontMapper::HasInstalledFont(ByteStringView name) const {
@@ -731,7 +731,7 @@
#ifdef PDF_ENABLE_XFA
std::unique_ptr<uint8_t, FxFreeDeleter> CFX_FontMapper::RawBytesForIndex(
- uint32_t index,
+ size_t index,
size_t* returned_length) {
if (!m_pFontInfo)
return nullptr;
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index e40b662..4622145 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -69,8 +69,8 @@
CFX_SubstFont* pSubstFont);
bool IsBuiltinFace(const RetainPtr<CFX_Face>& face) const;
- int GetFaceSize() const;
- ByteString GetFaceName(int index) const { return m_FaceArray[index].name; }
+ size_t GetFaceSize() const;
+ ByteString GetFaceName(size_t index) const { return m_FaceArray[index].name; }
bool HasInstalledFont(ByteStringView name) const;
bool HasLocalizedFont(ByteStringView name) const;
@@ -83,7 +83,7 @@
#ifdef PDF_ENABLE_XFA
std::unique_ptr<uint8_t, FxFreeDeleter> RawBytesForIndex(
- uint32_t index,
+ size_t index,
size_t* returned_length);
#endif // PDF_ENABLE_XFA
diff --git a/core/fxge/fx_font_unittest.cpp b/core/fxge/fx_font_unittest.cpp
index 107fa8e..9de3d56 100644
--- a/core/fxge/fx_font_unittest.cpp
+++ b/core/fxge/fx_font_unittest.cpp
@@ -52,6 +52,6 @@
ASSERT_TRUE(folder_font_info.EnumFontList(&font_mapper));
}
- ASSERT_EQ(1, font_mapper.GetFaceSize());
+ ASSERT_EQ(1u, font_mapper.GetFaceSize());
ASSERT_EQ("Test", font_mapper.GetFaceName(0));
}
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index b126030..8af8e70 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -441,7 +441,7 @@
}
RetainPtr<IFX_SeekableReadStream> CreateFontStream(CFX_FontMapper* pFontMapper,
- uint32_t index) {
+ size_t index) {
size_t dwFileSize = 0;
std::unique_ptr<uint8_t, FxFreeDeleter> pBuffer =
pFontMapper->RawBytesForIndex(index, &dwFileSize);
@@ -457,7 +457,7 @@
CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper();
pFontMapper->LoadInstalledFonts();
- for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) {
+ for (size_t i = 0; i < pFontMapper->GetFaceSize(); ++i) {
if (pFontMapper->GetFaceName(i) == bsFaceName)
return CreateFontStream(pFontMapper, i);
}
@@ -614,7 +614,7 @@
CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper();
pFontMapper->LoadInstalledFonts();
- for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) {
+ for (size_t i = 0; i < pFontMapper->GetFaceSize(); ++i) {
RetainPtr<IFX_SeekableReadStream> pFontStream =
CreateFontStream(pFontMapper, i);
if (!pFontStream)