From 58c2c144c5ac6a7397573d2f25d1ba9c79bc4f15 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 19 Dec 2017 19:00:43 +0000 Subject: Remove some dead code. Change-Id: I8edb14c024860c66b5e6c014136393e71e38387d Reviewed-on: https://pdfium-review.googlesource.com/21570 Reviewed-by: Henrique Nakashima Commit-Queue: Lei Zhang --- core/fpdfapi/page/cpdf_devicecs.cpp | 13 ------------- core/fpdfapi/parser/cfdf_document.cpp | 15 +++------------ core/fpdfapi/parser/cfdf_document.h | 2 -- core/fxcodec/fx_codec.h | 7 ------- core/fxcrt/cfx_binarybuf.cpp | 20 -------------------- core/fxcrt/cfx_binarybuf.h | 2 -- core/fxcrt/fx_coordinates.cpp | 6 ------ core/fxcrt/fx_coordinates.h | 1 - fpdfsdk/cpdfsdk_interform.cpp | 4 ---- fpdfsdk/cpdfsdk_interform.h | 1 - fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 5 ----- fpdfsdk/formfiller/cffl_interactiveformfiller.h | 1 - fpdfsdk/pwl/cpwl_edit.cpp | 9 --------- fpdfsdk/pwl/cpwl_edit.h | 2 -- 14 files changed, 3 insertions(+), 85 deletions(-) diff --git a/core/fpdfapi/page/cpdf_devicecs.cpp b/core/fpdfapi/page/cpdf_devicecs.cpp index 276d19b174..efd0ae4f46 100644 --- a/core/fpdfapi/page/cpdf_devicecs.cpp +++ b/core/fpdfapi/page/cpdf_devicecs.cpp @@ -36,19 +36,6 @@ uint32_t ComponentsForFamily(int family) { return 4; } -void sRGB_to_AdobeCMYK(float R, - float G, - float B, - float& c, - float& m, - float& y, - float& k) { - c = 1.0f - R; - m = 1.0f - G; - y = 1.0f - B; - k = std::min(c, std::min(m, y)); -} - void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels) { if (pDestBuf == pSrcBuf) { for (int i = 0; i < pixels; i++) { diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp index 55493b257d..f6af4546d7 100644 --- a/core/fpdfapi/parser/cfdf_document.cpp +++ b/core/fpdfapi/parser/cfdf_document.cpp @@ -29,20 +29,11 @@ std::unique_ptr CFDF_Document::CreateNewDoc() { return pDoc; } -std::unique_ptr CFDF_Document::ParseFile( - const RetainPtr& pFile) { - if (!pFile) - return nullptr; - - auto pDoc = pdfium::MakeUnique(); - pDoc->ParseStream(pFile); - return pDoc->m_pRootDict ? std::move(pDoc) : nullptr; -} - std::unique_ptr CFDF_Document::ParseMemory(uint8_t* pData, uint32_t size) { - return CFDF_Document::ParseFile( - pdfium::MakeRetain(pData, size, false)); + auto pDoc = pdfium::MakeUnique(); + pDoc->ParseStream(pdfium::MakeRetain(pData, size, false)); + return pDoc->m_pRootDict ? std::move(pDoc) : nullptr; } void CFDF_Document::ParseStream( diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h index 743c5c0eaa..b2cbd5bae9 100644 --- a/core/fpdfapi/parser/cfdf_document.h +++ b/core/fpdfapi/parser/cfdf_document.h @@ -19,8 +19,6 @@ class IFX_SeekableReadStream; class CFDF_Document : public CPDF_IndirectObjectHolder { public: static std::unique_ptr CreateNewDoc(); - static std::unique_ptr ParseFile( - const RetainPtr& pFile); static std::unique_ptr ParseMemory(uint8_t* pData, uint32_t size); diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h index 0a6d836ddd..923eb7cb71 100644 --- a/core/fxcodec/fx_codec.h +++ b/core/fxcodec/fx_codec.h @@ -100,13 +100,6 @@ class CCodec_ModuleMgr { void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels); uint32_t ComponentsForFamily(int family); -void sRGB_to_AdobeCMYK(float R, - float G, - float B, - float& c, - float& m, - float& y, - float& k); std::tuple AdobeCMYK_to_sRGB(float c, float m, float y, diff --git a/core/fxcrt/cfx_binarybuf.cpp b/core/fxcrt/cfx_binarybuf.cpp index 3673fa58d4..1243593a77 100644 --- a/core/fxcrt/cfx_binarybuf.cpp +++ b/core/fxcrt/cfx_binarybuf.cpp @@ -12,11 +12,6 @@ CFX_BinaryBuf::CFX_BinaryBuf() : m_AllocStep(0), m_AllocSize(0), m_DataSize(0) {} -CFX_BinaryBuf::CFX_BinaryBuf(size_t size) - : m_AllocStep(0), m_AllocSize(size), m_DataSize(size) { - m_pBuffer.reset(FX_Alloc(uint8_t, size)); -} - CFX_BinaryBuf::~CFX_BinaryBuf() {} void CFX_BinaryBuf::Delete(size_t start_index, size_t count) { @@ -77,18 +72,3 @@ void CFX_BinaryBuf::AppendBlock(const void* pBuf, size_t size) { } m_DataSize += size; } - -void CFX_BinaryBuf::InsertBlock(size_t pos, const void* pBuf, size_t size) { - if (size <= 0) - return; - - ExpandBuf(size); - memmove(m_pBuffer.get() + pos + size, m_pBuffer.get() + pos, - m_DataSize - pos); - if (pBuf) { - memcpy(m_pBuffer.get() + pos, pBuf, size); - } else { - memset(m_pBuffer.get() + pos, 0, size); - } - m_DataSize += size; -} diff --git a/core/fxcrt/cfx_binarybuf.h b/core/fxcrt/cfx_binarybuf.h index 1a1c821bb9..2d4f019560 100644 --- a/core/fxcrt/cfx_binarybuf.h +++ b/core/fxcrt/cfx_binarybuf.h @@ -16,7 +16,6 @@ class CFX_BinaryBuf { public: CFX_BinaryBuf(); - explicit CFX_BinaryBuf(size_t size); virtual ~CFX_BinaryBuf(); uint8_t* GetBuffer() const { return m_pBuffer.get(); } @@ -36,7 +35,6 @@ class CFX_BinaryBuf { m_pBuffer.get()[m_DataSize++] = byte; } - void InsertBlock(size_t pos, const void* pBuf, size_t size); void Delete(size_t start_index, size_t count); // Releases ownership of |m_pBuffer| and returns it. diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp index 733425ef26..db4bea945f 100644 --- a/core/fxcrt/fx_coordinates.cpp +++ b/core/fxcrt/fx_coordinates.cpp @@ -313,12 +313,6 @@ float CFX_Matrix::TransformXDistance(float dx) const { return sqrt(fx * fx + fy * fy); } -float CFX_Matrix::TransformDistance(float dx, float dy) const { - float fx = a * dx + c * dy; - float fy = b * dx + d * dy; - return sqrt(fx * fx + fy * fy); -} - float CFX_Matrix::TransformDistance(float distance) const { return distance * (GetXUnit() + GetYUnit()) / 2; } diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 55d28cd66f..c53d157610 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -644,7 +644,6 @@ class CFX_Matrix { CFX_FloatRect GetUnitRect() const; float TransformXDistance(float dx) const; - float TransformDistance(float dx, float dy) const; float TransformDistance(float distance) const; CFX_PointF Transform(const CFX_PointF& point) const; diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 04680e93bf..4f0012d3ec 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -518,10 +518,6 @@ ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( return pFDF ? pFDF->WriteToString() : ByteString(); } -WideString CPDFSDK_InterForm::GetTemporaryFileName(const WideString& sFileExt) { - return L""; -} - bool CPDFSDK_InterForm::SubmitForm(const WideString& sDestination, bool bUrlEncoded) { if (sDestination.IsEmpty()) diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h index ae39913c4c..dc9ac64b5b 100644 --- a/fpdfsdk/cpdfsdk_interform.h +++ b/fpdfsdk/cpdfsdk_interform.h @@ -92,7 +92,6 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { ByteString ExportFieldsToFDFTextBuf( const std::vector& fields, bool bIncludeOrExclude); - WideString GetTemporaryFileName(const WideString& sFileExt); bool IsNeedHighLight(int nFieldType); void RemoveAllHighLight(); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index fb1afe94b4..703fc47808 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -511,11 +511,6 @@ CFFL_FormFiller* CFFL_InteractiveFormFiller::GetFormFiller( return pFormFiller; } -void CFFL_InteractiveFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) { - if (pAnnot) - UnRegisterFormFiller(pAnnot); -} - WideString CFFL_InteractiveFormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 7485dcfd6c..01927529f7 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -81,7 +81,6 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRegister); - void RemoveFormFiller(CPDFSDK_Annot* pAnnot); WideString GetSelectedText(CPDFSDK_Annot* pAnnot); void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text); diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index f2ed03dea4..6c867ca456 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp @@ -126,10 +126,6 @@ bool CPWL_Edit::CanSelectAll() const { return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); } -bool CPWL_Edit::CanClear() const { - return !IsReadOnly() && m_pEdit->IsSelected(); -} - bool CPWL_Edit::CanCopy() const { return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && m_pEdit->IsSelected(); @@ -674,11 +670,6 @@ CPVT_WordRange CPWL_Edit::GetLatinWordsRange( return GetSameWordsRange(place, true, false); } -CPVT_WordRange CPWL_Edit::GetArabicWordsRange( - const CPVT_WordPlace& place) const { - return GetSameWordsRange(place, false, true); -} - #define PWL_ISARABICWORD(word) \ ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC)) diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h index 9c6f5e8da1..3f9cd433f5 100644 --- a/fpdfsdk/pwl/cpwl_edit.h +++ b/fpdfsdk/pwl/cpwl_edit.h @@ -74,7 +74,6 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetCharSpace(float fCharSpace); bool CanSelectAll() const; - bool CanClear() const; bool CanCopy() const; bool CanCut() const; @@ -122,7 +121,6 @@ class CPWL_Edit : public CPWL_EditCtrl { const CPVT_WordRange& wr2); CPVT_WordRange GetLatinWordsRange(const CFX_PointF& point) const; CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; - CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, bool bLatin, bool bArabic) const; -- cgit v1.2.3