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

Side by Side Diff: fpdfsdk/fpdfview.cpp

Issue 2062313002: Make code compile with clang_use_chrome_plugin (part IV) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: remove unused file Created 4 years, 6 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
« no previous file with comments | « fpdfsdk/fpdfsave.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_app.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "public/fpdfview.h" 7 #include "public/fpdfview.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 FX_FILESIZE CFPDF_FileStream::GetSize() { 97 FX_FILESIZE CFPDF_FileStream::GetSize() {
98 if (m_pFS && m_pFS->GetSize) 98 if (m_pFS && m_pFS->GetSize)
99 return (FX_FILESIZE)m_pFS->GetSize(m_pFS->clientData); 99 return (FX_FILESIZE)m_pFS->GetSize(m_pFS->clientData);
100 return 0; 100 return 0;
101 } 101 }
102 102
103 FX_BOOL CFPDF_FileStream::IsEOF() { 103 FX_BOOL CFPDF_FileStream::IsEOF() {
104 return m_nCurPos >= GetSize(); 104 return m_nCurPos >= GetSize();
105 } 105 }
106 106
107 FX_FILESIZE CFPDF_FileStream::GetPosition() {
108 return m_nCurPos;
109 }
110
107 FX_BOOL CFPDF_FileStream::ReadBlock(void* buffer, 111 FX_BOOL CFPDF_FileStream::ReadBlock(void* buffer,
108 FX_FILESIZE offset, 112 FX_FILESIZE offset,
109 size_t size) { 113 size_t size) {
110 if (!buffer || !size || !m_pFS->ReadBlock) 114 if (!buffer || !size || !m_pFS->ReadBlock)
111 return FALSE; 115 return FALSE;
112 116
113 if (m_pFS->ReadBlock(m_pFS->clientData, (FPDF_DWORD)offset, buffer, 117 if (m_pFS->ReadBlock(m_pFS->clientData, (FPDF_DWORD)offset, buffer,
114 (FPDF_DWORD)size) == 0) { 118 (FPDF_DWORD)size) == 0) {
115 m_nCurPos = offset + size; 119 m_nCurPos = offset + size;
116 return TRUE; 120 return TRUE;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 #endif // PDF_ENABLE_XFA 164 #endif // PDF_ENABLE_XFA
161 165
162 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) { 166 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) {
163 m_FileAccess = *pFileAccess; 167 m_FileAccess = *pFileAccess;
164 #ifdef PDF_ENABLE_XFA 168 #ifdef PDF_ENABLE_XFA
165 m_BufferOffset = (uint32_t)-1; 169 m_BufferOffset = (uint32_t)-1;
166 #endif // PDF_ENABLE_XFA 170 #endif // PDF_ENABLE_XFA
167 } 171 }
168 172
169 #ifdef PDF_ENABLE_XFA 173 #ifdef PDF_ENABLE_XFA
174 CFX_ByteString CPDF_CustomAccess::GetFullPath() {
175 return "";
176 }
177
170 FX_BOOL CPDF_CustomAccess::GetByte(uint32_t pos, uint8_t& ch) { 178 FX_BOOL CPDF_CustomAccess::GetByte(uint32_t pos, uint8_t& ch) {
171 if (pos >= m_FileAccess.m_FileLen) 179 if (pos >= m_FileAccess.m_FileLen)
172 return FALSE; 180 return FALSE;
173 if (m_BufferOffset == (uint32_t)-1 || pos < m_BufferOffset || 181 if (m_BufferOffset == (uint32_t)-1 || pos < m_BufferOffset ||
174 pos >= m_BufferOffset + 512) { 182 pos >= m_BufferOffset + 512) {
175 // Need to read from file access 183 // Need to read from file access
176 m_BufferOffset = pos; 184 m_BufferOffset = pos;
177 int size = 512; 185 int size = 512;
178 if (pos + 512 > m_FileAccess.m_FileLen) 186 if (pos + 512 > m_FileAccess.m_FileLen)
179 size = m_FileAccess.m_FileLen - pos; 187 size = m_FileAccess.m_FileLen - pos;
180 if (!m_FileAccess.m_GetBlock(m_FileAccess.m_Param, m_BufferOffset, m_Buffer, 188 if (!m_FileAccess.m_GetBlock(m_FileAccess.m_Param, m_BufferOffset, m_Buffer,
181 size)) 189 size))
182 return FALSE; 190 return FALSE;
183 } 191 }
184 ch = m_Buffer[pos - m_BufferOffset]; 192 ch = m_Buffer[pos - m_BufferOffset];
185 return TRUE; 193 return TRUE;
186 } 194 }
187 195
188 FX_BOOL CPDF_CustomAccess::GetBlock(uint32_t pos, 196 FX_BOOL CPDF_CustomAccess::GetBlock(uint32_t pos,
189 uint8_t* pBuf, 197 uint8_t* pBuf,
190 uint32_t size) { 198 uint32_t size) {
191 if (pos + size > m_FileAccess.m_FileLen) 199 if (pos + size > m_FileAccess.m_FileLen)
192 return FALSE; 200 return FALSE;
193 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, pos, pBuf, size); 201 return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, pos, pBuf, size);
194 } 202 }
195 #endif // PDF_ENABLE_XFA 203 #endif // PDF_ENABLE_XFA
196 204
205 FX_FILESIZE CPDF_CustomAccess::GetSize() {
206 return m_FileAccess.m_FileLen;
207 }
208
209 void CPDF_CustomAccess::Release() {
210 delete this;
211 }
212
197 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, 213 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer,
198 FX_FILESIZE offset, 214 FX_FILESIZE offset,
199 size_t size) { 215 size_t size) {
200 if (offset < 0) { 216 if (offset < 0) {
201 return FALSE; 217 return FALSE;
202 } 218 }
203 FX_SAFE_FILESIZE newPos = 219 FX_SAFE_FILESIZE newPos =
204 pdfium::base::checked_cast<FX_FILESIZE, size_t>(size); 220 pdfium::base::checked_cast<FX_FILESIZE, size_t>(size);
205 newPos += offset; 221 newPos += offset;
206 if (!newPos.IsValid() || 222 if (!newPos.IsValid() ||
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 if (!buffer) { 1109 if (!buffer) {
1094 *buflen = len; 1110 *buflen = len;
1095 } else if (*buflen >= len) { 1111 } else if (*buflen >= len) {
1096 memcpy(buffer, utf16Name.c_str(), len); 1112 memcpy(buffer, utf16Name.c_str(), len);
1097 *buflen = len; 1113 *buflen = len;
1098 } else { 1114 } else {
1099 *buflen = -1; 1115 *buflen = -1;
1100 } 1116 }
1101 return (FPDF_DEST)pDestObj; 1117 return (FPDF_DEST)pDestObj;
1102 } 1118 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfsave.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_app.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698