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

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

Issue 1979723003: Make CFX_WideString(const CFX_WideString&) explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Override Created 4 years, 7 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_wstring.cpp ('k') | core/fxcrt/include/fx_basic.h » ('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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 SkipWhiteSpaces(); 450 SkipWhiteSpaces();
451 iState = 0; 451 iState = 0;
452 } else if (ch == '/') { 452 } else if (ch == '/') {
453 CFX_ByteString space, name; 453 CFX_ByteString space, name;
454 GetName(space, name); 454 GetName(space, name);
455 SkipWhiteSpaces(); 455 SkipWhiteSpaces();
456 m_dwIndex++; 456 m_dwIndex++;
457 iState = 10; 457 iState = 10;
458 } else { 458 } else {
459 content << decoder.GetResult(); 459 content << decoder.GetResult();
460 CFX_WideString dataStr = content.AsStringC(); 460 CFX_WideString dataStr = content.MakeString();
461 if (!bCDATA && !m_bSaveSpaceChars) { 461 if (!bCDATA && !m_bSaveSpaceChars) {
462 dataStr.TrimRight(L" \t\r\n"); 462 dataStr.TrimRight(L" \t\r\n");
463 } 463 }
464 InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement); 464 InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement);
465 content.Clear(); 465 content.Clear();
466 decoder.Clear(); 466 decoder.Clear();
467 bCDATA = FALSE; 467 bCDATA = FALSE;
468 iState = 0; 468 iState = 0;
469 m_dwIndex--; 469 m_dwIndex--;
470 CXML_Element* pSubElement = ParseElement(pElement, TRUE); 470 CXML_Element* pSubElement = ParseElement(pElement, TRUE);
(...skipping 23 matching lines...) Expand all
494 if (iState == 10) { 494 if (iState == 10) {
495 break; 495 break;
496 } 496 }
497 } 497 }
498 m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; 498 m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
499 if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) { 499 if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) {
500 break; 500 break;
501 } 501 }
502 } while (ReadNextBlock()); 502 } while (ReadNextBlock());
503 content << decoder.GetResult(); 503 content << decoder.GetResult();
504 CFX_WideString dataStr = content.AsStringC(); 504 CFX_WideString dataStr = content.MakeString();
505 if (!m_bSaveSpaceChars) { 505 if (!m_bSaveSpaceChars) {
506 dataStr.TrimRight(L" \t\r\n"); 506 dataStr.TrimRight(L" \t\r\n");
507 } 507 }
508 InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement); 508 InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement);
509 content.Clear(); 509 content.Clear();
510 decoder.Clear(); 510 decoder.Clear();
511 bCDATA = FALSE; 511 bCDATA = FALSE;
512 return pElement; 512 return pElement;
513 } 513 }
514 void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, 514 void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 if (!m_pMap) 777 if (!m_pMap)
778 m_pMap.reset(new std::vector<CXML_AttrItem>); 778 m_pMap.reset(new std::vector<CXML_AttrItem>);
779 779
780 for (CXML_AttrItem& item : *m_pMap) { 780 for (CXML_AttrItem& item : *m_pMap) {
781 if (item.Matches(space, name)) { 781 if (item.Matches(space, name)) {
782 item.m_Value = value; 782 item.m_Value = value;
783 return; 783 return;
784 } 784 }
785 } 785 }
786 786
787 m_pMap->push_back({space, name, value}); 787 m_pMap->push_back({space, name, CFX_WideString(value)});
788 } 788 }
789 789
790 int CXML_AttrMap::GetSize() const { 790 int CXML_AttrMap::GetSize() const {
791 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; 791 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0;
792 } 792 }
793 793
794 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { 794 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const {
795 return (*m_pMap)[index]; 795 return (*m_pMap)[index];
796 } 796 }
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_wstring.cpp ('k') | core/fxcrt/include/fx_basic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698