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

Side by Side Diff: pdf/pdfium/pdfium_mem_buffer_file_read.cc

Issue 2828413005: Clang format pdf/ (Closed)
Patch Set: Manual tweaks Created 3 years, 8 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 | « pdf/pdfium/pdfium_engine.cc ('k') | pdf/pdfium/pdfium_mem_buffer_file_write.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "pdf/pdfium/pdfium_mem_buffer_file_read.h" 5 #include "pdf/pdfium/pdfium_mem_buffer_file_read.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 namespace chrome_pdf { 10 namespace chrome_pdf {
11 11
12 PDFiumMemBufferFileRead::PDFiumMemBufferFileRead(const void* data, 12 PDFiumMemBufferFileRead::PDFiumMemBufferFileRead(const void* data,
13 size_t size) { 13 size_t size) {
14 m_FileLen = size; 14 m_FileLen = size;
15 m_Param = this; 15 m_Param = this;
16 m_GetBlock = &GetBlock; 16 m_GetBlock = &GetBlock;
17 data_ = reinterpret_cast<const unsigned char*>(data); 17 data_ = reinterpret_cast<const unsigned char*>(data);
18 } 18 }
19 19
20 PDFiumMemBufferFileRead::~PDFiumMemBufferFileRead() { 20 PDFiumMemBufferFileRead::~PDFiumMemBufferFileRead() {}
21 }
22 21
23 int PDFiumMemBufferFileRead::GetBlock(void* param, 22 int PDFiumMemBufferFileRead::GetBlock(void* param,
24 unsigned long position, 23 unsigned long position,
25 unsigned char* buf, 24 unsigned char* buf,
26 unsigned long size) { 25 unsigned long size) {
27 const PDFiumMemBufferFileRead* data = 26 const PDFiumMemBufferFileRead* data =
28 reinterpret_cast<const PDFiumMemBufferFileRead*>(param); 27 reinterpret_cast<const PDFiumMemBufferFileRead*>(param);
29 if (!data || position + size > data->m_FileLen) 28 if (!data || position + size > data->m_FileLen)
30 return 0; 29 return 0;
31 memcpy(buf, data->data_ + position, size); 30 memcpy(buf, data->data_ + position, size);
32 return 1; 31 return 1;
33 } 32 }
34 33
35 } // namespace chrome_pdf 34 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/pdfium/pdfium_engine.cc ('k') | pdf/pdfium/pdfium_mem_buffer_file_write.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698