summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-23 10:38:07 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-23 10:38:07 -0700
commit524fa626d71efeb2164c82d565f17f077035b7df (patch)
tree0ad13752db2c216dced6872671db7ef179def4a0
parent168fc2be3253fdfb8a58685b89d28a471fa4740a (diff)
downloadpdfium-524fa626d71efeb2164c82d565f17f077035b7df.tar.xz
Clean up more XFA code which causes warnings
This is part of efforts to bring XFA to chromium_code standard. Most of them will have behavior change. The details of these problems are: xfa/fgas/layout/fgas_rtfbreak.cpp: Wrong condition with misused variable xfa/fgas/localization/fgas_locale.cpp Unnecessary condition xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp xfa/fxfa/app/xfa_fffield.cpp Unreachable code should be the correct code xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp xfa/fxbarcode/qrcode/BC_QRDetector.cpp Wrong condition logic BUG=pdfium:29 Review-Url: https://codereview.chromium.org/2000073003
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp2
-rw-r--r--xfa/fgas/localization/fgas_locale.cpp3
-rw-r--r--xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp4
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp12
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRDetector.cpp14
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp1
6 files changed, 17 insertions, 19 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index c6a43d3b56..62b3f5f28e 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -1317,7 +1317,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
bAdjusted = pAdjustPos(wForm, bMBCSCode, pFont, fFontSize,
bVerticalChar, ptOffset);
}
- if (!pAdjustPos && bVerticalChar && (dwProps & 0x00010000) != 0) {
+ if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) {
CFX_Rect rtBBox;
rtBBox.Reset();
if (pFont->GetCharBBox(wForm, rtBBox, bMBCSCode)) {
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index 6eed202643..f0d1066397 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -3655,9 +3655,8 @@ FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
}
millisecond = millisecond * 10 + str[cc++] - '0';
}
- if (cc < cc_start + 3 || millisecond >= 1000) {
+ if (cc < cc_start + 3)
return FALSE;
- }
}
if (cc < len) {
FX_TIMEZONE tzDiff;
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp
index 53c5a84656..292a1de2f7 100644
--- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp
@@ -246,7 +246,7 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeC40Segment(
shift = 0;
break;
default:
- break;
+ // Should never be reached.
e = BCExceptionFormatException;
return;
}
@@ -337,7 +337,7 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeTextSegment(
}
break;
default:
- break;
+ // Should never be reached.
e = BCExceptionFormatException;
return;
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
index 4c3d4dbdf2..4e1d8dd1e9 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
@@ -423,15 +423,13 @@ CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(
}
CBC_CommonDecoderResult* decoderResult =
decodeCodewords(codewords, ecLevel, erasureArray, e);
- if (e != BCExceptionNO) {
- e = BCExceptionNO;
- continue;
- } else {
+ if (e == BCExceptionNO)
return decoderResult;
- }
+
+ e = BCExceptionNO;
if (ambiguousIndexCount.GetSize() == 0) {
e = BCExceptionChecksumInstance;
- return NULL;
+ return nullptr;
}
for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) {
if (ambiguousIndexCount[i] <
@@ -442,7 +440,7 @@ CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(
ambiguousIndexCount[i] = 0;
if (i == ambiguousIndexCount.GetSize() - 1) {
e = BCExceptionChecksumInstance;
- return NULL;
+ return nullptr;
}
}
}
diff --git a/xfa/fxbarcode/qrcode/BC_QRDetector.cpp b/xfa/fxbarcode/qrcode/BC_QRDetector.cpp
index 15ae3e26f1..35915cd673 100644
--- a/xfa/fxbarcode/qrcode/BC_QRDetector.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRDetector.cpp
@@ -56,17 +56,17 @@ CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(
CalculateModuleSize(topLeft.get(), topRight.get(), bottomLeft.get());
if (moduleSize < 1.0f) {
e = BCExceptionRead;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ return nullptr;
}
int32_t dimension = ComputeDimension(topLeft.get(), topRight.get(),
bottomLeft.get(), moduleSize, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
CBC_QRCoderVersion* provisionalVersion =
CBC_QRCoderVersion::GetProvisionalVersionForDimension(dimension, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
int32_t modulesBetweenFPCenters =
provisionalVersion->GetDimensionForVersion() - 7;
- CBC_QRAlignmentPattern* alignmentPattern = NULL;
+ CBC_QRAlignmentPattern* alignmentPattern = nullptr;
if (provisionalVersion->GetAlignmentPatternCenters()->GetSize() > 0) {
FX_FLOAT bottomRightX =
topRight->GetX() - topLeft->GetX() + bottomLeft->GetX();
@@ -83,8 +83,10 @@ CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(
for (int32_t i = 4; i <= 16; i <<= 1) {
CBC_QRAlignmentPattern* temp = FindAlignmentInRegion(
moduleSize, estAlignmentX, estAlignmentY, (FX_FLOAT)i, e);
- alignmentPattern = temp;
- break;
+ if (temp) {
+ alignmentPattern = temp;
+ break;
+ }
}
}
CBC_CommonBitMatrix* bits =
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 5b70caa924..177a06484f 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -450,7 +450,6 @@ FX_BOOL CXFA_FFField::OnMouseWheel(uint32_t dwFlags,
int16_t zDelta,
FX_FLOAT fx,
FX_FLOAT fy) {
- return FALSE;
if (!m_pNormalWidget) {
return FALSE;
}