This commit is contained in:
Kovid Goyal 2024-01-19 14:03:30 +05:30
commit 7038292d11
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 5 additions and 5 deletions

View File

@ -76,7 +76,7 @@ blur_mask(kernel_type *image_data, ssize_t width, ssize_t height, ssize_t kernel
static kernel_type* 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) { 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; if (!mask) return NULL;
for (size_t y = margin; y < height - margin; y++) { for (size_t y = margin; y < height - margin; y++) {
kernel_type *row = mask + y * width; kernel_type *row = mask + y * width;

View File

@ -345,7 +345,7 @@ render_run(RenderCtx *ctx, RenderState *rs) {
if (pbm.rows > bm_height) { if (pbm.rows > bm_height) {
double ratio = pbm.width / (double)pbm.rows; double ratio = pbm.width / (double)pbm.rows;
bm_width = (unsigned)(ratio * bm_height); 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; if (!buf) break;
downsample_32bit_image(pbm.buf, pbm.width, pbm.rows, pbm.stride, buf, bm_width, bm_height); 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; 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; } if (!hb_buffer_pre_allocate(hb_buffer, 512)) { PyErr_NoMemory(); return false; }
size_t text_len = strlen(text); 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; } if (!unicode) { PyErr_NoMemory(); return false; }
bool ok = false; bool ok = false;
text_len = decode_utf8_string(text, text_len, unicode); text_len = decode_utf8_string(text, text_len, unicode);

View File

@ -392,7 +392,7 @@ static void
pagerhist_rewrap_to(HistoryBuf *self, index_type cells_in_line) { pagerhist_rewrap_to(HistoryBuf *self, index_type cells_in_line) {
PagerHistoryBuf *ph = self->pagerhist; PagerHistoryBuf *ph = self->pagerhist;
if (!ph->ringbuf || !ringbuf_bytes_used(ph->ringbuf)) return; if (!ph->ringbuf || !ringbuf_bytes_used(ph->ringbuf)) return;
PagerHistoryBuf *nph = calloc(sizeof(PagerHistoryBuf), 1); PagerHistoryBuf *nph = calloc(1, sizeof(PagerHistoryBuf));
if (!nph) return; if (!nph) return;
nph->maximum_size = ph->maximum_size; nph->maximum_size = ph->maximum_size;
nph->ringbuf = ringbuf_new(MIN(ph->maximum_size, ringbuf_capacity(ph->ringbuf) + 4096)); nph->ringbuf = ringbuf_new(MIN(ph->maximum_size, ringbuf_capacity(ph->ringbuf) + 4096));

View File

@ -534,7 +534,7 @@ dispatch_possible_click(Window *w, int button, int modifiers) {
Screen *screen = w->render_data.screen; Screen *screen = w->render_data.screen;
int count = multi_click_count(w, button); int count = multi_click_count(w, button);
if (release_is_click(w, button)) { if (release_is_click(w, button)) {
PendingClick *pc = calloc(sizeof(PendingClick), 1); PendingClick *pc = calloc(1, sizeof(PendingClick));
if (pc) { if (pc) {
const ClickQueue *q = &w->click_queues[button]; const ClickQueue *q = &w->click_queues[button];
pc->press_num = q->length ? q->clicks[q->length - 1].num : 0; pc->press_num = q->length ? q->clicks[q->length - 1].num : 0;