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
Родитель 5aa99c8506
Коммит 98152b3898
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);