Bug 1161932 - Fix coverity warning in nsBidi.cpp. r=smontagu

This commit is contained in:
Ted Clancy 2015-05-12 22:49:50 -04:00
Родитель 7e66ac4a43
Коммит 8e8b87b257
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -669,7 +669,7 @@ void nsBidi::ResolveExplicitLevels(nsBidiDirection *aDirection)
uint16_t stack[NSBIDI_MAX_EXPLICIT_LEVEL + 2]; /* we never push anything >=NSBIDI_MAX_EXPLICIT_LEVEL
but we need one more entry as base */
uint32_t stackLast = 0;
int32_t stackLast = 0;
int32_t overflowIsolateCount = 0;
int32_t overflowEmbeddingCount = 0;
int32_t validIsolateCount = 0;
@ -773,8 +773,14 @@ void nsBidi::ResolveExplicitLevels(nsBidiDirection *aDirection)
/* pop embedding entries */
/* until the last isolate entry */
stackLast--;
// Since validIsolateCount is true, there must be an isolate entry
// on the stack, so the stack is guaranteed to not be empty.
// Still, to eliminate a warning from coverity, we use an assertion.
MOZ_ASSERT(stackLast > 0);
}
stackLast--; /* pop also the last isolate entry */
MOZ_ASSERT(stackLast >= 0); // For coverity
validIsolateCount--;
} else {
dirProps[i] |= IGNORE_CC;