This commit is contained in:
waterson%netscape.com 2000-06-15 06:42:27 +00:00
Родитель 6f04def0f7
Коммит a97ae58687
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -73,6 +73,7 @@ nsVoidArray::nsVoidArray(PRInt32 aCount)
char* bytes = new char[sizeof(Impl) + sizeof(void*) * (aCount - 1)]; char* bytes = new char[sizeof(Impl) + sizeof(void*) * (aCount - 1)];
mImpl = NS_REINTERPRET_CAST(Impl*, bytes); mImpl = NS_REINTERPRET_CAST(Impl*, bytes);
if (mImpl) { if (mImpl) {
mImpl->mBits = 0;
SetArraySize(aCount); SetArraySize(aCount);
mImpl->mCount = aCount; mImpl->mCount = aCount;
nsCRT::memset(mImpl->mArray, 0, mImpl->mCount * sizeof(void*)); nsCRT::memset(mImpl->mArray, 0, mImpl->mCount * sizeof(void*));
@ -91,6 +92,7 @@ nsVoidArray& nsVoidArray::operator=(const nsVoidArray& other)
char* bytes = new char[sizeof(Impl) + sizeof(void*) * (otherCount - 1)]; char* bytes = new char[sizeof(Impl) + sizeof(void*) * (otherCount - 1)];
mImpl = NS_REINTERPRET_CAST(Impl*, bytes); mImpl = NS_REINTERPRET_CAST(Impl*, bytes);
if (mImpl) { if (mImpl) {
mImpl->mBits = 0;
SetArraySize(otherCount); SetArraySize(otherCount);
mImpl->mCount = otherCount; mImpl->mCount = otherCount;
SetArrayOwner(PR_TRUE); SetArrayOwner(PR_TRUE);
@ -172,6 +174,7 @@ PRBool nsVoidArray::InsertElementAt(void* aElement, PRInt32 aIndex)
delete[] NS_REINTERPRET_CAST(char*, mImpl); delete[] NS_REINTERPRET_CAST(char*, mImpl);
mImpl = newImpl; mImpl = newImpl;
mImpl->mBits = 0;
SetArraySize(newCount); SetArraySize(newCount);
mImpl->mCount = oldCount; mImpl->mCount = oldCount;
SetArrayOwner(PR_TRUE); SetArrayOwner(PR_TRUE);
@ -214,6 +217,7 @@ PRBool nsVoidArray::ReplaceElementAt(void* aElement, PRInt32 aIndex)
delete[] NS_REINTERPRET_CAST(char*, mImpl); delete[] NS_REINTERPRET_CAST(char*, mImpl);
mImpl = newImpl; mImpl = newImpl;
mImpl->mBits = 0;
SetArraySize(newCount); SetArraySize(newCount);
mImpl->mCount = oldCount; mImpl->mCount = oldCount;
SetArrayOwner(PR_TRUE); SetArrayOwner(PR_TRUE);
@ -283,6 +287,7 @@ void nsVoidArray::Compact()
nsCRT::memcpy(newImpl->mArray, mImpl->mArray, count * sizeof(void*)); nsCRT::memcpy(newImpl->mArray, mImpl->mArray, count * sizeof(void*));
mImpl = newImpl; mImpl = newImpl;
mImpl->mBits = 0;
SetArraySize(count); SetArraySize(count);
mImpl->mCount = count; mImpl->mCount = count;
SetArrayOwner(PR_TRUE); SetArrayOwner(PR_TRUE);
@ -329,10 +334,11 @@ nsAutoVoidArray::nsAutoVoidArray()
: nsVoidArray() : nsVoidArray()
{ {
mImpl = NS_REINTERPRET_CAST(Impl*, mAutoBuf); mImpl = NS_REINTERPRET_CAST(Impl*, mAutoBuf);
mImpl->mCount = 0; mImpl->mBits = 0;
::memset(mImpl->mArray, 0, mImpl->mCount * sizeof(void*));
SetArraySize(kAutoBufSize); SetArraySize(kAutoBufSize);
mImpl->mCount = 0;
SetArrayOwner(PR_FALSE); SetArrayOwner(PR_FALSE);
::memset(mImpl->mArray, 0, mImpl->mCount * sizeof(void*));
} }
//---------------------------------------------------------------- //----------------------------------------------------------------