summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser')
-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;