diff options
author | dan sinclair <dsinclair@chromium.org> | 2017-05-17 22:17:34 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-18 15:27:37 +0000 |
commit | 2034b941dfa07d30c286bfcceffd6904740ac446 (patch) | |
tree | 1bc3c9be4d3108b53ced4db9837187dddf6df88d /xfa/fxfa/fm2js/cxfa_fmlexer.cpp | |
parent | cfd56852b6375d2b4eea473399231caf7dcdbf36 (diff) | |
download | pdfium-2034b941dfa07d30c286bfcceffd6904740ac446.tar.xz |
Remove CXFA_FMErrorInfo
This Cl removes the CXFA_FMErrorInfo class. The message was never output, just
used as a flag to determine if there was an error. The class has been replaced
with a boolean.
Change-Id: I1cde99ce6957f5f8c6be0755a198d80ec8378b3a
Reviewed-on: https://pdfium-review.googlesource.com/5653
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmlexer.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer.cpp | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index 18f915f198..db7cc956e8 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -94,12 +94,11 @@ CXFA_FMToken::CXFA_FMToken() : m_type(TOKreserver), m_uLinenum(1) {} CXFA_FMToken::CXFA_FMToken(uint32_t uLineNum) : m_type(TOKreserver), m_uLinenum(uLineNum) {} -CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc, - CXFA_FMErrorInfo* pErrorInfo) +CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc) : m_ptr(wsFormCalc.c_str()), m_end(m_ptr + wsFormCalc.GetLength() - 1), m_uCurrentLine(1), - m_pErrorInfo(pErrorInfo) {} + m_LexerError(false) {} CXFA_FMLexer::~CXFA_FMLexer() {} @@ -119,7 +118,7 @@ std::unique_ptr<CXFA_FMToken> CXFA_FMLexer::Scan() { auto p = pdfium::MakeUnique<CXFA_FMToken>(m_uCurrentLine); if (!IsValid(m_ptr)) { ch = *m_ptr; - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; return p; } @@ -134,7 +133,7 @@ std::unique_ptr<CXFA_FMToken> CXFA_FMLexer::Scan() { ch = *m_ptr; if (!IsValid(m_ptr)) { - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; return p; } @@ -190,7 +189,7 @@ std::unique_ptr<CXFA_FMToken> CXFA_FMLexer::Scan() { } } else { ch = *m_ptr; - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; } return p; case '<': @@ -213,7 +212,7 @@ std::unique_ptr<CXFA_FMToken> CXFA_FMLexer::Scan() { } } else { ch = *m_ptr; - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; } return p; case '>': @@ -233,7 +232,7 @@ std::unique_ptr<CXFA_FMToken> CXFA_FMLexer::Scan() { } } else { ch = *m_ptr; - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; } return p; case ',': @@ -285,7 +284,7 @@ std::unique_ptr<CXFA_FMToken> CXFA_FMLexer::Scan() { if (!IsValid(m_ptr)) { ch = *m_ptr; - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; return p; } ch = *m_ptr; @@ -323,7 +322,7 @@ std::unique_ptr<CXFA_FMToken> CXFA_FMLexer::Scan() { } } else { ch = *m_ptr; - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; } return p; case 0x09: @@ -346,7 +345,7 @@ const wchar_t* CXFA_FMLexer::Number(CXFA_FMToken* t, const wchar_t* p) { if (p) wcstod(const_cast<wchar_t*>(p), &pEnd); if (pEnd && FXSYS_iswalpha(*pEnd)) { - Error(kFMErrBadSuffixNumber); + m_LexerError = true; return pEnd; } @@ -359,7 +358,7 @@ const wchar_t* CXFA_FMLexer::String(CXFA_FMToken* t, const wchar_t* p) { ++p; if (p > m_end) { - Error(kFMErrEndOfInput); + m_LexerError = true; return p; } @@ -368,7 +367,7 @@ const wchar_t* CXFA_FMLexer::String(CXFA_FMToken* t, const wchar_t* p) { if (!IsValid(p)) { ch = *p; t->m_wstring = CFX_WideStringC(pStart, (p - pStart)); - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; return p; } @@ -376,7 +375,7 @@ const wchar_t* CXFA_FMLexer::String(CXFA_FMToken* t, const wchar_t* p) { if (ch != '"') { // We've hit the end of the input, return the string. if (p > m_end) { - Error(kFMErrEndOfInput); + m_LexerError = true; return p; } ch = *p; @@ -389,7 +388,7 @@ const wchar_t* CXFA_FMLexer::String(CXFA_FMToken* t, const wchar_t* p) { if (!IsValid(p)) { ch = *p; t->m_wstring = CFX_WideStringC(pStart, (p - pStart)); - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; return p; } ch = *p; @@ -398,7 +397,7 @@ const wchar_t* CXFA_FMLexer::String(CXFA_FMToken* t, const wchar_t* p) { ++p; if (p > m_end) { - Error(kFMErrEndOfInput); + m_LexerError = true; return p; } ch = *p; @@ -419,7 +418,7 @@ const wchar_t* CXFA_FMLexer::Identifiers(CXFA_FMToken* t, const wchar_t* p) { if (!IsValid(p)) { t->m_wstring = CFX_WideStringC(pStart, (p - pStart)); - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; return p; } @@ -427,7 +426,7 @@ const wchar_t* CXFA_FMLexer::Identifiers(CXFA_FMToken* t, const wchar_t* p) { while (ch) { if (!IsValid(p)) { t->m_wstring = CFX_WideStringC(pStart, (p - pStart)); - Error(kFMErrUnsupportedChar, ch); + m_LexerError = true; return p; } @@ -486,16 +485,3 @@ XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) { } while (iStart <= iEnd); return TOKidentifier; } - -void CXFA_FMLexer::Error(const wchar_t* msg, ...) { - m_pErrorInfo->linenum = m_uCurrentLine; - va_list ap; - va_start(ap, msg); - m_pErrorInfo->message.FormatV(msg, ap); - va_end(ap); - ASSERT(!m_pErrorInfo->message.IsEmpty()); -} - -bool CXFA_FMLexer::HasError() const { - return !m_pErrorInfo->message.IsEmpty(); -} |