Pass span<> arguments in fxbarcode/.
Preferable to a const-ref vector of a specific allocator type.
Change-Id: I749b54aa1b0187c8b9983f9f4849410a37a02866
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62574
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxbarcode/BC_TwoDimWriter.cpp b/fxbarcode/BC_TwoDimWriter.cpp
index d31c59c..61d2b55 100644
--- a/fxbarcode/BC_TwoDimWriter.cpp
+++ b/fxbarcode/BC_TwoDimWriter.cpp
@@ -21,7 +21,7 @@
CBC_TwoDimWriter::~CBC_TwoDimWriter() = default;
-bool CBC_TwoDimWriter::RenderResult(const std::vector<uint8_t>& code,
+bool CBC_TwoDimWriter::RenderResult(pdfium::span<const uint8_t> code,
int32_t codeWidth,
int32_t codeHeight) {
if (code.empty())
diff --git a/fxbarcode/BC_TwoDimWriter.h b/fxbarcode/BC_TwoDimWriter.h
index 91f5ac7..a887ded 100644
--- a/fxbarcode/BC_TwoDimWriter.h
+++ b/fxbarcode/BC_TwoDimWriter.h
@@ -8,10 +8,10 @@
#define FXBARCODE_BC_TWODIMWRITER_H_
#include <memory>
-#include <vector>
#include "core/fxcrt/fx_coordinates.h"
#include "fxbarcode/BC_Writer.h"
+#include "third_party/base/span.h"
class CBC_CommonBitMatrix;
class CFX_RenderDevice;
@@ -21,7 +21,7 @@
explicit CBC_TwoDimWriter(bool bFixedSize);
~CBC_TwoDimWriter() override;
- bool RenderResult(const std::vector<uint8_t>& code,
+ bool RenderResult(pdfium::span<const uint8_t> code,
int32_t codeWidth,
int32_t codeHeight);
void RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix);
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index 995d4d8..2cee833 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -251,7 +251,7 @@
return submode;
}
-void CBC_PDF417HighLevelEncoder::EncodeBinary(const std::vector<uint8_t>& bytes,
+void CBC_PDF417HighLevelEncoder::EncodeBinary(pdfium::span<const uint8_t> bytes,
size_t startpos,
size_t count,
EncodingMode startmode,
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
index 32c3f2d..df1cd54 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
@@ -11,8 +11,8 @@
#include "core/fxcrt/fx_string.h"
#include "fxbarcode/pdf417/BC_PDF417.h"
-
#include "third_party/base/optional.h"
+#include "third_party/base/span.h"
class CBC_PDF417HighLevelEncoder {
public:
@@ -31,7 +31,7 @@
size_t count,
SubMode initialSubmode,
WideString* sb);
- static void EncodeBinary(const std::vector<uint8_t>& bytes,
+ static void EncodeBinary(pdfium::span<const uint8_t> bytes,
size_t startpos,
size_t count,
EncodingMode startmode,
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 2ecd3b8..be02f5b 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -224,7 +224,7 @@
return false;
}
-std::vector<uint8_t> GenerateECBytes(const std::vector<uint8_t>& dataBytes,
+std::vector<uint8_t> GenerateECBytes(pdfium::span<const uint8_t> dataBytes,
size_t numEcBytesInBlock) {
// If |numEcBytesInBlock| is 0, the encoder will fail anyway.
ASSERT(numEcBytesInBlock > 0);