Add some missing const to pdf417.
Change-Id: Ie5dbcca051f664049ea2d0a90d2898ca975adc99
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74274
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
index 7955d34..3e712ae 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
@@ -36,8 +36,7 @@
CBC_BarcodeMatrix::toBitArray() {
std::vector<uint8_t, FxAllocAllocator<uint8_t>> bitArray(m_width * m_height);
for (size_t i = 0; i < m_height; ++i) {
- std::vector<uint8_t, FxAllocAllocator<uint8_t>>& bytearray =
- m_matrix[i]->getRow();
+ const auto& bytearray = m_matrix[i]->getRow();
for (size_t j = 0; j < m_width; ++j)
bitArray[i * m_width + j] = bytearray[j];
}
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
index bb5b17e..1202d17 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
@@ -33,7 +33,3 @@
std::fill_n(m_row.begin() + m_currentLocation, width, black ? 1 : 0);
m_currentLocation += width;
}
-
-std::vector<uint8_t, FxAllocAllocator<uint8_t>>& CBC_BarcodeRow::getRow() {
- return m_row;
-}
diff --git a/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
index 4b7b6f0..e3bdb44 100644
--- a/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
+++ b/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
@@ -19,7 +19,9 @@
~CBC_BarcodeRow();
void addBar(bool black, int32_t width);
- std::vector<uint8_t, FxAllocAllocator<uint8_t>>& getRow();
+ const std::vector<uint8_t, FxAllocAllocator<uint8_t>>& getRow() const {
+ return m_row;
+ }
private:
std::vector<uint8_t, FxAllocAllocator<uint8_t>> m_row;