diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-27 12:25:48 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-27 12:25:48 -0700 |
commit | 5c4f26fe8d6f30403de48271e3bd685490b345d2 (patch) | |
tree | b337bcb3af7618212bd837bd2a02194804e96f42 /core | |
parent | 8d2aae7ee320da3a8ffe01c57e38b3f98443257d (diff) | |
download | pdfium-5c4f26fe8d6f30403de48271e3bd685490b345d2.tar.xz |
Kill CFX_ArchiveLoader / CFX_ArchiveSaver and subclasses
These are unused until we get to XFA.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1255113003 .
Diffstat (limited to 'core')
-rw-r--r-- | core/include/fpdfapi/fpdf_serial.h | 90 | ||||
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 75 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_buffer.cpp | 139 |
3 files changed, 0 insertions, 304 deletions
diff --git a/core/include/fpdfapi/fpdf_serial.h b/core/include/fpdfapi/fpdf_serial.h index 1877ef8866..cccb3abf11 100644 --- a/core/include/fpdfapi/fpdf_serial.h +++ b/core/include/fpdfapi/fpdf_serial.h @@ -13,96 +13,6 @@ class CPDF_ObjectStream; class CPDF_XRefStream; CFX_ByteTextBuf& operator << (CFX_ByteTextBuf& buf, const CPDF_Object* pObj); -class CPDF_ObjArchiveSaver : public CFX_ArchiveSaver -{ -public: - - friend CPDF_ObjArchiveSaver& operator << (CPDF_ObjArchiveSaver& ar, const CPDF_Object* pObj); -protected: - - CFX_MapPtrToPtr m_ObjectMap; -}; -class CPDF_ObjArchiveLoader : public CFX_ArchiveLoader -{ -public: - - CPDF_ObjArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) : CFX_ArchiveLoader(pData, dwSize), - m_IndirectObjects(NULL) {} - - friend CPDF_ObjArchiveLoader& operator >> (CPDF_ObjArchiveLoader& ar, CPDF_Object*& pObj); -protected: - - CPDF_IndirectObjects m_IndirectObjects; -}; -class CPDF_PageArchiveSaver : public CPDF_ObjArchiveSaver -{ -public: - - CPDF_PageArchiveSaver(CPDF_PageObjects* pPageObjs); - - friend CPDF_PageArchiveSaver& operator << (CPDF_PageArchiveSaver& ar, CPDF_PageObject* pObj); - - - - friend CPDF_PageArchiveSaver& operator << (CPDF_PageArchiveSaver& ar, CPDF_ClipPath clip_path); - - friend CPDF_PageArchiveSaver& operator << (CPDF_PageArchiveSaver& ar, CPDF_GraphState graph_state); - - friend CPDF_PageArchiveSaver& operator << (CPDF_PageArchiveSaver& ar, CPDF_TextState text_state); - - friend CPDF_PageArchiveSaver& operator << (CPDF_PageArchiveSaver& ar, CPDF_ColorState color_state); - - friend CPDF_PageArchiveSaver& operator << (CPDF_PageArchiveSaver& ar, CPDF_GeneralState general_state); - -protected: - - CPDF_ClipPath m_LastClipPath; - - CPDF_GraphState m_LastGraphState; - - CPDF_ColorState m_LastColorState; - - CPDF_TextState m_LastTextState; - - CPDF_GeneralState m_LastGeneralState; -}; -class CPDF_PageArchiveLoader : public CPDF_ObjArchiveLoader -{ -public: - - CPDF_PageArchiveLoader(CPDF_PageObjects* pPageObjs, const uint8_t* pData, FX_DWORD dwSize); - - friend CPDF_PageArchiveLoader& operator >> (CPDF_PageArchiveLoader& ar, CPDF_PageObject*& pObj); - - - - friend CPDF_PageArchiveLoader& operator >> (CPDF_PageArchiveLoader& ar, CPDF_ClipPath& clip_path); - - friend CPDF_PageArchiveLoader& operator >> (CPDF_PageArchiveLoader& ar, CPDF_GraphState& graph_state); - - friend CPDF_PageArchiveLoader& operator >> (CPDF_PageArchiveLoader& ar, CPDF_TextState& text_state); - - friend CPDF_PageArchiveLoader& operator >> (CPDF_PageArchiveLoader& ar, CPDF_ColorState& color_state); - - friend CPDF_PageArchiveLoader& operator >> (CPDF_PageArchiveLoader& ar, CPDF_GeneralState& general_state); - -protected: - void PostProcColor(CPDF_Color& color); - - CPDF_Object* AddResource(CPDF_Object* pSrcObj, const FX_CHAR* type); - - CPDF_ClipPath m_LastClipPath; - - CPDF_GraphState m_LastGraphState; - - CPDF_ColorState m_LastColorState; - - CPDF_TextState m_LastTextState; - - CPDF_GeneralState m_LastGeneralState; - - CFX_MapPtrToPtr m_ObjectMap; -}; #define FPDFCREATE_INCREMENTAL 1 #define FPDFCREATE_NO_ORIGINAL 2 #define FPDFCREATE_PROGRESSIVE 4 diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index d575df6e67..5e945e7aee 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -155,81 +155,6 @@ public: CFX_WideStringC GetWideString() const; }; -class CFX_ArchiveSaver -{ -public: - CFX_ArchiveSaver() : m_pStream(NULL) {} - - CFX_ArchiveSaver& operator << (uint8_t i); - - CFX_ArchiveSaver& operator << (int i); - - CFX_ArchiveSaver& operator << (FX_DWORD i); - - CFX_ArchiveSaver& operator << (FX_FLOAT i); - - CFX_ArchiveSaver& operator << (double i); - - CFX_ArchiveSaver& operator << (const CFX_ByteStringC& bstr); - - CFX_ArchiveSaver& operator << (const FX_WCHAR* bstr); - - CFX_ArchiveSaver& operator << (const CFX_WideString& wstr); - - void Write(const void* pData, FX_STRSIZE dwSize); - - intptr_t GetLength() - { - return m_SavingBuf.GetSize(); - } - - const uint8_t* GetBuffer() - { - return m_SavingBuf.GetBuffer(); - } - - void SetStream(IFX_FileStream* pStream) - { - m_pStream = pStream; - } -protected: - - CFX_BinaryBuf m_SavingBuf; - - IFX_FileStream* m_pStream; -}; -class CFX_ArchiveLoader -{ -public: - - CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize); - - CFX_ArchiveLoader& operator >> (uint8_t& i); - - CFX_ArchiveLoader& operator >> (int& i); - - CFX_ArchiveLoader& operator >> (FX_DWORD& i); - - CFX_ArchiveLoader& operator >> (FX_FLOAT& i); - - CFX_ArchiveLoader& operator >> (double& i); - - CFX_ArchiveLoader& operator >> (CFX_ByteString& bstr); - - CFX_ArchiveLoader& operator >> (CFX_WideString& wstr); - - FX_BOOL IsEOF(); - - FX_BOOL Read(void* pBuf, FX_DWORD dwSize); -protected: - - FX_DWORD m_LoadingPos; - - const uint8_t* m_pLoadingBuf; - - FX_DWORD m_LoadingSize; - -}; class IFX_BufferArchive { diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 9fc400e183..d6225b46f2 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -242,145 +242,6 @@ CFX_WideStringC CFX_WideTextBuf::GetWideString() const { return CFX_WideStringC((const FX_WCHAR*)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (uint8_t i) -{ - if (m_pStream) { - m_pStream->WriteBlock(&i, 1); - } else { - m_SavingBuf.AppendByte(i); - } - return *this; -} -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (int i) -{ - if (m_pStream) { - m_pStream->WriteBlock(&i, sizeof(int)); - } else { - m_SavingBuf.AppendBlock(&i, sizeof(int)); - } - return *this; -} -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_DWORD i) -{ - if (m_pStream) { - m_pStream->WriteBlock(&i, sizeof(FX_DWORD)); - } else { - m_SavingBuf.AppendBlock(&i, sizeof(FX_DWORD)); - } - return *this; -} -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_FLOAT f) -{ - if (m_pStream) { - m_pStream->WriteBlock(&f, sizeof(FX_FLOAT)); - } else { - m_SavingBuf.AppendBlock(&f, sizeof(FX_FLOAT)); - } - return *this; -} -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (const CFX_ByteStringC& bstr) -{ - int len = bstr.GetLength(); - if (m_pStream) { - m_pStream->WriteBlock(&len, sizeof(int)); - m_pStream->WriteBlock(bstr.GetPtr(), len); - } else { - m_SavingBuf.AppendBlock(&len, sizeof(int)); - m_SavingBuf.AppendBlock(bstr.GetPtr(), len); - } - return *this; -} -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (const FX_WCHAR* wstr) -{ - FX_STRSIZE len = FXSYS_wcslen(wstr); - if (m_pStream) { - m_pStream->WriteBlock(&len, sizeof(int)); - m_pStream->WriteBlock(wstr, len); - } else { - m_SavingBuf.AppendBlock(&len, sizeof(int)); - m_SavingBuf.AppendBlock(wstr, len); - } - return *this; -} -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (const CFX_WideString& wstr) -{ - CFX_ByteString encoded = wstr.UTF16LE_Encode(); - return operator << (encoded); -} -void CFX_ArchiveSaver::Write(const void* pData, FX_STRSIZE dwSize) -{ - if (m_pStream) { - m_pStream->WriteBlock(pData, dwSize); - } else { - m_SavingBuf.AppendBlock(pData, dwSize); - } -} -CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) -{ - m_pLoadingBuf = pData; - m_LoadingPos = 0; - m_LoadingSize = dwSize; -} -FX_BOOL CFX_ArchiveLoader::IsEOF() -{ - return m_LoadingPos >= m_LoadingSize; -} -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (uint8_t& i) -{ - if (m_LoadingPos >= m_LoadingSize) { - return *this; - } - i = m_pLoadingBuf[m_LoadingPos++]; - return *this; -} -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (int& i) -{ - Read(&i, sizeof(int)); - return *this; -} -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (FX_DWORD& i) -{ - Read(&i, sizeof(FX_DWORD)); - return *this; -} -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (FX_FLOAT& i) -{ - Read(&i, sizeof(FX_FLOAT)); - return *this; -} -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_ByteString& str) -{ - if (m_LoadingPos + 4 > m_LoadingSize) { - return *this; - } - int len; - operator >> (len); - str.Empty(); - if (len <= 0 || m_LoadingPos + len > m_LoadingSize) { - return *this; - } - FX_CHAR* buffer = str.GetBuffer(len); - FXSYS_memcpy(buffer, m_pLoadingBuf + m_LoadingPos, len); - str.ReleaseBuffer(len); - m_LoadingPos += len; - return *this; -} -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_WideString& str) -{ - CFX_ByteString encoded; - operator >> (encoded); - str = CFX_WideString::FromUTF16LE((const unsigned short*)encoded.c_str(), encoded.GetLength()); - return *this; -} -FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) -{ - if (m_LoadingPos + dwSize > m_LoadingSize) { - return FALSE; - } - FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); - m_LoadingPos += dwSize; - return TRUE; -} void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { m_pData = pData; |