Remove editint.h and create individual headers
This Cl creates a cpdf_objectstream and cpdf_xrefstream headers from the
editint header.
Change-Id: I857981fa055ee9296cbd344860e55c67acf200ce
Reviewed-on: https://pdfium-review.googlesource.com/5113
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 73d339f..adf318e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -436,9 +436,10 @@
"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 0000000..3e5c5a7
--- /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/cpdf_xrefstream.h b/core/fpdfapi/edit/cpdf_xrefstream.h
new file mode 100644
index 0000000..cb11261
--- /dev/null
+++ b/core/fpdfapi/edit/cpdf_xrefstream.h
@@ -0,0 +1,50 @@
+// 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_XREFSTREAM_H_
+#define CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_
+
+#include <vector>
+
+class CPDF_Creator;
+class CPDF_Object;
+
+class CPDF_XRefStream {
+ public:
+ struct Index {
+ uint32_t objnum;
+ uint32_t count;
+ };
+
+ CPDF_XRefStream();
+ ~CPDF_XRefStream();
+
+ bool Start();
+ int32_t CompressIndirectObject(uint32_t dwObjNum,
+ const CPDF_Object* pObj,
+ CPDF_Creator* pCreator);
+ int32_t CompressIndirectObject(uint32_t dwObjNum,
+ const uint8_t* pBuffer,
+ uint32_t dwSize,
+ CPDF_Creator* pCreator);
+ bool End(CPDF_Creator* pCreator, bool bEOF);
+ void AddObjectNumberToIndexArray(uint32_t objnum);
+ bool EndXRefStream(CPDF_Creator* pCreator);
+
+ std::vector<Index> m_IndexArray;
+ FX_FILESIZE m_PrevOffset;
+ uint32_t m_dwTempObjNum;
+
+ protected:
+ int32_t EndObjectStream(CPDF_Creator* pCreator, bool bEOF);
+ bool GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF);
+
+ size_t m_iSeg;
+ CPDF_ObjectStream m_ObjStream;
+ CFX_ByteTextBuf m_Buffer;
+};
+
+#endif // CORE_FPDFAPI_EDIT_CPDF_XREFSTREAM_H_
diff --git a/core/fpdfapi/edit/editint.h b/core/fpdfapi/edit/editint.h
deleted file mode 100644
index 881c2cc..0000000
--- a/core/fpdfapi/edit/editint.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 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_
-
-#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 {
- uint32_t objnum;
- uint32_t count;
- };
-
- CPDF_XRefStream();
- ~CPDF_XRefStream();
-
- bool Start();
- int32_t CompressIndirectObject(uint32_t dwObjNum,
- const CPDF_Object* pObj,
- CPDF_Creator* pCreator);
- int32_t CompressIndirectObject(uint32_t dwObjNum,
- const uint8_t* pBuffer,
- uint32_t dwSize,
- CPDF_Creator* pCreator);
- bool End(CPDF_Creator* pCreator, bool bEOF = false);
- void AddObjectNumberToIndexArray(uint32_t objnum);
- bool EndXRefStream(CPDF_Creator* pCreator);
-
- std::vector<Index> m_IndexArray;
- FX_FILESIZE m_PrevOffset;
- uint32_t m_dwTempObjNum;
-
- protected:
- int32_t EndObjectStream(CPDF_Creator* pCreator, bool bEOF = true);
- bool GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF);
-
- size_t m_iSeg;
- CPDF_ObjectStream m_ObjStream;
- CFX_ByteTextBuf m_Buffer;
-};
-
-#endif // CORE_FPDFAPI_EDIT_EDITINT_H_
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp
index ecae681..42fe13d 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 @@
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 @@
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 @@
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 @@
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 @@
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;