summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn3
-rw-r--r--core/fpdfapi/edit/cpdf_objectstream.h40
-rw-r--r--core/fpdfapi/edit/cpdf_xrefstream.h (renamed from core/fpdfapi/edit/editint.h)39
-rw-r--r--core/fpdfapi/edit/fpdf_edit_create.cpp14
4 files changed, 55 insertions, 41 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 73d339fa6f..adf318e234 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -436,9 +436,10 @@ static_library("fpdfapi") {
"core/fpdfapi/cpdf_pagerendercontext.cpp",
"core/fpdfapi/cpdf_pagerendercontext.h",
"core/fpdfapi/edit/cpdf_creator.h",
+ "core/fpdfapi/edit/cpdf_objectstream.h",
"core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp",
"core/fpdfapi/edit/cpdf_pagecontentgenerator.h",
- "core/fpdfapi/edit/editint.h",
+ "core/fpdfapi/edit/cpdf_xrefstream.h",
"core/fpdfapi/edit/fpdf_edit_create.cpp",
"core/fpdfapi/font/cpdf_cidfont.cpp",
"core/fpdfapi/font/cpdf_cidfont.h",
diff --git a/core/fpdfapi/edit/cpdf_objectstream.h b/core/fpdfapi/edit/cpdf_objectstream.h
new file mode 100644
index 0000000000..3e5c5a72a9
--- /dev/null
+++ b/core/fpdfapi/edit/cpdf_objectstream.h
@@ -0,0 +1,40 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_EDIT_CPDF_OBJECTSTREAM_H_
+#define CORE_FPDFAPI_EDIT_CPDF_OBJECTSTREAM_H_
+
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+
+class CPDF_Creator;
+class CPDF_Object;
+
+class CPDF_ObjectStream {
+ public:
+ struct Item {
+ uint32_t objnum;
+ FX_STRSIZE offset;
+ };
+
+ CPDF_ObjectStream();
+ ~CPDF_ObjectStream();
+
+ void Start();
+ FX_FILESIZE End(CPDF_Creator* pCreator);
+ void CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj);
+ void CompressIndirectObject(uint32_t dwObjNum,
+ const uint8_t* pBuffer,
+ uint32_t dwSize);
+
+ std::vector<Item> m_Items;
+ CFX_ByteTextBuf m_Buffer;
+ uint32_t m_dwObjNum;
+ int32_t m_index;
+};
+
+#endif // CORE_FPDFAPI_EDIT_CPDF_OBJECTSTREAM_H_
diff --git a/core/fpdfapi/edit/editint.h b/core/fpdfapi/edit/cpdf_xrefstream.h
index 881c2cca36..cb11261f9f 100644
--- a/core/fpdfapi/edit/editint.h
+++ b/core/fpdfapi/edit/cpdf_xrefstream.h
@@ -1,44 +1,17 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FPDFAPI_EDIT_EDITINT_H_
-#define CORE_FPDFAPI_EDIT_EDITINT_H_
+#ifndef CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_
+#define CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_
#include <vector>
-#include "core/fxcrt/fx_basic.h"
-#include "core/fxcrt/fx_stream.h"
-#include "core/fxcrt/fx_system.h"
-
class CPDF_Creator;
class CPDF_Object;
-class CPDF_ObjectStream {
- public:
- struct Item {
- uint32_t objnum;
- FX_STRSIZE offset;
- };
-
- CPDF_ObjectStream();
- ~CPDF_ObjectStream();
-
- void Start();
- FX_FILESIZE End(CPDF_Creator* pCreator);
- void CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj);
- void CompressIndirectObject(uint32_t dwObjNum,
- const uint8_t* pBuffer,
- uint32_t dwSize);
-
- std::vector<Item> m_Items;
- CFX_ByteTextBuf m_Buffer;
- uint32_t m_dwObjNum;
- int32_t m_index;
-};
-
class CPDF_XRefStream {
public:
struct Index {
@@ -57,7 +30,7 @@ class CPDF_XRefStream {
const uint8_t* pBuffer,
uint32_t dwSize,
CPDF_Creator* pCreator);
- bool End(CPDF_Creator* pCreator, bool bEOF = false);
+ bool End(CPDF_Creator* pCreator, bool bEOF);
void AddObjectNumberToIndexArray(uint32_t objnum);
bool EndXRefStream(CPDF_Creator* pCreator);
@@ -66,7 +39,7 @@ class CPDF_XRefStream {
uint32_t m_dwTempObjNum;
protected:
- int32_t EndObjectStream(CPDF_Creator* pCreator, bool bEOF = true);
+ int32_t EndObjectStream(CPDF_Creator* pCreator, bool bEOF);
bool GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF);
size_t m_iSeg;
@@ -74,4 +47,4 @@ class CPDF_XRefStream {
CFX_ByteTextBuf m_Buffer;
};
-#endif // CORE_FPDFAPI_EDIT_EDITINT_H_
+#endif // CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp
index ecae681eb0..42fe13d4e9 100644
--- a/core/fpdfapi/edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/edit/fpdf_edit_create.cpp
@@ -4,12 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fpdfapi/edit/editint.h"
-
#include <memory>
#include <vector>
#include "core/fpdfapi/edit/cpdf_creator.h"
+#include "core/fpdfapi/edit/cpdf_objectstream.h"
+#include "core/fpdfapi/edit/cpdf_xrefstream.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_crypto_handler.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
@@ -420,7 +420,7 @@ int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum,
m_ObjStream.m_Buffer.GetLength() < kObjectStreamMaxLength) {
return 1;
}
- return EndObjectStream(pCreator);
+ return EndObjectStream(pCreator, true);
}
int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum,
@@ -436,7 +436,7 @@ int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum,
m_ObjStream.m_Buffer.GetLength() < kObjectStreamMaxLength) {
return 1;
}
- return EndObjectStream(pCreator);
+ return EndObjectStream(pCreator, true);
}
int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, bool bEOF) {
@@ -728,7 +728,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) {
return -1;
if (!IsXRefNeedEnd())
return 0;
- if (!m_pXRefStream->End(this))
+ if (!m_pXRefStream->End(this, false))
return -1;
if (!m_pXRefStream->Start())
return -1;
@@ -747,7 +747,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(uint32_t objnum,
return iRet;
if (!IsXRefNeedEnd())
return 0;
- if (!m_pXRefStream->End(this))
+ if (!m_pXRefStream->End(this, false))
return -1;
if (!m_pXRefStream->Start())
return -1;
@@ -761,7 +761,7 @@ int32_t CPDF_Creator::AppendObjectNumberToXRef(uint32_t objnum) {
m_pXRefStream->AddObjectNumberToIndexArray(objnum);
if (!IsXRefNeedEnd())
return 0;
- if (!m_pXRefStream->End(this))
+ if (!m_pXRefStream->End(this, false))
return -1;
if (!m_pXRefStream->Start())
return -1;