Bug 124218 if kCSSRawKeywords gets out of sync with eCSSKeyword_COUNT nsCSSKeywords::AddRefTable might crash in DEBUG code

r=bz sr=bz
This commit is contained in:
timeless%mozdev.org 2003-10-30 01:59:15 +00:00
Родитель a51b7b4593
Коммит 61783f20d3
2 изменённых файлов: 6 добавлений и 2 удалений

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

@ -64,13 +64,15 @@ nsCSSKeywords::AddRefTable(void)
#ifdef DEBUG
{
// let's verify the table...
for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) {
PRInt32 index = 0;
for (; index < eCSSKeyword_COUNT && kCSSRawKeywords[index]; ++index) {
nsCAutoString temp1(kCSSRawKeywords[index]);
nsCAutoString temp2(kCSSRawKeywords[index]);
ToLowerCase(temp1);
NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table");
}
NS_ASSERTION(index == eCSSKeyword_COUNT, "kCSSRawKeywords and eCSSKeyword_COUNT are out of sync");
}
#endif
gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT);

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

@ -64,13 +64,15 @@ nsCSSKeywords::AddRefTable(void)
#ifdef DEBUG
{
// let's verify the table...
for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) {
PRInt32 index = 0;
for (; index < eCSSKeyword_COUNT && kCSSRawKeywords[index]; ++index) {
nsCAutoString temp1(kCSSRawKeywords[index]);
nsCAutoString temp2(kCSSRawKeywords[index]);
ToLowerCase(temp1);
NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table");
}
NS_ASSERTION(index == eCSSKeyword_COUNT, "kCSSRawKeywords and eCSSKeyword_COUNT are out of sync");
}
#endif
gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT);