Make CodeQL happy

This commit is contained in:
Kovid Goyal 2026-05-02 07:52:07 +05:30
parent eaec66fdc6
commit 7e1a97795f
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 5 deletions

View file

@ -889,11 +889,11 @@ thumbnail_callback(OSWindow *os_window) {
double scale = 300. / vw;
thumb_h = (unsigned)(vh * scale + 0.5f);
}
RAII_PyObject(pixels, PyBytes_FromStringAndSize(NULL, 4 * thumb_w * thumb_h));
RAII_PyObject(pixels, PyBytes_FromStringAndSize(NULL, (Py_ssize_t)4 * thumb_w * thumb_h));
if (pixels && global_state.boss) {
take_screenshot_of_rectangular_region(
os_window, region, (unsigned char*)PyBytes_AS_STRING(pixels), &thumb_w, &thumb_h);
_PyBytes_Resize(&pixels, 4 * thumb_w *thumb_h);
_PyBytes_Resize(&pixels, (Py_ssize_t)4 * thumb_w * thumb_h);
PyObject *r = PyObject_CallMethod(
global_state.boss, tc.callback, "KKOII", os_window->id, tc.window, pixels, thumb_w, thumb_h);
if (!r) PyErr_Print(); else Py_DECREF(r);

View file

@ -3867,8 +3867,8 @@ void
screen_apply_selection(Screen *self, void *address_, size_t size) {
uint8_t *address = address_;
memset(address, 0, size);
const int offset = pixel_scroll_enabled(self);
const unsigned int scrolled_by = self->paused_rendering.expires_at ? self->paused_rendering.scrolled_by : self->scrolled_by;
const unsigned offset = pixel_scroll_enabled(self);
const unsigned scrolled_by = self->paused_rendering.expires_at ? self->paused_rendering.scrolled_by : self->scrolled_by;
Selections *sel = self->paused_rendering.expires_at ? &self->paused_rendering.selections : &self->selections;
for (size_t i = 0; i < sel->count; i++) apply_selection(self, address, sel->items + i, 1, offset, scrolled_by);
sel->last_rendered_count = sel->count;
@ -3879,7 +3879,7 @@ screen_apply_selection(Screen *self, void *address_, size_t size) {
apply_selection(self, address, s, 2, offset, scrolled_by);
}
sel->last_rendered_count = sel->count;
address += offset * self->columns; size -= offset * self->columns;
address += (size_t)offset * self->columns; size -= (size_t)offset * self->columns;
ExtraCursors *ec = self->paused_rendering.expires_at ? &self->paused_rendering.extra_cursors : &self->extra_cursors;
for (unsigned i = 0; i < ec->count; i++) {
if (ec->locations[i].cell < size) address[ec->locations[i].cell] |= (ec->locations[i].shape & 7) << 2;