summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_widgetdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 13:44:38 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 13:44:38 +0000
commit0bf9aef229ae2c4f2f16ab753d6d2e9e6d718a44 (patch)
tree2ed1f71183096853a7d552276047a67b473a9721 /xfa/fxfa/parser/cxfa_widgetdata.cpp
parentb066704a22ba4f242567f508c12bf2545cbed9e1 (diff)
downloadpdfium-0bf9aef229ae2c4f2f16ab753d6d2e9e6d718a44.tar.xz
Convert TryInteger to return an optional
This Cl changes CJX_Node::TryInteger to return a pdfium::Optional<int32_t> instead of a boolean with an out param. Change-Id: I4675e08d3b132041f7d87e4639efa1d555089dc2 Reviewed-on: https://pdfium-review.googlesource.com/18511 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 1a39e2a525..90d02994de 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -1350,8 +1350,13 @@ bool CXFA_WidgetData::GetFracDigits(int32_t& iFracDigits) {
if (!pChild)
return false;
- return pChild->JSNode()->TryInteger(XFA_Attribute::FracDigits, iFracDigits,
- true);
+ pdfium::Optional<int32_t> ret =
+ pChild->JSNode()->TryInteger(XFA_Attribute::FracDigits, true);
+ if (!ret)
+ return false;
+
+ iFracDigits = *ret;
+ return true;
}
bool CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) {
@@ -1365,8 +1370,13 @@ bool CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) {
if (!pChild)
return false;
- return pChild->JSNode()->TryInteger(XFA_Attribute::LeadDigits, iLeadDigits,
- true);
+ pdfium::Optional<int32_t> ret =
+ pChild->JSNode()->TryInteger(XFA_Attribute::LeadDigits, true);
+ if (!ret)
+ return false;
+
+ iLeadDigits = *ret;
+ return true;
}
bool CXFA_WidgetData::SetValue(const WideString& wsValue,