Give CBC_SymbolInfo methods Chromium-style names.
Also remove an unused method and an unused include.
Change-Id: I6e625f6d44672369d09e8b380a9521a8b8391f7e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/69155
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/fxbarcode/datamatrix/BC_Base256Encoder.cpp
index ea70f68..25c7458 100644
--- a/fxbarcode/datamatrix/BC_Base256Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_Base256Encoder.cpp
@@ -73,7 +73,7 @@
if (!context->UpdateSymbolInfo(currentSize))
return false;
- bool mustPad = (context->m_symbolInfo->dataCapacity() - currentSize) > 0;
+ bool mustPad = (context->m_symbolInfo->data_capacity() - currentSize) > 0;
if (context->hasMoreCharacters() || mustPad) {
if (dataCount <= 249) {
buffer.SetAt(0, static_cast<wchar_t>(dataCount));
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp
index 0ee471b..f380e6e 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -68,7 +68,7 @@
return false;
int32_t available =
- context->m_symbolInfo->dataCapacity() - curCodewordCount;
+ context->m_symbolInfo->data_capacity() - curCodewordCount;
if (!context->hasMoreCharacters()) {
if ((buffer.GetLength() % 3) == 2) {
if (available < 2 || available > 2) {
@@ -113,7 +113,7 @@
if (!context->UpdateSymbolInfo(curCodewordCount))
return false;
- int32_t available = context->m_symbolInfo->dataCapacity() - curCodewordCount;
+ int32_t available = context->m_symbolInfo->data_capacity() - curCodewordCount;
if (rest == 2) {
*buffer += (wchar_t)'\0';
while (buffer->GetLength() >= 3)
diff --git a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp
index 100d1fa..c4ddae1 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp
+++ b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp
@@ -36,6 +36,6 @@
CBC_DataMatrixSymbolInfo144::~CBC_DataMatrixSymbolInfo144() = default;
-size_t CBC_DataMatrixSymbolInfo144::getInterleavedBlockCount() const {
+size_t CBC_DataMatrixSymbolInfo144::GetInterleavedBlockCount() const {
return 10;
}
diff --git a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h
index 2f44557..b891d0a 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h
+++ b/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h
@@ -15,7 +15,7 @@
~CBC_DataMatrixSymbolInfo144() override;
// CBC_SymbolInfo:
- size_t getInterleavedBlockCount() const override;
+ size_t GetInterleavedBlockCount() const override;
};
#endif // FXBARCODE_DATAMATRIX_BC_DATAMATRIXSYMBOLINFO144_H_
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
index 16ec3a9..ac3e24c 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
@@ -49,20 +49,20 @@
std::unique_ptr<CBC_CommonByteMatrix> encodeLowLevel(
CBC_DefaultPlacement* placement,
const CBC_SymbolInfo* symbolInfo) {
- int32_t symbolWidth = symbolInfo->getSymbolDataWidth();
+ int32_t symbolWidth = symbolInfo->GetSymbolDataWidth();
ASSERT(symbolWidth);
- int32_t symbolHeight = symbolInfo->getSymbolDataHeight();
+ int32_t symbolHeight = symbolInfo->GetSymbolDataHeight();
ASSERT(symbolHeight);
- int32_t width = symbolInfo->getSymbolWidth();
+ int32_t width = symbolInfo->GetSymbolWidth();
ASSERT(width);
- int32_t height = symbolInfo->getSymbolHeight();
+ int32_t height = symbolInfo->GetSymbolHeight();
ASSERT(height);
auto matrix = pdfium::MakeUnique<CBC_CommonByteMatrix>(width, height);
int32_t matrixY = 0;
for (int32_t y = 0; y < symbolHeight; y++) {
int32_t matrixX;
- if ((y % symbolInfo->matrixHeight()) == 0) {
+ if ((y % symbolInfo->matrix_height()) == 0) {
matrixX = 0;
for (int32_t x = 0; x < width; x++) {
matrix->Set(matrixX, matrixY, x % 2 == 0);
@@ -72,19 +72,19 @@
}
matrixX = 0;
for (int32_t x = 0; x < symbolWidth; x++) {
- if (x % symbolInfo->matrixWidth() == 0) {
+ if (x % symbolInfo->matrix_width() == 0) {
matrix->Set(matrixX, matrixY, true);
matrixX++;
}
matrix->Set(matrixX, matrixY, placement->getBit(x, y));
matrixX++;
- if (x % symbolInfo->matrixWidth() == symbolInfo->matrixWidth() - 1) {
+ if (x % symbolInfo->matrix_width() == symbolInfo->matrix_width() - 1) {
matrix->Set(matrixX, matrixY, y % 2 == 0);
matrixX++;
}
}
matrixY++;
- if (y % symbolInfo->matrixHeight() == symbolInfo->matrixHeight() - 1) {
+ if (y % symbolInfo->matrix_height() == symbolInfo->matrix_height() - 1) {
matrixX = 0;
for (int32_t x = 0; x < width; x++) {
matrix->Set(matrixX, matrixY, true);
@@ -126,9 +126,9 @@
if (codewords.IsEmpty())
return results;
- int32_t width = pSymbolInfo->getSymbolDataWidth();
+ int32_t width = pSymbolInfo->GetSymbolDataWidth();
ASSERT(width);
- int32_t height = pSymbolInfo->getSymbolDataHeight();
+ int32_t height = pSymbolInfo->GetSymbolDataHeight();
ASSERT(height);
auto placement =
diff --git a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
index bd86a95..fc62210 100644
--- a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
@@ -62,7 +62,7 @@
return false;
int32_t available =
- context->m_symbolInfo->dataCapacity() - context->getCodewordCount();
+ context->m_symbolInfo->data_capacity() - context->getCodewordCount();
int32_t remaining = context->getRemainingCharacters();
if (remaining == 0 && available <= 2)
return true;
@@ -80,7 +80,7 @@
return false;
int32_t available =
- context->m_symbolInfo->dataCapacity() - context->getCodewordCount();
+ context->m_symbolInfo->data_capacity() - context->getCodewordCount();
if (available >= 3) {
restInAscii = false;
if (!context->UpdateSymbolInfo(context->getCodewordCount() +
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.cpp b/fxbarcode/datamatrix/BC_EncoderContext.cpp
index 3fbfee8..0217c56 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.cpp
+++ b/fxbarcode/datamatrix/BC_EncoderContext.cpp
@@ -24,6 +24,7 @@
#include <utility>
+#include "core/fxcrt/fx_string.h"
#include "fxbarcode/common/BC_CommonBitMatrix.h"
#include "fxbarcode/datamatrix/BC_Encoder.h"
#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
@@ -90,7 +91,7 @@
}
bool CBC_EncoderContext::UpdateSymbolInfo(size_t len) {
- if (!m_symbolInfo || len > m_symbolInfo->dataCapacity()) {
+ if (!m_symbolInfo || len > m_symbolInfo->data_capacity()) {
m_symbolInfo = CBC_SymbolInfo::Lookup(len, m_bAllowRectangular);
if (!m_symbolInfo)
return false;
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index 6d660c7..5758f7e 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -184,13 +184,13 @@
WideString CBC_ErrorCorrection::EncodeECC200(const WideString& codewords,
const CBC_SymbolInfo* symbolInfo) {
- if (codewords.GetLength() != symbolInfo->dataCapacity())
+ if (codewords.GetLength() != symbolInfo->data_capacity())
return WideString();
WideString sb = codewords;
- size_t blockCount = symbolInfo->getInterleavedBlockCount();
+ size_t blockCount = symbolInfo->GetInterleavedBlockCount();
if (blockCount == 1) {
- WideString ecc = CreateECCBlock(codewords, symbolInfo->errorCodewords());
+ WideString ecc = CreateECCBlock(codewords, symbolInfo->error_codewords());
if (ecc.IsEmpty())
return WideString();
sb += ecc;
@@ -199,8 +199,8 @@
std::vector<size_t> errorSizes(blockCount);
std::vector<size_t> startPos(blockCount);
for (size_t i = 0; i < blockCount; ++i) {
- dataSizes[i] = symbolInfo->getDataLengthForInterleavedBlock();
- errorSizes[i] = symbolInfo->getErrorLengthForInterleavedBlock();
+ dataSizes[i] = symbolInfo->GetDataLengthForInterleavedBlock();
+ errorSizes[i] = symbolInfo->GetErrorLengthForInterleavedBlock();
startPos[i] = i > 0 ? startPos[i - 1] + dataSizes[i] : 0;
}
@@ -212,9 +212,9 @@
for (size_t block = 0; block < blockCount; ++block) {
WideString temp;
- if (symbolInfo->dataCapacity() > block)
- temp.Reserve((symbolInfo->dataCapacity() - block / blockCount) + 1);
- for (size_t d = block; d < symbolInfo->dataCapacity(); d += blockCount)
+ if (symbolInfo->data_capacity() > block)
+ temp.Reserve((symbolInfo->data_capacity() - block / blockCount) + 1);
+ for (size_t d = block; d < symbolInfo->data_capacity(); d += blockCount)
temp.InsertAtBack(static_cast<wchar_t>(codewords[d]));
WideString ecc = CreateECCBlock(temp, errorSizes[block]);
@@ -223,7 +223,7 @@
for (size_t pos = 0, i = block; i < errorSizes[block] * blockCount;
++pos, i += blockCount) {
- sb.SetAt(symbolInfo->dataCapacity() + i, ecc[pos]);
+ sb.SetAt(symbolInfo->data_capacity() + i, ecc[pos]);
}
}
}
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index 9e389f8..39f2299 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -165,7 +165,7 @@
if (!context.UpdateSymbolInfo())
return WideString();
- size_t capacity = context.m_symbolInfo->dataCapacity();
+ size_t capacity = context.m_symbolInfo->data_capacity();
if (len < capacity) {
if (encodingMode != Encoding::ASCII && encodingMode != Encoding::BASE256)
context.writeCodeword(0x00fe);
diff --git a/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/fxbarcode/datamatrix/BC_SymbolInfo.cpp
index 7304aed..1b77f5f 100644
--- a/fxbarcode/datamatrix/BC_SymbolInfo.cpp
+++ b/fxbarcode/datamatrix/BC_SymbolInfo.cpp
@@ -85,13 +85,13 @@
if (symbol->is_rectangular() && !allow_rectangular)
continue;
- if (data_codewords <= symbol->dataCapacity())
+ if (data_codewords <= symbol->data_capacity())
return symbol;
}
return nullptr;
}
-int32_t CBC_SymbolInfo::getHorizontalDataRegions() const {
+int32_t CBC_SymbolInfo::GetHorizontalDataRegions() const {
switch (data_->data_regions) {
case 1:
return 1;
@@ -109,7 +109,7 @@
}
}
-int32_t CBC_SymbolInfo::getVerticalDataRegions() const {
+int32_t CBC_SymbolInfo::GetVerticalDataRegions() const {
switch (data_->data_regions) {
case 1:
return 1;
@@ -127,34 +127,30 @@
}
}
-int32_t CBC_SymbolInfo::getSymbolDataWidth() const {
- return getHorizontalDataRegions() * data_->matrix_width;
+int32_t CBC_SymbolInfo::GetSymbolDataWidth() const {
+ return GetHorizontalDataRegions() * data_->matrix_width;
}
-int32_t CBC_SymbolInfo::getSymbolDataHeight() const {
- return getVerticalDataRegions() * data_->matrix_height;
+int32_t CBC_SymbolInfo::GetSymbolDataHeight() const {
+ return GetVerticalDataRegions() * data_->matrix_height;
}
-int32_t CBC_SymbolInfo::getSymbolWidth() const {
- return getSymbolDataWidth() + (getHorizontalDataRegions() * 2);
+int32_t CBC_SymbolInfo::GetSymbolWidth() const {
+ return GetSymbolDataWidth() + (GetHorizontalDataRegions() * 2);
}
-int32_t CBC_SymbolInfo::getSymbolHeight() const {
- return getSymbolDataHeight() + (getVerticalDataRegions() * 2);
+int32_t CBC_SymbolInfo::GetSymbolHeight() const {
+ return GetSymbolDataHeight() + (GetVerticalDataRegions() * 2);
}
-size_t CBC_SymbolInfo::getCodewordCount() const {
- return data_->data_capacity + data_->error_codewords;
-}
-
-size_t CBC_SymbolInfo::getInterleavedBlockCount() const {
+size_t CBC_SymbolInfo::GetInterleavedBlockCount() const {
return data_->data_capacity / data_->rs_block_data;
}
-size_t CBC_SymbolInfo::getDataLengthForInterleavedBlock() const {
+size_t CBC_SymbolInfo::GetDataLengthForInterleavedBlock() const {
return data_->rs_block_data;
}
-size_t CBC_SymbolInfo::getErrorLengthForInterleavedBlock() const {
+size_t CBC_SymbolInfo::GetErrorLengthForInterleavedBlock() const {
return data_->rs_block_error;
}
diff --git a/fxbarcode/datamatrix/BC_SymbolInfo.h b/fxbarcode/datamatrix/BC_SymbolInfo.h
index 97b09e1..77a14c9 100644
--- a/fxbarcode/datamatrix/BC_SymbolInfo.h
+++ b/fxbarcode/datamatrix/BC_SymbolInfo.h
@@ -7,7 +7,6 @@
#ifndef FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
#define FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_
-#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
class CBC_SymbolInfo {
@@ -29,26 +28,25 @@
static const CBC_SymbolInfo* Lookup(size_t data_codewords,
bool allow_rectangular);
- int32_t getSymbolDataWidth() const;
- int32_t getSymbolDataHeight() const;
- int32_t getSymbolWidth() const;
- int32_t getSymbolHeight() const;
- size_t getCodewordCount() const;
- virtual size_t getInterleavedBlockCount() const;
- size_t getDataLengthForInterleavedBlock() const;
- size_t getErrorLengthForInterleavedBlock() const;
+ int32_t GetSymbolDataWidth() const;
+ int32_t GetSymbolDataHeight() const;
+ int32_t GetSymbolWidth() const;
+ int32_t GetSymbolHeight() const;
+ virtual size_t GetInterleavedBlockCount() const;
+ size_t GetDataLengthForInterleavedBlock() const;
+ size_t GetErrorLengthForInterleavedBlock() const;
- size_t dataCapacity() const { return data_->data_capacity; }
- size_t errorCodewords() const { return data_->error_codewords; }
- int32_t matrixWidth() const { return data_->matrix_width; }
- int32_t matrixHeight() const { return data_->matrix_height; }
+ size_t data_capacity() const { return data_->data_capacity; }
+ size_t error_codewords() const { return data_->error_codewords; }
+ int32_t matrix_width() const { return data_->matrix_width; }
+ int32_t matrix_height() const { return data_->matrix_height; }
protected:
explicit CBC_SymbolInfo(const Data* data);
private:
- int32_t getHorizontalDataRegions() const;
- int32_t getVerticalDataRegions() const;
+ int32_t GetHorizontalDataRegions() const;
+ int32_t GetVerticalDataRegions() const;
bool is_rectangular() const {
return data_->matrix_width != data_->matrix_height;
}
diff --git a/fxbarcode/datamatrix/BC_X12Encoder.cpp b/fxbarcode/datamatrix/BC_X12Encoder.cpp
index 6dba27b..5901324 100644
--- a/fxbarcode/datamatrix/BC_X12Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_X12Encoder.cpp
@@ -67,7 +67,7 @@
return false;
int32_t available =
- context->m_symbolInfo->dataCapacity() - context->getCodewordCount();
+ context->m_symbolInfo->data_capacity() - context->getCodewordCount();
size_t count = buffer->GetLength();
if (count == 2) {
context->writeCodeword(CBC_HighLevelEncoder::X12_UNLATCH);