Fix a bunch of code scanning warnings
This commit is contained in:
parent
ee47a10b37
commit
521f921424
@ -503,7 +503,7 @@ collect_cursor_info(CursorRenderInfo *ans, Window *w, monotonic_t now, OSWindow
|
|||||||
int d = monotonic_t_to_ms(OPT(cursor_blink_interval));
|
int d = monotonic_t_to_ms(OPT(cursor_blink_interval));
|
||||||
int n = t / d;
|
int n = t / d;
|
||||||
do_draw_cursor = n % 2 == 0 ? true : false;
|
do_draw_cursor = n % 2 == 0 ? true : false;
|
||||||
monotonic_t bucket = ms_to_monotonic_t((n + 1) * d);
|
monotonic_t bucket = ms_to_monotonic_t((monotonic_t)(n + 1) * d);
|
||||||
monotonic_t delay = bucket - time_since_start_blink;
|
monotonic_t delay = bucket - time_since_start_blink;
|
||||||
set_maximum_wait(delay);
|
set_maximum_wait(delay);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -461,7 +461,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_
|
|||||||
} else img->load_data.data = img->load_data.mapped_file;
|
} else img->load_data.data = img->load_data.mapped_file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
size_t required_sz = (img->load_data.is_opaque ? 3 : 4) * img->width * img->height;
|
size_t required_sz = (size_t)(img->load_data.is_opaque ? 3 : 4) * img->width * img->height;
|
||||||
if (img->load_data.data_sz != required_sz) ABRT(EINVAL, "Image dimensions: %ux%u do not match data size: %zu, expected size: %zu", img->width, img->height, img->load_data.data_sz, required_sz);
|
if (img->load_data.data_sz != required_sz) ABRT(EINVAL, "Image dimensions: %ux%u do not match data size: %zu, expected size: %zu", img->width, img->height, img->load_data.data_sz, required_sz);
|
||||||
if (LIKELY(img->data_loaded && send_to_gpu)) {
|
if (LIKELY(img->data_loaded && send_to_gpu)) {
|
||||||
send_image_to_gpu(&img->texture_id, img->load_data.data, img->width, img->height, img->load_data.is_opaque, img->load_data.is_4byte_aligned, false, REPEAT_CLAMP);
|
send_image_to_gpu(&img->texture_id, img->load_data.data, img->width, img->height, img->load_data.is_opaque, img->load_data.is_4byte_aligned, false, REPEAT_CLAMP);
|
||||||
|
|||||||
@ -536,8 +536,8 @@ linebuf_rewrap(LineBuf *self, LineBuf *other, index_type *num_content_lines_befo
|
|||||||
if (other->xnum == self->xnum && other->ynum == self->ynum) {
|
if (other->xnum == self->xnum && other->ynum == self->ynum) {
|
||||||
memcpy(other->line_map, self->line_map, sizeof(index_type) * self->ynum);
|
memcpy(other->line_map, self->line_map, sizeof(index_type) * self->ynum);
|
||||||
memcpy(other->line_attrs, self->line_attrs, sizeof(bool) * self->ynum);
|
memcpy(other->line_attrs, self->line_attrs, sizeof(bool) * self->ynum);
|
||||||
memcpy(other->cpu_cell_buf, self->cpu_cell_buf, self->xnum * self->ynum * sizeof(CPUCell));
|
memcpy(other->cpu_cell_buf, self->cpu_cell_buf, (size_t)self->xnum * self->ynum * sizeof(CPUCell));
|
||||||
memcpy(other->gpu_cell_buf, self->gpu_cell_buf, self->xnum * self->ynum * sizeof(GPUCell));
|
memcpy(other->gpu_cell_buf, self->gpu_cell_buf, (size_t)self->xnum * self->ynum * sizeof(GPUCell));
|
||||||
*num_content_lines_before = self->ynum; *num_content_lines_after = self->ynum;
|
*num_content_lines_before = self->ynum; *num_content_lines_after = self->ynum;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ inflate_png_inner(png_read_data *d, const uint8_t *buf, size_t bufsz) {
|
|||||||
png_read_update_info(png, info);
|
png_read_update_info(png, info);
|
||||||
|
|
||||||
int rowbytes = png_get_rowbytes(png, info);
|
int rowbytes = png_get_rowbytes(png, info);
|
||||||
d->sz = rowbytes * d->height * sizeof(png_byte);
|
d->sz = sizeof(png_byte) * rowbytes * d->height;
|
||||||
d->decompressed = malloc(d->sz + 16);
|
d->decompressed = malloc(d->sz + 16);
|
||||||
if (d->decompressed == NULL) ABRT(ENOMEM, "Out of memory allocating decompression buffer for PNG");
|
if (d->decompressed == NULL) ABRT(ENOMEM, "Out of memory allocating decompression buffer for PNG");
|
||||||
d->row_pointers = malloc(d->height * sizeof(png_bytep));
|
d->row_pointers = malloc(d->height * sizeof(png_bytep));
|
||||||
|
|||||||
@ -1576,7 +1576,7 @@ screen_request_capabilities(Screen *self, char c, PyObject *q) {
|
|||||||
// Rendering {{{
|
// Rendering {{{
|
||||||
static inline void
|
static inline void
|
||||||
update_line_data(Line *line, unsigned int dest_y, uint8_t *data) {
|
update_line_data(Line *line, unsigned int dest_y, uint8_t *data) {
|
||||||
size_t base = dest_y * line->xnum * sizeof(GPUCell);
|
size_t base = sizeof(GPUCell) * dest_y * line->xnum;
|
||||||
memcpy(data + base, line->gpu_cells, line->xnum * sizeof(GPUCell));
|
memcpy(data + base, line->gpu_cells, line->xnum * sizeof(GPUCell));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ copy_image_sub_data(GLuint src_texture_id, GLuint dest_texture_id, unsigned int
|
|||||||
copy_image_warned = true;
|
copy_image_warned = true;
|
||||||
log_error("WARNING: Your system's OpenGL implementation does not have glCopyImageSubData, falling back to a slower implementation");
|
log_error("WARNING: Your system's OpenGL implementation does not have glCopyImageSubData, falling back to a slower implementation");
|
||||||
}
|
}
|
||||||
size_t sz = width * height * num_levels;
|
size_t sz = (size_t)width * height * num_levels;
|
||||||
pixel *src = malloc(sz * sizeof(pixel));
|
pixel *src = malloc(sz * sizeof(pixel));
|
||||||
if (src == NULL) { fatal("Out of memory."); }
|
if (src == NULL) { fatal("Out of memory."); }
|
||||||
glBindTexture(GL_TEXTURE_2D_ARRAY, src_texture_id);
|
glBindTexture(GL_TEXTURE_2D_ARRAY, src_texture_id);
|
||||||
@ -334,7 +334,7 @@ cell_prepare_to_render(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, GLfloa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (screen->reload_all_gpu_data || screen_resized || screen_is_selection_dirty(screen)) {
|
if (screen->reload_all_gpu_data || screen_resized || screen_is_selection_dirty(screen)) {
|
||||||
sz = screen->lines * screen->columns;
|
sz = (size_t)screen->lines * screen->columns;
|
||||||
address = alloc_and_map_vao_buffer(vao_idx, sz, selection_buffer, GL_STREAM_DRAW, GL_WRITE_ONLY);
|
address = alloc_and_map_vao_buffer(vao_idx, sz, selection_buffer, GL_STREAM_DRAW, GL_WRITE_ONLY);
|
||||||
screen_apply_selection(screen, address, sz);
|
screen_apply_selection(screen, address, sz);
|
||||||
unmap_vao_buffer(vao_idx, selection_buffer); address = NULL;
|
unmap_vao_buffer(vao_idx, selection_buffer); address = NULL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user