From c0d358ad234843a524a1bcc2a439f08ad0c64aa1 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 16 May 2017 12:17:50 -0400 Subject: Update formcalc return types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update return types to be bools instead of ints. Make some methods private. Change-Id: I5d55c48a861f90e9bd116ef835c11cdb515002a6 Reviewed-on: https://pdfium-review.googlesource.com/5553 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña --- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'xfa/fxfa/fm2js/xfa_fm2jscontext.cpp') diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 716e378ed7..d0a111fa0d 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -2778,7 +2778,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, } CFX_WideTextBuf wsJavaScriptBuf; - if (CXFA_FM2JSContext::Translate( + if (!CXFA_FM2JSContext::Translate( CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), &wsJavaScriptBuf)) { pContext->ThrowCompilerErrorException(); @@ -5433,8 +5433,8 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, CFX_WideString scriptString = CFX_WideString::FromUTF8(argString.AsStringC()); CFX_WideTextBuf wsJavaScriptBuf; - if (CXFA_FM2JSContext::Translate(scriptString.AsStringC(), - &wsJavaScriptBuf)) { + if (!CXFA_FM2JSContext::Translate(scriptString.AsStringC(), + &wsJavaScriptBuf)) { pContext->ThrowCompilerErrorException(); return; } @@ -6112,18 +6112,15 @@ CFX_ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) { } // static. -int32_t CXFA_FM2JSContext::Translate(const CFX_WideStringC& wsFormcalc, - CFX_WideTextBuf* wsJavascript) { +bool CXFA_FM2JSContext::Translate(const CFX_WideStringC& wsFormcalc, + CFX_WideTextBuf* wsJavascript) { if (wsFormcalc.IsEmpty()) { wsJavascript->Clear(); - return 0; + return true; } - CXFA_FMProgram program(wsFormcalc); - int32_t status = program.ParseProgram(); - if (status) - return status; - return program.TranslateProgram(*wsJavascript); + CXFA_FMProgram program(wsFormcalc); + return program.ParseProgram() && program.TranslateProgram(*wsJavascript); } CXFA_FM2JSContext::CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, -- cgit v1.2.3