From 8873a4dffed0ae3ccd961ada58c588f92b210bf2 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 16 Nov 2017 14:19:07 +0000 Subject: 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 Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_widgetdata.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'xfa/fxfa') 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 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 truncate = + GetUIChild()->JSNode()->TryBoolean(XFA_Attribute::Truncate, true); + if (!truncate) return false; - *val = bTruncate; + *val = *truncate; return true; } -- cgit v1.2.3