summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorspace.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_array.h1
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp2
4 files changed, 4 insertions, 3 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index 9d3aeb2adc..759d0f37b5 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -355,7 +355,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) {
}
CPDF_Array* pArray = pObj->AsArray();
- if (!pArray || pArray->GetCount() == 0)
+ if (!pArray || pArray->IsEmpty())
return nullptr;
CPDF_Object* pFamilyObj = pArray->GetDirectObjectAt(0);
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 059679a8cd..f8d7575318 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -275,7 +275,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl(
}
CPDF_Array* pArray = pCSObj->AsArray();
- if (!pArray || pArray->GetCount() == 0)
+ if (!pArray || pArray->IsEmpty())
return nullptr;
if (pArray->GetCount() == 1) {
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
index 0629046d9e..9bb99da053 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
@@ -28,6 +28,7 @@ class CPDF_Array : public CPDF_Object {
CPDF_Array* AsArray() override;
const CPDF_Array* AsArray() const override;
+ bool IsEmpty() const { return m_Objects.empty(); }
size_t GetCount() const { return m_Objects.size(); }
CPDF_Object* GetObjectAt(size_t index) const;
CPDF_Object* GetDirectObjectAt(size_t index) const;
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 81d2178820..ac6c01bae2 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -887,7 +887,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
if (bSelected)
pArray->AddInteger(iOptIndex);
- if (pArray->GetCount() == 0)
+ if (pArray->IsEmpty())
m_pDict->RemoveAt("I");
}
if (bNotify)