summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_edit
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2015-10-26 16:54:39 -0400
committerDan Sinclair <dsinclair@chromium.org>2015-10-26 16:54:39 -0400
commitbf81c14cdb2b336a62f97119315f6bc43502e840 (patch)
treec9bc0f23a2cc60307b77a69851733ed85c87196f /core/src/fpdfapi/fpdf_edit
parent15ce59a0f34278b6b222675c77b25e3e0c50139f (diff)
downloadpdfium-bf81c14cdb2b336a62f97119315f6bc43502e840.tar.xz
Merge to XFA: Revert "Revert "Add type cast definitions for CPDF_Reference.""
This reverts commit 7e155865c90cc1115cc7193b7646a341d8f9093e. Add type cast definitions for CPDF_Reference. This Cl adds ToReference, CPDF_Object::AsReference and CPDF_Object::IsReference and updates the src to use them as needed. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1418923005 . (cherry picked from commit 6ee3484bcb413f4cce303e237fe15e2bdaf51ade) Review URL: https://codereview.chromium.org/1410073007 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_edit')
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 16124a3c38..fec4e4f8e1 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -61,16 +61,12 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
break;
}
case PDFOBJ_REFERENCE: {
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(FX_BSTRC(" ")) < 0)
return -1;
- }
- CPDF_Reference* p = (CPDF_Reference*)pObj;
- if ((len = pFile->AppendDWord(p->GetRefObjNum())) < 0) {
+ if ((len = pFile->AppendDWord(pObj->AsReference()->GetRefObjNum())) < 0)
return -1;
- }
- if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0) {
+ if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0)
return -1;
- }
offset += len + 6;
break;
}
@@ -1168,16 +1164,12 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
break;
}
case PDFOBJ_REFERENCE: {
- if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
+ if (m_File.AppendString(FX_BSTRC(" ")) < 0)
return -1;
- }
- CPDF_Reference* p = (CPDF_Reference*)pObj;
- if ((len = m_File.AppendDWord(p->GetRefObjNum())) < 0) {
+ if ((len = m_File.AppendDWord(pObj->AsReference()->GetRefObjNum())) < 0)
return -1;
- }
- if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) {
+ if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0)
return -1;
- }
m_Offset += len + 5;
break;
}