Delete XFA barcode char encoding code
The call stack starting in //xfa eventually calls down to
CBC_Writer::SetCharEncoding(), which sets `m_CharEncoding`. But no code
reads `m_CharEncoding`.
Change-Id: I257421ef72f2e942b537ebaeef5188e649be59f2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/122611
Reviewed-by: Tom Sepez <tsepez@google.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxbarcode/BC_Library.h b/fxbarcode/BC_Library.h
index 81d5a88..004aac4 100644
--- a/fxbarcode/BC_Library.h
+++ b/fxbarcode/BC_Library.h
@@ -17,11 +17,6 @@
kBelowEmbed,
};
-enum class BC_CHAR_ENCODING : uint8_t {
- kUTF8 = 0,
- kUnicode,
-};
-
enum class BC_TYPE : int8_t {
kUnknown = -1,
kCode39 = 0,
diff --git a/fxbarcode/BC_Writer.cpp b/fxbarcode/BC_Writer.cpp
index 48d02bb..ed53989 100644
--- a/fxbarcode/BC_Writer.cpp
+++ b/fxbarcode/BC_Writer.cpp
@@ -10,10 +10,6 @@
CBC_Writer::~CBC_Writer() = default;
-void CBC_Writer::SetCharEncoding(BC_CHAR_ENCODING encoding) {
- m_CharEncoding = encoding;
-}
-
bool CBC_Writer::SetModuleHeight(int32_t moduleHeight) {
if (moduleHeight > 10 || moduleHeight < 1)
return false;
diff --git a/fxbarcode/BC_Writer.h b/fxbarcode/BC_Writer.h
index 7bf6e18..a951dbb 100644
--- a/fxbarcode/BC_Writer.h
+++ b/fxbarcode/BC_Writer.h
@@ -15,7 +15,6 @@
CBC_Writer();
virtual ~CBC_Writer();
- void SetCharEncoding(BC_CHAR_ENCODING encoding);
bool SetModuleHeight(int32_t moduleHeight);
bool SetModuleWidth(int32_t moduleWidth);
void SetHeight(int32_t height);
@@ -35,7 +34,6 @@
int32_t m_ModuleWidth = 1;
int32_t m_Height = 320;
int32_t m_Width = 640;
- BC_CHAR_ENCODING m_CharEncoding = BC_CHAR_ENCODING::kUTF8;
};
#endif // FXBARCODE_BC_WRITER_H_
diff --git a/fxbarcode/cbc_codebase.cpp b/fxbarcode/cbc_codebase.cpp
index 78403c7..865531d 100644
--- a/fxbarcode/cbc_codebase.cpp
+++ b/fxbarcode/cbc_codebase.cpp
@@ -50,10 +50,6 @@
return m_pBCWriter->SetErrorCorrectionLevel(level);
}
-void CBC_CodeBase::SetCharEncoding(BC_CHAR_ENCODING encoding) {
- m_pBCWriter->SetCharEncoding(encoding);
-}
-
bool CBC_CodeBase::SetModuleHeight(int32_t moduleHeight) {
return m_pBCWriter->SetModuleHeight(moduleHeight);
}
diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h
index 250cbf3..363cdf8 100644
--- a/fxbarcode/cbc_codebase.h
+++ b/fxbarcode/cbc_codebase.h
@@ -34,7 +34,6 @@
bool SetStartChar(char start);
bool SetEndChar(char end);
bool SetErrorCorrectionLevel(int32_t level);
- void SetCharEncoding(BC_CHAR_ENCODING encoding);
bool SetModuleHeight(int32_t moduleHeight);
bool SetModuleWidth(int32_t moduleWidth);
void SetHeight(int32_t height);
diff --git a/fxbarcode/cfx_barcode.cpp b/fxbarcode/cfx_barcode.cpp
index e77f3e2..b97df4a 100644
--- a/fxbarcode/cfx_barcode.cpp
+++ b/fxbarcode/cfx_barcode.cpp
@@ -69,11 +69,6 @@
return m_pBCEngine ? m_pBCEngine->GetType() : BC_TYPE::kUnknown;
}
-void CFX_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) {
- if (m_pBCEngine)
- m_pBCEngine->SetCharEncoding(encoding);
-}
-
bool CFX_Barcode::SetModuleHeight(int32_t moduleHeight) {
return m_pBCEngine && m_pBCEngine->SetModuleHeight(moduleHeight);
}
diff --git a/fxbarcode/cfx_barcode.h b/fxbarcode/cfx_barcode.h
index dda54e9..7f2cbae 100644
--- a/fxbarcode/cfx_barcode.h
+++ b/fxbarcode/cfx_barcode.h
@@ -30,7 +30,6 @@
bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix& matrix);
- void SetCharEncoding(BC_CHAR_ENCODING encoding);
bool SetModuleHeight(int32_t moduleHeight);
bool SetModuleWidth(int32_t moduleWidth);
void SetHeight(int32_t height);
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp
index 1802c7f..76ace0e 100644
--- a/xfa/fwl/cfwl_barcode.cpp
+++ b/xfa/fwl/cfwl_barcode.cpp
@@ -90,10 +90,6 @@
CFWL_Edit::OnProcessEvent(pEvent);
}
-void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) {
- m_eCharEncoding = encoding;
-}
-
void CFWL_Barcode::SetModuleHeight(int32_t height) {
m_nModuleHeight = height;
}
@@ -154,8 +150,6 @@
m_pBarcodeEngine->SetFontColor(pTheme->GetTextColor(part));
m_pBarcodeEngine->SetHeight(int32_t(GetRTClient().height));
m_pBarcodeEngine->SetWidth(int32_t(GetRTClient().width));
- if (m_eCharEncoding.has_value())
- m_pBarcodeEngine->SetCharEncoding(m_eCharEncoding.value());
if (m_nModuleHeight.has_value())
m_pBarcodeEngine->SetModuleHeight(m_nModuleHeight.value());
if (m_nModuleWidth.has_value())
diff --git a/xfa/fwl/cfwl_barcode.h b/xfa/fwl/cfwl_barcode.h
index eb89003..e20a154 100644
--- a/xfa/fwl/cfwl_barcode.h
+++ b/xfa/fwl/cfwl_barcode.h
@@ -36,7 +36,6 @@
void SetType(BC_TYPE type);
bool IsProtectedType() const;
- void SetCharEncoding(BC_CHAR_ENCODING encoding);
void SetModuleHeight(int32_t height);
void SetModuleWidth(int32_t width);
void SetDataLength(int32_t dataLength);
@@ -63,7 +62,6 @@
BC_TYPE m_type = BC_TYPE::kUnknown;
Status m_eStatus = Status::kNormal;
std::optional<BC_TEXT_LOC> m_eTextLocation;
- std::optional<BC_CHAR_ENCODING> m_eCharEncoding;
std::optional<bool> m_bCalChecksum;
std::optional<bool> m_bPrintChecksum;
std::optional<char> m_cStartChar;
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index 176c77f..2cd8d37 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -93,17 +93,6 @@
{0xfb48155c, "code3Of9", BC_TYPE::kCode39},
};
-std::optional<BC_CHAR_ENCODING> CharEncodingFromString(
- const WideString& value) {
- if (value.EqualsASCIINoCase("UTF-16")) {
- return BC_CHAR_ENCODING::kUnicode;
- }
- if (value.EqualsASCIINoCase("UTF-8")) {
- return BC_CHAR_ENCODING::kUTF8;
- }
- return std::nullopt;
-}
-
std::optional<BC_TEXT_LOC> TextLocFromAttribute(XFA_AttributeValue value) {
switch (value) {
case XFA_AttributeValue::None:
@@ -200,14 +189,6 @@
auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(GetNormalWidget());
pBarCodeWidget->SetType(bc_type);
- std::optional<WideString> encoding_string = barcode_->GetCharEncoding();
- if (encoding_string.has_value()) {
- std::optional<BC_CHAR_ENCODING> encoding =
- CharEncodingFromString(encoding_string.value());
- if (encoding.has_value())
- pBarCodeWidget->SetCharEncoding(encoding.value());
- }
-
std::optional<bool> calcChecksum = barcode_->GetChecksum();
if (calcChecksum.has_value())
pBarCodeWidget->SetCalChecksum(calcChecksum.value());
diff --git a/xfa/fxfa/parser/cxfa_barcode.cpp b/xfa/fxfa/parser/cxfa_barcode.cpp
index ceb96e3..7aaf9c3 100644
--- a/xfa/fxfa/parser/cxfa_barcode.cpp
+++ b/xfa/fxfa/parser/cxfa_barcode.cpp
@@ -32,7 +32,6 @@
(void*)XFA_AttributeValue::UsCarrier},
{XFA_Attribute::Checksum, XFA_AttributeType::Enum,
(void*)XFA_AttributeValue::None},
- {XFA_Attribute::CharEncoding, XFA_AttributeType::CData, (void*)L"UTF-8"},
{XFA_Attribute::Usehref, XFA_AttributeType::CData, nullptr},
{XFA_Attribute::DataColumnCount, XFA_AttributeType::CData, nullptr},
{XFA_Attribute::RowColumnRatio, XFA_AttributeType::CData, nullptr},
@@ -71,10 +70,6 @@
return WideString(JSObject()->GetCData(XFA_Attribute::Type));
}
-std::optional<WideString> CXFA_Barcode::GetCharEncoding() {
- return JSObject()->TryCData(XFA_Attribute::CharEncoding, true);
-}
-
std::optional<bool> CXFA_Barcode::GetChecksum() {
std::optional<XFA_AttributeValue> checksum =
JSObject()->TryEnum(XFA_Attribute::Checksum, true);
diff --git a/xfa/fxfa/parser/cxfa_barcode.h b/xfa/fxfa/parser/cxfa_barcode.h
index 99b24ad..e492bdc 100644
--- a/xfa/fxfa/parser/cxfa_barcode.h
+++ b/xfa/fxfa/parser/cxfa_barcode.h
@@ -21,7 +21,6 @@
XFA_FFWidgetType GetDefaultFFWidgetType() const override;
WideString GetBarcodeType();
- std::optional<WideString> GetCharEncoding();
std::optional<bool> GetChecksum();
std::optional<int32_t> GetDataLength();
std::optional<char> GetStartChar();