summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 14:19:07 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 14:19:07 +0000
commit8873a4dffed0ae3ccd961ada58c588f92b210bf2 (patch)
tree86472d2a7769467cabbcb9f1fdc71129b97d0c7d /xfa/fxfa/parser
parent9d608ff14177cd665f6b2ead639415bda935fbe2 (diff)
downloadpdfium-8873a4dffed0ae3ccd961ada58c588f92b210bf2.tar.xz
Convert TryBoolean to return a pdfium::Optional
This CL changes CJX_Node::TryBoolean to return a pdfium::Optional instead of a bool with an out parameter. Change-Id: Iceeaaaa5bda62f34e66161834e0209c2169f7f15 Reviewed-on: https://pdfium-review.googlesource.com/18530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 9613383879..5dd680ab8c 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -1226,10 +1226,10 @@ bool CXFA_WidgetData::GetBarcodeAttribute_ModuleHeight(int32_t* val) {
}
bool CXFA_WidgetData::GetBarcodeAttribute_PrintChecksum(bool* val) {
- bool bPrintCheckDigit;
- if (GetUIChild()->JSNode()->TryBoolean(XFA_Attribute::PrintCheckDigit,
- bPrintCheckDigit, true)) {
- *val = bPrintCheckDigit;
+ pdfium::Optional<bool> printCheckDigit =
+ GetUIChild()->JSNode()->TryBoolean(XFA_Attribute::PrintCheckDigit, true);
+ if (printCheckDigit) {
+ *val = *printCheckDigit;
return true;
}
return false;
@@ -1264,12 +1264,12 @@ bool CXFA_WidgetData::GetBarcodeAttribute_TextLocation(int32_t* val) {
}
bool CXFA_WidgetData::GetBarcodeAttribute_Truncate(bool* val) {
- bool bTruncate;
- if (!GetUIChild()->JSNode()->TryBoolean(XFA_Attribute::Truncate, bTruncate,
- true))
+ pdfium::Optional<bool> truncate =
+ GetUIChild()->JSNode()->TryBoolean(XFA_Attribute::Truncate, true);
+ if (!truncate)
return false;
- *val = bTruncate;
+ *val = *truncate;
return true;
}