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

Side by Side Diff: core/fpdfapi/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: delete the include folder Created 4 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
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/edit/editint.h" 7 #include "core/fpdfapi/edit/editint.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 m_iStage = 15; 1487 m_iStage = 15;
1488 } 1488 }
1489 } 1489 }
1490 if (m_iStage == 15) { 1490 if (m_iStage == 15) {
1491 if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) { 1491 if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) {
1492 IFX_SeekableReadStream* pSrcFile = m_pParser->GetFileAccess(); 1492 IFX_SeekableReadStream* pSrcFile = m_pParser->GetFileAccess();
1493 uint8_t buffer[4096]; 1493 uint8_t buffer[4096];
1494 uint32_t src_size = (uint32_t)(uintptr_t)m_Pos; 1494 uint32_t src_size = (uint32_t)(uintptr_t)m_Pos;
1495 while (src_size) { 1495 while (src_size) {
1496 uint32_t block_size = src_size > 4096 ? 4096 : src_size; 1496 uint32_t block_size = src_size > 4096 ? 4096 : src_size;
1497 if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) { 1497 if (pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size) !=
1498 block_size &&
1499 !pSrcFile->IsEOF()) {
1498 return -1; 1500 return -1;
1499 } 1501 }
1500 if (m_File.AppendBlock(buffer, block_size) < 0) { 1502 if (m_File.AppendBlock(buffer, block_size) < 0) {
Tom Sepez 2016/11/14 20:27:40 we could have a short read here, yet we appended t
1501 return -1; 1503 return -1;
1502 } 1504 }
1503 src_size -= block_size; 1505 src_size -= block_size;
1504 if (pPause && pPause->NeedToPauseNow()) { 1506 if (pPause && pPause->NeedToPauseNow()) {
1505 m_Pos = (void*)(uintptr_t)src_size; 1507 m_Pos = (void*)(uintptr_t)src_size;
1506 return 1; 1508 return 1;
1507 } 1509 }
1508 } 1510 }
1509 } 1511 }
1510 if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && 1512 if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 &&
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 m_pCryptoHandler = nullptr; 2014 m_pCryptoHandler = nullptr;
2013 } 2015 }
2014 void CPDF_Creator::ResetStandardSecurity() { 2016 void CPDF_Creator::ResetStandardSecurity() {
2015 if (!m_bLocalCryptoHandler) 2017 if (!m_bLocalCryptoHandler)
2016 return; 2018 return;
2017 2019
2018 delete m_pCryptoHandler; 2020 delete m_pCryptoHandler;
2019 m_pCryptoHandler = nullptr; 2021 m_pCryptoHandler = nullptr;
2020 m_bLocalCryptoHandler = false; 2022 m_bLocalCryptoHandler = false;
2021 } 2023 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_data_avail.cpp » ('j') | core/fpdfapi/parser/cpdf_data_avail.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698