| 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/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
| 8 #include "../../include/fxcrt/fx_xml.h" | 8 #include "../../include/fxcrt/fx_xml.h" |
| 9 typedef struct _PDFDOC_METADATA { | 9 typedef struct _PDFDOC_METADATA { |
| 10 CPDF_Document *m_pDoc; | 10 CPDF_Document *m_pDoc; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) | 51 void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) |
| 52 { | 52 { |
| 53 FXSYS_assert(pDoc != NULL); | 53 FXSYS_assert(pDoc != NULL); |
| 54 ((PDFDOC_LPMETADATA)m_pData)->m_pDoc = pDoc; | 54 ((PDFDOC_LPMETADATA)m_pData)->m_pDoc = pDoc; |
| 55 CPDF_Dictionary *pRoot = pDoc->GetRoot(); | 55 CPDF_Dictionary *pRoot = pDoc->GetRoot(); |
| 56 CPDF_Stream *pStream = pRoot->GetStream(FX_BSTRC("Metadata")); | 56 CPDF_Stream *pStream = pRoot->GetStream(FX_BSTRC("Metadata")); |
| 57 if (!pStream) { | 57 if (!pStream) { |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 CPDF_StreamAcc acc; | 60 CPDF_StreamAcc acc; |
| 61 acc.LoadAllData(pStream, FALSE); | 61 acc.LoadAllData(pStream, false); |
| 62 int size = acc.GetSize(); | 62 int size = acc.GetSize(); |
| 63 const uint8_t* pBuf = acc.GetData(); | 63 const uint8_t* pBuf = acc.GetData(); |
| 64 CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; | 64 CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; |
| 65 pXmlElmnt = CXML_Element::Parse(pBuf, size); | 65 pXmlElmnt = CXML_Element::Parse(pBuf, size); |
| 66 if (!pXmlElmnt) { | 66 if (!pXmlElmnt) { |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 CXML_Element *&pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; | 69 CXML_Element *&pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; |
| 70 if (pXmlElmnt->GetTagName() == FX_BSTRC("RDF")) { | 70 if (pXmlElmnt->GetTagName() == FX_BSTRC("RDF")) { |
| 71 pElmntRdf = pXmlElmnt; | 71 pElmntRdf = pXmlElmnt; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return -1; | 139 return -1; |
| 140 } | 140 } |
| 141 CXML_Element* CPDF_Metadata::GetRoot() const | 141 CXML_Element* CPDF_Metadata::GetRoot() const |
| 142 { | 142 { |
| 143 return ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; | 143 return ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; |
| 144 } | 144 } |
| 145 CXML_Element* CPDF_Metadata::GetRDF() const | 145 CXML_Element* CPDF_Metadata::GetRDF() const |
| 146 { | 146 { |
| 147 return ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; | 147 return ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; |
| 148 } | 148 } |
| OLD | NEW |