summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-08-05 10:11:22 -0700
committerTom Sepez <tsepez@chromium.org>2015-08-05 10:11:22 -0700
commit18d0aafda2d4984f510f4f679bfc5393c2c8a81b (patch)
treed236e8bd408a51d1ef928d5ec9a348c9314443bc
parent29007840b6deb699174ae5a6ef6b1188d001aa05 (diff)
downloadpdfium-18d0aafda2d4984f510f4f679bfc5393c2c8a81b.tar.xz
Merge to XFA: FPDF_Creator can only create file through callbacks.
(cherry picked from commit 5cd398545141226f082b2f757f23c73303058a83) Original Review URL: https://codereview.chromium.org/1264423003 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1275623002 .
-rw-r--r--core/include/fpdfapi/fpdf_serial.h9
-rw-r--r--core/include/fxcrt/fx_basic.h6
-rw-r--r--core/include/fxcrt/fx_stream.h2
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp20
-rw-r--r--core/src/fxcrt/fx_basic_buffer.cpp28
-rw-r--r--core/src/fxcrt/fx_extension.cpp6
6 files changed, 1 insertions, 70 deletions
diff --git a/core/include/fpdfapi/fpdf_serial.h b/core/include/fpdfapi/fpdf_serial.h
index efa30f646b..0e317ff6d9 100644
--- a/core/include/fpdfapi/fpdf_serial.h
+++ b/core/include/fpdfapi/fpdf_serial.h
@@ -110,22 +110,15 @@ class CPDF_PageArchiveLoader : public CPDF_ObjArchiveLoader {
#define FPDFCREATE_NO_ORIGINAL 2
#define FPDFCREATE_PROGRESSIVE 4
#define FPDFCREATE_OBJECTSTREAM 8
+
class CPDF_Creator {
public:
CPDF_Creator(CPDF_Document* pDoc);
-
~CPDF_Creator();
void RemoveSecurity();
-
- FX_BOOL Create(const FX_WCHAR* filename, FX_DWORD flags = 0);
-
- FX_BOOL Create(const FX_CHAR* filename, FX_DWORD flags = 0);
-
FX_BOOL Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0);
-
int32_t Continue(IFX_Pause* pPause = NULL);
-
FX_BOOL SetFileVersion(int32_t fileVersion = 17);
protected:
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 0079acdd5e..d93d3f7193 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -226,18 +226,12 @@ class CFX_FileBufferArchive : public IFX_BufferArchive {
~CFX_FileBufferArchive() override;
void Clear() override;
-
FX_BOOL AttachFile(IFX_StreamWrite* pFile, FX_BOOL bTakeover = FALSE);
- FX_BOOL AttachFile(const FX_WCHAR* filename);
-
- FX_BOOL AttachFile(const FX_CHAR* filename);
-
private:
FX_BOOL DoWork(const void* pBuf, size_t size) override;
IFX_StreamWrite* m_pFile;
-
FX_BOOL m_bTakeover;
};
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h
index e51c2bd244..f872e3334b 100644
--- a/core/include/fxcrt/fx_stream.h
+++ b/core/include/fxcrt/fx_stream.h
@@ -77,8 +77,6 @@ class IFX_FileWrite : public IFX_StreamWrite {
return WriteBlock(pData, GetSize(), size);
}
};
-IFX_FileWrite* FX_CreateFileWrite(const FX_CHAR* filename);
-IFX_FileWrite* FX_CreateFileWrite(const FX_WCHAR* filename);
class IFX_StreamRead {
public:
virtual ~IFX_StreamRead() {}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 6f193071de..ff0539c61f 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -2016,26 +2016,6 @@ void CPDF_Creator::Clear() {
m_pIDArray = NULL;
}
}
-FX_BOOL CPDF_Creator::Create(const FX_CHAR* filename, FX_DWORD flags) {
- if (!m_File.AttachFile(filename)) {
- return FALSE;
- }
- FX_BOOL bRet = Create(flags);
- if (!bRet || !(flags & FPDFCREATE_PROGRESSIVE)) {
- Clear();
- }
- return bRet;
-}
-FX_BOOL CPDF_Creator::Create(const FX_WCHAR* filename, FX_DWORD flags) {
- if (!m_File.AttachFile(filename)) {
- return FALSE;
- }
- FX_BOOL bRet = Create(flags);
- if (!bRet || !(flags & FPDFCREATE_PROGRESSIVE)) {
- Clear();
- }
- return bRet;
-}
FX_BOOL CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags) {
if (!pFile) {
return FALSE;
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp
index f2cc3de33d..40269e00c0 100644
--- a/core/src/fxcrt/fx_basic_buffer.cpp
+++ b/core/src/fxcrt/fx_basic_buffer.cpp
@@ -450,34 +450,6 @@ FX_BOOL CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile,
m_bTakeover = bTakeover;
return TRUE;
}
-FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_WCHAR* filename) {
- if (!filename) {
- return FALSE;
- }
- if (m_pFile && m_bTakeover) {
- m_pFile->Release();
- }
- m_pFile = FX_CreateFileWrite(filename);
- if (!m_pFile) {
- return FALSE;
- }
- m_bTakeover = TRUE;
- return TRUE;
-}
-FX_BOOL CFX_FileBufferArchive::AttachFile(const FX_CHAR* filename) {
- if (!filename) {
- return FALSE;
- }
- if (m_pFile && m_bTakeover) {
- m_pFile->Release();
- }
- m_pFile = FX_CreateFileWrite(filename);
- if (!m_pFile) {
- return FALSE;
- }
- m_bTakeover = TRUE;
- return TRUE;
-}
FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) {
if (!m_pFile) {
return FALSE;
diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp
index 1ea05574e3..004e39d5e2 100644
--- a/core/src/fxcrt/fx_extension.cpp
+++ b/core/src/fxcrt/fx_extension.cpp
@@ -48,12 +48,6 @@ IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename,
}
return FX_NEW CFX_CRTFileStream(pFA);
}
-IFX_FileWrite* FX_CreateFileWrite(const FX_CHAR* filename) {
- return FX_CreateFileStream(filename, FX_FILEMODE_Truncate);
-}
-IFX_FileWrite* FX_CreateFileWrite(const FX_WCHAR* filename) {
- return FX_CreateFileStream(filename, FX_FILEMODE_Truncate);
-}
IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename) {
return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly);
}