Use span<> arguments in FAXModule and CJPX_Decoder.
Preferable to passing a const-ref vector of a specific allocator type.
Change-Id: I8cc5cb8cfd4b0f39e405585b789a099b9c9d9fd2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62632
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/fax/faxmodule.cpp b/core/fxcodec/fax/faxmodule.cpp
index d8df9e1..da39918 100644
--- a/core/fxcodec/fax/faxmodule.cpp
+++ b/core/fxcodec/fax/faxmodule.cpp
@@ -87,7 +87,7 @@
return max_pos;
}
-void FaxG4FindB1B2(const std::vector<uint8_t>& ref_buf,
+void FaxG4FindB1B2(pdfium::span<const uint8_t> ref_buf,
int columns,
int a0,
bool a0color,
@@ -284,7 +284,7 @@
int bitsize,
int* bitpos,
uint8_t* dest_buf,
- const std::vector<uint8_t>& ref_buf,
+ pdfium::span<const uint8_t> ref_buf,
int columns) {
int a0 = -1;
bool a0color = true;
diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp
index f865d38..4653b5e 100644
--- a/core/fxcodec/jpx/cjpx_decoder.cpp
+++ b/core/fxcodec/jpx/cjpx_decoder.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <limits>
#include <utility>
+#include <vector>
#include "core/fxcodec/jpx/jpx_decode_utils.h"
#include "core/fxcrt/fx_safe_types.h"
@@ -498,7 +499,7 @@
bool CJPX_Decoder::Decode(uint8_t* dest_buf,
uint32_t pitch,
- const std::vector<uint8_t>& offsets) {
+ pdfium::span<const uint8_t> offsets) {
if (m_Image->comps[0].w != m_Image->x1 || m_Image->comps[0].h != m_Image->y1)
return false;
diff --git a/core/fxcodec/jpx/cjpx_decoder.h b/core/fxcodec/jpx/cjpx_decoder.h
index 11d94c1..1fe5043 100644
--- a/core/fxcodec/jpx/cjpx_decoder.h
+++ b/core/fxcodec/jpx/cjpx_decoder.h
@@ -8,7 +8,6 @@
#define CORE_FXCODEC_JPX_CJPX_DECODER_H_
#include <memory>
-#include <vector>
#include "core/fxcrt/unowned_ptr.h"
#include "third_party/base/span.h"
@@ -41,7 +40,7 @@
bool StartDecode();
bool Decode(uint8_t* dest_buf,
uint32_t pitch,
- const std::vector<uint8_t>& offsets);
+ pdfium::span<const uint8_t> offsets);
private:
const ColorSpaceOption m_ColorSpaceOption;