From 038aa531bcf1a76764d3cef46fd9b8e08b166dae Mon Sep 17 00:00:00 2001 From: weili Date: Fri, 20 May 2016 15:38:29 -0700 Subject: Clean up XFA code which causes warnings This is part of efforts to bring XFA to chromium_code standard. The warnings are from unreachable code, or using potentially uninitialized variables, or using assignment within a condition. This change list only contains easy to fix cases. More cleanups will follow. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/1998873002 --- xfa/fxbarcode/oned/BC_OneDimReader.cpp | 4 +--- xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp | 4 +--- xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp | 5 +---- xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp | 4 +--- 4 files changed, 4 insertions(+), 13 deletions(-) (limited to 'xfa/fxbarcode/oned') diff --git a/xfa/fxbarcode/oned/BC_OneDimReader.cpp b/xfa/fxbarcode/oned/BC_OneDimReader.cpp index 5187c34af9..a1cfc9b492 100644 --- a/xfa/fxbarcode/oned/BC_OneDimReader.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimReader.cpp @@ -211,9 +211,7 @@ int32_t CBC_OneDimReader::DecodeDigit(CBC_CommonBitArray* row, } if (bestMatch >= 0) { return bestMatch; - } else { - e = BCExceptionNotFound; - return 0; } + e = BCExceptionNotFound; return 0; } diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp index b5f5aa5fe4..a0479e7f6d 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp @@ -150,10 +150,8 @@ int32_t CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray* row, } if (bestMatch >= 0) { return bestMatch; - } else { - e = BCExceptionNotFound; - return 0; } + e = BCExceptionNotFound; return 0; } CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber, diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index 5806b3d09d..bc9b14f04e 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -45,10 +45,7 @@ FX_BOOL CBC_OnedCode128Writer::CheckContentValidity( if (m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C) { while (position < contents.GetLength()) { patternIndex = (int32_t)contents.GetAt(position); - if (patternIndex >= 32 && patternIndex <= 126 && patternIndex != 34) { - position++; - continue; - } else { + if (patternIndex < 32 || patternIndex > 126 || patternIndex == 34) { ret = FALSE; break; } diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp index 50a8fbb2f9..eb197b916c 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp @@ -89,9 +89,7 @@ CFX_ByteString CBC_OnedUPCAReader::MaybeReturnResult(CFX_ByteString& result, if (result[0] == '0') { result.Delete(0); return result; - } else { - e = BCExceptionFormatException; - return ""; } + e = BCExceptionFormatException; return ""; } -- cgit v1.2.3