summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_object.h1
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.cpp4
4 files changed, 7 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index 0d0c02f28d..1aec3e06f3 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -161,7 +161,7 @@ void CPDF_Array::ConvertToIndirectObjectAt(size_t i,
void CPDF_Array::SetAt(size_t i, CPDF_Object* pObj) {
ASSERT(IsArray());
- CHECK(!pObj || pObj->GetObjNum() == 0);
+ CHECK(!pObj || pObj->IsInline());
if (i >= m_Objects.size()) {
ASSERT(false);
return;
@@ -174,7 +174,7 @@ void CPDF_Array::SetAt(size_t i, CPDF_Object* pObj) {
void CPDF_Array::InsertAt(size_t index, CPDF_Object* pObj) {
ASSERT(IsArray());
- CHECK(!pObj || pObj->GetObjNum() == 0);
+ CHECK(!pObj || pObj->IsInline());
if (index >= m_Objects.size()) {
// Allocate space first.
m_Objects.resize(index + 1, nullptr);
@@ -187,7 +187,7 @@ void CPDF_Array::InsertAt(size_t index, CPDF_Object* pObj) {
void CPDF_Array::Add(CPDF_Object* pObj) {
ASSERT(IsArray());
- CHECK(!pObj || pObj->GetObjNum() == 0);
+ CHECK(!pObj || pObj->IsInline());
m_Objects.push_back(pObj);
}
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index 2aa5248be0..aab7422b3c 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -174,7 +174,7 @@ bool CPDF_Dictionary::IsSignatureDict() const {
}
void CPDF_Dictionary::SetFor(const CFX_ByteString& key, CPDF_Object* pObj) {
- CHECK(!pObj || pObj->GetObjNum() == 0);
+ CHECK(!pObj || pObj->IsInline());
auto it = m_Map.find(key);
if (it == m_Map.end()) {
if (pObj)
diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h
index e2c30b96ca..3cf23188a7 100644
--- a/core/fpdfapi/parser/cpdf_object.h
+++ b/core/fpdfapi/parser/cpdf_object.h
@@ -41,6 +41,7 @@ class CPDF_Object {
virtual Type GetType() const = 0;
uint32_t GetObjNum() const { return m_ObjNum; }
uint32_t GetGenNum() const { return m_GenNum; }
+ bool IsInline() const { return m_ObjNum == 0; }
// Create a deep copy of the object.
virtual CPDF_Object* Clone() const = 0;
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 10fac7fa1c..7b9ead4005 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -179,7 +179,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
buf << "[";
for (size_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetObjectAt(i);
- if (pElement && pElement->GetObjNum()) {
+ if (pElement && !pElement->IsInline()) {
buf << " " << pElement->GetObjNum() << " 0 R";
} else {
buf << pElement;
@@ -195,7 +195,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
const CFX_ByteString& key = it.first;
CPDF_Object* pValue = it.second;
buf << "/" << PDF_NameEncode(key);
- if (pValue && pValue->GetObjNum()) {
+ if (pValue && !pValue->IsInline()) {
buf << " " << pValue->GetObjNum() << " 0 R ";
} else {
buf << pValue;