| 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/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
| 8 const char PDF_CharType[256] = { | 8 const char PDF_CharType[256] = { |
| 9 //NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO S
I | 9 //NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO S
I |
| 10 'W', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W', 'W', 'R', 'W', 'W', 'R', '
R', | 10 'W', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W', 'W', 'R', 'W', 'W', 'R', '
R', |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #define MAX_PATH 4096 | 44 #define MAX_PATH 4096 |
| 45 #endif | 45 #endif |
| 46 CPDF_SimpleParser::CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize) | 46 CPDF_SimpleParser::CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize) |
| 47 { | 47 { |
| 48 m_pData = pData; | 48 m_pData = pData; |
| 49 m_dwSize = dwSize; | 49 m_dwSize = dwSize; |
| 50 m_dwCurPos = 0; | 50 m_dwCurPos = 0; |
| 51 } | 51 } |
| 52 CPDF_SimpleParser::CPDF_SimpleParser(FX_BSTR str) | 52 CPDF_SimpleParser::CPDF_SimpleParser(FX_BSTR str) |
| 53 { | 53 { |
| 54 m_pData = str; | 54 m_pData = str.GetPtr(); |
| 55 m_dwSize = str.GetLength(); | 55 m_dwSize = str.GetLength(); |
| 56 m_dwCurPos = 0; | 56 m_dwCurPos = 0; |
| 57 } | 57 } |
| 58 void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ
e) | 58 void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ
e) |
| 59 { | 59 { |
| 60 pStart = NULL; | 60 pStart = NULL; |
| 61 dwSize = 0; | 61 dwSize = 0; |
| 62 type = PDFWORD_EOF; | 62 type = PDFWORD_EOF; |
| 63 FX_BYTE ch; | 63 FX_BYTE ch; |
| 64 char chartype; | 64 char chartype; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 m_dwCurPos ++; | 191 m_dwCurPos ++; |
| 192 } | 192 } |
| 193 return CFX_ByteStringC(pStart, (FX_STRSIZE)(m_dwCurPos - (pStart - m_pDa
ta))); | 193 return CFX_ByteStringC(pStart, (FX_STRSIZE)(m_dwCurPos - (pStart - m_pDa
ta))); |
| 194 } | 194 } |
| 195 return CFX_ByteStringC(pStart, dwSize); | 195 return CFX_ByteStringC(pStart, dwSize); |
| 196 } | 196 } |
| 197 FX_BOOL CPDF_SimpleParser::SearchToken(FX_BSTR token) | 197 FX_BOOL CPDF_SimpleParser::SearchToken(FX_BSTR token) |
| 198 { | 198 { |
| 199 int token_len = token.GetLength(); | 199 int token_len = token.GetLength(); |
| 200 while (m_dwCurPos < m_dwSize - token_len) { | 200 while (m_dwCurPos < m_dwSize - token_len) { |
| 201 if (FXSYS_memcmp32(m_pData + m_dwCurPos, token, token_len) == 0) { | 201 if (FXSYS_memcmp32(m_pData + m_dwCurPos, token.GetPtr(), token_len) == 0
) { |
| 202 break; | 202 break; |
| 203 } | 203 } |
| 204 m_dwCurPos ++; | 204 m_dwCurPos ++; |
| 205 } | 205 } |
| 206 if (m_dwCurPos == m_dwSize - token_len) { | 206 if (m_dwCurPos == m_dwSize - token_len) { |
| 207 return FALSE; | 207 return FALSE; |
| 208 } | 208 } |
| 209 m_dwCurPos += token_len; | 209 m_dwCurPos += token_len; |
| 210 return TRUE; | 210 return TRUE; |
| 211 } | 211 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 if (pFound) { | 470 if (pFound) { |
| 471 return pFound; | 471 return pFound; |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 return NULL; | 474 return NULL; |
| 475 } | 475 } |
| 476 CPDF_Object* CPDF_NumberTree::LookupValue(int num) | 476 CPDF_Object* CPDF_NumberTree::LookupValue(int num) |
| 477 { | 477 { |
| 478 return SearchNumberNode(m_pRoot, num); | 478 return SearchNumberNode(m_pRoot, num); |
| 479 } | 479 } |
| OLD | NEW |