Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: xfa/fxfa/fm2js/xfa_lexer.cpp

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fm2jscontext.cpp ('k') | xfa/fxfa/fm2js/xfa_simpleexpression.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/fm2js/xfa_lexer.h" 7 #include "xfa/fxfa/fm2js/xfa_lexer.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return keyWords[op].m_keyword; 158 return keyWords[op].m_keyword;
159 } 159 }
160 160
161 CXFA_FMToken::CXFA_FMToken() : m_type(TOKreserver), m_uLinenum(1) {} 161 CXFA_FMToken::CXFA_FMToken() : m_type(TOKreserver), m_uLinenum(1) {}
162 162
163 CXFA_FMToken::CXFA_FMToken(uint32_t uLineNum) 163 CXFA_FMToken::CXFA_FMToken(uint32_t uLineNum)
164 : m_type(TOKreserver), m_uLinenum(uLineNum) {} 164 : m_type(TOKreserver), m_uLinenum(uLineNum) {}
165 165
166 CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc, 166 CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc,
167 CXFA_FMErrorInfo* pErrorInfo) 167 CXFA_FMErrorInfo* pErrorInfo)
168 : m_ptr(wsFormCalc.GetPtr()), m_uCurrentLine(1), m_pErrorInfo(pErrorInfo) {} 168 : m_ptr(wsFormCalc.raw_str()),
169 m_uCurrentLine(1),
170 m_pErrorInfo(pErrorInfo) {}
169 171
170 CXFA_FMToken* CXFA_FMLexer::NextToken() { 172 CXFA_FMToken* CXFA_FMLexer::NextToken() {
171 m_pToken.reset(Scan()); 173 m_pToken.reset(Scan());
172 return m_pToken.get(); 174 return m_pToken.get();
173 } 175 }
174 176
175 CXFA_FMToken* CXFA_FMLexer::Scan() { 177 CXFA_FMToken* CXFA_FMLexer::Scan() {
176 uint16_t ch = 0; 178 uint16_t ch = 0;
177 CXFA_FMToken* p = new CXFA_FMToken(m_uCurrentLine); 179 CXFA_FMToken* p = new CXFA_FMToken(m_uCurrentLine);
178 if (!XFA_FMDChar::isAvalid(m_ptr)) { 180 if (!XFA_FMDChar::isAvalid(m_ptr)) {
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 return; 512 return;
511 } 513 }
512 XFA_FMDChar::inc(p); 514 XFA_FMDChar::inc(p);
513 ch = XFA_FMDChar::get(p); 515 ch = XFA_FMDChar::get(p);
514 } 516 }
515 pEnd = p; 517 pEnd = p;
516 } 518 }
517 519
518 XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) { 520 XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) {
519 int32_t iLength = str.GetLength(); 521 int32_t iLength = str.GetLength();
520 uint32_t uHash = FX_HashCode_String_GetW(str.GetPtr(), iLength, TRUE); 522 uint32_t uHash = FX_HashCode_String_GetW(str.raw_str(), iLength, TRUE);
521 int32_t iStart = KEYWORD_START, iEnd = KEYWORD_END; 523 int32_t iStart = KEYWORD_START, iEnd = KEYWORD_END;
522 int32_t iMid = (iStart + iEnd) / 2; 524 int32_t iMid = (iStart + iEnd) / 2;
523 XFA_FMKeyword keyword; 525 XFA_FMKeyword keyword;
524 do { 526 do {
525 iMid = (iStart + iEnd) / 2; 527 iMid = (iStart + iEnd) / 2;
526 keyword = keyWords[iMid]; 528 keyword = keyWords[iMid];
527 if (uHash == keyword.m_uHash) { 529 if (uHash == keyword.m_uHash) {
528 return keyword.m_type; 530 return keyword.m_type;
529 } else if (uHash < keyword.m_uHash) { 531 } else if (uHash < keyword.m_uHash) {
530 iEnd = iMid - 1; 532 iEnd = iMid - 1;
(...skipping 12 matching lines...) Expand all
543 m_pErrorInfo->message.FormatV(lpMessageInfo, ap); 545 m_pErrorInfo->message.FormatV(lpMessageInfo, ap);
544 va_end(ap); 546 va_end(ap);
545 } 547 }
546 548
547 FX_BOOL CXFA_FMLexer::HasError() const { 549 FX_BOOL CXFA_FMLexer::HasError() const {
548 if (m_pErrorInfo->message.IsEmpty()) { 550 if (m_pErrorInfo->message.IsEmpty()) {
549 return FALSE; 551 return FALSE;
550 } 552 }
551 return TRUE; 553 return TRUE;
552 } 554 }
OLDNEW
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fm2jscontext.cpp ('k') | xfa/fxfa/fm2js/xfa_simpleexpression.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698