Chromium Code Reviews| 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_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
| 9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
| 10 #include "pageint.h" | 10 #include "pageint.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 ((CPDF_Array*)pFilter)->RemoveAt(0); | 432 ((CPDF_Array*)pFilter)->RemoveAt(0); |
| 433 CPDF_Array* pParams = pDict->GetArray(FX_BSTRC("DecodeParms")); | 433 CPDF_Array* pParams = pDict->GetArray(FX_BSTRC("DecodeParms")); |
| 434 if (pParams) { | 434 if (pParams) { |
| 435 pParams->RemoveAt(0); | 435 pParams->RemoveAt(0); |
| 436 } | 436 } |
| 437 } else { | 437 } else { |
| 438 pDict->RemoveAt(FX_BSTRC("Filter")); | 438 pDict->RemoveAt(FX_BSTRC("Filter")); |
| 439 pDict->RemoveAt(FX_BSTRC("DecodeParms")); | 439 pDict->RemoveAt(FX_BSTRC("DecodeParms")); |
| 440 } | 440 } |
| 441 } else { | 441 } else { |
| 442 if (pData) { | |
| 443 FX_Free(pData); | 442 FX_Free(pData); |
| 444 } | |
| 445 FX_DWORD dwSavePos = m_Pos; | 443 FX_DWORD dwSavePos = m_Pos; |
| 446 m_Pos += dwStreamSize; | 444 m_Pos += dwStreamSize; |
| 447 while (1) { | 445 while (1) { |
| 448 FX_DWORD dwPrevPos = m_Pos; | 446 FX_DWORD dwPrevPos = m_Pos; |
| 449 CPDF_StreamParser::SyntaxType type = ParseNextElement(); | 447 CPDF_StreamParser::SyntaxType type = ParseNextElement(); |
| 450 if (type == CPDF_StreamParser::EndOfData) { | 448 if (type == CPDF_StreamParser::EndOfData) { |
| 451 break; | 449 break; |
| 452 } | 450 } |
| 453 if (type != CPDF_StreamParser::Keyword) { | 451 if (type != CPDF_StreamParser::Keyword) { |
| 454 dwStreamSize += m_Pos - dwPrevPos; | 452 dwStreamSize += m_Pos - dwPrevPos; |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 Clear(); | 951 Clear(); |
| 954 } | 952 } |
| 955 void CPDF_ContentParser::Clear() { | 953 void CPDF_ContentParser::Clear() { |
| 956 delete m_pParser; | 954 delete m_pParser; |
| 957 delete m_pSingleStream; | 955 delete m_pSingleStream; |
| 958 if (m_pStreamArray) { | 956 if (m_pStreamArray) { |
| 959 for (FX_DWORD i = 0; i < m_nStreams; i++) | 957 for (FX_DWORD i = 0; i < m_nStreams; i++) |
| 960 delete m_pStreamArray[i]; | 958 delete m_pStreamArray[i]; |
| 961 FX_Free(m_pStreamArray); | 959 FX_Free(m_pStreamArray); |
| 962 } | 960 } |
| 963 if (m_pData && m_pSingleStream == NULL) { | 961 if (!m_pSingleStream) |
| 964 FX_Free((void*)m_pData); | 962 FX_Free((void*)m_pData); |
|
Tom Sepez
2015/08/14 21:21:34
nit: void cast not needed?
Lei Zhang
2015/08/14 21:43:15
Done.
| |
| 965 } | |
| 966 m_pParser = NULL; | 963 m_pParser = NULL; |
| 967 m_pStreamArray = NULL; | 964 m_pStreamArray = NULL; |
| 968 m_pSingleStream = NULL; | 965 m_pSingleStream = NULL; |
| 969 m_pData = NULL; | 966 m_pData = NULL; |
| 970 m_Status = Ready; | 967 m_Status = Ready; |
| 971 } | 968 } |
| 972 void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) { | 969 void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) { |
| 973 if (m_Status != Ready || pPage == NULL || pPage->m_pDocument == NULL || | 970 if (m_Status != Ready || pPage == NULL || pPage->m_pDocument == NULL || |
| 974 pPage->m_pFormDict == NULL) { | 971 pPage->m_pFormDict == NULL) { |
| 975 m_Status = Done; | 972 m_Status = Done; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1176 } | 1173 } |
| 1177 m_Status = Done; | 1174 m_Status = Done; |
| 1178 return; | 1175 return; |
| 1179 } | 1176 } |
| 1180 steps++; | 1177 steps++; |
| 1181 if (pPause && pPause->NeedToPauseNow()) { | 1178 if (pPause && pPause->NeedToPauseNow()) { |
| 1182 break; | 1179 break; |
| 1183 } | 1180 } |
| 1184 } | 1181 } |
| 1185 } | 1182 } |
| OLD | NEW |