summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-13 22:50:02 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-13 22:50:02 +0000
commitf0260b2cccb9e6c59413a20040dccf5551fb6882 (patch)
tree7fcb8b5c36eb3e6a967860277a242c79015e6cba /core
parent2ee811f24c98ac3900a164118ab976be6c3c9bab (diff)
downloadpdfium-f0260b2cccb9e6c59413a20040dccf5551fb6882.tar.xz
Change CFDF_Document::ParseMemory() to use pdfium::span.
Change-Id: I1e9b02f0cb2628d41bc1c6bdcfcfa09c36faf97e Reviewed-on: https://pdfium-review.googlesource.com/39990 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp8
-rw-r--r--core/fpdfapi/parser/cfdf_document.h5
2 files changed, 8 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index cfed11b9cd..d37c8d5457 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -16,6 +16,7 @@
#include "core/fpdfapi/parser/fpdf_parser_utility.h"
#include "core/fxcrt/cfx_readonlymemorystream.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/span.h"
CFDF_Document::CFDF_Document() = default;
@@ -28,10 +29,11 @@ std::unique_ptr<CFDF_Document> CFDF_Document::CreateNewDoc() {
return pDoc;
}
-std::unique_ptr<CFDF_Document> CFDF_Document::ParseMemory(const uint8_t* pData,
- uint32_t size) {
+std::unique_ptr<CFDF_Document> CFDF_Document::ParseMemory(
+ pdfium::span<const uint8_t> span) {
auto pDoc = pdfium::MakeUnique<CFDF_Document>();
- pDoc->ParseStream(pdfium::MakeRetain<CFX_ReadOnlyMemoryStream>(pData, size));
+ pDoc->ParseStream(
+ pdfium::MakeRetain<CFX_ReadOnlyMemoryStream>(span.data(), span.size()));
return pDoc->m_pRootDict ? std::move(pDoc) : nullptr;
}
diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h
index c1c1b79636..6efaa4ce06 100644
--- a/core/fpdfapi/parser/cfdf_document.h
+++ b/core/fpdfapi/parser/cfdf_document.h
@@ -12,6 +12,7 @@
#include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
#include "core/fpdfapi/parser/cpdf_object.h"
#include "core/fxcrt/unowned_ptr.h"
+#include "third_party/base/span.h"
class CPDF_Dictionary;
class IFX_SeekableReadStream;
@@ -19,8 +20,8 @@ class IFX_SeekableReadStream;
class CFDF_Document : public CPDF_IndirectObjectHolder {
public:
static std::unique_ptr<CFDF_Document> CreateNewDoc();
- static std::unique_ptr<CFDF_Document> ParseMemory(const uint8_t* pData,
- uint32_t size);
+ static std::unique_ptr<CFDF_Document> ParseMemory(
+ pdfium::span<const uint8_t> span);
CFDF_Document();
~CFDF_Document() override;