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/datamatrix/BC_ASCIIEncoder.cpp | 19 ++++----- xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h | 4 +- xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp | 22 +++++----- xfa/fxbarcode/datamatrix/BC_Base256Encoder.h | 2 +- xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp | 46 ++++++++++---------- xfa/fxbarcode/datamatrix/BC_C40Encoder.h | 2 +- xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp | 24 +++++------ xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h | 2 +- xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp | 8 ++-- xfa/fxbarcode/datamatrix/BC_EncoderContext.h | 6 +-- xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp | 4 +- xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp | 54 ++++++++++++------------ xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h | 42 +++++++++--------- xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp | 42 +++++++++--------- xfa/fxbarcode/datamatrix/BC_TextEncoder.h | 2 +- xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp | 16 +++---- xfa/fxbarcode/datamatrix/BC_X12Encoder.h | 2 +- 17 files changed, 145 insertions(+), 152 deletions(-) (limited to 'xfa/fxbarcode/datamatrix') diff --git a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp index 00d8fc1615..88a12b23a2 100644 --- a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp @@ -37,16 +37,15 @@ void CBC_ASCIIEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { int32_t n = CBC_HighLevelEncoder::determineConsecutiveDigitCount( context.m_msg, context.m_pos); if (n >= 2) { - FX_WCHAR code = - encodeASCIIDigits(context.m_msg.GetAt(context.m_pos), - context.m_msg.GetAt(context.m_pos + 1), e); + wchar_t code = encodeASCIIDigits(context.m_msg.GetAt(context.m_pos), + context.m_msg.GetAt(context.m_pos + 1), e); if (e != BCExceptionNO) { return; } context.writeCodeword(code); context.m_pos += 2; } else { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); int32_t newMode = CBC_HighLevelEncoder::lookAheadTest( context.m_msg, context.m_pos, getEncodingMode()); if (newMode != getEncodingMode()) { @@ -77,21 +76,21 @@ void CBC_ASCIIEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { } } else if (CBC_HighLevelEncoder::isExtendedASCII(c)) { context.writeCodeword(CBC_HighLevelEncoder::UPPER_SHIFT); - context.writeCodeword((FX_WCHAR)(c - 128 + 1)); + context.writeCodeword((wchar_t)(c - 128 + 1)); context.m_pos++; } else { - context.writeCodeword((FX_WCHAR)(c + 1)); + context.writeCodeword((wchar_t)(c + 1)); context.m_pos++; } } } -FX_WCHAR CBC_ASCIIEncoder::encodeASCIIDigits(FX_WCHAR digit1, - FX_WCHAR digit2, - int32_t& e) { +wchar_t CBC_ASCIIEncoder::encodeASCIIDigits(wchar_t digit1, + wchar_t digit2, + int32_t& e) { if (CBC_HighLevelEncoder::isDigit(digit1) && CBC_HighLevelEncoder::isDigit(digit2)) { int32_t num = (digit1 - 48) * 10 + (digit2 - 48); - return (FX_WCHAR)(num + 130); + return (wchar_t)(num + 130); } e = BCExceptionIllegalArgumentNotGigits; return 0; diff --git a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h index 40559b532d..a0cfaa76ed 100644 --- a/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_ASCIIEncoder.h @@ -21,9 +21,7 @@ class CBC_ASCIIEncoder : public CBC_Encoder { void Encode(CBC_EncoderContext& context, int32_t& e) override; private: - static FX_WCHAR encodeASCIIDigits(FX_WCHAR digit1, - FX_WCHAR digit2, - int32_t& e); + static wchar_t encodeASCIIDigits(wchar_t digit1, wchar_t digit2, int32_t& e); }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_ASCIIENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp index b8e427c7fc..333377e392 100644 --- a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.cpp @@ -35,9 +35,9 @@ int32_t CBC_Base256Encoder::getEncodingMode() { } void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; - buffer += (FX_WCHAR)'\0'; + buffer += (wchar_t)'\0'; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); buffer += c; context.m_pos++; int32_t newMode = CBC_HighLevelEncoder::lookAheadTest( @@ -48,9 +48,9 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { } } int32_t dataCount = buffer.GetLength() - 1; - FX_CHAR buf[128]; + char buf[128]; FXSYS_itoa(dataCount, buf, 10); - buffer.SetAt(0, FX_WCHAR(*buf) - '0'); + buffer.SetAt(0, wchar_t(*buf) - '0'); int32_t lengthFieldSize = 1; int32_t currentSize = context.getCodewordCount() + dataCount + lengthFieldSize; @@ -61,10 +61,10 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { bool mustPad = (context.m_symbolInfo->m_dataCapacity - currentSize) > 0; if (context.hasMoreCharacters() || mustPad) { if (dataCount <= 249) { - buffer.SetAt(0, (FX_WCHAR)dataCount); + buffer.SetAt(0, (wchar_t)dataCount); } else if (dataCount > 249 && dataCount <= 1555) { - buffer.SetAt(0, (FX_WCHAR)((dataCount / 250) + 249)); - buffer.Insert(1, (FX_WCHAR)(dataCount % 250)); + buffer.SetAt(0, (wchar_t)((dataCount / 250) + 249)); + buffer.Insert(1, (wchar_t)(dataCount % 250)); } else { e = BCExceptionIllegalStateMessageLengthInvalid; return; @@ -75,13 +75,13 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { randomize255State(buffer.GetAt(i), context.getCodewordCount() + 1)); } } -FX_WCHAR CBC_Base256Encoder::randomize255State(FX_WCHAR ch, - int32_t codewordPosition) { +wchar_t CBC_Base256Encoder::randomize255State(wchar_t ch, + int32_t codewordPosition) { int32_t pseudoRandom = ((149 * codewordPosition) % 255) + 1; int32_t tempVariable = ch + pseudoRandom; if (tempVariable <= 255) { - return (FX_WCHAR)tempVariable; + return (wchar_t)tempVariable; } else { - return (FX_WCHAR)(tempVariable - 256); + return (wchar_t)(tempVariable - 256); } } diff --git a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h index c41c79db08..41229afb80 100644 --- a/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h +++ b/xfa/fxbarcode/datamatrix/BC_Base256Encoder.h @@ -19,7 +19,7 @@ class CBC_Base256Encoder : public CBC_Encoder { void Encode(CBC_EncoderContext& context, int32_t& e) override; private: - static FX_WCHAR randomize255State(FX_WCHAR ch, int32_t codewordPosition); + static wchar_t randomize255State(wchar_t ch, int32_t codewordPosition); }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_BASE256ENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp index 50f02ca52d..04fcb6b541 100644 --- a/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp @@ -37,7 +37,7 @@ int32_t CBC_C40Encoder::getEncodingMode() { void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); context.m_pos++; int32_t lastCharSize = encodeChar(c, buffer, e); if (e != BCExceptionNO) { @@ -100,7 +100,7 @@ void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context, } int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount; if (rest == 2) { - buffer += (FX_WCHAR)'\0'; + buffer += (wchar_t)'\0'; while (buffer.GetLength() >= 3) { writeNextTriplet(context, buffer); } @@ -128,39 +128,39 @@ void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context, } context.signalEncoderChange(ASCII_ENCODATION); } -int32_t CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) { +int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c == ' ') { - sb += (FX_WCHAR)'\3'; + sb += (wchar_t)'\3'; return 1; } else if ((c >= '0') && (c <= '9')) { - sb += (FX_WCHAR)(c - 48 + 4); + sb += (wchar_t)(c - 48 + 4); return 1; } else if ((c >= 'A') && (c <= 'Z')) { - sb += (FX_WCHAR)(c - 65 + 14); + sb += (wchar_t)(c - 65 + 14); return 1; } else if (c <= 0x1f) { - sb += (FX_WCHAR)'\0'; + sb += (wchar_t)'\0'; sb += c; return 2; } else if ((c >= '!') && (c <= '/')) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 33); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 33); return 2; } else if ((c >= ':') && (c <= '@')) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 58 + 15); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 58 + 15); return 2; } else if ((c >= '[') && (c <= '_')) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 91 + 22); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 91 + 22); return 2; } else if ((c >= 60) && (c <= 0x7f)) { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 96); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 96); return 2; } else if (c >= 80) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)0x001e; + sb += (wchar_t)'\1'; + sb += (wchar_t)0x001e; int32_t len = 2; len += encodeChar((c - 128), sb, e); if (e != BCExceptionNO) @@ -179,7 +179,7 @@ int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context, int32_t count = buffer.GetLength(); buffer.Delete(count - lastCharSize, count); context.m_pos--; - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); lastCharSize = encodeChar(c, removed, e); if (e != BCExceptionNO) return -1; @@ -188,12 +188,12 @@ int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context, } CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb, int32_t startPos) { - FX_WCHAR c1 = sb.GetAt(startPos); - FX_WCHAR c2 = sb.GetAt(startPos + 1); - FX_WCHAR c3 = sb.GetAt(startPos + 2); + wchar_t c1 = sb.GetAt(startPos); + wchar_t c2 = sb.GetAt(startPos + 1); + wchar_t c3 = sb.GetAt(startPos + 2); int32_t v = (1600 * c1) + (40 * c2) + c3 + 1; - FX_WCHAR cw1 = (FX_WCHAR)(v / 256); - FX_WCHAR cw2 = (FX_WCHAR)(v % 256); + wchar_t cw1 = (wchar_t)(v / 256); + wchar_t cw2 = (wchar_t)(v % 256); CFX_WideString b1(cw1); CFX_WideString b2(cw2); return b1 + b2; diff --git a/xfa/fxbarcode/datamatrix/BC_C40Encoder.h b/xfa/fxbarcode/datamatrix/BC_C40Encoder.h index 9737981f75..03dee140df 100644 --- a/xfa/fxbarcode/datamatrix/BC_C40Encoder.h +++ b/xfa/fxbarcode/datamatrix/BC_C40Encoder.h @@ -24,7 +24,7 @@ class CBC_C40Encoder : public CBC_Encoder { virtual void handleEOD(CBC_EncoderContext& context, CFX_WideString& buffer, int32_t& e); - virtual int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e); + virtual int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e); private: int32_t backtrackOneCharacter(CBC_EncoderContext& context, diff --git a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp index 7db117d003..2ffc8413a3 100644 --- a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp @@ -37,7 +37,7 @@ int32_t CBC_EdifactEncoder::getEncodingMode() { void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); encodeChar(c, buffer, e); if (e != BCExceptionNO) { return; @@ -58,7 +58,7 @@ void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { } } } - buffer += (FX_WCHAR)31; + buffer += (wchar_t)31; handleEOD(context, buffer, e); } void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext& context, @@ -115,13 +115,11 @@ void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext& context, } context.signalEncoderChange(ASCII_ENCODATION); } -void CBC_EdifactEncoder::encodeChar(FX_WCHAR c, - CFX_WideString& sb, - int32_t& e) { +void CBC_EdifactEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c >= ' ' && c <= '?') { sb += c; } else if (c >= '@' && c <= '^') { - sb += (FX_WCHAR)(c - 64); + sb += (wchar_t)(c - 64); } else { CBC_HighLevelEncoder::illegalCharacter(c, e); } @@ -134,14 +132,14 @@ CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb, e = BCExceptionNoContents; return CFX_WideString(); } - FX_WCHAR c1 = sb.GetAt(startPos); - FX_WCHAR c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0; - FX_WCHAR c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0; - FX_WCHAR c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0; + wchar_t c1 = sb.GetAt(startPos); + wchar_t c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0; + wchar_t c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0; + wchar_t c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0; int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4; - FX_WCHAR cw1 = (FX_WCHAR)((v >> 16) & 255); - FX_WCHAR cw2 = (FX_WCHAR)((v >> 8) & 255); - FX_WCHAR cw3 = (FX_WCHAR)(v & 255); + wchar_t cw1 = (wchar_t)((v >> 16) & 255); + wchar_t cw2 = (wchar_t)((v >> 8) & 255); + wchar_t cw3 = (wchar_t)(v & 255); CFX_WideString res; res += cw1; if (len >= 2) { diff --git a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h index 3eb762fe6d..afe013e02e 100644 --- a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.h @@ -22,7 +22,7 @@ class CBC_EdifactEncoder : public CBC_Encoder { static void handleEOD(CBC_EncoderContext& context, CFX_WideString buffer, int32_t& e); - static void encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e); + static void encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e); static CFX_WideString encodeToCodewords(CFX_WideString sb, int32_t startPos, int32_t& e); diff --git a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp index b01b3120e3..6af2bc4e83 100644 --- a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp +++ b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp @@ -36,7 +36,7 @@ CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg, CFX_WideString sb; int32_t c = dststr.GetLength(); for (int32_t i = 0; i < c; i++) { - FX_WCHAR ch = (FX_WCHAR)(dststr.GetAt(i) & 0xff); + wchar_t ch = (wchar_t)(dststr.GetAt(i) & 0xff); if (ch == '?' && dststr.GetAt(i) != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; } @@ -66,16 +66,16 @@ CFX_WideString CBC_EncoderContext::getMessage() { void CBC_EncoderContext::setSkipAtEnd(int32_t count) { m_skipAtEnd = count; } -FX_WCHAR CBC_EncoderContext::getCurrentChar() { +wchar_t CBC_EncoderContext::getCurrentChar() { return m_msg.GetAt(m_pos); } -FX_WCHAR CBC_EncoderContext::getCurrent() { +wchar_t CBC_EncoderContext::getCurrent() { return m_msg.GetAt(m_pos); } void CBC_EncoderContext::writeCodewords(CFX_WideString codewords) { m_codewords += codewords; } -void CBC_EncoderContext::writeCodeword(FX_WCHAR codeword) { +void CBC_EncoderContext::writeCodeword(wchar_t codeword) { m_codewords += codeword; } int32_t CBC_EncoderContext::getCodewordCount() { diff --git a/xfa/fxbarcode/datamatrix/BC_EncoderContext.h b/xfa/fxbarcode/datamatrix/BC_EncoderContext.h index 8d0ea5d7ed..03018b2ffe 100644 --- a/xfa/fxbarcode/datamatrix/BC_EncoderContext.h +++ b/xfa/fxbarcode/datamatrix/BC_EncoderContext.h @@ -23,10 +23,10 @@ class CBC_EncoderContext : public CBC_SymbolShapeHint { void setSizeConstraints(CBC_Dimension* minSize, CBC_Dimension* maxSize); CFX_WideString getMessage(); void setSkipAtEnd(int32_t count); - FX_WCHAR getCurrentChar(); - FX_WCHAR getCurrent(); + wchar_t getCurrentChar(); + wchar_t getCurrent(); void writeCodewords(CFX_WideString codewords); - void writeCodeword(FX_WCHAR codeword); + void writeCodeword(wchar_t codeword); int32_t getCodewordCount(); void signalEncoderChange(int32_t encoding); void resetEncoderSignal(); diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp index 17eec1ee4f..ffdd308d54 100644 --- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp +++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp @@ -150,7 +150,7 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, for (int32_t block = 0; block < blockCount; block++) { CFX_WideString temp; for (int32_t d = block; d < symbolInfo->m_dataCapacity; d += blockCount) { - temp += (FX_WCHAR)codewords.GetAt(d); + temp += (wchar_t)codewords.GetAt(d); } CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e); if (e != BCExceptionNO) @@ -203,7 +203,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, } CFX_WideString strecc; for (int32_t j = 0; j < numECWords; j++) { - strecc += (FX_WCHAR)ecc[numECWords - j - 1]; + strecc += (wchar_t)ecc[numECWords - j - 1]; } FX_Free(ecc); return strecc; diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index abd3584761..ec6eb02b1c 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -40,17 +40,17 @@ #include "xfa/fxbarcode/datamatrix/BC_X12Encoder.h" #include "xfa/fxbarcode/utils.h" -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_C40 = 230; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_BASE256 = 231; -FX_WCHAR CBC_HighLevelEncoder::UPPER_SHIFT = 235; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_ANSIX12 = 238; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_TEXT = 239; -FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_EDIFACT = 240; -FX_WCHAR CBC_HighLevelEncoder::C40_UNLATCH = 254; -FX_WCHAR CBC_HighLevelEncoder::X12_UNLATCH = 254; -FX_WCHAR CBC_HighLevelEncoder::PAD = 129; -FX_WCHAR CBC_HighLevelEncoder::MACRO_05 = 236; -FX_WCHAR CBC_HighLevelEncoder::MACRO_06 = 237; +wchar_t CBC_HighLevelEncoder::LATCH_TO_C40 = 230; +wchar_t CBC_HighLevelEncoder::LATCH_TO_BASE256 = 231; +wchar_t CBC_HighLevelEncoder::UPPER_SHIFT = 235; +wchar_t CBC_HighLevelEncoder::LATCH_TO_ANSIX12 = 238; +wchar_t CBC_HighLevelEncoder::LATCH_TO_TEXT = 239; +wchar_t CBC_HighLevelEncoder::LATCH_TO_EDIFACT = 240; +wchar_t CBC_HighLevelEncoder::C40_UNLATCH = 254; +wchar_t CBC_HighLevelEncoder::X12_UNLATCH = 254; +wchar_t CBC_HighLevelEncoder::PAD = 129; +wchar_t CBC_HighLevelEncoder::MACRO_05 = 236; +wchar_t CBC_HighLevelEncoder::MACRO_06 = 237; const wchar_t* CBC_HighLevelEncoder::MACRO_05_HEADER = L"[)>05"; const wchar_t* CBC_HighLevelEncoder::MACRO_06_HEADER = L"[)>06"; const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004; @@ -184,7 +184,7 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, } return C40_ENCODATION; } - FX_WCHAR c = msg.GetAt(startpos + charsProcessed); + wchar_t c = msg.GetAt(startpos + charsProcessed); charsProcessed++; if (isDigit(c)) { charCounts[ASCII_ENCODATION] += 0.5; @@ -271,7 +271,7 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, if (intCharCounts[C40_ENCODATION] == intCharCounts[X12_ENCODATION]) { int32_t p = startpos + charsProcessed + 1; while (p < msg.GetLength()) { - FX_WCHAR tc = msg.GetAt(p); + wchar_t tc = msg.GetAt(p); if (isX12TermSep(tc)) { return X12_ENCODATION; } @@ -286,10 +286,10 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, } } } -bool CBC_HighLevelEncoder::isDigit(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isDigit(wchar_t ch) { return ch >= '0' && ch <= '9'; } -bool CBC_HighLevelEncoder::isExtendedASCII(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isExtendedASCII(wchar_t ch) { return ch >= 128 && ch <= 255; } int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, @@ -298,7 +298,7 @@ int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, int32_t len = msg.GetLength(); int32_t idx = startpos; if (idx < len) { - FX_WCHAR ch = msg.GetAt(idx); + wchar_t ch = msg.GetAt(idx); while (isDigit(ch) && idx < len) { count++; idx++; @@ -309,15 +309,15 @@ int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, } return count; } -void CBC_HighLevelEncoder::illegalCharacter(FX_WCHAR c, int32_t& e) { +void CBC_HighLevelEncoder::illegalCharacter(wchar_t c, int32_t& e) { e = BCExceptionIllegalArgument; } -FX_WCHAR CBC_HighLevelEncoder::randomize253State(FX_WCHAR ch, - int32_t codewordPosition) { +wchar_t CBC_HighLevelEncoder::randomize253State(wchar_t ch, + int32_t codewordPosition) { int32_t pseudoRandom = ((149 * codewordPosition) % 253) + 1; int32_t tempVariable = ch + pseudoRandom; - return tempVariable <= 254 ? (FX_WCHAR)tempVariable - : (FX_WCHAR)(tempVariable - 254); + return tempVariable <= 254 ? (wchar_t)tempVariable + : (wchar_t)(tempVariable - 254); } int32_t CBC_HighLevelEncoder::findMinimums( std::vector& charCounts, @@ -350,22 +350,22 @@ int32_t CBC_HighLevelEncoder::getMinimumCount( } return minCount; } -bool CBC_HighLevelEncoder::isNativeC40(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeC40(wchar_t ch) { return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z'); } -bool CBC_HighLevelEncoder::isNativeText(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeText(wchar_t ch) { return (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z'); } -bool CBC_HighLevelEncoder::isNativeX12(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeX12(wchar_t ch) { return isX12TermSep(ch) || (ch == ' ') || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z'); } -bool CBC_HighLevelEncoder::isX12TermSep(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isX12TermSep(wchar_t ch) { return (ch == '\r') || (ch == '*') || (ch == '>'); } -bool CBC_HighLevelEncoder::isNativeEDIFACT(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isNativeEDIFACT(wchar_t ch) { return ch >= ' ' && ch <= '^'; } -bool CBC_HighLevelEncoder::isSpecialB256(FX_WCHAR ch) { +bool CBC_HighLevelEncoder::isSpecialB256(wchar_t ch) { return false; } diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h index 5d72f1074e..cfd16ed676 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h @@ -36,44 +36,44 @@ class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { static int32_t lookAheadTest(CFX_WideString msg, int32_t startpos, int32_t currentMode); - static bool isDigit(FX_WCHAR ch); - static bool isExtendedASCII(FX_WCHAR ch); + static bool isDigit(wchar_t ch); + static bool isExtendedASCII(wchar_t ch); static int32_t determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos); - static void illegalCharacter(FX_WCHAR c, int32_t& e); + static void illegalCharacter(wchar_t c, int32_t& e); public: - static FX_WCHAR LATCH_TO_C40; - static FX_WCHAR LATCH_TO_BASE256; - static FX_WCHAR UPPER_SHIFT; - static FX_WCHAR LATCH_TO_ANSIX12; - static FX_WCHAR LATCH_TO_TEXT; - static FX_WCHAR LATCH_TO_EDIFACT; - static FX_WCHAR C40_UNLATCH; - static FX_WCHAR X12_UNLATCH; + static wchar_t LATCH_TO_C40; + static wchar_t LATCH_TO_BASE256; + static wchar_t UPPER_SHIFT; + static wchar_t LATCH_TO_ANSIX12; + static wchar_t LATCH_TO_TEXT; + static wchar_t LATCH_TO_EDIFACT; + static wchar_t C40_UNLATCH; + static wchar_t X12_UNLATCH; private: - static FX_WCHAR PAD; - static FX_WCHAR MACRO_05; - static FX_WCHAR MACRO_06; + static wchar_t PAD; + static wchar_t MACRO_05; + static wchar_t MACRO_06; static const wchar_t* MACRO_05_HEADER; static const wchar_t* MACRO_06_HEADER; static const wchar_t MACRO_TRAILER; CFX_ArrayTemplate m_bytearray; private: - static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition); + static wchar_t randomize253State(wchar_t ch, int32_t codewordPosition); static int32_t findMinimums(std::vector& charCounts, CFX_ArrayTemplate& intCharCounts, int32_t min, CFX_ArrayTemplate& mins); static int32_t getMinimumCount(CFX_ArrayTemplate& mins); - static bool isNativeC40(FX_WCHAR ch); - static bool isNativeText(FX_WCHAR ch); - static bool isNativeX12(FX_WCHAR ch); - static bool isX12TermSep(FX_WCHAR ch); - static bool isNativeEDIFACT(FX_WCHAR ch); - static bool isSpecialB256(FX_WCHAR ch); + static bool isNativeC40(wchar_t ch); + static bool isNativeText(wchar_t ch); + static bool isNativeX12(wchar_t ch); + static bool isX12TermSep(wchar_t ch); + static bool isNativeEDIFACT(wchar_t ch); + static bool isSpecialB256(wchar_t ch); }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp index e3eb4a8c4e..cc02661c26 100644 --- a/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp @@ -35,61 +35,59 @@ CBC_TextEncoder::~CBC_TextEncoder() {} int32_t CBC_TextEncoder::getEncodingMode() { return TEXT_ENCODATION; } -int32_t CBC_TextEncoder::encodeChar(FX_WCHAR c, - CFX_WideString& sb, - int32_t& e) { +int32_t CBC_TextEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c == ' ') { - sb += (FX_WCHAR)'\3'; + sb += (wchar_t)'\3'; return 1; } if (c >= '0' && c <= '9') { - sb += (FX_WCHAR)(c - 48 + 4); + sb += (wchar_t)(c - 48 + 4); return 1; } if (c >= 'a' && c <= 'z') { - sb += (FX_WCHAR)(c - 97 + 14); + sb += (wchar_t)(c - 97 + 14); return 1; } if (c <= 0x1f) { - sb += (FX_WCHAR)'\0'; + sb += (wchar_t)'\0'; sb += c; return 2; } if (c >= '!' && c <= '/') { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 33); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 33); return 2; } if (c >= ':' && c <= '@') { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 58 + 15); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 58 + 15); return 2; } if (c >= '[' && c <= '_') { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)(c - 91 + 22); + sb += (wchar_t)'\1'; + sb += (wchar_t)(c - 91 + 22); return 2; } if (c == 0x0060) { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 96); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 96); return 2; } if (c >= 'A' && c <= 'Z') { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 65 + 1); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 65 + 1); return 2; } if (c >= '{' && c <= 0x007f) { - sb += (FX_WCHAR)'\2'; - sb += (FX_WCHAR)(c - 123 + 27); + sb += (wchar_t)'\2'; + sb += (wchar_t)(c - 123 + 27); return 2; } if (c >= 0x0080) { - sb += (FX_WCHAR)'\1'; - sb += (FX_WCHAR)0x001e; + sb += (wchar_t)'\1'; + sb += (wchar_t)0x001e; int32_t len = 2; - len += encodeChar((FX_WCHAR)(c - 128), sb, e); + len += encodeChar((wchar_t)(c - 128), sb, e); if (e != BCExceptionNO) return -1; return len; diff --git a/xfa/fxbarcode/datamatrix/BC_TextEncoder.h b/xfa/fxbarcode/datamatrix/BC_TextEncoder.h index e6013b9508..71092023da 100644 --- a/xfa/fxbarcode/datamatrix/BC_TextEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_TextEncoder.h @@ -16,7 +16,7 @@ class CBC_TextEncoder : public CBC_C40Encoder { // CBC_C40Encoder int32_t getEncodingMode() override; - int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) override; + int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override; }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_ diff --git a/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp index d77af9318a..570076b348 100644 --- a/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp @@ -38,7 +38,7 @@ int32_t CBC_X12Encoder::getEncodingMode() { void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { CFX_WideString buffer; while (context.hasMoreCharacters()) { - FX_WCHAR c = context.getCurrentChar(); + wchar_t c = context.getCurrentChar(); context.m_pos++; encodeChar(c, buffer, e); if (e != BCExceptionNO) { @@ -79,19 +79,19 @@ void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context, context.signalEncoderChange(ASCII_ENCODATION); } } -int32_t CBC_X12Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) { +int32_t CBC_X12Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { if (c == '\r') { - sb += (FX_WCHAR)'\0'; + sb += (wchar_t)'\0'; } else if (c == '*') { - sb += (FX_WCHAR)'\1'; + sb += (wchar_t)'\1'; } else if (c == '>') { - sb += (FX_WCHAR)'\2'; + sb += (wchar_t)'\2'; } else if (c == ' ') { - sb += (FX_WCHAR)'\3'; + sb += (wchar_t)'\3'; } else if (c >= '0' && c <= '9') { - sb += (FX_WCHAR)(c - 48 + 4); + sb += (wchar_t)(c - 48 + 4); } else if (c >= 'A' && c <= 'Z') { - sb += (FX_WCHAR)(c - 65 + 14); + sb += (wchar_t)(c - 65 + 14); } else { CBC_HighLevelEncoder::illegalCharacter(c, e); if (e != BCExceptionNO) diff --git a/xfa/fxbarcode/datamatrix/BC_X12Encoder.h b/xfa/fxbarcode/datamatrix/BC_X12Encoder.h index 52239ce529..693b9bba6c 100644 --- a/xfa/fxbarcode/datamatrix/BC_X12Encoder.h +++ b/xfa/fxbarcode/datamatrix/BC_X12Encoder.h @@ -20,7 +20,7 @@ class CBC_X12Encoder : public CBC_C40Encoder { void handleEOD(CBC_EncoderContext& context, CFX_WideString& buffer, int32_t& e) override; - int32_t encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) override; + int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override; }; #endif // XFA_FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_ -- cgit v1.2.3