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 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
10 #include "../../../../third_party/numerics/safe_math.h" | 10 #include "../../../../third_party/numerics/safe_math.h" |
11 #include "../fpdf_page/pageint.h" | 11 #include "../fpdf_page/pageint.h" |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #define _PARSER_OBJECT_LEVLE_ 64 | |
16 extern const FX_LPCSTR _PDF_CharType; | 15 extern const FX_LPCSTR _PDF_CharType; |
17 FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) | 16 FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) |
18 { | 17 { |
19 CPDF_Object* pType = pDict->GetElementValue(FX_BSTRC("Type")); | 18 CPDF_Object* pType = pDict->GetElementValue(FX_BSTRC("Type")); |
20 if (!pType) { | 19 if (!pType) { |
21 pType = pDict->GetElementValue(FX_BSTRC("FT")); | 20 pType = pDict->GetElementValue(FX_BSTRC("FT")); |
22 if (!pType) { | 21 if (!pType) { |
23 return FALSE; | 22 return FALSE; |
24 } | 23 } |
25 } | 24 } |
(...skipping 10 matching lines...) Expand all Loading... |
36 { | 35 { |
37 FX_FILESIZE ret = (*(FX_FILESIZE*)p1) - (*(FX_FILESIZE*)p2); | 36 FX_FILESIZE ret = (*(FX_FILESIZE*)p1) - (*(FX_FILESIZE*)p2); |
38 if (ret > 0) { | 37 if (ret > 0) { |
39 return 1; | 38 return 1; |
40 } | 39 } |
41 if (ret < 0) { | 40 if (ret < 0) { |
42 return -1; | 41 return -1; |
43 } | 42 } |
44 return 0; | 43 return 0; |
45 } | 44 } |
| 45 |
46 CPDF_Parser::CPDF_Parser() | 46 CPDF_Parser::CPDF_Parser() |
47 { | 47 { |
48 m_pDocument = NULL; | 48 m_pDocument = NULL; |
49 m_pTrailer = NULL; | 49 m_pTrailer = NULL; |
50 m_pEncryptDict = NULL; | 50 m_pEncryptDict = NULL; |
51 m_pSecurityHandler = NULL; | 51 m_pSecurityHandler = NULL; |
52 m_pLinearized = NULL; | 52 m_pLinearized = NULL; |
53 m_dwFirstPageNo = 0; | 53 m_dwFirstPageNo = 0; |
54 m_dwXrefStartObjNum = 0; | 54 m_dwXrefStartObjNum = 0; |
55 m_bOwnFileRead = TRUE; | 55 m_bOwnFileRead = TRUE; |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); | 1214 FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First")); |
1215 CPDF_SyntaxParser syntax; | 1215 CPDF_SyntaxParser syntax; |
1216 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)p
ObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); | 1216 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)p
ObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE)); |
1217 syntax.InitParser((IFX_FileStream*)file, 0); | 1217 syntax.InitParser((IFX_FileStream*)file, 0); |
1218 CPDF_Object* pRet = NULL; | 1218 CPDF_Object* pRet = NULL; |
1219 while (n) { | 1219 while (n) { |
1220 FX_DWORD thisnum = syntax.GetDirectNum(); | 1220 FX_DWORD thisnum = syntax.GetDirectNum(); |
1221 FX_DWORD thisoff = syntax.GetDirectNum(); | 1221 FX_DWORD thisoff = syntax.GetDirectNum(); |
1222 if (thisnum == objnum) { | 1222 if (thisnum == objnum) { |
1223 syntax.RestorePos(offset + thisoff); | 1223 syntax.RestorePos(offset + thisoff); |
1224 pRet = syntax.GetObject(pObjList, 0, 0, 0, pContext); | 1224 pRet = syntax.GetObject(pObjList, 0, 0, pContext); |
1225 break; | 1225 break; |
1226 } | 1226 } |
1227 n --; | 1227 n --; |
1228 } | 1228 } |
1229 return pRet; | 1229 return pRet; |
1230 } | 1230 } |
1231 return NULL; | 1231 return NULL; |
1232 } | 1232 } |
1233 CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) | 1233 CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) |
1234 { | 1234 { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 word = m_Syntax.GetNextWord(bIsNumber); | 1393 word = m_Syntax.GetNextWord(bIsNumber); |
1394 if (!bIsNumber) { | 1394 if (!bIsNumber) { |
1395 m_Syntax.RestorePos(SavedPos); | 1395 m_Syntax.RestorePos(SavedPos); |
1396 return NULL; | 1396 return NULL; |
1397 } | 1397 } |
1398 FX_DWORD parser_gennum = FXSYS_atoi(word); | 1398 FX_DWORD parser_gennum = FXSYS_atoi(word); |
1399 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) { | 1399 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) { |
1400 m_Syntax.RestorePos(SavedPos); | 1400 m_Syntax.RestorePos(SavedPos); |
1401 return NULL; | 1401 return NULL; |
1402 } | 1402 } |
1403 CPDF_Object* pObj = m_Syntax.GetObject(pObjList, objnum, parser_gennum, 0, p
Context); | 1403 CPDF_Object* pObj = m_Syntax.GetObject(pObjList, objnum, parser_gennum, pCon
text); |
1404 FX_FILESIZE endOffset = m_Syntax.SavePos(); | 1404 FX_FILESIZE endOffset = m_Syntax.SavePos(); |
1405 CFX_ByteString bsWord = m_Syntax.GetKeyword(); | 1405 CFX_ByteString bsWord = m_Syntax.GetKeyword(); |
1406 if (bsWord == FX_BSTRC("endobj")) { | 1406 if (bsWord == FX_BSTRC("endobj")) { |
1407 endOffset = m_Syntax.SavePos(); | 1407 endOffset = m_Syntax.SavePos(); |
1408 } | 1408 } |
1409 m_Syntax.RestorePos(SavedPos); | 1409 m_Syntax.RestorePos(SavedPos); |
1410 if (pObj) { | 1410 if (pObj) { |
1411 if (!objnum) { | 1411 if (!objnum) { |
1412 pObj->m_ObjNum = parser_objnum; | 1412 pObj->m_ObjNum = parser_objnum; |
1413 } | 1413 } |
(...skipping 20 matching lines...) Expand all Loading... |
1434 word = m_Syntax.GetNextWord(bIsNumber); | 1434 word = m_Syntax.GetNextWord(bIsNumber); |
1435 if (!bIsNumber) { | 1435 if (!bIsNumber) { |
1436 m_Syntax.RestorePos(SavedPos); | 1436 m_Syntax.RestorePos(SavedPos); |
1437 return NULL; | 1437 return NULL; |
1438 } | 1438 } |
1439 FX_DWORD gennum = FXSYS_atoi(word); | 1439 FX_DWORD gennum = FXSYS_atoi(word); |
1440 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) { | 1440 if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) { |
1441 m_Syntax.RestorePos(SavedPos); | 1441 m_Syntax.RestorePos(SavedPos); |
1442 return NULL; | 1442 return NULL; |
1443 } | 1443 } |
1444 CPDF_Object* pObj = m_Syntax.GetObjectByStrict(pObjList, objnum, gennum, 0,
pContext); | 1444 CPDF_Object* pObj = m_Syntax.GetObjectByStrict(pObjList, objnum, gennum, pCo
ntext); |
1445 if (pResultPos) { | 1445 if (pResultPos) { |
1446 *pResultPos = m_Syntax.m_Pos; | 1446 *pResultPos = m_Syntax.m_Pos; |
1447 } | 1447 } |
1448 m_Syntax.RestorePos(SavedPos); | 1448 m_Syntax.RestorePos(SavedPos); |
1449 return pObj; | 1449 return pObj; |
1450 } | 1450 } |
1451 CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() | 1451 CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() |
1452 { | 1452 { |
1453 if (m_Syntax.GetKeyword() != FX_BSTRC("trailer")) { | 1453 if (m_Syntax.GetKeyword() != FX_BSTRC("trailer")) { |
1454 return NULL; | 1454 return NULL; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 m_ObjectStreamMap.RemoveAll(); | 1673 m_ObjectStreamMap.RemoveAll(); |
1674 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && !
LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1674 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && !
LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1675 m_LastXRefOffset = 0; | 1675 m_LastXRefOffset = 0; |
1676 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum; | 1676 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum; |
1677 return PDFPARSE_ERROR_FORMAT; | 1677 return PDFPARSE_ERROR_FORMAT; |
1678 } | 1678 } |
1679 FXSYS_qsort(m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FI
LESIZE), _CompareFileSize); | 1679 FXSYS_qsort(m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FI
LESIZE), _CompareFileSize); |
1680 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum; | 1680 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum; |
1681 return PDFPARSE_ERROR_SUCCESS; | 1681 return PDFPARSE_ERROR_SUCCESS; |
1682 } | 1682 } |
| 1683 |
| 1684 // static |
| 1685 int CPDF_SyntaxParser::s_CurrentRecursionDepth = 0; |
| 1686 |
1683 CPDF_SyntaxParser::CPDF_SyntaxParser() | 1687 CPDF_SyntaxParser::CPDF_SyntaxParser() |
1684 { | 1688 { |
1685 m_pFileAccess = NULL; | 1689 m_pFileAccess = NULL; |
1686 m_pCryptoHandler = NULL; | 1690 m_pCryptoHandler = NULL; |
1687 m_pFileBuf = NULL; | 1691 m_pFileBuf = NULL; |
1688 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize; | 1692 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize; |
1689 m_pFileBuf = NULL; | 1693 m_pFileBuf = NULL; |
1690 m_MetadataObjnum = 0; | 1694 m_MetadataObjnum = 0; |
1691 m_dwWordPos = 0; | 1695 m_dwWordPos = 0; |
1692 m_bFileStream = FALSE; | 1696 m_bFileStream = FALSE; |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 { | 2050 { |
2047 GetNextWord(); | 2051 GetNextWord(); |
2048 bIsNumber = m_bIsNumber; | 2052 bIsNumber = m_bIsNumber; |
2049 return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); | 2053 return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); |
2050 } | 2054 } |
2051 CFX_ByteString CPDF_SyntaxParser::GetKeyword() | 2055 CFX_ByteString CPDF_SyntaxParser::GetKeyword() |
2052 { | 2056 { |
2053 GetNextWord(); | 2057 GetNextWord(); |
2054 return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); | 2058 return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize); |
2055 } | 2059 } |
2056 CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
RD objnum, FX_DWORD gennum, FX_INT32 level, PARSE_CONTEXT* pContext, FX_BOOL bDe
crypt) | 2060 CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
RD objnum, FX_DWORD gennum, PARSE_CONTEXT* pContext, FX_BOOL bDecrypt) |
2057 { | 2061 { |
2058 if (level > _PARSER_OBJECT_LEVLE_) { | 2062 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); |
| 2063 if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) { |
2059 return NULL; | 2064 return NULL; |
2060 } | 2065 } |
2061 FX_FILESIZE SavedPos = m_Pos; | 2066 FX_FILESIZE SavedPos = m_Pos; |
2062 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY); | 2067 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY); |
2063 FX_BOOL bIsNumber; | 2068 FX_BOOL bIsNumber; |
2064 CFX_ByteString word = GetNextWord(bIsNumber); | 2069 CFX_ByteString word = GetNextWord(bIsNumber); |
2065 CPDF_Object* pRet = NULL; | 2070 CPDF_Object* pRet = NULL; |
2066 if (word.GetLength() == 0) { | 2071 if (word.GetLength() == 0) { |
2067 if (bTypeOnly) { | 2072 if (bTypeOnly) { |
2068 return (CPDF_Object*)PDFOBJ_INVALID; | 2073 return (CPDF_Object*)PDFOBJ_INVALID; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 } | 2138 } |
2134 pRet = CPDF_String::Create(str, TRUE); | 2139 pRet = CPDF_String::Create(str, TRUE); |
2135 return pRet; | 2140 return pRet; |
2136 } | 2141 } |
2137 if (word == FX_BSTRC("[")) { | 2142 if (word == FX_BSTRC("[")) { |
2138 if (bTypeOnly) { | 2143 if (bTypeOnly) { |
2139 return (CPDF_Object*)PDFOBJ_ARRAY; | 2144 return (CPDF_Object*)PDFOBJ_ARRAY; |
2140 } | 2145 } |
2141 CPDF_Array* pArray = CPDF_Array::Create(); | 2146 CPDF_Array* pArray = CPDF_Array::Create(); |
2142 while (1) { | 2147 while (1) { |
2143 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, level + 1); | 2148 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); |
2144 if (pObj == NULL) { | 2149 if (pObj == NULL) { |
2145 return pArray; | 2150 return pArray; |
2146 } | 2151 } |
2147 pArray->Add(pObj); | 2152 pArray->Add(pObj); |
2148 } | 2153 } |
2149 } | 2154 } |
2150 if (word[0] == '/') { | 2155 if (word[0] == '/') { |
2151 if (bTypeOnly) { | 2156 if (bTypeOnly) { |
2152 return (CPDF_Object*)PDFOBJ_NAME; | 2157 return (CPDF_Object*)PDFOBJ_NAME; |
2153 } | 2158 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 break; | 2190 break; |
2186 } | 2191 } |
2187 if (key[0] != '/') { | 2192 if (key[0] != '/') { |
2188 continue; | 2193 continue; |
2189 } | 2194 } |
2190 nKeys ++; | 2195 nKeys ++; |
2191 key = PDF_NameDecode(key); | 2196 key = PDF_NameDecode(key); |
2192 if (key == FX_BSTRC("/Contents")) { | 2197 if (key == FX_BSTRC("/Contents")) { |
2193 dwSignValuePos = m_Pos; | 2198 dwSignValuePos = m_Pos; |
2194 } | 2199 } |
2195 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, level + 1); | 2200 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); |
2196 if (pObj == NULL) { | 2201 if (pObj == NULL) { |
2197 continue; | 2202 continue; |
2198 } | 2203 } |
2199 if (key.GetLength() >= 1) { | 2204 if (key.GetLength() >= 1) { |
2200 if (nKeys < 32) { | 2205 if (nKeys < 32) { |
2201 pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength(
) - 1), pObj); | 2206 pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength(
) - 1), pObj); |
2202 } else { | 2207 } else { |
2203 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLeng
th() - 1), pObj); | 2208 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLeng
th() - 1), pObj); |
2204 } | 2209 } |
2205 } | 2210 } |
2206 } | 2211 } |
2207 if (IsSignatureDict(pDict)) { | 2212 if (IsSignatureDict(pDict)) { |
2208 FX_FILESIZE dwSavePos = m_Pos; | 2213 FX_FILESIZE dwSavePos = m_Pos; |
2209 m_Pos = dwSignValuePos; | 2214 m_Pos = dwSignValuePos; |
2210 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, level + 1, N
ULL, FALSE); | 2215 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, FALSE)
; |
2211 pDict->SetAt(FX_BSTRC("Contents"), pObj); | 2216 pDict->SetAt(FX_BSTRC("Contents"), pObj); |
2212 m_Pos = dwSavePos; | 2217 m_Pos = dwSavePos; |
2213 } | 2218 } |
2214 if (pContext) { | 2219 if (pContext) { |
2215 pContext->m_DictEnd = m_Pos; | 2220 pContext->m_DictEnd = m_Pos; |
2216 if (pContext->m_Flags & PDFPARSE_NOSTREAM) { | 2221 if (pContext->m_Flags & PDFPARSE_NOSTREAM) { |
2217 return pDict; | 2222 return pDict; |
2218 } | 2223 } |
2219 } | 2224 } |
2220 FX_FILESIZE SavedPos = m_Pos; | 2225 FX_FILESIZE SavedPos = m_Pos; |
(...skipping 14 matching lines...) Expand all Loading... |
2235 } | 2240 } |
2236 if (word == FX_BSTRC(">>")) { | 2241 if (word == FX_BSTRC(">>")) { |
2237 m_Pos = SavedPos; | 2242 m_Pos = SavedPos; |
2238 return NULL; | 2243 return NULL; |
2239 } | 2244 } |
2240 if (bTypeOnly) { | 2245 if (bTypeOnly) { |
2241 return (CPDF_Object*)PDFOBJ_INVALID; | 2246 return (CPDF_Object*)PDFOBJ_INVALID; |
2242 } | 2247 } |
2243 return NULL; | 2248 return NULL; |
2244 } | 2249 } |
2245 CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
, FX_DWORD objnum, FX_DWORD gennum, | 2250 CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
, FX_DWORD objnum, FX_DWORD gennum, struct PARSE_CONTEXT* pContext) |
2246 FX_INT32 level, struct PARSE_CONTEXT* pContext) | |
2247 { | 2251 { |
2248 if (level > _PARSER_OBJECT_LEVLE_) { | 2252 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); |
| 2253 if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) { |
2249 return NULL; | 2254 return NULL; |
2250 } | 2255 } |
2251 FX_FILESIZE SavedPos = m_Pos; | 2256 FX_FILESIZE SavedPos = m_Pos; |
2252 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY); | 2257 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY); |
2253 FX_BOOL bIsNumber; | 2258 FX_BOOL bIsNumber; |
2254 CFX_ByteString word = GetNextWord(bIsNumber); | 2259 CFX_ByteString word = GetNextWord(bIsNumber); |
2255 if (word.GetLength() == 0) { | 2260 if (word.GetLength() == 0) { |
2256 if (bTypeOnly) { | 2261 if (bTypeOnly) { |
2257 return (CPDF_Object*)PDFOBJ_INVALID; | 2262 return (CPDF_Object*)PDFOBJ_INVALID; |
2258 } | 2263 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2315 m_pCryptoHandler->Decrypt(objnum, gennum, str); | 2320 m_pCryptoHandler->Decrypt(objnum, gennum, str); |
2316 } | 2321 } |
2317 return CPDF_String::Create(str, TRUE); | 2322 return CPDF_String::Create(str, TRUE); |
2318 } | 2323 } |
2319 if (word == FX_BSTRC("[")) { | 2324 if (word == FX_BSTRC("[")) { |
2320 if (bTypeOnly) { | 2325 if (bTypeOnly) { |
2321 return (CPDF_Object*)PDFOBJ_ARRAY; | 2326 return (CPDF_Object*)PDFOBJ_ARRAY; |
2322 } | 2327 } |
2323 CPDF_Array* pArray = CPDF_Array::Create(); | 2328 CPDF_Array* pArray = CPDF_Array::Create(); |
2324 while (1) { | 2329 while (1) { |
2325 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, level + 1); | 2330 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); |
2326 if (pObj == NULL) { | 2331 if (pObj == NULL) { |
2327 if (m_WordBuffer[0] == ']') { | 2332 if (m_WordBuffer[0] == ']') { |
2328 return pArray; | 2333 return pArray; |
2329 } | 2334 } |
2330 if (pArray) | 2335 if (pArray) |
2331 pArray->Release(); | 2336 pArray->Release(); |
2332 return NULL; | 2337 return NULL; |
2333 } | 2338 } |
2334 pArray->Add(pObj); | 2339 pArray->Add(pObj); |
2335 } | 2340 } |
(...skipping 25 matching lines...) Expand all Loading... |
2361 break; | 2366 break; |
2362 } | 2367 } |
2363 if (key == FX_BSTRC("endobj")) { | 2368 if (key == FX_BSTRC("endobj")) { |
2364 m_Pos = SavedPos; | 2369 m_Pos = SavedPos; |
2365 break; | 2370 break; |
2366 } | 2371 } |
2367 if (key[0] != '/') { | 2372 if (key[0] != '/') { |
2368 continue; | 2373 continue; |
2369 } | 2374 } |
2370 key = PDF_NameDecode(key); | 2375 key = PDF_NameDecode(key); |
2371 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, level + 1); | 2376 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); |
2372 if (pObj == NULL) { | 2377 if (pObj == NULL) { |
2373 if (pDict) | 2378 if (pDict) |
2374 pDict->Release(); | 2379 pDict->Release(); |
2375 FX_BYTE ch; | 2380 FX_BYTE ch; |
2376 while (1) { | 2381 while (1) { |
2377 if (!GetNextChar(ch)) { | 2382 if (!GetNextChar(ch)) { |
2378 break; | 2383 break; |
2379 } | 2384 } |
2380 if (ch == 0x0A || ch == 0x0D) { | 2385 if (ch == 0x0A || ch == 0x0D) { |
2381 break; | 2386 break; |
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4628 { | 4633 { |
4629 FX_INT32 iSize = m_childNode.GetSize(); | 4634 FX_INT32 iSize = m_childNode.GetSize(); |
4630 for (FX_INT32 i = 0; i < iSize; ++i) { | 4635 for (FX_INT32 i = 0; i < iSize; ++i) { |
4631 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4636 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4632 if (pNode) { | 4637 if (pNode) { |
4633 delete pNode; | 4638 delete pNode; |
4634 } | 4639 } |
4635 } | 4640 } |
4636 m_childNode.RemoveAll(); | 4641 m_childNode.RemoveAll(); |
4637 } | 4642 } |
OLD | NEW |