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

Side by Side Diff: core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp

Issue 2430743003: in the attempt to fix 627393, changed IFX_FileRead's readBlock to return the length it reads
Patch Set: remove .tmp files Created 4 years, 2 months 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
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 "core/fpdfapi/fpdf_edit/editint.h" 7 #include "core/fpdfapi/fpdf_edit/editint.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 m_iStage = 15; 1488 m_iStage = 15;
1489 } 1489 }
1490 } 1490 }
1491 if (m_iStage == 15) { 1491 if (m_iStage == 15) {
1492 if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) { 1492 if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) {
1493 IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); 1493 IFX_FileRead* pSrcFile = m_pParser->GetFileAccess();
1494 uint8_t buffer[4096]; 1494 uint8_t buffer[4096];
1495 uint32_t src_size = (uint32_t)(uintptr_t)m_Pos; 1495 uint32_t src_size = (uint32_t)(uintptr_t)m_Pos;
1496 while (src_size) { 1496 while (src_size) {
1497 uint32_t block_size = src_size > 4096 ? 4096 : src_size; 1497 uint32_t block_size = src_size > 4096 ? 4096 : src_size;
1498 if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) { 1498 if (pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size) !=
1499 block_size &&
1500 !pSrcFile->IsEOF()) {
1499 return -1; 1501 return -1;
1500 } 1502 }
1501 if (m_File.AppendBlock(buffer, block_size) < 0) { 1503 if (m_File.AppendBlock(buffer, block_size) < 0) {
1502 return -1; 1504 return -1;
1503 } 1505 }
1504 src_size -= block_size; 1506 src_size -= block_size;
1505 if (pPause && pPause->NeedToPauseNow()) { 1507 if (pPause && pPause->NeedToPauseNow()) {
1506 m_Pos = (void*)(uintptr_t)src_size; 1508 m_Pos = (void*)(uintptr_t)src_size;
1507 return 1; 1509 return 1;
1508 } 1510 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 m_pCryptoHandler = nullptr; 2015 m_pCryptoHandler = nullptr;
2014 } 2016 }
2015 void CPDF_Creator::ResetStandardSecurity() { 2017 void CPDF_Creator::ResetStandardSecurity() {
2016 if (!m_bLocalCryptoHandler) 2018 if (!m_bLocalCryptoHandler)
2017 return; 2019 return;
2018 2020
2019 delete m_pCryptoHandler; 2021 delete m_pCryptoHandler;
2020 m_pCryptoHandler = nullptr; 2022 m_pCryptoHandler = nullptr;
2021 m_bLocalCryptoHandler = FALSE; 2023 m_bLocalCryptoHandler = FALSE;
2022 } 2024 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp » ('j') | core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698