From 76852be59cbfdb22901b37bb8579d19c07af7037 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 20 May 2016 16:09:37 -0700 Subject: Fix /analyze warnings in fxbarcode/ Part of the fix to the issues in bug 613623. These are all real bugs arising from non-use of L""-style literals band-aided over with casts. Remove the casts, and fix the literals or replace with empty string constructors. BUG=613623, 427616 Review-Url: https://codereview.chromium.org/1999933002 --- xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp | 2 +- xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp | 8 +++---- xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp | 2 +- xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp | 25 ---------------------- xfa/fxbarcode/datamatrix/BC_SymbolInfo.h | 1 - xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp | 4 +++- 6 files changed, 9 insertions(+), 33 deletions(-) diff --git a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp index d1f5b9796d..e1d493a1ca 100644 --- a/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_EdifactEncoder.cpp @@ -132,7 +132,7 @@ CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb, int32_t len = sb.GetLength() - startPos; if (len == 0) { e = BCExceptionNoContents; - return (FX_WCHAR*)""; + return CFX_WideString(); } FX_WCHAR c1 = sb.GetAt(startPos); FX_WCHAR c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0; diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp index 8f54353d4a..f52f0ff0c4 100644 --- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp +++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp @@ -121,7 +121,7 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, int32_t& e) { if (codewords.GetLength() != symbolInfo->m_dataCapacity) { e = BCExceptionIllegalArgument; - return (FX_WCHAR*)""; + return CFX_WideString(); } CFX_WideString sb; sb += codewords; @@ -129,7 +129,7 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, if (blockCount == 1) { CFX_WideString ecc = createECCBlock(codewords, symbolInfo->m_errorCodewords, e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); + BC_EXCEPTION_CHECK_ReturnValue(e, CFX_WideString()); sb += ecc; } else { CFX_Int32Array dataSizes; @@ -152,7 +152,7 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, temp += (FX_WCHAR)codewords.GetAt(d); } CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); + BC_EXCEPTION_CHECK_ReturnValue(e, CFX_WideString()); int32_t pos = 0; for (int32_t l = block; l < errorSizes[block] * blockCount; l += blockCount) { @@ -179,7 +179,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, if (table >= kFactorTableNum) { e = BCExceptionIllegalArgument; - return (FX_WCHAR*)""; + return CFX_WideString(); } uint16_t* ecc = FX_Alloc(uint16_t, numECWords); FXSYS_memset(ecc, 0, numECWords * sizeof(uint16_t)); diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index 19672c1b71..5388244351 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -78,7 +78,7 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CBC_Dimension* maxSize, int32_t& e) { CBC_EncoderContext context(msg, ecLevel, e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); + BC_EXCEPTION_CHECK_ReturnValue(e, CFX_WideString()); context.setSymbolShape(shape); context.setSizeConstraints(minSize, maxSize); if ((msg.Mid(0, 6) == MACRO_05_HEADER) && diff --git a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp index 593f4cb162..d3d68541c4 100644 --- a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp +++ b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp @@ -228,28 +228,3 @@ int32_t CBC_SymbolInfo::getDataLengthForInterleavedBlock(int32_t index) { int32_t CBC_SymbolInfo::getErrorLengthForInterleavedBlock(int32_t index) { return m_rsBlockError; } -CFX_WideString CBC_SymbolInfo::toString(int32_t& e) { - CFX_WideString sb; - sb += (FX_WCHAR*)(m_rectangular ? "Rectangular Symbol:" : "Square Symbol:"); - sb += (FX_WCHAR*)" data region "; - sb += m_matrixWidth; - sb += (FX_WCHAR)'x'; - sb += m_matrixHeight; - sb += (FX_WCHAR*)", symbol size "; - sb += getSymbolWidth(e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); - sb += (FX_WCHAR)'x'; - sb += getSymbolHeight(e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); - sb += (FX_WCHAR*)", symbol data size "; - sb += getSymbolDataWidth(e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); - sb += (FX_WCHAR)'x'; - sb += getSymbolDataHeight(e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); - sb += (FX_WCHAR*)", codewords "; - sb += m_dataCapacity; - sb += (FX_WCHAR)'+'; - sb += m_errorCodewords; - return sb; -} diff --git a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h index f5d6b8ae28..7885c8da74 100644 --- a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h +++ b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.h @@ -53,7 +53,6 @@ class CBC_SymbolInfo : public CBC_SymbolShapeHint { int32_t getInterleavedBlockCount(); int32_t getDataLengthForInterleavedBlock(int32_t index); int32_t getErrorLengthForInterleavedBlock(int32_t index); - CFX_WideString toString(int32_t& e); public: int32_t m_dataCapacity; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 27c6651542..7617d526c1 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -52,7 +52,9 @@ int32_t CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0}; void CBC_PDF417HighLevelEncoder::Initialize() { Inverse(); } + void CBC_PDF417HighLevelEncoder::Finalize() {} + CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( CFX_WideString wideMsg, Compaction compaction, @@ -65,7 +67,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( FX_WCHAR ch = (FX_WCHAR)(bytes.GetAt(i) & 0xff); if (ch == '?' && bytes.GetAt(i) != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; - return (FX_WCHAR*)""; + return CFX_WideString(); } msg += ch; } -- cgit v1.2.3