Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "../../include/fxcrt/fx_xml.h" | 7 #include "../../include/fxcrt/fx_xml.h" |
| 8 #include "xml_int.h" | 8 #include "xml_int.h" |
| 9 CXML_Parser::~CXML_Parser() | 9 CXML_Parser::~CXML_Parser() |
| 10 { | 10 { |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 FX_BOOL CXML_Element::HasAttr(FX_BSTR name) const | 663 FX_BOOL CXML_Element::HasAttr(FX_BSTR name) const |
| 664 { | 664 { |
| 665 CFX_ByteStringC bsSpace, bsName; | 665 CFX_ByteStringC bsSpace, bsName; |
| 666 FX_XML_SplitQualifiedName(name, bsSpace, bsName); | 666 FX_XML_SplitQualifiedName(name, bsSpace, bsName); |
| 667 return m_AttrMap.Lookup(bsSpace, bsName) != NULL; | 667 return m_AttrMap.Lookup(bsSpace, bsName) != NULL; |
| 668 } | 668 } |
| 669 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR name, CFX_WideString& attribute) cons t | 669 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR name, CFX_WideString& attribute) cons t |
| 670 { | 670 { |
| 671 CFX_ByteStringC bsSpace, bsName; | 671 CFX_ByteStringC bsSpace, bsName; |
| 672 FX_XML_SplitQualifiedName(name, bsSpace, bsName); | 672 FX_XML_SplitQualifiedName(name, bsSpace, bsName); |
| 673 const CFX_WideString* pValue = m_AttrMap.Lookup(bsSpace, bsName); | 673 const CFX_WideString* pValue = m_AttrMap.Lookup(bsSpace, bsName); |
|
Tom Sepez
2014/11/17 18:43:15
nit: some reason this doesn't just call into the m
brucedawson
2014/11/17 18:52:02
Could do that, if there aren't any additional risk
| |
| 674 if (pValue) { | 674 if (pValue) { |
| 675 attribute = CFX_WideString((FX_LPCWSTR)pValue, pValue->GetLength()); | 675 attribute = CFX_WideString(pValue->c_str(), pValue->GetLength()); |
| 676 return TRUE; | 676 return TRUE; |
| 677 } | 677 } |
| 678 return FALSE; | 678 return FALSE; |
| 679 } | 679 } |
| 680 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString& attribute) const | 680 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString& attribute) const |
| 681 { | 681 { |
| 682 const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); | 682 const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); |
| 683 if (pValue) { | 683 if (pValue) { |
| 684 attribute = CFX_WideString((FX_LPCWSTR)pValue, pValue->GetLength()); | 684 attribute = CFX_WideString(pValue->c_str(), pValue->GetLength()); |
| 685 return TRUE; | 685 return TRUE; |
| 686 } | 686 } |
| 687 return FALSE; | 687 return FALSE; |
| 688 } | 688 } |
| 689 FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR name, int& attribute) const | 689 FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR name, int& attribute) const |
| 690 { | 690 { |
| 691 CFX_ByteStringC bsSpace, bsName; | 691 CFX_ByteStringC bsSpace, bsName; |
| 692 FX_XML_SplitQualifiedName(name, bsSpace, bsName); | 692 FX_XML_SplitQualifiedName(name, bsSpace, bsName); |
| 693 const CFX_WideString* pwsValue = m_AttrMap.Lookup(bsSpace, bsName); | 693 const CFX_WideString* pwsValue = m_AttrMap.Lookup(bsSpace, bsName); |
| 694 if (pwsValue) { | 694 if (pwsValue) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 } | 860 } |
| 861 void CXML_AttrMap::RemoveAll() | 861 void CXML_AttrMap::RemoveAll() |
| 862 { | 862 { |
| 863 if (!m_pMap) { | 863 if (!m_pMap) { |
| 864 return; | 864 return; |
| 865 } | 865 } |
| 866 m_pMap->RemoveAll(); | 866 m_pMap->RemoveAll(); |
| 867 delete m_pMap; | 867 delete m_pMap; |
| 868 m_pMap = NULL; | 868 m_pMap = NULL; |
| 869 } | 869 } |
| OLD | NEW |