Remove height out-parameter from 1D barcode encoding methods.
1D barcodes don't need a second dimension.
Change-Id: Ia38873c2a203c59d1a56188cb0f03c72c7ae670a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100850
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxbarcode/cbc_codabar.cpp b/fxbarcode/cbc_codabar.cpp
index 0b00604..beb126f 100644
--- a/fxbarcode/cbc_codabar.cpp
+++ b/fxbarcode/cbc_codabar.cpp
@@ -39,11 +39,10 @@
BC_TYPE format = BC_TYPE::kCodabar;
int32_t outWidth = 0;
- int32_t outHeight = 0;
m_renderContents = pWriter->FilterContents(contents);
ByteString byteString = m_renderContents.ToUTF8();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(byteString, format, outWidth, outHeight));
+ pWriter->Encode(byteString, format, outWidth));
return data && pWriter->RenderResult(m_renderContents.AsStringView(),
data.get(), outWidth);
}
diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp
index 900a47c..f84ee82 100644
--- a/fxbarcode/cbc_code128.cpp
+++ b/fxbarcode/cbc_code128.cpp
@@ -39,7 +39,6 @@
BC_TYPE format = BC_TYPE::kCode128;
int32_t outWidth = 0;
- int32_t outHeight = 0;
WideString content(contents);
if (contents.GetLength() % 2 && pWriter->GetType() == BC_TYPE::kCode128C)
content += '0';
@@ -47,7 +46,7 @@
m_renderContents = pWriter->FilterContents(content.AsStringView());
ByteString byteString = m_renderContents.ToUTF8();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(byteString, format, outWidth, outHeight));
+ pWriter->Encode(byteString, format, outWidth));
return data && pWriter->RenderResult(m_renderContents.AsStringView(),
data.get(), outWidth);
}
diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp
index d5ed8bb..7939404 100644
--- a/fxbarcode/cbc_code39.cpp
+++ b/fxbarcode/cbc_code39.cpp
@@ -39,12 +39,11 @@
BC_TYPE format = BC_TYPE::kCode39;
int32_t outWidth = 0;
- int32_t outHeight = 0;
WideString filtercontents = pWriter->FilterContents(contents);
m_renderContents = pWriter->RenderTextContents(contents);
ByteString byteString = filtercontents.ToUTF8();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(byteString, format, outWidth, outHeight));
+ pWriter->Encode(byteString, format, outWidth));
return data && pWriter->RenderResult(m_renderContents.AsStringView(),
data.get(), outWidth);
}
diff --git a/fxbarcode/cbc_eancode.cpp b/fxbarcode/cbc_eancode.cpp
index cb20388..81d22df 100644
--- a/fxbarcode/cbc_eancode.cpp
+++ b/fxbarcode/cbc_eancode.cpp
@@ -28,12 +28,11 @@
BC_TYPE format = GetType();
int32_t out_width = 0;
- int32_t out_height = 0;
m_renderContents = Preprocess(contents);
ByteString str = m_renderContents.ToUTF8();
pWriter->InitEANWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(str, format, out_width, out_height));
+ pWriter->Encode(str, format, out_width));
return data && pWriter->RenderResult(m_renderContents.AsStringView(),
data.get(), out_width);
}
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index ee51b57..df9f088 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -88,17 +88,14 @@
uint8_t* CBC_OneDimWriter::EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) {
- outHeight = 1;
return EncodeImpl(contents, outWidth);
}
uint8_t* CBC_OneDimWriter::Encode(const ByteString& contents,
BC_TYPE format,
- int32_t& outWidth,
- int32_t& outHeight) {
- return EncodeWithHint(contents, format, outWidth, outHeight, 0);
+ int32_t& outWidth) {
+ return EncodeWithHint(contents, format, outWidth, 0);
}
int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target,
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index f9cad12..a8a3486 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -49,8 +49,7 @@
uint8_t* Encode(const ByteString& contents,
BC_TYPE format,
- int32_t& outWidth,
- int32_t& outHeight);
+ int32_t& outWidth);
bool RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix& matrix,
WideStringView contents);
@@ -60,7 +59,6 @@
virtual uint8_t* EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints);
virtual uint8_t* EncodeImpl(const ByteString& contents,
int32_t& outLength) = 0;
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index ca72c43..57c28be 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -123,13 +123,11 @@
uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) {
if (format != BC_TYPE::kCodabar)
return nullptr;
- return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, outHeight,
- hints);
+ return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, hints);
}
uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const ByteString& contents,
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h
index 46f1d1c..a0ee62f 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -23,7 +23,6 @@
uint8_t* EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) override;
bool RenderResult(WideStringView contents,
uint8_t* code,
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter_unittest.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter_unittest.cpp
index 615c48c..eb1cad0 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter_unittest.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter_unittest.cpp
@@ -21,10 +21,8 @@
TEST(OnedCodaBarWriterTest, Encode) {
CBC_OnedCodaBarWriter writer;
int32_t width;
- int32_t height;
- uint8_t* encoded = writer.Encode("", BC_TYPE::kCodabar, width, height);
- EXPECT_EQ(1, height);
+ uint8_t* encoded = writer.Encode("", BC_TYPE::kCodabar, width);
EXPECT_EQ(kModulesForDelimiters, width);
const char* expected =
"# ## # # " // A Start
@@ -34,8 +32,7 @@
}
FX_Free(encoded);
- encoded = writer.Encode("123", BC_TYPE::kCodabar, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("123", BC_TYPE::kCodabar, width);
EXPECT_EQ(kModulesForDelimiters + 3 * kModulesPerNumber, width);
expected =
"# ## # # " // A Start
@@ -48,8 +45,7 @@
}
FX_Free(encoded);
- encoded = writer.Encode("-$./:+", BC_TYPE::kCodabar, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("-$./:+", BC_TYPE::kCodabar, width);
EXPECT_EQ(kModulesForDelimiters + 2 * kModulesPerNumber +
4 * kModulesPerPunctuation,
width);
@@ -67,9 +63,7 @@
}
FX_Free(encoded);
- encoded =
- writer.Encode("456.987987987/001", BC_TYPE::kCodabar, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("456.987987987/001", BC_TYPE::kCodabar, width);
EXPECT_EQ(kModulesForDelimiters + 15 * kModulesPerNumber +
2 * kModulesPerPunctuation,
width);
@@ -102,7 +96,6 @@
TEST(OnedCodaBarWriterTest, SetDelimiters) {
CBC_OnedCodaBarWriter writer;
int32_t width;
- int32_t height;
EXPECT_TRUE(writer.SetStartChar('A'));
EXPECT_TRUE(writer.SetStartChar('B'));
@@ -133,8 +126,7 @@
writer.SetStartChar('N');
writer.SetEndChar('*');
- uint8_t* encoded = writer.Encode("987", BC_TYPE::kCodabar, width, height);
- EXPECT_EQ(1, height);
+ uint8_t* encoded = writer.Encode("987", BC_TYPE::kCodabar, width);
EXPECT_EQ(kModulesForDelimiters + 3 * kModulesPerNumber, width);
const char* expected =
"# # # ## " // N (same as B) Start
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp
index e7ddd3a..2fc3488 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -121,13 +121,11 @@
uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) {
if (format != BC_TYPE::kCode128)
return nullptr;
- return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, outHeight,
- hints);
+ return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, hints);
}
uint8_t* CBC_OnedCode128Writer::EncodeImpl(const ByteString& contents,
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.h b/fxbarcode/oned/BC_OnedCode128Writer.h
index 6ed2cd3..169a157 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.h
+++ b/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -30,7 +30,6 @@
uint8_t* EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) override;
uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
bool CheckContentValidity(WideStringView contents) override;
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp
index daae1f7..1b2fb24 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -122,13 +122,11 @@
uint8_t* CBC_OnedCode39Writer::EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) {
if (format != BC_TYPE::kCode39)
return nullptr;
- return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, outHeight,
- hints);
+ return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, hints);
}
void CBC_OnedCode39Writer::ToIntArray(int16_t a, int8_t* toReturn) {
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h
index ccd8fc3..c44f2dd 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.h
+++ b/fxbarcode/oned/BC_OnedCode39Writer.h
@@ -19,7 +19,6 @@
uint8_t* EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) override;
uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
bool RenderResult(WideStringView contents,
diff --git a/fxbarcode/oned/BC_OnedCode39Writer_unittest.cpp b/fxbarcode/oned/BC_OnedCode39Writer_unittest.cpp
index b151af6..44c3e62 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer_unittest.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer_unittest.cpp
@@ -37,11 +37,10 @@
writer.SetWideNarrowRatio(3);
int32_t width;
- int32_t height;
uint8_t* encoded;
const char* expected;
- encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width, height);
+ encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width);
expected =
"# # ### ### # " // * Start
"# ### ### # # " // P
@@ -57,7 +56,7 @@
writer.SetWideNarrowRatio(2);
- encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width, height);
+ encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width);
expected =
"# # ## ## # " // * Start
"# ## ## # # " // P
@@ -75,12 +74,10 @@
TEST(OnedCode39WriterTest, Encode) {
CBC_OnedCode39Writer writer;
int32_t width;
- int32_t height;
uint8_t* encoded;
const char* expected;
- encoded = writer.Encode("", BC_TYPE::kCode39, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("", BC_TYPE::kCode39, width);
EXPECT_EQ((0 + DELIMITER_CHARS) * MODULES_PER_CHAR - 1, width);
expected =
"# # ### ### # " // * Start
@@ -89,8 +86,7 @@
EXPECT_EQ(expected[i] != ' ', !!encoded[i]) << i;
FX_Free(encoded);
- encoded = writer.Encode("123", BC_TYPE::kCode39, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("123", BC_TYPE::kCode39, width);
EXPECT_EQ((3 + DELIMITER_CHARS) * MODULES_PER_CHAR - 1, width);
expected =
"# # ### ### # " // * Start
@@ -102,8 +98,7 @@
EXPECT_EQ(expected[i] != ' ', !!encoded[i]) << i;
FX_Free(encoded);
- encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width);
EXPECT_EQ((6 + DELIMITER_CHARS) * MODULES_PER_CHAR - 1, width);
expected =
"# # ### ### # " // * Start
@@ -118,8 +113,7 @@
EXPECT_EQ(expected[i] != ' ', !!encoded[i]) << i;
FX_Free(encoded);
- encoded = writer.Encode("A -$%./+Z", BC_TYPE::kCode39, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("A -$%./+Z", BC_TYPE::kCode39, width);
EXPECT_EQ((9 + DELIMITER_CHARS) * MODULES_PER_CHAR - 1, width);
expected =
"# # ### ### # " // * Start
@@ -141,14 +135,12 @@
TEST(OnedCode39WriterTest, Checksum) {
CBC_OnedCode39Writer writer;
int32_t width;
- int32_t height;
uint8_t* encoded;
const char* expected;
writer.SetCalcChecksum(true);
- encoded = writer.Encode("123", BC_TYPE::kCode39, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("123", BC_TYPE::kCode39, width);
EXPECT_EQ((3 + CHECKSUM_CHARS + DELIMITER_CHARS) * MODULES_PER_CHAR - 1,
width);
expected =
@@ -162,8 +154,7 @@
EXPECT_EQ(expected[i] != ' ', !!encoded[i]) << i;
FX_Free(encoded);
- encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width, height);
- EXPECT_EQ(1, height);
+ encoded = writer.Encode("PDFIUM", BC_TYPE::kCode39, width);
EXPECT_EQ((6 + CHECKSUM_CHARS + DELIMITER_CHARS) * MODULES_PER_CHAR - 1,
width);
expected =
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 23ada14..0834941 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -88,13 +88,11 @@
uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) {
if (format != BC_TYPE::kEAN13)
return nullptr;
- return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, outHeight,
- hints);
+ return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, hints);
}
uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const ByteString& contents,
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.h b/fxbarcode/oned/BC_OnedEAN13Writer.h
index 68212ae..0a9f2ce 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.h
@@ -24,7 +24,6 @@
uint8_t* EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) override;
uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
bool CheckContentValidity(WideStringView contents) override;
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer_unittest.cpp b/fxbarcode/oned/BC_OnedEAN13Writer_unittest.cpp
index 98b015c..d7f1425 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer_unittest.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer_unittest.cpp
@@ -13,31 +13,29 @@
CBC_OnedEAN13Writer writer;
writer.InitEANWriter();
int32_t width;
- int32_t height;
uint8_t* encoded;
const char* expected;
// EAN-13 barcodes encode 13-digit numbers into 95 modules in a unidimensional
// disposition.
- encoded = writer.Encode("", BC_TYPE::kEAN13, width, height);
+ encoded = writer.Encode("", BC_TYPE::kEAN13, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("123", BC_TYPE::kEAN13, width, height);
+ encoded = writer.Encode("123", BC_TYPE::kEAN13, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("123456789012", BC_TYPE::kEAN13, width, height);
+ encoded = writer.Encode("123456789012", BC_TYPE::kEAN13, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("12345678901234", BC_TYPE::kEAN13, width, height);
+ encoded = writer.Encode("12345678901234", BC_TYPE::kEAN13, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("1234567890128", BC_TYPE::kEAN13, width, height);
+ encoded = writer.Encode("1234567890128", BC_TYPE::kEAN13, width);
EXPECT_TRUE(encoded);
- EXPECT_EQ(1, height);
EXPECT_EQ(95, width);
expected =
@@ -62,9 +60,8 @@
}
FX_Free(encoded);
- encoded = writer.Encode("7776665554440", BC_TYPE::kEAN13, width, height);
+ encoded = writer.Encode("7776665554440", BC_TYPE::kEAN13, width);
EXPECT_TRUE(encoded);
- EXPECT_EQ(1, height);
EXPECT_EQ(95, width);
expected =
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index e53bd54..91d0420 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -91,13 +91,11 @@
uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) {
if (format != BC_TYPE::kEAN8)
return nullptr;
- return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, outHeight,
- hints);
+ return CBC_OneDimWriter::EncodeWithHint(contents, format, outWidth, hints);
}
uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const ByteString& contents,
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.h b/fxbarcode/oned/BC_OnedEAN8Writer.h
index 60b9724..9c3d751 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.h
@@ -25,7 +25,6 @@
uint8_t* EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) override;
uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
bool CheckContentValidity(WideStringView contents) override;
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer_unittest.cpp b/fxbarcode/oned/BC_OnedEAN8Writer_unittest.cpp
index 839fe6e..18bc605 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer_unittest.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer_unittest.cpp
@@ -13,31 +13,29 @@
CBC_OnedEAN8Writer writer;
writer.InitEANWriter();
int32_t width;
- int32_t height;
uint8_t* encoded;
const char* expected;
// EAN-8 barcodes encode 8-digit numbers into 67 modules in a unidimensional
// disposition.
- encoded = writer.Encode("", BC_TYPE::kEAN8, width, height);
+ encoded = writer.Encode("", BC_TYPE::kEAN8, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("123", BC_TYPE::kEAN8, width, height);
+ encoded = writer.Encode("123", BC_TYPE::kEAN8, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("1234567", BC_TYPE::kEAN8, width, height);
+ encoded = writer.Encode("1234567", BC_TYPE::kEAN8, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("123456789", BC_TYPE::kEAN8, width, height);
+ encoded = writer.Encode("123456789", BC_TYPE::kEAN8, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("12345670", BC_TYPE::kEAN8, width, height);
+ encoded = writer.Encode("12345670", BC_TYPE::kEAN8, width);
EXPECT_TRUE(encoded);
- EXPECT_EQ(1, height);
EXPECT_EQ(67, width);
expected =
@@ -57,9 +55,8 @@
}
FX_Free(encoded);
- encoded = writer.Encode("99441104", BC_TYPE::kEAN8, width, height);
+ encoded = writer.Encode("99441104", BC_TYPE::kEAN8, width);
EXPECT_TRUE(encoded);
- EXPECT_EQ(1, height);
EXPECT_EQ(67, width);
expected =
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 99fb011..bff5db1 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -87,7 +87,6 @@
uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) {
if (format != BC_TYPE::kUPCA)
return nullptr;
@@ -95,7 +94,7 @@
ByteString toEAN13String = '0' + contents;
m_iDataLenth = 13;
return m_subWriter->EncodeWithHint(toEAN13String, BC_TYPE::kEAN13, outWidth,
- outHeight, hints);
+ hints);
}
uint8_t* CBC_OnedUPCAWriter::EncodeImpl(const ByteString& contents,
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.h b/fxbarcode/oned/BC_OnedUPCAWriter.h
index 1a79b54..aad574d 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.h
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.h
@@ -26,7 +26,6 @@
uint8_t* EncodeWithHint(const ByteString& contents,
BC_TYPE format,
int32_t& outWidth,
- int32_t& outHeight,
int32_t hints) override;
uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
bool CheckContentValidity(WideStringView contents) override;
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter_unittest.cpp b/fxbarcode/oned/BC_OnedUPCAWriter_unittest.cpp
index 5b92488..0088a69 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter_unittest.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter_unittest.cpp
@@ -13,27 +13,26 @@
CBC_OnedUPCAWriter writer;
writer.InitEANWriter();
int32_t width;
- int32_t height;
// UPCA barcodes encode 12-digit numbers into 95 modules in a unidimensional
// disposition.
- uint8_t* encoded = writer.Encode("", BC_TYPE::kUPCA, width, height);
+ uint8_t* encoded = writer.Encode("", BC_TYPE::kUPCA, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("123", BC_TYPE::kUPCA, width, height);
+ encoded = writer.Encode("123", BC_TYPE::kUPCA, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("12345678901", BC_TYPE::kUPCA, width, height);
+ encoded = writer.Encode("12345678901", BC_TYPE::kUPCA, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("1234567890123", BC_TYPE::kUPCA, width, height);
+ encoded = writer.Encode("1234567890123", BC_TYPE::kUPCA, width);
EXPECT_FALSE(encoded);
FX_Free(encoded);
- encoded = writer.Encode("123456789012", BC_TYPE::kUPCA, width, height);
+ encoded = writer.Encode("123456789012", BC_TYPE::kUPCA, width);
const char* expected =
"# #" // Start
" ## #" // 1 L
@@ -51,14 +50,13 @@
"## ## " // 2 R
"# #"; // End
EXPECT_TRUE(encoded);
- EXPECT_EQ(1, height);
EXPECT_EQ(static_cast<int32_t>(strlen(expected)), width);
for (size_t i = 0; i < strlen(expected); i++) {
EXPECT_EQ(expected[i] != ' ', !!encoded[i]) << i;
}
FX_Free(encoded);
- encoded = writer.Encode("777666555440", BC_TYPE::kUPCA, width, height);
+ encoded = writer.Encode("777666555440", BC_TYPE::kUPCA, width);
expected =
"# #" // Start
" ### ##" // 7 L
@@ -76,7 +74,6 @@
"### # " // 0 R
"# #"; // End
EXPECT_TRUE(encoded);
- EXPECT_EQ(1, height);
EXPECT_EQ(static_cast<int32_t>(strlen(expected)), width);
for (size_t i = 0; i < strlen(expected); i++) {
EXPECT_EQ(expected[i] != ' ', !!encoded[i]) << i;