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

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

Issue 1853233002: Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix CPDF_Name::GetConstString() 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 | « core/fxcrt/fx_basic_buffer.cpp ('k') | core/fxcrt/fxcrt_posix.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/fxcrt/xml_int.h" 7 #include "core/fxcrt/xml_int.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 return nullptr; 364 return nullptr;
365 } 365 }
366 CFX_ByteString tag_name, tag_space; 366 CFX_ByteString tag_name, tag_space;
367 FX_BOOL bEndTag; 367 FX_BOOL bEndTag;
368 GetTagName(tag_space, tag_name, bEndTag, bStartTag); 368 GetTagName(tag_space, tag_name, bEndTag, bStartTag);
369 if (tag_name.IsEmpty() || bEndTag) { 369 if (tag_name.IsEmpty() || bEndTag) {
370 return nullptr; 370 return nullptr;
371 } 371 }
372 CXML_Element* pElement = new CXML_Element; 372 CXML_Element* pElement = new CXML_Element;
373 pElement->m_pParent = pParent; 373 pElement->m_pParent = pParent;
374 pElement->SetTag(tag_space, tag_name); 374 pElement->SetTag(tag_space.AsByteStringC(), tag_name.AsByteStringC());
375 do { 375 do {
376 CFX_ByteString attr_space, attr_name; 376 CFX_ByteString attr_space, attr_name;
377 while (m_dwIndex < m_dwBufferSize) { 377 while (m_dwIndex < m_dwBufferSize) {
378 SkipWhiteSpaces(); 378 SkipWhiteSpaces();
379 if (IsEOF()) { 379 if (IsEOF()) {
380 break; 380 break;
381 } 381 }
382 if (!g_FXCRT_XML_IsNameIntro(m_pBuffer[m_dwIndex])) { 382 if (!g_FXCRT_XML_IsNameIntro(m_pBuffer[m_dwIndex])) {
383 break; 383 break;
384 } 384 }
385 GetName(attr_space, attr_name); 385 GetName(attr_space, attr_name);
386 SkipWhiteSpaces(); 386 SkipWhiteSpaces();
387 if (IsEOF()) { 387 if (IsEOF()) {
388 break; 388 break;
389 } 389 }
390 if (m_pBuffer[m_dwIndex] != '=') { 390 if (m_pBuffer[m_dwIndex] != '=') {
391 break; 391 break;
392 } 392 }
393 m_dwIndex++; 393 m_dwIndex++;
394 SkipWhiteSpaces(); 394 SkipWhiteSpaces();
395 if (IsEOF()) { 395 if (IsEOF()) {
396 break; 396 break;
397 } 397 }
398 CFX_WideString attr_value; 398 CFX_WideString attr_value;
399 GetAttrValue(attr_value); 399 GetAttrValue(attr_value);
400 pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value); 400 pElement->m_AttrMap.SetAt(attr_space.AsByteStringC(),
401 attr_name.AsByteStringC(), attr_value);
401 } 402 }
402 m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; 403 m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
403 if (m_dwIndex < m_dwBufferSize || IsEOF()) { 404 if (m_dwIndex < m_dwBufferSize || IsEOF()) {
404 break; 405 break;
405 } 406 }
406 } while (ReadNextBlock()); 407 } while (ReadNextBlock());
407 SkipWhiteSpaces(); 408 SkipWhiteSpaces();
408 if (IsEOF()) { 409 if (IsEOF()) {
409 return pElement; 410 return pElement;
410 } 411 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 594 }
594 CFX_ByteString bsTag = m_QSpaceName; 595 CFX_ByteString bsTag = m_QSpaceName;
595 bsTag += ":"; 596 bsTag += ":";
596 bsTag += m_TagName; 597 bsTag += m_TagName;
597 return bsTag; 598 return bsTag;
598 } 599 }
599 CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const { 600 CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const {
600 if (bQualified) { 601 if (bQualified) {
601 return m_QSpaceName; 602 return m_QSpaceName;
602 } 603 }
603 return GetNamespaceURI(m_QSpaceName); 604 return GetNamespaceURI(m_QSpaceName.AsByteStringC());
604 } 605 }
605 CFX_ByteString CXML_Element::GetNamespaceURI( 606 CFX_ByteString CXML_Element::GetNamespaceURI(
606 const CFX_ByteStringC& qName) const { 607 const CFX_ByteStringC& qName) const {
607 const CFX_WideString* pwsSpace; 608 const CFX_WideString* pwsSpace;
608 const CXML_Element* pElement = this; 609 const CXML_Element* pElement = this;
609 do { 610 do {
610 if (qName.IsEmpty()) { 611 if (qName.IsEmpty()) {
611 pwsSpace = pElement->m_AttrMap.Lookup("", "xmlns"); 612 pwsSpace = pElement->m_AttrMap.Lookup("", "xmlns");
612 } else { 613 } else {
613 pwsSpace = pElement->m_AttrMap.Lookup("xmlns", qName); 614 pwsSpace = pElement->m_AttrMap.Lookup("xmlns", qName);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 m_pMap->push_back({space, name, value}); 787 m_pMap->push_back({space, name, value});
787 } 788 }
788 789
789 int CXML_AttrMap::GetSize() const { 790 int CXML_AttrMap::GetSize() const {
790 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; 791 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0;
791 } 792 }
792 793
793 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { 794 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const {
794 return (*m_pMap)[index]; 795 return (*m_pMap)[index];
795 } 796 }
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_buffer.cpp ('k') | core/fxcrt/fxcrt_posix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698