From 3ac07ffafea1ee4d3cf985e32692849dd3fcfdfb Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 2 Nov 2017 19:09:58 +0000 Subject: Cleanup params to CJX_Node::TryCData This CL removes the bProto param as it was never set and inlines the value where needed in the methods. The default value was removed from bUseDefault and inlined into callsites as needed. Change-Id: I773261d19aa3799bc607e7df482b5f5e5217bee6 Reviewed-on: https://pdfium-review.googlesource.com/17533 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_widgetdata.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp') diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index a0ac520981..1d6ea33859 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -445,7 +445,7 @@ bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover, CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { WideStringView wsName; - pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); if (wsName == L"rollover") { pText->JSNode()->TryContent(wsRollover); bRichText = pText->GetElementType() == XFA_Element::ExData; @@ -462,7 +462,7 @@ bool CXFA_WidgetData::GetButtonDown(WideString& wsDown, bool& bRichText) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { WideStringView wsName; - pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); if (wsName == L"down") { pText->JSNode()->TryContent(wsDown); bRichText = pText->GetElementType() == XFA_Element::ExData; @@ -1177,8 +1177,8 @@ WideString CXFA_WidgetData::GetBarcodeType() { bool CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsCharEncoding; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_CharEncoding, - wsCharEncoding)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_CharEncoding, wsCharEncoding, + true)) { if (wsCharEncoding.CompareNoCase(L"UTF-16")) { *val = CHAR_ENCODING_UNICODE; return true; @@ -1218,7 +1218,8 @@ bool CXFA_WidgetData::GetBarcodeAttribute_Checksum(bool* val) { bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsDataLength; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength, + true)) { *val = FXSYS_wtoi(wsDataLength.c_str()); return true; } @@ -1228,7 +1229,8 @@ bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) { bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { CXFA_Node* pUIChild = GetUIChild(); WideStringView wsStartEndChar; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar, + true)) { if (wsStartEndChar.GetLength()) { *val = static_cast(wsStartEndChar[0]); return true; @@ -1240,7 +1242,8 @@ bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) { CXFA_Node* pUIChild = GetUIChild(); WideStringView wsStartEndChar; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar, + true)) { if (wsStartEndChar.GetLength()) { *val = static_cast(wsStartEndChar[0]); return true; @@ -1253,7 +1256,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsECLevel; if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_ErrorCorrectionLevel, - wsECLevel)) { + wsECLevel, true)) { *val = FXSYS_wtoi(wsECLevel.c_str()); return true; } @@ -1334,7 +1337,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsWideNarrowRatio; if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, - wsWideNarrowRatio)) { + wsWideNarrowRatio, true)) { auto ptPos = wsWideNarrowRatio.Find(':'); float fRatio = 0; if (!ptPos.has_value()) { @@ -1358,7 +1361,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { void CXFA_WidgetData::GetPasswordChar(WideString& wsPassWord) { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { - pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord); + pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord, true); } else { wsPassWord = GetAttributeDefaultValue_Cdata(XFA_Element::PasswordEdit, XFA_ATTRIBUTE_PasswordChar, -- cgit v1.2.3