Allow implicit convestion from FixedUninitDataVector<> to span<>
Change-Id: Iaf495bad02e5a41cdf090fdf9df989e0bc78e434
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98190
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/cfx_read_only_vector_stream.cpp b/core/fxcrt/cfx_read_only_vector_stream.cpp
index 2d370ce..f1d01ac 100644
--- a/core/fxcrt/cfx_read_only_vector_stream.cpp
+++ b/core/fxcrt/cfx_read_only_vector_stream.cpp
@@ -16,7 +16,7 @@
CFX_ReadOnlyVectorStream::CFX_ReadOnlyVectorStream(
FixedUninitDataVector<uint8_t> data)
: fixed_data_(std::move(data)),
- stream_(pdfium::MakeRetain<CFX_ReadOnlySpanStream>(fixed_data_.span())) {}
+ stream_(pdfium::MakeRetain<CFX_ReadOnlySpanStream>(fixed_data_)) {}
CFX_ReadOnlyVectorStream::~CFX_ReadOnlyVectorStream() = default;
diff --git a/core/fxcrt/fixed_uninit_data_vector.h b/core/fxcrt/fixed_uninit_data_vector.h
index c1544e1..de5e48b 100644
--- a/core/fxcrt/fixed_uninit_data_vector.h
+++ b/core/fxcrt/fixed_uninit_data_vector.h
@@ -40,6 +40,8 @@
}
~FixedUninitDataVector() = default;
+ operator pdfium::span<const T>() const { return span(); }
+
pdfium::span<T> writable_span() {
return pdfium::make_span(data_.get(), size_);
}
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index d936f16..418fc30 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -31,7 +31,7 @@
CONSTRUCT_VIA_MAKE_RETAIN;
~FontDesc() override;
- pdfium::span<const uint8_t> FontData() const { return m_pFontData.span(); }
+ pdfium::span<const uint8_t> FontData() const { return m_pFontData; }
void SetFace(size_t index, CFX_Face* face);
CFX_Face* GetFace(size_t index) const;