From 812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 13 Mar 2017 16:43:37 -0400 Subject: Replace FX_CHAR and FX_WCHAR with underlying types. Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxbarcode/oned/BC_OneDimWriter.cpp | 2 +- xfa/fxbarcode/oned/BC_OneDimWriter.h | 2 +- xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 28 +++++++-------- xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h | 10 +++--- xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp | 4 +-- xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp | 55 ++++++++++++++--------------- xfa/fxbarcode/oned/BC_OnedCode39Writer.h | 2 +- xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp | 2 +- xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | 2 +- xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | 2 +- 10 files changed, 54 insertions(+), 55 deletions(-) (limited to 'xfa/fxbarcode/oned') diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index bc0d61fd25..dd7fcaa864 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -83,7 +83,7 @@ void CBC_OneDimWriter::SetFontColor(FX_ARGB color) { m_fontColor = color; } -FX_WCHAR CBC_OneDimWriter::Upper(FX_WCHAR ch) { +wchar_t CBC_OneDimWriter::Upper(wchar_t ch) { if (ch >= 'a' && ch <= 'z') { ch = ch - ('a' - 'A'); } diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h index e37d774341..b7c5cebe06 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h @@ -96,7 +96,7 @@ class CBC_OneDimWriter : public CBC_Writer { int32_t startColor, int32_t& e); - FX_WCHAR Upper(FX_WCHAR ch); + wchar_t Upper(wchar_t ch); bool m_bPrintChecksum; int32_t m_iDataLenth; diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 399e5e7d40..7d51fa8f94 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -28,17 +28,17 @@ namespace { -const FX_CHAR ALPHABET_STRING[] = "0123456789-$:/.+ABCDTN"; +const char ALPHABET_STRING[] = "0123456789-$:/.+ABCDTN"; const int32_t CHARACTER_ENCODINGS[22] = { 0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E, 0x01A, 0x029}; -const FX_CHAR START_END_CHARS[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E', - 'a', 'b', 'c', 'd', 't', 'n', 'e'}; -const FX_CHAR CONTENT_CHARS[] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', '-', '$', '/', ':', '+', '.'}; +const char START_END_CHARS[] = {'A', 'B', 'C', 'D', 'T', 'N', '*', 'E', + 'a', 'b', 'c', 'd', 't', 'n', 'e'}; +const char CONTENT_CHARS[] = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', '-', '$', '/', ':', '+', '.'}; } // namespace @@ -48,7 +48,7 @@ CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() { m_iWideNarrRatio = 2; } CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {} -bool CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { +bool CBC_OnedCodaBarWriter::SetStartChar(char start) { for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == start) { m_chStart = start; @@ -58,7 +58,7 @@ bool CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { return false; } -bool CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) { +bool CBC_OnedCodaBarWriter::SetEndChar(char end) { for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == end) { m_chEnd = end; @@ -84,22 +84,22 @@ bool CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) { m_iWideNarrRatio = ratio; return true; } -bool CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, bool isContent) { +bool CBC_OnedCodaBarWriter::FindChar(wchar_t ch, bool isContent) { if (isContent) { for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { - if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { + if (ch == (wchar_t)CONTENT_CHARS[i]) { return true; } } for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) { - if (ch == (FX_WCHAR)START_END_CHARS[j]) { + if (ch == (wchar_t)START_END_CHARS[j]) { return true; } } return false; } else { for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { - if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { + if (ch == (wchar_t)CONTENT_CHARS[i]) { return true; } } @@ -108,7 +108,7 @@ bool CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, bool isContent) { } bool CBC_OnedCodaBarWriter::CheckContentValidity( const CFX_WideStringC& contents) { - FX_WCHAR ch; + wchar_t ch; int32_t index = 0; for (index = 0; index < contents.GetLength(); index++) { ch = contents.GetAt(index); @@ -123,7 +123,7 @@ bool CBC_OnedCodaBarWriter::CheckContentValidity( CFX_WideString CBC_OnedCodaBarWriter::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t index = 0; index < contents.GetLength(); index++) { ch = contents.GetAt(index); if (ch > 175) { @@ -170,7 +170,7 @@ uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, CFX_ByteString data = m_chStart + contents + m_chEnd; m_iContentLen = data.GetLength(); uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength()); - FX_CHAR ch; + char ch; int32_t position = 0; for (int32_t index = 0; index < data.GetLength(); index++) { ch = data.GetAt(index); diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h index 301c34a751..0d01ad9242 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h @@ -37,11 +37,11 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter { void SetDataLength(int32_t length) override; virtual CFX_WideString encodedContents(const CFX_WideStringC& contents); - virtual bool SetStartChar(FX_CHAR start); - virtual bool SetEndChar(FX_CHAR end); + virtual bool SetStartChar(char start); + virtual bool SetEndChar(char end); virtual bool SetTextLocation(BC_TEXT_LOC location); virtual bool SetWideNarrowRatio(int32_t ratio); - virtual bool FindChar(FX_WCHAR ch, bool isContent); + virtual bool FindChar(wchar_t ch, bool isContent); private: void RenderResult(const CFX_WideStringC& contents, @@ -50,8 +50,8 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter { bool isDevice, int32_t& e) override; - FX_CHAR m_chStart; - FX_CHAR m_chEnd; + char m_chStart; + char m_chEnd; int32_t m_iWideNarrRatio; }; diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index f163b18663..c1e28a50c1 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -102,7 +102,7 @@ bool CBC_OnedCode128Writer::CheckContentValidity( CFX_WideString CBC_OnedCode128Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filterChineseChar; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { @@ -253,7 +253,7 @@ int32_t CBC_OnedCode128Writer::Encode128C( checkSum += CODE_START_C * checkWeight; while (position < contents.GetLength()) { int32_t patternIndex = 0; - FX_CHAR ch = contents.GetAt(position); + char ch = contents.GetAt(position); if (ch < '0' || ch > '9') { patternIndex = (int32_t)ch; position++; diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp index a1ba5c8086..bd0607d3cd 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -27,10 +27,9 @@ namespace { -const FX_CHAR ALPHABET_STRING[] = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; +const char ALPHABET_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; -const FX_CHAR CHECKSUM_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; +const char CHECKSUM_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; const int32_t CHARACTER_ENCODINGS[44] = { 0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, @@ -48,12 +47,12 @@ CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {} bool CBC_OnedCode39Writer::CheckContentValidity( const CFX_WideStringC& contents) { for (int32_t i = 0; i < contents.GetLength(); i++) { - FX_WCHAR ch = contents.GetAt(i); - if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || - (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || ch == (FX_WCHAR)'-' || - ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' || - ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' || - ch == (FX_WCHAR)'%') { + wchar_t ch = contents.GetAt(i); + if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') || + (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || ch == (wchar_t)'-' || + ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' || + ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' || + ch == (wchar_t)'%') { continue; } return false; @@ -65,8 +64,8 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; for (int32_t i = 0; i < contents.GetLength(); i++) { - FX_WCHAR ch = contents.GetAt(i); - if (ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1)) { + wchar_t ch = contents.GetAt(i); + if (ch == (wchar_t)'*' && (i == 0 || i == contents.GetLength() - 1)) { continue; } if (ch > 175) { @@ -75,11 +74,11 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents( } else { ch = Upper(ch); } - if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || - (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || ch == (FX_WCHAR)'-' || - ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' || - ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' || - ch == (FX_WCHAR)'%') { + if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') || + (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || ch == (wchar_t)'-' || + ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' || + ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' || + ch == (wchar_t)'%') { filtercontents += ch; } } @@ -90,20 +89,20 @@ CFX_WideString CBC_OnedCode39Writer::RenderTextContents( const CFX_WideStringC& contents) { CFX_WideString renderContents; for (int32_t i = 0; i < contents.GetLength(); i++) { - FX_WCHAR ch = contents.GetAt(i); - if (ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1)) { + wchar_t ch = contents.GetAt(i); + if (ch == (wchar_t)'*' && (i == 0 || i == contents.GetLength() - 1)) { continue; } if (ch > 175) { i++; continue; } - if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || - (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z') || - (ch >= (FX_WCHAR)'a' && ch <= (FX_WCHAR)'z') || ch == (FX_WCHAR)'-' || - ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*' || - ch == (FX_WCHAR)'$' || ch == (FX_WCHAR)'/' || ch == (FX_WCHAR)'+' || - ch == (FX_WCHAR)'%') { + if ((ch >= (wchar_t)'0' && ch <= (wchar_t)'9') || + (ch >= (wchar_t)'A' && ch <= (wchar_t)'Z') || + (ch >= (wchar_t)'a' && ch <= (wchar_t)'z') || ch == (wchar_t)'-' || + ch == (wchar_t)'.' || ch == (wchar_t)' ' || ch == (wchar_t)'*' || + ch == (wchar_t)'$' || ch == (wchar_t)'/' || ch == (wchar_t)'+' || + ch == (wchar_t)'%') { renderContents += ch; } } @@ -155,8 +154,8 @@ void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t* toReturn) { toReturn[i] = (a & (1 << i)) == 0 ? 1 : m_iWideNarrRatio; } } -FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents, - int32_t& e) { +char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents, + int32_t& e) { int32_t length = contents.GetLength(); if (length > 80) { e = BCExceptionContentsLengthShouldBetween1and80; @@ -187,7 +186,7 @@ FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents, uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& outlength, int32_t& e) { - FX_CHAR checksum = CalcCheckSum(contents, e); + char checksum = CalcCheckSum(contents, e); if (checksum == '*') { return nullptr; } @@ -263,7 +262,7 @@ CFX_WideString CBC_OnedCode39Writer::encodedContents( if (m_bCalcChecksum && m_bPrintChecksum) { CFX_WideString checksumContent = FilterContents(contents); CFX_ByteString str = checksumContent.UTF8Encode(); - FX_CHAR checksum; + char checksum; checksum = CalcCheckSum(str, e); if (e != BCExceptionNO) return CFX_WideString(); diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.h b/xfa/fxbarcode/oned/BC_OnedCode39Writer.h index c8755a3e69..5f7c294c2b 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.h +++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.h @@ -46,7 +46,7 @@ class CBC_OnedCode39Writer : public CBC_OneDimWriter { private: void ToIntArray(int32_t a, int32_t* toReturn); - FX_CHAR CalcCheckSum(const CFX_ByteString& contents, int32_t& e); + char CalcCheckSum(const CFX_ByteString& contents, int32_t& e); int32_t m_iWideNarrRatio; }; diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index bcbc80a61d..47e47eaddb 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -62,7 +62,7 @@ bool CBC_OnedEAN13Writer::CheckContentValidity( CFX_WideString CBC_OnedEAN13Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index c40223818f..cd21759a19 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -65,7 +65,7 @@ bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) { CFX_WideString CBC_OnedEAN8Writer::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 6d6e79637c..3cb72f204a 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -50,7 +50,7 @@ bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) { CFX_WideString CBC_OnedUPCAWriter::FilterContents( const CFX_WideStringC& contents) { CFX_WideString filtercontents; - FX_WCHAR ch; + wchar_t ch; for (int32_t i = 0; i < contents.GetLength(); i++) { ch = contents.GetAt(i); if (ch > 175) { -- cgit v1.2.3