summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-20 15:38:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-20 15:38:30 -0700
commit038aa531bcf1a76764d3cef46fd9b8e08b166dae (patch)
treed1ef7d15ff37e4c98d1d7522b225755ba99bc330 /xfa/fxfa/fm2js
parentdc3ccdfb49c4d533d524d2084a7ebe5117f35934 (diff)
downloadpdfium-038aa531bcf1a76764d3cef46fd9b8e08b166dae.tar.xz
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
Diffstat (limited to 'xfa/fxfa/fm2js')
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 96ebbfa1e9..4813eb1a63 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -1291,7 +1291,7 @@ void CXFA_FM2JSContext::Num2Date(FXJSE_HOBJECT hThis,
int32_t argc = args.GetLength();
if ((argc > 0) && (argc < 4)) {
FX_BOOL bFlags = FALSE;
- int32_t dDate;
+ int32_t dDate = 0;
CFX_ByteString formatString;
CFX_ByteString localString;
FXJSE_HVALUE dateValue = GetSimpleHValue(hThis, args, 0);
@@ -1446,7 +1446,7 @@ void CXFA_FM2JSContext::Num2GMTime(FXJSE_HOBJECT hThis,
int32_t argc = args.GetLength();
if ((argc > 0) && (argc < 4)) {
FX_BOOL bFlags = FALSE;
- int32_t iTime;
+ int32_t iTime = 0;
CFX_ByteString formatString;
CFX_ByteString localString;
FXJSE_HVALUE timeValue = GetSimpleHValue(hThis, args, 0);
@@ -1508,7 +1508,7 @@ void CXFA_FM2JSContext::Num2Time(FXJSE_HOBJECT hThis,
int32_t argc = args.GetLength();
if ((argc > 0) && (argc < 4)) {
FX_BOOL bFlags = FALSE;
- FX_FLOAT fTime;
+ FX_FLOAT fTime = 0.0f;
CFX_ByteString formatString;
CFX_ByteString localString;
FXJSE_HVALUE timeValue = GetSimpleHValue(hThis, args, 0);
@@ -4860,7 +4860,7 @@ void CXFA_FM2JSContext::Str(FXJSE_HOBJECT hThis,
int32_t argc = args.GetLength();
if ((argc > 0) && (argc < 4)) {
FX_BOOL bFlags = FALSE;
- FX_FLOAT fNumber;
+ FX_FLOAT fNumber = 0.0f;
int32_t iWidth = 10;
int32_t iPrecision = 0;
FXJSE_HVALUE numberValue = GetSimpleHValue(hThis, args, 0);
@@ -5171,7 +5171,7 @@ void CXFA_FM2JSContext::WordNum(FXJSE_HOBJECT hThis,
int32_t argc = args.GetLength();
if ((argc > 0) && (argc < 4)) {
FX_BOOL bFlags = FALSE;
- FX_FLOAT fNumber;
+ FX_FLOAT fNumber = 0.0f;
int32_t iIdentifier = 0;
CFX_ByteString localeString;
FXJSE_HVALUE numberValue = GetSimpleHValue(hThis, args, 0);
@@ -5477,14 +5477,12 @@ void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis,
CFX_ByteString bsContentType;
CFX_ByteString bsEncode;
CFX_ByteString bsHeader;
- FXJSE_HVALUE argOne;
- FXJSE_HVALUE argTwo;
- FXJSE_HVALUE argThree;
- FXJSE_HVALUE argFour;
- FXJSE_HVALUE argFive;
- argOne = GetSimpleHValue(hThis, args, 0);
+ FXJSE_HVALUE argThree = nullptr;
+ FXJSE_HVALUE argFour = nullptr;
+ FXJSE_HVALUE argFive = nullptr;
+ FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0);
HValueToUTF8String(argOne, bsURL);
- argTwo = GetSimpleHValue(hThis, args, 1);
+ FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1);
HValueToUTF8String(argTwo, bsData);
if (argc > 2) {
argThree = GetSimpleHValue(hThis, args, 2);
@@ -5548,12 +5546,10 @@ void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis,
CFX_ByteString bsURL;
CFX_ByteString bsData;
CFX_ByteString bsEncode;
- FXJSE_HVALUE argOne;
- FXJSE_HVALUE argTwo;
- FXJSE_HVALUE argThree;
- argOne = GetSimpleHValue(hThis, args, 0);
+ FXJSE_HVALUE argThree = nullptr;
+ FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0);
HValueToUTF8String(argOne, bsURL);
- argTwo = GetSimpleHValue(hThis, args, 1);
+ FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1);
HValueToUTF8String(argTwo, bsData);
if (argc > 2) {
argThree = GetSimpleHValue(hThis, args, 2);