From 80c40de632cc089979dfd5bea351f58aa20930ce Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 8 Dec 2016 12:28:04 -0800 Subject: Remove last usage of CFX_ObjectArray. Review-Url: https://codereview.chromium.org/2558373002 --- core/fpdfapi/parser/cpdf_stream_acc.h | 3 + core/fxcrt/fx_basic.h | 102 ---------------------------------- 2 files changed, 3 insertions(+), 102 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h index 24ae5d2ed8..51a8a18332 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.h +++ b/core/fpdfapi/parser/cpdf_stream_acc.h @@ -19,6 +19,9 @@ class CPDF_StreamAcc { CPDF_StreamAcc(); ~CPDF_StreamAcc(); + CPDF_StreamAcc(const CPDF_StreamAcc&) = delete; + CPDF_StreamAcc& operator=(const CPDF_StreamAcc&) = delete; + void LoadAllData(const CPDF_Stream* pStream, bool bRawAccess = false, uint32_t estimated_size = 0, diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 2b8f6b6afe..30673f6525 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -321,108 +321,6 @@ typedef CFX_ArrayTemplate CFX_WideStringCArray; typedef CFX_ArrayTemplate CFX_FloatArray; typedef CFX_ArrayTemplate CFX_ByteArray; typedef CFX_ArrayTemplate CFX_Int32Array; - -template -class CFX_ObjectArray : public CFX_BasicArray { - public: - CFX_ObjectArray() : CFX_BasicArray(sizeof(ObjectClass)) {} - - ~CFX_ObjectArray() { RemoveAll(); } - - void Add(const ObjectClass& data) { - new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data); - } - - ObjectClass& Add() { - return *(ObjectClass*)new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(); - } - - void* AddSpace() { return InsertSpaceAt(m_nSize, 1); } - - int32_t Append(const CFX_ObjectArray& src, - int32_t nStart = 0, - int32_t nCount = -1) { - if (nCount == 0) { - return 0; - } - int32_t nSize = src.GetSize(); - if (!nSize) { - return 0; - } - ASSERT(nStart > -1 && nStart < nSize); - if (nCount < 0) { - nCount = nSize; - } - if (nStart + nCount > nSize) { - nCount = nSize - nStart; - } - if (nCount < 1) { - return 0; - } - nSize = m_nSize; - InsertSpaceAt(m_nSize, nCount); - ObjectClass* pStartObj = (ObjectClass*)GetDataPtr(nSize); - nSize = nStart + nCount; - for (int32_t i = nStart; i < nSize; i++, pStartObj++) { - new ((void*)pStartObj) ObjectClass(src[i]); - } - return nCount; - } - - int32_t Copy(const CFX_ObjectArray& src, - int32_t nStart = 0, - int32_t nCount = -1) { - if (nCount == 0) { - return 0; - } - int32_t nSize = src.GetSize(); - if (!nSize) { - return 0; - } - ASSERT(nStart > -1 && nStart < nSize); - if (nCount < 0) { - nCount = nSize; - } - if (nStart + nCount > nSize) { - nCount = nSize - nStart; - } - if (nCount < 1) { - return 0; - } - RemoveAll(); - SetSize(nCount); - ObjectClass* pStartObj = (ObjectClass*)m_pData; - nSize = nStart + nCount; - for (int32_t i = nStart; i < nSize; i++, pStartObj++) { - new ((void*)pStartObj) ObjectClass(src[i]); - } - return nCount; - } - - int GetSize() const { return m_nSize; } - - ObjectClass& operator[](int index) const { - ASSERT(index < m_nSize); - return *(ObjectClass*)CFX_BasicArray::GetDataPtr(index); - } - - ObjectClass* GetDataPtr(int index) { - return (ObjectClass*)CFX_BasicArray::GetDataPtr(index); - } - - void RemoveAt(int index) { - ASSERT(index < m_nSize); - ((ObjectClass*)GetDataPtr(index))->~ObjectClass(); - CFX_BasicArray::RemoveAt(index, 1); - } - - void RemoveAll() { - for (int i = 0; i < m_nSize; i++) { - ((ObjectClass*)GetDataPtr(i))->~ObjectClass(); - } - CFX_BasicArray::SetSize(0); - } -}; #endif // PDF_ENABLE_XFA template -- cgit v1.2.3