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

Side by Side Diff: core/src/fxcrt/fx_xml_parser.cpp

Issue 1757283002: Combine StrToInt methods. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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 | « core/src/fxcrt/fx_extension_unittest.cpp ('k') | fpdfsdk/src/javascript/PublicMethods.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 "core/src/fxcrt/xml_int.h" 7 #include "core/src/fxcrt/xml_int.h"
8 8
9 #include "core/include/fxcrt/fx_ext.h" 9 #include "core/include/fxcrt/fx_ext.h"
10 #include "core/include/fxcrt/fx_xml.h" 10 #include "core/include/fxcrt/fx_xml.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 break; 224 break;
225 } 225 }
226 iState = 3; 226 iState = 3;
227 case 3: 227 case 3:
228 m_dwIndex++; 228 m_dwIndex++;
229 if (ch == ';') { 229 if (ch == ';') {
230 iState = 10; 230 iState = 10;
231 break; 231 break;
232 } 232 }
233 if (g_FXCRT_XML_IsDigital(ch)) 233 if (g_FXCRT_XML_IsDigital(ch))
234 code = code * 10 + FXSYS_toDecimalDigit(ch); 234 code = code * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
235 break; 235 break;
236 case 4: 236 case 4:
237 m_dwIndex++; 237 m_dwIndex++;
238 if (ch == ';') { 238 if (ch == ';') {
239 iState = 10; 239 iState = 10;
240 break; 240 break;
241 } 241 }
242 uint8_t nHex = 242 uint8_t nHex =
243 g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; 243 g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar;
244 if (nHex) { 244 if (nHex) {
245 if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { 245 if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) {
246 code = (code << 4) + FXSYS_toDecimalDigit(ch); 246 code =
247 (code << 4) + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(ch));
247 } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) { 248 } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) {
248 code = (code << 4) + ch - 87; 249 code = (code << 4) + ch - 87;
249 } else { 250 } else {
250 code = (code << 4) + ch - 55; 251 code = (code << 4) + ch - 55;
251 } 252 }
252 } 253 }
253 break; 254 break;
254 } 255 }
255 if (iState == 10) { 256 if (iState == 10) {
256 break; 257 break;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 m_pMap->push_back({space, name, value}); 784 m_pMap->push_back({space, name, value});
784 } 785 }
785 786
786 int CXML_AttrMap::GetSize() const { 787 int CXML_AttrMap::GetSize() const {
787 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; 788 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0;
788 } 789 }
789 790
790 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { 791 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const {
791 return (*m_pMap)[index]; 792 return (*m_pMap)[index];
792 } 793 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_extension_unittest.cpp ('k') | fpdfsdk/src/javascript/PublicMethods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698