summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp28
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp10
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp9
3 files changed, 5 insertions, 42 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 24c4c2c29a..d386217f23 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -260,16 +260,8 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
const CPDF_Array* p = pObj->AsArray();
for (size_t i = 0; i < p->GetCount(); i++) {
- const CPDF_Object* pElement = p->GetObjectAt(i);
- if (!pElement->IsInline()) {
- if (!m_Archive->WriteString(" ") ||
- !m_Archive->WriteDWord(pElement->GetObjNum()) ||
- !m_Archive->WriteString(" 0 R")) {
- return false;
- }
- } else if (!WriteDirectObj(objnum, pElement, true)) {
+ if (!WriteDirectObj(objnum, p->GetObjectAt(i), true))
return false;
- }
}
if (!m_Archive->WriteString("]"))
return false;
@@ -298,15 +290,8 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
if (bSignDict && key == "Contents")
bSignValue = true;
- if (!pValue->IsInline()) {
- if (!m_Archive->WriteString(" ") ||
- !m_Archive->WriteDWord(pValue->GetObjNum()) ||
- !m_Archive->WriteString(" 0 R ")) {
- return false;
- }
- } else if (!WriteDirectObj(objnum, pValue, !bSignValue)) {
+ if (!WriteDirectObj(objnum, pValue, !bSignValue))
return false;
- }
}
if (!m_Archive->WriteString(">>"))
return false;
@@ -637,15 +622,8 @@ int32_t CPDF_Creator::WriteDoc_Stage4() {
!m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return -1;
}
- if (!pValue->IsInline()) {
- if (!m_Archive->WriteString(" ") ||
- !m_Archive->WriteDWord(pValue->GetObjNum()) ||
- !m_Archive->WriteString(" 0 R ")) {
- return -1;
- }
- } else if (!pValue->WriteTo(m_Archive.get())) {
+ if (!pValue->WriteTo(m_Archive.get()))
return -1;
- }
}
} else {
if (!m_Archive->WriteString("\r\n/Root ") ||
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index 4f802d9e7f..a5361fbbb9 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -235,16 +235,8 @@ bool CPDF_Array::WriteTo(IFX_ArchiveStream* archive) const {
return false;
for (size_t i = 0; i < GetCount(); ++i) {
- const CPDF_Object* pElement = GetObjectAt(i);
- if (!pElement->IsInline()) {
- if (!archive->WriteString(" ") ||
- !archive->WriteDWord(pElement->GetObjNum()) ||
- !archive->WriteString(" 0 R")) {
- return false;
- }
- } else if (!pElement->WriteTo(archive)) {
+ if (!GetObjectAt(i)->WriteTo(archive))
return false;
- }
}
return archive->WriteString("]");
}
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index ae7239efdf..c6127fa344 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -287,15 +287,8 @@ bool CPDF_Dictionary::WriteTo(IFX_ArchiveStream* archive) const {
return false;
}
- if (!pValue->IsInline()) {
- if (!archive->WriteString(" ") ||
- !archive->WriteDWord(pValue->GetObjNum()) ||
- !archive->WriteString(" 0 R")) {
- return false;
- }
- } else if (!pValue->WriteTo(archive)) {
+ if (!pValue->WriteTo(archive))
return false;
- }
}
return archive->WriteString(">>");
}