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

Side by Side Diff: core/src/fxcrt/fx_basic_buffer.cpp

Issue 1264423003: FPDF_Creator can only create file through embedder-supplied callback. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 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 | « core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp ('k') | core/src/fxcrt/fx_extension.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 "../../include/fxcrt/fx_basic.h" 7 #include "../../include/fxcrt/fx_basic.h"
8 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); 8 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
9 CFX_BinaryBuf::CFX_BinaryBuf() 9 CFX_BinaryBuf::CFX_BinaryBuf()
10 : m_AllocStep(0), m_pBuffer(NULL), m_DataSize(0), m_AllocSize(0) {} 10 : m_AllocStep(0), m_pBuffer(NULL), m_DataSize(0), m_AllocSize(0) {}
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 if (!pFile) { 320 if (!pFile) {
321 return FALSE; 321 return FALSE;
322 } 322 }
323 if (m_pFile && m_bTakeover) { 323 if (m_pFile && m_bTakeover) {
324 m_pFile->Release(); 324 m_pFile->Release();
325 } 325 }
326 m_pFile = pFile; 326 m_pFile = pFile;
327 m_bTakeover = bTakeover; 327 m_bTakeover = bTakeover;
328 return TRUE; 328 return TRUE;
329 } 329 }
330 FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_WCHAR* filename) {
331 if (!filename) {
332 return FALSE;
333 }
334 if (m_pFile && m_bTakeover) {
335 m_pFile->Release();
336 }
337 m_pFile = FX_CreateFileWrite(filename);
338 if (!m_pFile) {
339 return FALSE;
340 }
341 m_bTakeover = TRUE;
342 return TRUE;
343 }
344 FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_CHAR* filename) {
345 if (!filename) {
346 return FALSE;
347 }
348 if (m_pFile && m_bTakeover) {
349 m_pFile->Release();
350 }
351 m_pFile = FX_CreateFileWrite(filename);
352 if (!m_pFile) {
353 return FALSE;
354 }
355 m_bTakeover = TRUE;
356 return TRUE;
357 }
358 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { 330 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) {
359 if (!m_pFile) { 331 if (!m_pFile) {
360 return FALSE; 332 return FALSE;
361 } 333 }
362 if (!pBuf || size < 1) { 334 if (!pBuf || size < 1) {
363 return TRUE; 335 return TRUE;
364 } 336 }
365 return m_pFile->WriteBlock(pBuf, size); 337 return m_pFile->WriteBlock(pBuf, size);
366 } 338 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp ('k') | core/src/fxcrt/fx_extension.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698