diff options
author | Lei Zhang <thestig@chromium.org> | 2016-01-08 14:32:23 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-01-08 14:32:23 -0800 |
commit | 4a24ad858484ecdf9b49481e63060e4d476cf1c7 (patch) | |
tree | 7e7a3cb34dc9fc12e4f1b19456e47f2a17898236 | |
parent | 149f1db8bba85bdf2b40d330c38f2478695ca0d5 (diff) | |
download | pdfium-4a24ad858484ecdf9b49481e63060e4d476cf1c7.tar.xz |
Remove a bunch of dead code.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1567333003 .
-rw-r--r-- | core/include/fxcrt/fx_stream.h | 13 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_platforms.cpp | 47 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_posix.cpp | 49 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_windows.cpp | 38 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_ComboBox.h | 1 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_EditCtrl.h | 1 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Wnd.h | 2 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/Document.cpp | 52 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/Document.h | 8 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp | 4 |
11 files changed, 1 insertions, 218 deletions
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index a5599b04d0..5ec90d34ad 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -44,18 +44,7 @@ FX_WCHAR FX_GetFolderSeparator(); #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 -FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName); -FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName); -FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName); -FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName); -FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst); -FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst); -FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst); -FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst); + class IFX_StreamWrite { public: virtual ~IFX_StreamWrite() {} diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 190605cb60..4c123d3984 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -129,51 +129,4 @@ FX_BOOL CFXCRT_FileAccess_CRT::Flush() { FX_BOOL CFXCRT_FileAccess_CRT::Truncate(FX_FILESIZE szFile) { return FALSE; } -FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { - return access(fileName.GetCStr(), F_OK) > -1; -} -FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { - return FX_File_Exist(FX_UTF8Encode(fileName)); -} -FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { - return remove(fileName.GetCStr()) > -1; -} -FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { - return FX_File_Delete(FX_UTF8Encode(fileName)); -} -FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst) { - CFXCRT_FileAccess_CRT src, dst; - if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) { - return FALSE; - } - FX_FILESIZE size = src.GetSize(); - if (!size) { - return FALSE; - } - if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) { - return FALSE; - } - FX_FILESIZE num = 0; - uint8_t* pBuffer = FX_Alloc(uint8_t, 32768); - while (num = src.Read(pBuffer, 32768)) { - if (dst.Write(pBuffer, num) != num) { - break; - } - } - FX_Free(pBuffer); - return TRUE; -} -FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst) { - return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); -} -FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst) { - return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); -} -FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst) { - return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); -} #endif diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp index d7df15eb32..f6710eb49b 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -127,53 +127,4 @@ FX_BOOL CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) { } return !ftruncate(m_nFD, szFile); } -FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { - return access(fileName.GetCStr(), F_OK) > -1; -} -FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { - return FX_File_Exist(FX_UTF8Encode(fileName)); -} -FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { - return remove(fileName.GetCStr()) > -1; -} -FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { - return FX_File_Delete(FX_UTF8Encode(fileName)); -} -FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst) { - CFXCRT_FileAccess_Posix src, dst; - if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) { - return FALSE; - } - FX_FILESIZE size = src.GetSize(); - if (!size) { - return FALSE; - } - if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) { - return FALSE; - } - size_t num = 0; - uint8_t* pBuffer = FX_Alloc(uint8_t, 32768); - num = src.Read(pBuffer, 32768); - while (num) { - if (dst.Write(pBuffer, num) != num) { - break; - } - num = src.Read(pBuffer, 32768); - } - FX_Free(pBuffer); - return TRUE; -} -FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst) { - return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); -} -FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst) { - return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); -} -FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst) { - return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); -} #endif diff --git a/core/src/fxcrt/fxcrt_windows.cpp b/core/src/fxcrt/fxcrt_windows.cpp index aff6a58aea..6f379a127c 100644 --- a/core/src/fxcrt/fxcrt_windows.cpp +++ b/core/src/fxcrt/fxcrt_windows.cpp @@ -9,20 +9,6 @@ #include "core/include/fxcrt/fx_string.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { - FX_DWORD dwAttri = ::GetFileAttributesA(fileName.GetCStr()); - if (dwAttri == -1) { - return FALSE; - } - return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; -} -FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { - FX_DWORD dwAttri = ::GetFileAttributesW((LPCWSTR)fileName.GetPtr()); - if (dwAttri == -1) { - return FALSE; - } - return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; -} IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_Win64; } @@ -183,28 +169,4 @@ FX_BOOL CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) { } return ::SetEndOfFile(m_hFile); } -FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { - return ::DeleteFileA(fileName.GetCStr()); -} -FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { - return ::DeleteFileW((LPCWSTR)fileName.GetPtr()); -} -FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst) { - return ::CopyFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr(), FALSE); -} -FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst) { - return ::CopyFileW((LPCWSTR)fileNameSrc.GetPtr(), - (LPCWSTR)fileNameDst.GetPtr(), FALSE); -} -FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, - const CFX_ByteStringC& fileNameDst) { - return ::MoveFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); -} -FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, - const CFX_WideStringC& fileNameDst) { - return ::MoveFileW((LPCWSTR)fileNameSrc.GetPtr(), - (LPCWSTR)fileNameDst.GetPtr()); -} #endif diff --git a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h index 9860483aca..b174f022b8 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h @@ -65,7 +65,6 @@ class CPWL_ComboBox : public CPWL_Wnd { CPDF_Rect GetFocusRect() const override; void SetFocus() override; void KillFocus() override; - FX_BOOL IsModified() const override; void SetFillerNotify(IPWL_Filler_Notify* pNotify); diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h index 284de9ed7f..0d5c931148 100644 --- a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h @@ -117,7 +117,6 @@ class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify { void SetFontSize(FX_FLOAT fFontSize) override; FX_FLOAT GetFontSize() const override; void SetCursor() override; - FX_BOOL IsModified() const override; protected: // IFX_Edit_Notify diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index 4f59fc3d92..058057bb76 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -335,8 +335,6 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const; virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const; - virtual FX_BOOL IsModified() const { return FALSE; } - virtual void SetFontSize(FX_FLOAT fFontSize); void SetBackgroundColor(const CPWL_Color& color); diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 9a434a5db7..db98fcc5e4 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -666,16 +666,6 @@ CPDFSDK_Document* Document::GetReaderDoc() { return m_pDocument; } -FX_BOOL Document::ExtractFileName(CPDFSDK_Document* pDoc, - CFX_ByteString& strFileName) { - return FALSE; -} - -FX_BOOL Document::ExtractFolderName(CPDFSDK_Document* pDoc, - CFX_ByteString& strFolderName) { - return FALSE; -} - FX_BOOL Document::bookmarkRoot(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { @@ -1107,48 +1097,6 @@ FX_BOOL Document::documentFileName(IJS_Context* cc, return TRUE; } -CFX_WideString Document::ReversalStr(CFX_WideString cbFrom) { - size_t iLength = cbFrom.GetLength(); - pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); - iSize *= (iLength + 1); - wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); - wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); - - for (size_t i = 0; i < iLength; i++) { - pResult[i] = *(pFrom + iLength - i - 1); - } - pResult[iLength] = L'\0'; - - cbFrom.ReleaseBuffer(); - CFX_WideString cbRet = CFX_WideString(pResult); - free(pResult); - pResult = NULL; - return cbRet; -} - -CFX_WideString Document::CutString(CFX_WideString cbFrom) { - size_t iLength = cbFrom.GetLength(); - pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); - iSize *= (iLength + 1); - wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); - wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); - - for (size_t i = 0; i < iLength; i++) { - if (pFrom[i] == L'\\' || pFrom[i] == L'/') { - pResult[i] = L'\0'; - break; - } - pResult[i] = pFrom[i]; - } - pResult[iLength] = L'\0'; - - cbFrom.ReleaseBuffer(); - CFX_WideString cbRet = CFX_WideString(pResult); - free(pResult); - pResult = NULL; - return cbRet; -} - FX_BOOL Document::path(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { diff --git a/fpdfsdk/src/javascript/Document.h b/fpdfsdk/src/javascript/Document.h index 94860fc425..2295fd7328 100644 --- a/fpdfsdk/src/javascript/Document.h +++ b/fpdfsdk/src/javascript/Document.h @@ -56,7 +56,6 @@ class Document : public CJS_EmbedObj { Document(CJS_Object* pJSObject); ~Document() override; - public: FX_BOOL ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); FX_BOOL author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); FX_BOOL baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); @@ -258,21 +257,14 @@ class Document : public CJS_EmbedObj { CJS_Value& vRet, CFX_WideString& sError); - public: void AttachDoc(CPDFSDK_Document* pDoc); CPDFSDK_Document* GetReaderDoc(); - static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc, - CFX_ByteString& strFileName); - static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc, - CFX_ByteString& strFolderName); void AddDelayData(CJS_DelayData* pData); void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; } CJS_Document* GetCJSDoc() const; private: - CFX_WideString ReversalStr(CFX_WideString cbFrom); - CFX_WideString CutString(CFX_WideString cbFrom); bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect); int CountWords(CPDF_TextObject* pTextObj); CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp index 392867c29a..f695351bc4 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp @@ -592,10 +592,6 @@ void CPWL_ComboBox::SetSelectText() { m_nSelectItem = m_pList->GetCurSel(); } -FX_BOOL CPWL_ComboBox::IsModified() const { - return m_pEdit->IsModified(); -} - void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) { m_pFillerNotify = pNotify; diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp index e54810e0ce..c505c7e780 100644 --- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp @@ -383,10 +383,6 @@ void CPWL_EditCtrl::SetCaret(FX_BOOL bVisible, } } -FX_BOOL CPWL_EditCtrl::IsModified() const { - return m_pEdit->IsModified(); -} - CFX_WideString CPWL_EditCtrl::GetText() const { return m_pEdit->GetText(); } |