More code scanning warning fixes
This commit is contained in:
parent
ee3462592a
commit
e678c41f56
@ -457,7 +457,7 @@ calc_cell_metrics(FontGroup *fg) {
|
|||||||
fg->cell_width = cell_width; fg->cell_height = cell_height;
|
fg->cell_width = cell_width; fg->cell_height = cell_height;
|
||||||
fg->baseline = baseline; fg->underline_position = underline_position; fg->underline_thickness = underline_thickness, fg->strikethrough_position = strikethrough_position, fg->strikethrough_thickness = strikethrough_thickness;
|
fg->baseline = baseline; fg->underline_position = underline_position; fg->underline_thickness = underline_thickness, fg->strikethrough_position = strikethrough_position, fg->strikethrough_thickness = strikethrough_thickness;
|
||||||
free(fg->canvas);
|
free(fg->canvas);
|
||||||
fg->canvas = calloc(CELLS_IN_CANVAS * fg->cell_width * fg->cell_height, sizeof(pixel));
|
fg->canvas = calloc((size_t)CELLS_IN_CANVAS * fg->cell_width * fg->cell_height, sizeof(pixel));
|
||||||
if (!fg->canvas) fatal("Out of memory allocating canvas for font group");
|
if (!fg->canvas) fatal("Out of memory allocating canvas for font group");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -497,7 +497,8 @@ static inline bool
|
|||||||
render_color_bitmap(Face *self, int glyph_id, ProcessedBitmap *ans, unsigned int cell_width, unsigned int cell_height, unsigned int num_cells, unsigned int baseline) {
|
render_color_bitmap(Face *self, int glyph_id, ProcessedBitmap *ans, unsigned int cell_width, unsigned int cell_height, unsigned int num_cells, unsigned int baseline) {
|
||||||
(void)baseline;
|
(void)baseline;
|
||||||
unsigned short best = 0, diff = USHRT_MAX;
|
unsigned short best = 0, diff = USHRT_MAX;
|
||||||
for (short i = 0; i < (short)self->face->num_fixed_sizes; i++) {
|
const short limit = self->face->num_fixed_sizes;
|
||||||
|
for (short i = 0; i < limit; i++) {
|
||||||
unsigned short w = self->face->available_sizes[i].width;
|
unsigned short w = self->face->available_sizes[i].width;
|
||||||
unsigned short d = w > (unsigned short)cell_width ? w - (unsigned short)cell_width : (unsigned short)cell_width - w;
|
unsigned short d = w > (unsigned short)cell_width ? w - (unsigned short)cell_width : (unsigned short)cell_width - w;
|
||||||
if (d < diff) {
|
if (d < diff) {
|
||||||
|
|||||||
@ -348,7 +348,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_
|
|||||||
break;
|
break;
|
||||||
case RGB:
|
case RGB:
|
||||||
case RGBA:
|
case RGBA:
|
||||||
img->load_data.data_sz = g->data_width * g->data_height * (fmt / 8);
|
img->load_data.data_sz = (size_t)g->data_width * g->data_height * (fmt / 8);
|
||||||
if (!img->load_data.data_sz) ABRT(EINVAL, "Zero width/height not allowed");
|
if (!img->load_data.data_sz) ABRT(EINVAL, "Zero width/height not allowed");
|
||||||
img->load_data.is_4byte_aligned = fmt == RGBA || (img->width % 4 == 0);
|
img->load_data.is_4byte_aligned = fmt == RGBA || (img->width % 4 == 0);
|
||||||
img->load_data.is_opaque = fmt == RGB;
|
img->load_data.is_opaque = fmt == RGB;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user