From 276dd94b300f1a5eb537fceb5bcfd311d75bd2e6 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 31 Aug 2017 13:42:25 -0400 Subject: Clean up of typing in lexer code BUG=pdfium:813 Change-Id: I4c638857bf114327dbc0344cc6d231b897f0d001 Reviewed-on: https://pdfium-review.googlesource.com/11971 Commit-Queue: Ryan Harrison Reviewed-by: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/fm2js/cxfa_fmlexer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index 16e07b5b4f..1a43e837f4 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -372,12 +372,13 @@ void CXFA_FMLexer::AdvanceForNumber() { wchar_t* end = nullptr; if (m_cursor) wcstod(const_cast(m_cursor), &end); - if (end && FXSYS_iswalpha(*end)) { + if (!end || FXSYS_iswalpha(*end)) { RaiseError(); return; } - m_token->m_string = CFX_WideStringC(m_cursor, (end - m_cursor)); + m_token->m_string = + CFX_WideStringC(m_cursor, static_cast(end - m_cursor)); m_cursor = end; } @@ -393,7 +394,8 @@ void CXFA_FMLexer::AdvanceForString() { ++m_cursor; // If the end of the input has been reached it was not escaped. if (m_cursor > m_end) { - m_token->m_string = CFX_WideStringC(start, (m_cursor - start)); + m_token->m_string = + CFX_WideStringC(start, static_cast(m_cursor - start)); return; } // If the next character is not a " then the end of the string has been @@ -427,7 +429,8 @@ void CXFA_FMLexer::AdvanceForIdentifier() { } ++m_cursor; } - m_token->m_string = CFX_WideStringC(start, (m_cursor - start)); + m_token->m_string = + CFX_WideStringC(start, static_cast(m_cursor - start)); m_token->m_type = TokenizeIdentifier(m_token->m_string); } -- cgit v1.2.3