Fix Windows optimized bustage from bug 636039 patch 15: use placement new in a loop instead of using placement new[].

This commit is contained in:
L. David Baron 2011-03-18 14:02:44 -07:00
Родитель 92673c9bcd
Коммит 5970f11790
1 изменённых файлов: 6 добавлений и 1 удалений

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

@ -1716,8 +1716,13 @@ struct AutoCSSValueArray {
AutoCSSValueArray(void* aStorage, size_t aCount) {
NS_ABORT_IF_FALSE(size_t(aStorage) % NS_ALIGNMENT_OF(nsCSSValue) == 0,
"bad alignment from alloca");
mArray = new (aStorage) nsCSSValue[aCount];
mCount = aCount;
// Don't use placement new[], since it might store extra data
// for the count (on Windows!).
mArray = static_cast<nsCSSValue*>(aStorage);
for (size_t i = 0; i < mCount; ++i) {
new (mArray + i) nsCSSValue();
}
}
~AutoCSSValueArray() {