summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp8
-rw-r--r--core/fpdfapi/parser/cfdf_document.h5
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp3
3 files changed, 9 insertions, 7 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;
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 55b9f7cc44..b9256aac35 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -79,8 +79,7 @@ bool IsFormFieldTypeXFA(FormFieldType fieldType) {
#endif // PDF_ENABLE_XFA
bool FDFToURLEncodedData(std::vector<uint8_t>* pBuffer) {
- std::unique_ptr<CFDF_Document> pFDF =
- CFDF_Document::ParseMemory(pBuffer->data(), pBuffer->size());
+ std::unique_ptr<CFDF_Document> pFDF = CFDF_Document::ParseMemory(*pBuffer);
if (!pFDF)
return true;