| 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 "../../include/fxcrt/fx_ext.h" | |
| 9 #include "xml_int.h" | 8 #include "xml_int.h" |
| 10 | |
| 11 CXML_Parser::~CXML_Parser() { | 9 CXML_Parser::~CXML_Parser() { |
| 12 if (m_bOwnedStream) { | 10 if (m_bOwnedStream) { |
| 13 m_pDataAcc->Release(); | 11 m_pDataAcc->Release(); |
| 14 } | 12 } |
| 15 } | 13 } |
| 16 FX_BOOL CXML_Parser::Init(uint8_t* pBuffer, size_t size) { | 14 FX_BOOL CXML_Parser::Init(uint8_t* pBuffer, size_t size) { |
| 17 m_pDataAcc = new CXML_DataBufAcc(pBuffer, size); | 15 m_pDataAcc = new CXML_DataBufAcc(pBuffer, size); |
| 18 return Init(TRUE); | 16 return Init(TRUE); |
| 19 } | 17 } |
| 20 FX_BOOL CXML_Parser::Init(IFX_FileRead* pFileRead) { | 18 FX_BOOL CXML_Parser::Init(IFX_FileRead* pFileRead) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 iState = 4; | 219 iState = 4; |
| 222 break; | 220 break; |
| 223 } | 221 } |
| 224 iState = 3; | 222 iState = 3; |
| 225 case 3: | 223 case 3: |
| 226 m_dwIndex++; | 224 m_dwIndex++; |
| 227 if (ch == ';') { | 225 if (ch == ';') { |
| 228 iState = 10; | 226 iState = 10; |
| 229 break; | 227 break; |
| 230 } | 228 } |
| 231 if (g_FXCRT_XML_IsDigital(ch)) | 229 if (g_FXCRT_XML_IsDigital(ch)) { |
| 232 code = code * 10 + FXSYS_toDecimalDigit(ch); | 230 code = code * 10 + ch - '0'; |
| 231 } |
| 233 break; | 232 break; |
| 234 case 4: | 233 case 4: |
| 235 m_dwIndex++; | 234 m_dwIndex++; |
| 236 if (ch == ';') { | 235 if (ch == ';') { |
| 237 iState = 10; | 236 iState = 10; |
| 238 break; | 237 break; |
| 239 } | 238 } |
| 240 uint8_t nHex = | 239 uint8_t nHex = |
| 241 g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; | 240 g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; |
| 242 if (nHex) { | 241 if (nHex) { |
| 243 if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { | 242 if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { |
| 244 code = (code << 4) + FXSYS_toDecimalDigit(ch); | 243 code = (code << 4) + ch - '0'; |
| 245 } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) { | 244 } else if (nHex == FXCRTM_XML_CHARTYPE_HexLowerLetter) { |
| 246 code = (code << 4) + ch - 87; | 245 code = (code << 4) + ch - 87; |
| 247 } else { | 246 } else { |
| 248 code = (code << 4) + ch - 55; | 247 code = (code << 4) + ch - 55; |
| 249 } | 248 } |
| 250 } | 249 } |
| 251 break; | 250 break; |
| 252 } | 251 } |
| 253 if (iState == 10) { | 252 if (iState == 10) { |
| 254 break; | 253 break; |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 return (*m_pMap)[index]; | 821 return (*m_pMap)[index]; |
| 823 } | 822 } |
| 824 void CXML_AttrMap::RemoveAll() { | 823 void CXML_AttrMap::RemoveAll() { |
| 825 if (!m_pMap) { | 824 if (!m_pMap) { |
| 826 return; | 825 return; |
| 827 } | 826 } |
| 828 m_pMap->RemoveAll(); | 827 m_pMap->RemoveAll(); |
| 829 delete m_pMap; | 828 delete m_pMap; |
| 830 m_pMap = NULL; | 829 m_pMap = NULL; |
| 831 } | 830 } |
| OLD | NEW |