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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_syntax_parser.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 side-by-side diff with in-line comments
Download patch
Index: core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
index a29137cd4315a8c185709be10ce1dcd34aed168f..abb4698f0d1ba2766cccb86c714c98df01731c1c 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
@@ -77,7 +77,9 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) {
}
}
- if (!m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size))
+ if (m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size) !=
+ read_size &&
+ !m_pFileAccess->IsEOF())
return FALSE;
m_BufOffset = read_pos;
@@ -109,7 +111,9 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
}
}
- if (!m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size))
+ if (m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size) !=
+ read_size &&
+ !m_pFileAccess->IsEOF())
return FALSE;
m_BufOffset = read_pos;
@@ -119,7 +123,8 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
}
FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, uint32_t size) {
- if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size))
+ if (m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size) != size &&
+ !m_pFileAccess->IsEOF())
return FALSE;
m_Pos += size;
return TRUE;

Powered by Google App Engine
This is Rietveld 408576698