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

Side by Side Diff: core/fxcrt/fx_xml_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 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/fxcrt/xml_int.h" 7 #include "core/fxcrt/xml_int.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 m_nStart += (FX_FILESIZE)m_dwSize; 89 m_nStart += (FX_FILESIZE)m_dwSize;
90 if (m_nStart >= nLength) { 90 if (m_nStart >= nLength) {
91 return FALSE; 91 return FALSE;
92 } 92 }
93 static const FX_FILESIZE FX_XMLDATASTREAM_BufferSize = 32 * 1024; 93 static const FX_FILESIZE FX_XMLDATASTREAM_BufferSize = 32 * 1024;
94 m_dwSize = static_cast<size_t>( 94 m_dwSize = static_cast<size_t>(
95 std::min(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart)); 95 std::min(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart));
96 if (!m_pBuffer) { 96 if (!m_pBuffer) {
97 m_pBuffer = FX_Alloc(uint8_t, m_dwSize); 97 m_pBuffer = FX_Alloc(uint8_t, m_dwSize);
98 } 98 }
99 return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); 99 return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize) == m_dwSize ||
100 m_pFileRead->IsEOF();
100 } 101 }
101 102
102 const uint8_t* CXML_DataStmAcc::GetBlockBuffer() { 103 const uint8_t* CXML_DataStmAcc::GetBlockBuffer() {
103 return (const uint8_t*)m_pBuffer; 104 return (const uint8_t*)m_pBuffer;
104 } 105 }
105 106
106 size_t CXML_DataStmAcc::GetBlockSize() { 107 size_t CXML_DataStmAcc::GetBlockSize() {
107 return m_dwSize; 108 return m_dwSize;
108 } 109 }
109 110
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 m_pMap->push_back({space, name, CFX_WideString(value)}); 907 m_pMap->push_back({space, name, CFX_WideString(value)});
907 } 908 }
908 909
909 int CXML_AttrMap::GetSize() const { 910 int CXML_AttrMap::GetSize() const {
910 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; 911 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0;
911 } 912 }
912 913
913 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { 914 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const {
914 return (*m_pMap)[index]; 915 return (*m_pMap)[index];
915 } 916 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698