backout of previous patch due to redness and warnings

This commit is contained in:
cvshook%sicking.cc 2006-10-12 19:08:45 +00:00
Родитель 9804701e60
Коммит 0aa00ad601
8 изменённых файлов: 32 добавлений и 45 удалений

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

@ -48,13 +48,12 @@
#include "nsCSSDeclaration.h"
#include "nsIHTMLDocument.h"
#include "nsIDocument.h"
#include "nsTPtrArray.h"
#ifdef MOZ_SVG
#include "nsISVGValue.h"
#endif
nsTConstPtrArray<nsAttrValue::EnumTable>* nsAttrValue::sEnumTableArray = nsnull;
nsVoidArray* nsAttrValue::sEnumTableArray = nsnull;
nsAttrValue::nsAttrValue()
: mBits(0)
@ -98,7 +97,7 @@ nsAttrValue::Init()
{
NS_ASSERTION(!sEnumTableArray, "nsAttrValue already initialized");
sEnumTableArray = new nsTConstPtrArray<EnumTable>;
sEnumTableArray = new nsVoidArray;
NS_ENSURE_TRUE(sEnumTableArray, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;
@ -351,8 +350,8 @@ nsAttrValue::ToString(nsAString& aResult) const
case eEnum:
{
PRInt16 val = GetEnumValue();
const EnumTable* table = sEnumTableArray->
ElementAt(GetIntInternal() & NS_ATTRVALUE_ENUMTABLEINDEX_MASK);
EnumTable* table = NS_STATIC_CAST(EnumTable*, sEnumTableArray->
FastElementAt(GetIntInternal() & NS_ATTRVALUE_ENUMTABLEINDEX_MASK));
while (table->tag) {
if (table->value == val) {
aResult.AssignASCII(table->tag);
@ -833,18 +832,21 @@ nsAttrValue::ParseEnumValue(const nsAString& aValue,
{
ResetIfSet();
// Have to const cast here since nsVoidArray can't deal with constpointers
EnumTable* tableStart = NS_CONST_CAST(EnumTable*, aTable);
nsAutoString val(aValue);
while (aTable->tag) {
if (aCaseSensitive ? val.EqualsASCII(aTable->tag) :
val.EqualsIgnoreCase(aTable->tag)) {
// Find index of EnumTable
PRInt16 index = sEnumTableArray->IndexOf(aTable);
PRInt16 index = sEnumTableArray->IndexOf(tableStart);
if (index < 0) {
index = sEnumTableArray->Length();
index = sEnumTableArray->Count();
NS_ASSERTION(index <= NS_ATTRVALUE_ENUMTABLEINDEX_MAXVALUE,
"too many enum tables");
if (!sEnumTableArray->AppendElement(aTable)) {
if (!sEnumTableArray->AppendElement(tableStart)) {
return PR_FALSE;
}
}

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

@ -57,7 +57,7 @@ class nsICSSStyleRule;
class nsISVGValue;
class nsIDocument;
template<class E> class nsCOMArray;
template<class E> class nsTConstPtrArray;
class nsVoidArray;
#define NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM 12
@ -285,7 +285,7 @@ private:
PRBool EnsureEmptyMiscContainer();
PRBool EnsureEmptyAtomArray();
static nsTConstPtrArray<EnumTable>* sEnumTableArray;
static nsVoidArray* sEnumTableArray;
PtrBits mBits;
};

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

@ -272,7 +272,7 @@ txStylesheet::getKeyMap()
PRBool
txStylesheet::isStripSpaceAllowed(const txXPathNode& aNode, txIMatchContext* aContext)
{
PRInt32 frameCount = mStripSpaceTests.Length();
PRInt32 frameCount = mStripSpaceTests.Count();
if (frameCount == 0) {
return PR_FALSE;
}
@ -293,7 +293,8 @@ txStylesheet::isStripSpaceAllowed(const txXPathNode& aNode, txIMatchContext* aCo
// check Whitespace stipping handling list against given Node
PRInt32 i;
for (i = 0; i < frameCount; ++i) {
txStripSpaceTest* sst = mStripSpaceTests[i];
txStripSpaceTest* sst =
NS_STATIC_CAST(txStripSpaceTest*, mStripSpaceTests[i]);
if (sst->matches(node, aContext)) {
return sst->stripsSpace() && !XMLUtils::getXMLSpacePreserve(node);
}
@ -321,7 +322,7 @@ txStylesheet::doneCompiling()
frameIter.reset();
ImportFrame* frame;
while ((frame = NS_STATIC_CAST(ImportFrame*, frameIter.next()))) {
nsTPtrArray<txStripSpaceTest> frameStripSpaceTests;
nsVoidArray frameStripSpaceTests;
txListIterator itemIter(&frame->mToplevelItems);
itemIter.resetToEnd();
@ -506,19 +507,23 @@ txStylesheet::addFrames(txListIterator& aInsertIter)
nsresult
txStylesheet::addStripSpace(txStripSpaceItem* aStripSpaceItem,
nsTPtrArray<txStripSpaceTest>& aFrameStripSpaceTests)
nsVoidArray& frameStripSpaceTests)
{
PRInt32 testCount = aStripSpaceItem->mStripSpaceTests.Length();
PRInt32 testCount = aStripSpaceItem->mStripSpaceTests.Count();
for (; testCount > 0; --testCount) {
txStripSpaceTest* sst = aStripSpaceItem->mStripSpaceTests[testCount-1];
txStripSpaceTest* sst =
NS_STATIC_CAST(txStripSpaceTest*,
aStripSpaceItem->mStripSpaceTests[testCount-1]);
double priority = sst->getDefaultPriority();
PRInt32 i, frameCount = aFrameStripSpaceTests.Length();
PRInt32 i, frameCount = frameStripSpaceTests.Count();
for (i = 0; i < frameCount; ++i) {
if (aFrameStripSpaceTests[i]->getDefaultPriority() < priority) {
txStripSpaceTest* fsst =
NS_STATIC_CAST(txStripSpaceTest*, frameStripSpaceTests[i]);
if (fsst->getDefaultPriority() < priority) {
break;
}
}
if (!aFrameStripSpaceTests.InsertElementAt(i, sst)) {
if (!frameStripSpaceTests.InsertElementAt(sst, i)) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -43,7 +43,7 @@
#include "txExpandedNameMap.h"
#include "txList.h"
#include "txXSLTPatterns.h"
#include "nsTPtrArray.h"
#include "nsVoidArray.h"
class txInstruction;
class txToplevelItem;
@ -52,7 +52,6 @@ class txVariableItem;
class txStripSpaceItem;
class txAttributeSetItem;
class txDecimalFormat;
class txStripSpaceTest;
class txStylesheet
{
@ -162,7 +161,7 @@ private:
nsresult addGlobalVariable(txVariableItem* aVariable);
nsresult addFrames(txListIterator& aInsertIter);
nsresult addStripSpace(txStripSpaceItem* aStripSpaceItem,
nsTPtrArray<txStripSpaceTest>& aFrameStripSpaceTests);
nsVoidArray& frameStripSpaceTests);
nsresult addAttributeSet(txAttributeSetItem* aAttributeSetItem);
// Refcount
@ -197,7 +196,7 @@ private:
txExpandedNameMap mKeys;
// Array of all txStripSpaceTests, sorted in acending order
nsTPtrArray<txStripSpaceTest> mStripSpaceTests;
nsVoidArray mStripSpaceTests;
// Default templates
nsAutoPtr<txInstruction> mContainerTemplate;

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

@ -50,9 +50,9 @@ TX_IMPL_GETTYPE(txStripSpaceItem, txToplevelItem::stripSpace)
txStripSpaceItem::~txStripSpaceItem()
{
PRInt32 i, count = mStripSpaceTests.Length();
PRInt32 i, count = mStripSpaceTests.Count();
for (i = 0; i < count; ++i) {
delete mStripSpaceTests[i];
delete NS_STATIC_CAST(txStripSpaceTest*, mStripSpaceTests[i]);
}
}

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

@ -128,7 +128,7 @@ public:
nsresult addStripSpaceTest(txStripSpaceTest* aStripSpaceTest);
nsTPtrArray<txStripSpaceTest> mStripSpaceTests;
nsVoidArray mStripSpaceTests;
};
// xsl:template

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

@ -88,7 +88,6 @@ SDK_HEADERS = \
nsTHashtable.h \
nsVoidArray.h \
nsTArray.h \
nsTPtrArray.h \
nsTWeakRef.h \
nsID.h \
nsIGenericFactory.h \

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

@ -275,24 +275,6 @@ class nsTArray : public nsTArray_base {
return Elements()[i];
}
// This method provides direct access to the i'th element of the array in
// a bounds safe manner. If the requested index is out of bounds the
// provided default value is returned.
// @param i The index of an element in the array.
// @param def The value to return if the index is out of bounds.
elem_type& SafeElementAt(index_type i, elem_type& def) {
return i < Length() ? Elements()[i] : def;
}
// This method provides direct access to the i'th element of the array in
// a bounds safe manner. If the requested index is out of bounds the
// provided default value is returned.
// @param i The index of an element in the array.
// @param def The value to return if the index is out of bounds.
const elem_type& SafeElementAt(index_type i, const elem_type& def) const {
return i < Length() ? Elements()[i] : def;
}
// Shorthand for ElementAt(i)
elem_type& operator[](index_type i) {
return ElementAt(i);