diff --git a/glfw/linux_joystick.c b/glfw/linux_joystick.c index c1a1d00c8..d40bf0233 100644 --- a/glfw/linux_joystick.c +++ b/glfw/linux_joystick.c @@ -315,7 +315,7 @@ bool _glfwInitJoysticksLinux(void) // Continue with no joysticks if enumeration fails - qsort(_glfw.joysticks, count, sizeof(_GLFWjoystick), compareJoysticks); + qsort(_glfw.joysticks, count, sizeof(_glfw.joysticks[0]), compareJoysticks); return true; } diff --git a/glfw/monitor.c b/glfw/monitor.c index eb72afb58..7b01b3706 100644 --- a/glfw/monitor.c +++ b/glfw/monitor.c @@ -74,7 +74,7 @@ static bool refreshVideoModes(_GLFWmonitor* monitor) if (!modes) return false; - qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes); + qsort(modes, modeCount, sizeof(modes[0]), compareVideoModes); free(monitor->modes); monitor->modes = modes; diff --git a/kitty/graphics.c b/kitty/graphics.c index 74fcf29a8..49cb1d743 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -131,7 +131,7 @@ apply_storage_quota(GraphicsManager *self, size_t storage_limit, id_type current remove_images(self, trim_predicate, currently_added_image_internal_id); if (self->used_storage < storage_limit) return; - qsort(self->images, self->image_count, sizeof(Image), oldest_last); + qsort(self->images, self->image_count, sizeof(self->images[0]), oldest_last); while (self->used_storage > storage_limit && self->image_count > 0) { remove_image(self, self->image_count - 1); } @@ -576,7 +576,7 @@ grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float scree }} if (!self->count) return false; // Sort visible refs in draw order (z-index, img) - qsort(self->render_data, self->count, sizeof(ImageRenderData), cmp_by_zindex_and_image); + qsort(self->render_data, self->count, sizeof(self->render_data[0]), cmp_by_zindex_and_image); // Calculate the group counts i = 0; while (i < self->count) {