Fixing bug 248442. Fix incorrect item size argument that was passed to NS_QuickSort() which lead to a crash on platforms where sizeof(void *) != sizeof(PRUint32). r=ben@bengoodger.com, sr=dbaron@dbaron.org

This commit is contained in:
jst%mozilla.jstenback.com 2004-06-25 00:16:11 +00:00
Родитель e29b29c0ba
Коммит 3725a4cd14
1 изменённых файлов: 18 добавлений и 15 удалений

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

@ -740,24 +740,27 @@ nsFormHistory::AutoCompleteSearch(const nsAString &aInputName,
// Turn auto array into flat array for quick sort, now that we
// know how many items there are
PRUint32 count = matchingRows.Count();
PRUint32* items = new PRUint32[count];
PRUint32 i;
for (i = 0; i < count; ++i)
items[i] = i;
NS_QuickSort(items, count, sizeof(nsIMdbRow*),
SortComparison, &matchingValues);
if (count > 0) {
PRUint32* items = new PRUint32[count];
PRUint32 i;
for (i = 0; i < count; ++i)
items[i] = i;
for (i = 0; i < count; ++i) {
// Place the sorted result into the autocomplete result
result->AddRow((nsIMdbRow *)matchingRows[items[i]]);
// Free up these strings we owned.
delete (PRUnichar *) matchingValues[i];
NS_QuickSort(items, count, sizeof(PRUint32),
SortComparison, &matchingValues);
for (i = 0; i < count; ++i) {
// Place the sorted result into the autocomplete result
result->AddRow((nsIMdbRow *)matchingRows[items[i]]);
// Free up these strings we owned.
delete (PRUnichar *) matchingValues[i];
}
delete[] items;
}
delete[] items;
PRUint32 matchCount;
result->GetMatchCount(&matchCount);
if (matchCount > 0) {