diff --git a/intl/uconv/src/Makefile.in b/intl/uconv/src/Makefile.in index 5ae368cbcccc..d0d4c8a1edd6 100644 --- a/intl/uconv/src/Makefile.in +++ b/intl/uconv/src/Makefile.in @@ -50,7 +50,6 @@ CPPSRCS = \ nsMappingCache.cpp \ nsCharsetMenu.cpp \ nsUConvModule.cpp \ - nsObjectArray.cpp \ $(NULL) EXPORT_RESOURCE = \ diff --git a/intl/uconv/src/makefile.win b/intl/uconv/src/makefile.win index 2875555e0974..ef688170dbc5 100644 --- a/intl/uconv/src/makefile.win +++ b/intl/uconv/src/makefile.win @@ -42,7 +42,6 @@ CPPSRCS = \ nsMappingCache.cpp \ nsURLProperties.cpp \ nsCharsetMenu.cpp \ - nsObjectArray.cpp \ $(NULL) CPP_OBJS= \ @@ -56,7 +55,6 @@ CPP_OBJS= \ .\$(OBJDIR)\nsMappingCache.obj \ .\$(OBJDIR)\nsURLProperties.obj \ .\$(OBJDIR)\nsCharsetMenu.obj \ - .\$(OBJDIR)\nsObjectArray.obj \ $(NULL) CSRCS = \ diff --git a/intl/uconv/src/nsObjectArray.cpp b/intl/uconv/src/nsObjectArray.cpp deleted file mode 100644 index 84881955080c..000000000000 --- a/intl/uconv/src/nsObjectArray.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsObjectArray.h" - -//---------------------------------------------------------------------------- -// Class nsObject [implementation] - -// XXX clarify why I can't have this method as a pure virtual one?! -nsObject::~nsObject() -{ -} - -//---------------------------------------------------------------------------- -// Class nsObjectsArray [implementation] - -nsObjectArray::nsObjectArray(PRInt32 aCapacity) -{ - Init(aCapacity); -} - -nsObjectArray::nsObjectArray() -{ - Init(64); -} - -nsObjectArray::~nsObjectArray() -{ - for (PRInt32 i = 0; i < mUsage; i++) delete mArray[i]; - if (mArray != NULL) delete [] mArray; -} - -nsObject ** nsObjectArray::GetArray() -{ - return mArray; -} - -nsObject * nsObjectArray::GetObject(PRInt32 aIndex) -{ - if ((aIndex < 0) || (aIndex >= mUsage)) return NULL; - return mArray[aIndex]; -} - -PRInt32 nsObjectArray::GetUsage() -{ - return mUsage; -} - -void nsObjectArray::Init(PRInt32 aCapacity) -{ - mCapacity = aCapacity; - mUsage = 0; - mArray = NULL; -} - -nsresult nsObjectArray::InsureCapacity(PRInt32 aCapacity) -{ - PRInt32 i; - - if (mArray == NULL) { - mArray = new nsObject * [mCapacity]; - if (mArray == NULL) return NS_ERROR_OUT_OF_MEMORY; - } - - if (aCapacity > mCapacity) { - while (aCapacity > mCapacity) mCapacity *= 2; - nsObject ** newArray = new nsObject * [mCapacity]; - if (newArray == NULL) return NS_ERROR_OUT_OF_MEMORY; - for (i = 0; i < mUsage; i++) newArray[i] = mArray[i]; - delete [] mArray; - mArray = newArray; - } - - return NS_OK; -} - -nsresult nsObjectArray::AddObject(nsObject * aObject, PRInt32 aPosition) -{ - nsresult res; - - if ((aPosition < 0) || (aPosition > mUsage)) aPosition = mUsage; - - res = InsureCapacity(mUsage + 1); - if (NS_FAILED(res)) return res; - - PRInt32 i; - for (i = mUsage; i > aPosition; i--) mArray[i] = mArray[i-1]; - - mArray[aPosition] = aObject; - mUsage++; - - return NS_OK; -} - diff --git a/intl/uconv/src/nsObjectArray.h b/intl/uconv/src/nsObjectArray.h deleted file mode 100644 index 7b66fbafd7af..000000000000 --- a/intl/uconv/src/nsObjectArray.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nscore.h" -#include "nsError.h" - -//---------------------------------------------------------------------------- -// Class nsObject [declaration] - -class nsObject -{ -public: - virtual ~nsObject(); -}; - -//---------------------------------------------------------------------------- -// Class nsObjectArray [declaration] - -class nsObjectArray -{ -private: - - nsObject ** mArray; - PRInt32 mCapacity; - PRInt32 mUsage; - - void Init(PRInt32 aCapacity); - -public: - nsObjectArray(); - nsObjectArray(PRInt32 aCapacity); - ~nsObjectArray(); - - nsObject ** GetArray(); - nsObject * GetObject(PRInt32 aIndex); - PRInt32 GetUsage(); - nsresult InsureCapacity(PRInt32 aCapacity); - nsresult AddObject(nsObject * aObject, PRInt32 aPosition = -1); -}; -