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

Unified Diff: pdf/pdfium/pdfium_mem_buffer_file_read.cc

Issue 294793003: Add the pdf plugin's source in src\pdf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: review comments and sync past DEPS roll to fix gyp Created 6 years, 7 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: pdf/pdfium/pdfium_mem_buffer_file_read.cc
===================================================================
--- pdf/pdfium/pdfium_mem_buffer_file_read.cc (revision 0)
+++ pdf/pdfium/pdfium_mem_buffer_file_read.cc (revision 0)
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "pdf/pdfium/pdfium_mem_buffer_file_read.h"
+
+#include <string.h>
+
+namespace chrome_pdf {
+
+PDFiumMemBufferFileRead::PDFiumMemBufferFileRead(const void* data,
+ size_t size) {
+ m_FileLen = size;
+ m_Param = this;
+ m_GetBlock = &GetBlock;
+ data_ = reinterpret_cast<const unsigned char*>(data);
+}
+
+PDFiumMemBufferFileRead::~PDFiumMemBufferFileRead() {
+}
+
+int PDFiumMemBufferFileRead::GetBlock(void* param,
+ unsigned long position,
+ unsigned char* buf,
+ unsigned long size) {
+ const PDFiumMemBufferFileRead* data =
+ reinterpret_cast<const PDFiumMemBufferFileRead*>(param);
+ if (!data || position + size > data->m_FileLen)
+ return 0;
+ memcpy(buf, data->data_ + position, size);
+ return 1;
+}
+
+} // namespace chrome_pdf
Property changes on: pdf\pdfium\pdfium_mem_buffer_file_read.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698