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

Unified 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: fix an undefined variable 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_data_avail.cpp » ('j') | core/fpdfapi/parser/cpdf_stream.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/edit/fpdf_edit_create.cpp
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp
index a578a0a1141c81f80a64634c54c098b7ae428fed..1de9a577af22170ad457ec55e23358c577140768 100644
--- a/core/fpdfapi/edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/edit/fpdf_edit_create.cpp
@@ -1494,13 +1494,15 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
uint32_t src_size = (uint32_t)(uintptr_t)m_Pos;
while (src_size) {
uint32_t block_size = src_size > 4096 ? 4096 : src_size;
- if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) {
+ uint32_t read_size =
+ pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size);
+ if (read_size != block_size && !pSrcFile->IsEOF()) {
return -1;
}
- if (m_File.AppendBlock(buffer, block_size) < 0) {
+ if (m_File.AppendBlock(buffer, read_size) < 0) {
return -1;
}
- src_size -= block_size;
+ src_size -= read_size;
if (pPause && pPause->NeedToPauseNow()) {
m_Pos = (void*)(uintptr_t)src_size;
return 1;
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_data_avail.cpp » ('j') | core/fpdfapi/parser/cpdf_stream.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698