From 0ce9343fb6e4094e68c5b7fd6c74547ff02f2ecb Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 27 May 2008 15:30:51 +0000 Subject: [PATCH] (svn r13291) -Fix (r13266): qsort passed wrong sizeof data --- src/industry_gui.cpp | 2 +- src/network/network_gui.cpp | 2 +- src/vehicle_gui.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index d8857f6e1a..b6069424c4 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -841,7 +841,7 @@ static void SortIndustriesList(GUIIndustryList *sl) _internal_sort_order = (sl->sort_type << 1) | (sl->flags & VL_DESC); _last_industry = NULL; // used for "cache" in namesorting - qsort((void*)sl->Begin(), sl->Length(), sizeof(sl->Begin()), &GeneralIndustrySorter); + qsort((void*)sl->Begin(), sl->Length(), sizeof(*sl->Begin()), &GeneralIndustrySorter); sl->flags &= ~VL_RESORT; } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index c3787e33d4..5661b2f03a 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -237,7 +237,7 @@ struct NetworkGameWindow : public QueryStringBaseWindow { if (this->servers.Length() == 0) return; _internal_sort_order = !!(this->servers.flags & VL_DESC); - qsort(this->servers.Begin(), this->servers.Length(), sizeof(this->servers.Begin()), ngame_sorter[this->servers.sort_type]); + qsort(this->servers.Begin(), this->servers.Length(), sizeof(*this->servers.Begin()), ngame_sorter[this->servers.sort_type]); /* After sorting ngl->sort_list contains the sorted items. Put these back * into the original list. Basically nothing has changed, we are only diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index c0b02d8237..36ee986e66 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -110,7 +110,7 @@ void SortVehicleList(VehicleListBase *vl) _last_vehicle[0] = _last_vehicle[1] = NULL; _internal_sort_order = (vl->vehicles.flags & VL_DESC) != 0; - qsort((void*)vl->vehicles.Begin(), vl->vehicles.Length(), sizeof(vl->vehicles.Begin()), + qsort((void*)vl->vehicles.Begin(), vl->vehicles.Length(), sizeof(*vl->vehicles.Begin()), _vehicle_sorter[vl->vehicles.sort_type]); vl->vehicles.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; @@ -121,7 +121,7 @@ void DepotSortList(VehicleList *list) { _internal_sort_order = 0; if (list->Length() < 2) return; - qsort((void*)list->Begin(), list->Length(), sizeof(list->Begin()), _vehicle_sorter[0]); + qsort((void*)list->Begin(), list->Length(), sizeof(*list->Begin()), _vehicle_sorter[0]); } /** draw the vehicle profit button in the vehicle list window. */