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