From 99b3d0727dfb76d90bf2ac23c9d6913e0d1a6024 Mon Sep 17 00:00:00 2001 From: Pavel Solovev Date: Fri, 19 Jan 2024 11:25:37 +0300 Subject: [PATCH] Fix build with gcc14 --- glfw/wl_client_side_decorations.c | 2 +- kitty/freetype_render_ui_text.c | 4 ++-- kitty/history.c | 2 +- kitty/mouse.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/glfw/wl_client_side_decorations.c b/glfw/wl_client_side_decorations.c index c66cbcdff..b51c10c4c 100644 --- a/glfw/wl_client_side_decorations.c +++ b/glfw/wl_client_side_decorations.c @@ -76,7 +76,7 @@ blur_mask(kernel_type *image_data, ssize_t width, ssize_t height, ssize_t kernel static kernel_type* create_shadow_mask(size_t width, size_t height, size_t margin, size_t kernel_size, kernel_type base_alpha, kernel_type sigma) { - kernel_type *mask = calloc(sizeof(kernel_type), 2 * width * height + kernel_size); + kernel_type *mask = calloc(2 * width * height + kernel_size, sizeof(kernel_type)); if (!mask) return NULL; for (size_t y = margin; y < height - margin; y++) { kernel_type *row = mask + y * width; diff --git a/kitty/freetype_render_ui_text.c b/kitty/freetype_render_ui_text.c index bcbe46210..c0d35d549 100644 --- a/kitty/freetype_render_ui_text.c +++ b/kitty/freetype_render_ui_text.c @@ -345,7 +345,7 @@ render_run(RenderCtx *ctx, RenderState *rs) { if (pbm.rows > bm_height) { double ratio = pbm.width / (double)pbm.rows; bm_width = (unsigned)(ratio * bm_height); - buf = calloc(sizeof(pixel), (size_t)bm_height * bm_width); + buf = calloc((size_t)bm_height * bm_width, sizeof(pixel)); if (!buf) break; downsample_32bit_image(pbm.buf, pbm.width, pbm.rows, pbm.stride, buf, bm_width, bm_height); pbm.buf = buf; pbm.stride = 4 * bm_width; pbm.width = bm_width; pbm.rows = bm_height; @@ -442,7 +442,7 @@ render_single_line(FreeTypeRenderCtx ctx_, const char *text, unsigned sz_px, pix if (!hb_buffer_pre_allocate(hb_buffer, 512)) { PyErr_NoMemory(); return false; } size_t text_len = strlen(text); - char_type *unicode = calloc(sizeof(char_type), text_len + 1); + char_type *unicode = calloc(text_len + 1, sizeof(char_type)); if (!unicode) { PyErr_NoMemory(); return false; } bool ok = false; text_len = decode_utf8_string(text, text_len, unicode); diff --git a/kitty/history.c b/kitty/history.c index 957c8c3c0..f42736a32 100644 --- a/kitty/history.c +++ b/kitty/history.c @@ -392,7 +392,7 @@ static void pagerhist_rewrap_to(HistoryBuf *self, index_type cells_in_line) { PagerHistoryBuf *ph = self->pagerhist; if (!ph->ringbuf || !ringbuf_bytes_used(ph->ringbuf)) return; - PagerHistoryBuf *nph = calloc(sizeof(PagerHistoryBuf), 1); + PagerHistoryBuf *nph = calloc(1, sizeof(PagerHistoryBuf)); if (!nph) return; nph->maximum_size = ph->maximum_size; nph->ringbuf = ringbuf_new(MIN(ph->maximum_size, ringbuf_capacity(ph->ringbuf) + 4096)); diff --git a/kitty/mouse.c b/kitty/mouse.c index b298a45e8..8a7d5a1fc 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -534,7 +534,7 @@ dispatch_possible_click(Window *w, int button, int modifiers) { Screen *screen = w->render_data.screen; int count = multi_click_count(w, button); if (release_is_click(w, button)) { - PendingClick *pc = calloc(sizeof(PendingClick), 1); + PendingClick *pc = calloc(1, sizeof(PendingClick)); if (pc) { const ClickQueue *q = &w->click_queues[button]; pc->press_num = q->length ? q->clicks[q->length - 1].num : 0;