1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 05:48:01 +01:00

wmaker: fix size of element given to the 'qsort' function (Coverity #50210)

As pointed by Coverity, the sizeof used was not done on the right type.
This worked because the element was a pointer all pointers types have the
same size in most platforms.

For code maintainability, the code will now take the size from the first
element of the array to be sorted, so that if the structure gets changed
someday the expression will stay valid.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
Christophe CURIS
2014-11-15 19:40:57 +01:00
committed by Carlos R. Mafra
parent 2ed24561ff
commit 2b65b0416e

View File

@@ -776,10 +776,10 @@ static void updateMoveData(WWindow * wwin, MoveData * data)
/* order from closest to the border of the screen to farthest */ /* order from closest to the border of the screen to farthest */
qsort(data->topList, data->count, sizeof(WWindow **), compareWTop); qsort(data->topList, data->count, sizeof(data->topList[0]), compareWTop);
qsort(data->leftList, data->count, sizeof(WWindow **), compareWLeft); qsort(data->leftList, data->count, sizeof(data->leftList[0]), compareWLeft);
qsort(data->rightList, data->count, sizeof(WWindow **), compareWRight); qsort(data->rightList, data->count, sizeof(data->rightList[0]), compareWRight);
qsort(data->bottomList, data->count, sizeof(WWindow **), compareWBottom); qsort(data->bottomList, data->count, sizeof(data->bottomList[0]), compareWBottom);
/* figure the position of the window relative to the others */ /* figure the position of the window relative to the others */