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

Side by Side Diff: core/fpdfapi/parser/cpdf_stream.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/parser/cpdf_stream.h" 7 #include "core/fpdfapi/parser/cpdf_stream.h"
8 8
9 #include "core/fpdfapi/parser/cpdf_dictionary.h" 9 #include "core/fpdfapi/parser/cpdf_dictionary.h"
10 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 10 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 m_pDict.reset(new CPDF_Dictionary()); 98 m_pDict.reset(new CPDF_Dictionary());
99 m_pDict->SetIntegerFor("Length", size); 99 m_pDict->SetIntegerFor("Length", size);
100 m_pDict->RemoveFor("Filter"); 100 m_pDict->RemoveFor("Filter");
101 m_pDict->RemoveFor("DecodeParms"); 101 m_pDict->RemoveFor("DecodeParms");
102 } 102 }
103 103
104 bool CPDF_Stream::ReadRawData(FX_FILESIZE offset, 104 bool CPDF_Stream::ReadRawData(FX_FILESIZE offset,
105 uint8_t* buf, 105 uint8_t* buf,
106 uint32_t size) const { 106 uint32_t size) const {
107 if (m_bMemoryBased && m_pFile) 107 if (m_bMemoryBased && m_pFile)
108 return m_pFile->ReadBlock(buf, offset, size); 108 return m_pFile->ReadBlock(buf, offset, size) == size || m_pFile->IsEOF();
Tom Sepez 2016/11/16 18:32:00 This will return success if a short read at EOF.
109 109
110 if (m_pDataBuf) 110 if (m_pDataBuf)
111 FXSYS_memcpy(buf, m_pDataBuf.get() + offset, size); 111 FXSYS_memcpy(buf, m_pDataBuf.get() + offset, size);
112 112
113 return true; 113 return true;
114 } 114 }
115 115
116 CFX_WideString CPDF_Stream::GetUnicodeText() const { 116 CFX_WideString CPDF_Stream::GetUnicodeText() const {
117 CPDF_StreamAcc stream; 117 CPDF_StreamAcc stream;
118 stream.LoadAllData(this, false); 118 stream.LoadAllData(this, false);
119 return PDF_DecodeText(stream.GetData(), stream.GetSize()); 119 return PDF_DecodeText(stream.GetData(), stream.GetSize());
120 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698