Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 1417583007: Merge to XFA: Use static_cast for various CPDF_Object conversions. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 FX_BOOL bDecrypt) { 2039 FX_BOOL bDecrypt) {
2040 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); 2040 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
2041 if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) { 2041 if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) {
2042 return NULL; 2042 return NULL;
2043 } 2043 }
2044 FX_FILESIZE SavedPos = m_Pos; 2044 FX_FILESIZE SavedPos = m_Pos;
2045 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY); 2045 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
2046 FX_BOOL bIsNumber; 2046 FX_BOOL bIsNumber;
2047 CFX_ByteString word = GetNextWord(bIsNumber); 2047 CFX_ByteString word = GetNextWord(bIsNumber);
2048 if (word.GetLength() == 0) { 2048 if (word.GetLength() == 0) {
2049 if (bTypeOnly) { 2049 if (bTypeOnly)
2050 return (CPDF_Object*)PDFOBJ_INVALID; 2050 return (CPDF_Object*)PDFOBJ_INVALID;
2051 }
2052 return NULL; 2051 return NULL;
2053 } 2052 }
2054 if (bIsNumber) { 2053 if (bIsNumber) {
2055 FX_FILESIZE SavedPos = m_Pos; 2054 FX_FILESIZE SavedPos = m_Pos;
2056 CFX_ByteString nextword = GetNextWord(bIsNumber); 2055 CFX_ByteString nextword = GetNextWord(bIsNumber);
2057 if (bIsNumber) { 2056 if (bIsNumber) {
2058 CFX_ByteString nextword2 = GetNextWord(bIsNumber); 2057 CFX_ByteString nextword2 = GetNextWord(bIsNumber);
2059 if (nextword2 == FX_BSTRC("R")) { 2058 if (nextword2 == FX_BSTRC("R")) {
2060 FX_DWORD objnum = FXSYS_atoi(word); 2059 FX_DWORD objnum = FXSYS_atoi(word);
2061 if (bTypeOnly) { 2060 if (bTypeOnly)
2062 return (CPDF_Object*)PDFOBJ_REFERENCE; 2061 return (CPDF_Object*)PDFOBJ_REFERENCE;
2063 }
2064 return new CPDF_Reference(pObjList, objnum); 2062 return new CPDF_Reference(pObjList, objnum);
2065 } 2063 }
2066 } 2064 }
2067 m_Pos = SavedPos; 2065 m_Pos = SavedPos;
2068 if (bTypeOnly) { 2066 if (bTypeOnly)
2069 return (CPDF_Object*)PDFOBJ_NUMBER; 2067 return (CPDF_Object*)PDFOBJ_NUMBER;
2070 }
2071 return CPDF_Number::Create(word); 2068 return CPDF_Number::Create(word);
2072 } 2069 }
2073 if (word == FX_BSTRC("true") || word == FX_BSTRC("false")) { 2070 if (word == FX_BSTRC("true") || word == FX_BSTRC("false")) {
2074 if (bTypeOnly) { 2071 if (bTypeOnly)
2075 return (CPDF_Object*)PDFOBJ_BOOLEAN; 2072 return (CPDF_Object*)PDFOBJ_BOOLEAN;
2076 }
2077 return CPDF_Boolean::Create(word == FX_BSTRC("true")); 2073 return CPDF_Boolean::Create(word == FX_BSTRC("true"));
2078 } 2074 }
2079 if (word == FX_BSTRC("null")) { 2075 if (word == FX_BSTRC("null")) {
2080 if (bTypeOnly) { 2076 if (bTypeOnly)
2081 return (CPDF_Object*)PDFOBJ_NULL; 2077 return (CPDF_Object*)PDFOBJ_NULL;
2082 }
2083 return CPDF_Null::Create(); 2078 return CPDF_Null::Create();
2084 } 2079 }
2085 if (word == FX_BSTRC("(")) { 2080 if (word == FX_BSTRC("(")) {
2086 if (bTypeOnly) { 2081 if (bTypeOnly)
2087 return (CPDF_Object*)PDFOBJ_STRING; 2082 return (CPDF_Object*)PDFOBJ_STRING;
2088 }
2089 CFX_ByteString str = ReadString(); 2083 CFX_ByteString str = ReadString();
2090 if (m_pCryptoHandler && bDecrypt) { 2084 if (m_pCryptoHandler && bDecrypt) {
2091 m_pCryptoHandler->Decrypt(objnum, gennum, str); 2085 m_pCryptoHandler->Decrypt(objnum, gennum, str);
2092 } 2086 }
2093 return CPDF_String::Create(str, FALSE); 2087 return CPDF_String::Create(str, FALSE);
2094 } 2088 }
2095 if (word == FX_BSTRC("<")) { 2089 if (word == FX_BSTRC("<")) {
2096 if (bTypeOnly) { 2090 if (bTypeOnly)
2097 return (CPDF_Object*)PDFOBJ_STRING; 2091 return (CPDF_Object*)PDFOBJ_STRING;
2098 }
2099 CFX_ByteString str = ReadHexString(); 2092 CFX_ByteString str = ReadHexString();
2100 if (m_pCryptoHandler && bDecrypt) { 2093 if (m_pCryptoHandler && bDecrypt) {
2101 m_pCryptoHandler->Decrypt(objnum, gennum, str); 2094 m_pCryptoHandler->Decrypt(objnum, gennum, str);
2102 } 2095 }
2103 return CPDF_String::Create(str, TRUE); 2096 return CPDF_String::Create(str, TRUE);
2104 } 2097 }
2105 if (word == FX_BSTRC("[")) { 2098 if (word == FX_BSTRC("[")) {
2106 if (bTypeOnly) { 2099 if (bTypeOnly)
2107 return (CPDF_Object*)PDFOBJ_ARRAY; 2100 return (CPDF_Object*)PDFOBJ_ARRAY;
2108 }
2109 CPDF_Array* pArray = CPDF_Array::Create(); 2101 CPDF_Array* pArray = CPDF_Array::Create();
2110 while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum)) 2102 while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum))
2111 pArray->Add(pObj); 2103 pArray->Add(pObj);
2112 2104
2113 return pArray; 2105 return pArray;
2114 } 2106 }
2115 if (word[0] == '/') { 2107 if (word[0] == '/') {
2116 if (bTypeOnly) { 2108 if (bTypeOnly)
2117 return (CPDF_Object*)PDFOBJ_NAME; 2109 return (CPDF_Object*)PDFOBJ_NAME;
2118 }
2119 return CPDF_Name::Create( 2110 return CPDF_Name::Create(
2120 PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1))); 2111 PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
2121 } 2112 }
2122 if (word == FX_BSTRC("<<")) { 2113 if (word == FX_BSTRC("<<")) {
2123 if (bTypeOnly) 2114 if (bTypeOnly)
2124 return (CPDF_Object*)PDFOBJ_DICTIONARY; 2115 return (CPDF_Object*)PDFOBJ_DICTIONARY;
2125 2116
2126 if (pContext) 2117 if (pContext)
2127 pContext->m_DictStart = SavedPos; 2118 pContext->m_DictStart = SavedPos;
2128 2119
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 struct PARSE_CONTEXT* pContext) { 2203 struct PARSE_CONTEXT* pContext) {
2213 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); 2204 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
2214 if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) { 2205 if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) {
2215 return NULL; 2206 return NULL;
2216 } 2207 }
2217 FX_FILESIZE SavedPos = m_Pos; 2208 FX_FILESIZE SavedPos = m_Pos;
2218 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY); 2209 FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
2219 FX_BOOL bIsNumber; 2210 FX_BOOL bIsNumber;
2220 CFX_ByteString word = GetNextWord(bIsNumber); 2211 CFX_ByteString word = GetNextWord(bIsNumber);
2221 if (word.GetLength() == 0) { 2212 if (word.GetLength() == 0) {
2222 if (bTypeOnly) { 2213 if (bTypeOnly)
2223 return (CPDF_Object*)PDFOBJ_INVALID; 2214 return (CPDF_Object*)PDFOBJ_INVALID;
2224 } 2215 return nullptr;
2225 return NULL;
2226 } 2216 }
2227 if (bIsNumber) { 2217 if (bIsNumber) {
2228 FX_FILESIZE SavedPos = m_Pos; 2218 FX_FILESIZE SavedPos = m_Pos;
2229 CFX_ByteString nextword = GetNextWord(bIsNumber); 2219 CFX_ByteString nextword = GetNextWord(bIsNumber);
2230 if (bIsNumber) { 2220 if (bIsNumber) {
2231 CFX_ByteString nextword2 = GetNextWord(bIsNumber); 2221 CFX_ByteString nextword2 = GetNextWord(bIsNumber);
2232 if (nextword2 == FX_BSTRC("R")) { 2222 if (nextword2 == FX_BSTRC("R")) {
2233 if (bTypeOnly) { 2223 if (bTypeOnly)
2234 return (CPDF_Object*)PDFOBJ_REFERENCE; 2224 return (CPDF_Object*)PDFOBJ_REFERENCE;
2235 }
2236 FX_DWORD objnum = FXSYS_atoi(word); 2225 FX_DWORD objnum = FXSYS_atoi(word);
2237 return new CPDF_Reference(pObjList, objnum); 2226 return new CPDF_Reference(pObjList, objnum);
2238 } 2227 }
2239 } 2228 }
2240 m_Pos = SavedPos; 2229 m_Pos = SavedPos;
2241 if (bTypeOnly) { 2230 if (bTypeOnly)
2242 return (CPDF_Object*)PDFOBJ_NUMBER; 2231 return (CPDF_Object*)PDFOBJ_NUMBER;
2243 }
2244 return CPDF_Number::Create(word); 2232 return CPDF_Number::Create(word);
2245 } 2233 }
2246 if (word == FX_BSTRC("true") || word == FX_BSTRC("false")) { 2234 if (word == FX_BSTRC("true") || word == FX_BSTRC("false")) {
2247 if (bTypeOnly) { 2235 if (bTypeOnly)
2248 return (CPDF_Object*)PDFOBJ_BOOLEAN; 2236 return (CPDF_Object*)PDFOBJ_BOOLEAN;
2249 }
2250 return CPDF_Boolean::Create(word == FX_BSTRC("true")); 2237 return CPDF_Boolean::Create(word == FX_BSTRC("true"));
2251 } 2238 }
2252 if (word == FX_BSTRC("null")) { 2239 if (word == FX_BSTRC("null")) {
2253 if (bTypeOnly) { 2240 if (bTypeOnly)
2254 return (CPDF_Object*)PDFOBJ_NULL; 2241 return (CPDF_Object*)PDFOBJ_NULL;
2255 }
2256 return CPDF_Null::Create(); 2242 return CPDF_Null::Create();
2257 } 2243 }
2258 if (word == FX_BSTRC("(")) { 2244 if (word == FX_BSTRC("(")) {
2259 if (bTypeOnly) { 2245 if (bTypeOnly)
2260 return (CPDF_Object*)PDFOBJ_STRING; 2246 return (CPDF_Object*)PDFOBJ_STRING;
2261 }
2262 CFX_ByteString str = ReadString(); 2247 CFX_ByteString str = ReadString();
2263 if (m_pCryptoHandler) { 2248 if (m_pCryptoHandler)
2264 m_pCryptoHandler->Decrypt(objnum, gennum, str); 2249 m_pCryptoHandler->Decrypt(objnum, gennum, str);
2265 }
2266 return CPDF_String::Create(str, FALSE); 2250 return CPDF_String::Create(str, FALSE);
2267 } 2251 }
2268 if (word == FX_BSTRC("<")) { 2252 if (word == FX_BSTRC("<")) {
2269 if (bTypeOnly) { 2253 if (bTypeOnly)
2270 return (CPDF_Object*)PDFOBJ_STRING; 2254 return (CPDF_Object*)PDFOBJ_STRING;
2271 }
2272 CFX_ByteString str = ReadHexString(); 2255 CFX_ByteString str = ReadHexString();
2273 if (m_pCryptoHandler) { 2256 if (m_pCryptoHandler)
2274 m_pCryptoHandler->Decrypt(objnum, gennum, str); 2257 m_pCryptoHandler->Decrypt(objnum, gennum, str);
2275 }
2276 return CPDF_String::Create(str, TRUE); 2258 return CPDF_String::Create(str, TRUE);
2277 } 2259 }
2278 if (word == FX_BSTRC("[")) { 2260 if (word == FX_BSTRC("[")) {
2279 if (bTypeOnly) { 2261 if (bTypeOnly)
2280 return (CPDF_Object*)PDFOBJ_ARRAY; 2262 return (CPDF_Object*)PDFOBJ_ARRAY;
2281 }
2282 nonstd::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( 2263 nonstd::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray(
2283 CPDF_Array::Create()); 2264 CPDF_Array::Create());
2284 while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum)) 2265 while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum))
2285 pArray->Add(pObj); 2266 pArray->Add(pObj);
2286 return m_WordBuffer[0] == ']' ? pArray.release() : nullptr; 2267 return m_WordBuffer[0] == ']' ? pArray.release() : nullptr;
2287 } 2268 }
2288 if (word[0] == '/') { 2269 if (word[0] == '/') {
2289 if (bTypeOnly) { 2270 if (bTypeOnly)
2290 return (CPDF_Object*)PDFOBJ_NAME; 2271 return (CPDF_Object*)PDFOBJ_NAME;
2291 }
2292 return CPDF_Name::Create( 2272 return CPDF_Name::Create(
2293 PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1))); 2273 PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
2294 } 2274 }
2295 if (word == FX_BSTRC("<<")) { 2275 if (word == FX_BSTRC("<<")) {
2296 if (bTypeOnly) { 2276 if (bTypeOnly)
2297 return (CPDF_Object*)PDFOBJ_DICTIONARY; 2277 return (CPDF_Object*)PDFOBJ_DICTIONARY;
2298 } 2278 if (pContext)
2299 if (pContext) {
2300 pContext->m_DictStart = SavedPos; 2279 pContext->m_DictStart = SavedPos;
2301 } 2280
2302 nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( 2281 nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict(
2303 CPDF_Dictionary::Create()); 2282 CPDF_Dictionary::Create());
2304 while (1) { 2283 while (1) {
2305 FX_BOOL bIsNumber; 2284 FX_BOOL bIsNumber;
2306 FX_FILESIZE SavedPos = m_Pos; 2285 FX_FILESIZE SavedPos = m_Pos;
2307 CFX_ByteString key = GetNextWord(bIsNumber); 2286 CFX_ByteString key = GetNextWord(bIsNumber);
2308 if (key.IsEmpty()) 2287 if (key.IsEmpty())
2309 return nullptr; 2288 return nullptr;
2310 2289
2311 if (key == FX_BSTRC(">>")) 2290 if (key == FX_BSTRC(">>"))
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 } 2326 }
2348 2327
2349 return ReadStream(pDict.release(), pContext, objnum, gennum); 2328 return ReadStream(pDict.release(), pContext, objnum, gennum);
2350 } 2329 }
2351 if (word == FX_BSTRC(">>")) { 2330 if (word == FX_BSTRC(">>")) {
2352 m_Pos = SavedPos; 2331 m_Pos = SavedPos;
2353 return nullptr; 2332 return nullptr;
2354 } 2333 }
2355 if (bTypeOnly) 2334 if (bTypeOnly)
2356 return (CPDF_Object*)PDFOBJ_INVALID; 2335 return (CPDF_Object*)PDFOBJ_INVALID;
2357
2358 return nullptr; 2336 return nullptr;
2359 } 2337 }
2360 2338
2361 unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) { 2339 unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) {
2362 unsigned char byte1 = 0; 2340 unsigned char byte1 = 0;
2363 unsigned char byte2 = 0; 2341 unsigned char byte2 = 0;
2364 GetCharAt(pos, byte1); 2342 GetCharAt(pos, byte1);
2365 GetCharAt(pos + 1, byte2); 2343 GetCharAt(pos + 1, byte2);
2366 unsigned int markers = 0; 2344 unsigned int markers = 0;
2367 if (byte1 == '\r' && byte2 == '\n') { 2345 if (byte1 == '\r' && byte2 == '\n') {
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 } 2962 }
2985 if (m_pRoot) { 2963 if (m_pRoot) {
2986 m_pRoot->Release(); 2964 m_pRoot->Release();
2987 } 2965 }
2988 if (m_pTrailer) { 2966 if (m_pTrailer) {
2989 m_pTrailer->Release(); 2967 m_pTrailer->Release();
2990 } 2968 }
2991 int32_t i = 0; 2969 int32_t i = 0;
2992 int32_t iSize = m_arrayAcroforms.GetSize(); 2970 int32_t iSize = m_arrayAcroforms.GetSize();
2993 for (i = 0; i < iSize; ++i) { 2971 for (i = 0; i < iSize; ++i) {
2994 ((CPDF_Object*)m_arrayAcroforms.GetAt(i))->Release(); 2972 static_cast<CPDF_Object*>(m_arrayAcroforms.GetAt(i))->Release();
2995 } 2973 }
2996 } 2974 }
2997 void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) { 2975 void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
2998 m_pDocument = pDoc; 2976 m_pDocument = pDoc;
2999 } 2977 }
3000 FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) { 2978 FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) {
3001 CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser()); 2979 CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser());
3002 if (pParser == NULL) { 2980 if (pParser == NULL) {
3003 return 0; 2981 return 0;
3004 } 2982 }
(...skipping 27 matching lines...) Expand all
3032 FX_BOOL bParsePage, 3010 FX_BOOL bParsePage,
3033 IFX_DownloadHints* pHints, 3011 IFX_DownloadHints* pHints,
3034 CFX_PtrArray& ret_array) { 3012 CFX_PtrArray& ret_array) {
3035 if (!obj_array.GetSize()) { 3013 if (!obj_array.GetSize()) {
3036 return TRUE; 3014 return TRUE;
3037 } 3015 }
3038 FX_DWORD count = 0; 3016 FX_DWORD count = 0;
3039 CFX_PtrArray new_obj_array; 3017 CFX_PtrArray new_obj_array;
3040 int32_t i = 0; 3018 int32_t i = 0;
3041 for (i = 0; i < obj_array.GetSize(); i++) { 3019 for (i = 0; i < obj_array.GetSize(); i++) {
3042 CPDF_Object* pObj = (CPDF_Object*)obj_array[i]; 3020 CPDF_Object* pObj = static_cast<CPDF_Object*>(obj_array[i]);
3043 if (!pObj) { 3021 if (!pObj)
3044 continue; 3022 continue;
3045 } 3023
3046 int32_t type = pObj->GetType(); 3024 int32_t type = pObj->GetType();
3047 switch (type) { 3025 switch (type) {
3048 case PDFOBJ_ARRAY: { 3026 case PDFOBJ_ARRAY: {
3049 CPDF_Array* pArray = pObj->GetArray(); 3027 CPDF_Array* pArray = pObj->GetArray();
3050 for (FX_DWORD k = 0; k < pArray->GetCount(); k++) { 3028 for (FX_DWORD k = 0; k < pArray->GetCount(); k++) {
3051 new_obj_array.Add(pArray->GetElement(k)); 3029 new_obj_array.Add(pArray->GetElement(k));
3052 } 3030 }
3053 } break; 3031 } break;
3054 case PDFOBJ_STREAM: 3032 case PDFOBJ_STREAM:
3055 pObj = pObj->GetDict(); 3033 pObj = pObj->GetDict();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 if (pReferred) { 3081 if (pReferred) {
3104 new_obj_array.Add(pReferred); 3082 new_obj_array.Add(pReferred);
3105 } 3083 }
3106 } 3084 }
3107 } break; 3085 } break;
3108 } 3086 }
3109 } 3087 }
3110 if (count > 0) { 3088 if (count > 0) {
3111 int32_t iSize = new_obj_array.GetSize(); 3089 int32_t iSize = new_obj_array.GetSize();
3112 for (i = 0; i < iSize; ++i) { 3090 for (i = 0; i < iSize; ++i) {
3113 CPDF_Object* pObj = (CPDF_Object*)new_obj_array[i]; 3091 CPDF_Object* pObj = static_cast<CPDF_Object*>(new_obj_array[i]);
3114 if (CPDF_Reference* pRef = pObj->AsReference()) { 3092 if (CPDF_Reference* pRef = pObj->AsReference()) {
3115 FX_DWORD dwNum = pRef->GetRefObjNum(); 3093 FX_DWORD dwNum = pRef->GetRefObjNum();
3116 if (!m_objnum_array.Find(dwNum)) 3094 if (!m_objnum_array.Find(dwNum))
3117 ret_array.Add(pObj); 3095 ret_array.Add(pObj);
3118 } else { 3096 } else {
3119 ret_array.Add(pObj); 3097 ret_array.Add(pObj);
3120 } 3098 }
3121 } 3099 }
3122 return FALSE; 3100 return FALSE;
3123 } 3101 }
(...skipping 25 matching lines...) Expand all
3149 if (bRet) { 3127 if (bRet) {
3150 m_objs_array.RemoveAll(); 3128 m_objs_array.RemoveAll();
3151 } 3129 }
3152 return bRet; 3130 return bRet;
3153 } 3131 }
3154 CFX_PtrArray new_objs_array; 3132 CFX_PtrArray new_objs_array;
3155 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array); 3133 FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
3156 if (bRet) { 3134 if (bRet) {
3157 int32_t iSize = m_arrayAcroforms.GetSize(); 3135 int32_t iSize = m_arrayAcroforms.GetSize();
3158 for (int32_t i = 0; i < iSize; ++i) { 3136 for (int32_t i = 0; i < iSize; ++i) {
3159 ((CPDF_Object*)m_arrayAcroforms.GetAt(i))->Release(); 3137 static_cast<CPDF_Object*>(m_arrayAcroforms.GetAt(i))->Release();
3160 } 3138 }
3161 m_arrayAcroforms.RemoveAll(); 3139 m_arrayAcroforms.RemoveAll();
3162 } else { 3140 } else {
3163 m_objs_array.RemoveAll(); 3141 m_objs_array.RemoveAll();
3164 m_objs_array.Append(new_objs_array); 3142 m_objs_array.Append(new_objs_array);
3165 } 3143 }
3166 return bRet; 3144 return bRet;
3167 } 3145 }
3168 FX_BOOL CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints) { 3146 FX_BOOL CPDF_DataAvail::CheckAcroForm(IFX_DownloadHints* pHints) {
3169 FX_BOOL bExist = FALSE; 3147 FX_BOOL bExist = FALSE;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3462 } 3440 }
3463 pObj->Release(); 3441 pObj->Release();
3464 } 3442 }
3465 m_PageObjList.RemoveAll(); 3443 m_PageObjList.RemoveAll();
3466 if (UnavailObjList.GetSize()) { 3444 if (UnavailObjList.GetSize()) {
3467 m_PageObjList.Append(UnavailObjList); 3445 m_PageObjList.Append(UnavailObjList);
3468 return FALSE; 3446 return FALSE;
3469 } 3447 }
3470 FX_DWORD iPages = m_PagesArray.GetSize(); 3448 FX_DWORD iPages = m_PagesArray.GetSize();
3471 for (FX_DWORD i = 0; i < iPages; i++) { 3449 for (FX_DWORD i = 0; i < iPages; i++) {
3472 CPDF_Object* pPages = (CPDF_Object*)m_PagesArray.GetAt(i); 3450 CPDF_Object* pPages = static_cast<CPDF_Object*>(m_PagesArray.GetAt(i));
3473 if (!pPages) { 3451 if (!pPages)
3474 continue; 3452 continue;
3475 } 3453
3476 if (!GetPageKids(m_pCurrentParser, pPages)) { 3454 if (!GetPageKids(m_pCurrentParser, pPages)) {
3477 pPages->Release(); 3455 pPages->Release();
3478 while (++i < iPages) { 3456 while (++i < iPages) {
3479 pPages = (CPDF_Object*)m_PagesArray.GetAt(i); 3457 pPages = static_cast<CPDF_Object*>(m_PagesArray.GetAt(i));
3480 pPages->Release(); 3458 pPages->Release();
3481 } 3459 }
3482 m_PagesArray.RemoveAll(); 3460 m_PagesArray.RemoveAll();
3483 m_docStatus = PDF_DATAAVAIL_ERROR; 3461 m_docStatus = PDF_DATAAVAIL_ERROR;
3484 return FALSE; 3462 return FALSE;
3485 } 3463 }
3486 pPages->Release(); 3464 pPages->Release();
3487 } 3465 }
3488 m_PagesArray.RemoveAll(); 3466 m_PagesArray.RemoveAll();
3489 if (!m_PageObjList.GetSize()) { 3467 if (!m_PageObjList.GetSize()) {
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
4583 return FALSE; 4561 return FALSE;
4584 } 4562 }
4585 CPDF_PageNode::~CPDF_PageNode() { 4563 CPDF_PageNode::~CPDF_PageNode() {
4586 int32_t iSize = m_childNode.GetSize(); 4564 int32_t iSize = m_childNode.GetSize();
4587 for (int32_t i = 0; i < iSize; ++i) { 4565 for (int32_t i = 0; i < iSize; ++i) {
4588 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; 4566 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i];
4589 delete pNode; 4567 delete pNode;
4590 } 4568 }
4591 m_childNode.RemoveAll(); 4569 m_childNode.RemoveAll();
4592 } 4570 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698