diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-05-08 17:08:08 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-09 13:06:29 +0000 |
commit | f82efcc72fa16b145f101b38ea55d674278e32a1 (patch) | |
tree | 439e306aa39997fda46bf6252645f7ac1ab79b9f /core/fpdfapi/edit | |
parent | 3ba6010b63a97271f23ed921a58dc9298d2e74ef (diff) | |
download | pdfium-chromium/3095.tar.xz |
Remove editint.h and create individual headerschromium/3095
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>
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r-- | core/fpdfapi/edit/cpdf_objectstream.h | 40 | ||||
-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.cpp | 14 |
3 files changed, 53 insertions, 40 deletions
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; |