summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cfdf_document.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-13 19:56:29 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-13 19:56:29 +0000
commit30029419ad4b9e5cd382767a8645677afbeff7fd (patch)
tree1b932ad14e5acf12aefdeeebac856ca8f5d89bfa /core/fpdfapi/parser/cfdf_document.cpp
parent1a99f200c59a89fe297ac79658d2fe11b13b1553 (diff)
downloadpdfium-30029419ad4b9e5cd382767a8645677afbeff7fd.tar.xz
Use CFX_ReadOnlyMemoryStream in more places.
More const pointers, less const_casts. BUG=pdfium:263 Change-Id: I47fc6d8f2f837390e40ad22d8b67946065294eaa Reviewed-on: https://pdfium-review.googlesource.com/39879 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cfdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index bfade94af6..cfed11b9cd 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -14,13 +14,12 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_syntax_parser.h"
#include "core/fpdfapi/parser/fpdf_parser_utility.h"
-#include "core/fxcrt/cfx_memorystream.h"
+#include "core/fxcrt/cfx_readonlymemorystream.h"
#include "third_party/base/ptr_util.h"
-CFDF_Document::CFDF_Document()
- : CPDF_IndirectObjectHolder(), m_pRootDict(nullptr) {}
+CFDF_Document::CFDF_Document() = default;
-CFDF_Document::~CFDF_Document() {}
+CFDF_Document::~CFDF_Document() = default;
std::unique_ptr<CFDF_Document> CFDF_Document::CreateNewDoc() {
auto pDoc = pdfium::MakeUnique<CFDF_Document>();
@@ -29,10 +28,10 @@ std::unique_ptr<CFDF_Document> CFDF_Document::CreateNewDoc() {
return pDoc;
}
-std::unique_ptr<CFDF_Document> CFDF_Document::ParseMemory(uint8_t* pData,
+std::unique_ptr<CFDF_Document> CFDF_Document::ParseMemory(const uint8_t* pData,
uint32_t size) {
auto pDoc = pdfium::MakeUnique<CFDF_Document>();
- pDoc->ParseStream(pdfium::MakeRetain<CFX_MemoryStream>(pData, size, false));
+ pDoc->ParseStream(pdfium::MakeRetain<CFX_ReadOnlyMemoryStream>(pData, size));
return pDoc->m_pRootDict ? std::move(pDoc) : nullptr;
}