From b066704a22ba4f242567f508c12bf2545cbed9e1 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 16 Nov 2017 13:42:49 +0000 Subject: Convert TryCData and TryContent to optionals This CL changes the TryCData and TryContent to return pdfium::Optional values instead of returning a bool and taking an out WideString. Change-Id: I9c9d877803f9f1977191e12d6a907c29784c10b2 Reviewed-on: https://pdfium-review.googlesource.com/18510 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fxjs/cfxjse_engine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fxjs/cfxjse_engine.cpp') diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index eb76ef1c57..e5d6c0a0fe 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -501,11 +501,12 @@ bool CFXJSE_Engine::RunVariablesScript(CXFA_Node* pScriptNode) { if (!pTextNode) return false; - WideString wsScript; - if (!pTextNode->JSNode()->TryCData(XFA_Attribute::Value, wsScript, true)) + pdfium::Optional wsScript = + pTextNode->JSNode()->TryCData(XFA_Attribute::Value, true); + if (!wsScript) return false; - ByteString btScript = wsScript.UTF8Encode(); + ByteString btScript = wsScript->UTF8Encode(); auto hRetValue = pdfium::MakeUnique(m_pIsolate); CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent); CFXJSE_Context* pVariablesContext = -- cgit v1.2.3