mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 17:27:39 +02:00
Silence more code scanning warnings
This commit is contained in:
@@ -176,7 +176,7 @@ font_group_for(double font_sz_in_pts, double logical_dpi_x, double logical_dpi_y
|
|||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
clear_canvas(FontGroup *fg) {
|
clear_canvas(FontGroup *fg) {
|
||||||
if (fg->canvas) memset(fg->canvas, 0, CELLS_IN_CANVAS * fg->cell_width * fg->cell_height * sizeof(pixel));
|
if (fg->canvas) memset(fg->canvas, 0, sizeof(pixel) * CELLS_IN_CANVAS * fg->cell_width * fg->cell_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1388,7 +1388,7 @@ concat_cells(PyObject UNUSED *self, PyObject *args) {
|
|||||||
PyObject *cells;
|
PyObject *cells;
|
||||||
if (!PyArg_ParseTuple(args, "IIpO!", &cell_width, &cell_height, &is_32_bit, &PyTuple_Type, &cells)) return NULL;
|
if (!PyArg_ParseTuple(args, "IIpO!", &cell_width, &cell_height, &is_32_bit, &PyTuple_Type, &cells)) return NULL;
|
||||||
size_t num_cells = PyTuple_GET_SIZE(cells), r, c, i;
|
size_t num_cells = PyTuple_GET_SIZE(cells), r, c, i;
|
||||||
PyObject *ans = PyBytes_FromStringAndSize(NULL, 4 * cell_width * cell_height * num_cells);
|
PyObject *ans = PyBytes_FromStringAndSize(NULL, (size_t)4 * cell_width * cell_height * num_cells);
|
||||||
if (ans == NULL) return PyErr_NoMemory();
|
if (ans == NULL) return PyErr_NoMemory();
|
||||||
pixel *dest = (pixel*)PyBytes_AS_STRING(ans);
|
pixel *dest = (pixel*)PyBytes_AS_STRING(ans);
|
||||||
for (r = 0; r < cell_height; r++) {
|
for (r = 0; r < cell_height; r++) {
|
||||||
|
|||||||
@@ -457,7 +457,7 @@ downsample_bitmap(ProcessedBitmap *bm, unsigned int width, unsigned int cell_hei
|
|||||||
// it matters
|
// it matters
|
||||||
float ratio = MAX((float)bm->width / width, (float)bm->rows / cell_height);
|
float ratio = MAX((float)bm->width / width, (float)bm->rows / cell_height);
|
||||||
int factor = (int)ceilf(ratio);
|
int factor = (int)ceilf(ratio);
|
||||||
uint8_t *dest = calloc(4, width * cell_height);
|
uint8_t *dest = calloc(4, (size_t)width * cell_height);
|
||||||
if (dest == NULL) fatal("Out of memory");
|
if (dest == NULL) fatal("Out of memory");
|
||||||
uint8_t *d = dest;
|
uint8_t *d = dest;
|
||||||
|
|
||||||
|
|||||||
@@ -1079,7 +1079,7 @@ set_custom_cursor(PyObject *self UNUSED, PyObject *args) {
|
|||||||
size_t count = MIN((size_t)PyTuple_GET_SIZE(images), arraysz(gimages));
|
size_t count = MIN((size_t)PyTuple_GET_SIZE(images), arraysz(gimages));
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
if (!PyArg_ParseTuple(PyTuple_GET_ITEM(images, i), "s#ii", &gimages[i].pixels, &sz, &gimages[i].width, &gimages[i].height)) return NULL;
|
if (!PyArg_ParseTuple(PyTuple_GET_ITEM(images, i), "s#ii", &gimages[i].pixels, &sz, &gimages[i].width, &gimages[i].height)) return NULL;
|
||||||
if (gimages[i].width * gimages[i].height * 4 != sz) {
|
if ((Py_ssize_t)gimages[i].width * gimages[i].height * 4 != sz) {
|
||||||
PyErr_SetString(PyExc_ValueError, "The image data size does not match its width and height");
|
PyErr_SetString(PyExc_ValueError, "The image data size does not match its width and height");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user