Skip to content
Snippets Groups Projects
Commit 5c651cfc authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix some issues ide3ntified by coverity.

parent 4974f4d0
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4303 passed
...@@ -163,7 +163,7 @@ static int bitmap_loadfont_locked(const char *filename) ...@@ -163,7 +163,7 @@ static int bitmap_loadfont_locked(const char *filename)
} }
fh=vstat.charheight; fh=vstat.charheight;
fdw = vstat.charwidth - (vstat.flags & VIDMODES_FLAG_EXPAND) ? 1 : 0; fdw = vstat.charwidth - ((vstat.flags & VIDMODES_FLAG_EXPAND) ? 1 : 0);
fw = fdw / 8 + (fdw % 8 ? 1 : 0); fw = fdw / 8 + (fdw % 8 ? 1 : 0);
fontsize=fw*fh*256*sizeof(unsigned char); fontsize=fw*fh*256*sizeof(unsigned char);
...@@ -1564,8 +1564,8 @@ void bitmap_replace_font(uint8_t id, char *name, void *data, size_t size) ...@@ -1564,8 +1564,8 @@ void bitmap_replace_font(uint8_t id, char *name, void *data, size_t size)
free(name); free(name);
free(data); free(data);
} }
request_redraw();
pthread_mutex_unlock(&screenlock); pthread_mutex_unlock(&screenlock);
request_redraw();
} }
int bitmap_setpalette(uint32_t index, uint16_t r, uint16_t g, uint16_t b) int bitmap_setpalette(uint32_t index, uint16_t r, uint16_t g, uint16_t b)
......
...@@ -427,7 +427,7 @@ static int init_window() ...@@ -427,7 +427,7 @@ static int init_window()
pthread_mutex_lock(&vstatlock); pthread_mutex_lock(&vstatlock);
bitmap_get_scaled_win_size(x_cvstat.scaling, &w, &h, mw, mh); bitmap_get_scaled_win_size(x_cvstat.scaling, &w, &h, mw, mh);
vstat.winwidth = x_cvstat.winwidth = w; vstat.winwidth = x_cvstat.winwidth = w;
vstat.winwidth = x_cvstat.winheight = h; vstat.winheight = x_cvstat.winheight = h;
vstat.scaling = x_cvstat.scaling; vstat.scaling = x_cvstat.scaling;
pthread_mutex_unlock(&vstatlock); pthread_mutex_unlock(&vstatlock);
win = x11.XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0, win = x11.XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0,
......
...@@ -9082,9 +9082,9 @@ do_fill(bool overwrite) ...@@ -9082,9 +9082,9 @@ do_fill(bool overwrite)
bool in_line = false; bool in_line = false;
   
pix = getpixels(0, 0, rip.x_max - 1, rip.y_max - 1, false); pix = getpixels(0, 0, rip.x_max - 1, rip.y_max - 1, false);
FREE_AND_NULL(pix->pixelsb);
if (pix == NULL) if (pix == NULL)
return; return;
FREE_AND_NULL(pix->pixelsb);
   
// Horizontal even-odd top-left to bottom-right. // Horizontal even-odd top-left to bottom-right.
pixel = 0; pixel = 0;
...@@ -1460,9 +1460,10 @@ xmodem_progress(void *cbdata, unsigned block_num, int64_t offset, int64_t fsize, ...@@ -1460,9 +1460,10 @@ xmodem_progress(void *cbdata, unsigned block_num, int64_t offset, int64_t fsize,
if ((cps = (unsigned)(offset / t)) == 0) if ((cps = (unsigned)(offset / t)) == 0)
cps = 1; /* cps so far */ cps = 1; /* cps so far */
l = (time_t)(fsize / cps); /* total transfer est time */ l = (time_t)(fsize / cps); /* total transfer est time */
l -= t; /* now, it's est time left */ if (t >= l)
if (l < 0)
l = 0; l = 0;
else
l -= t; /* now, it's est time left */
if ((*(xm->mode)) & SEND) { if ((*(xm->mode)) & SEND) {
total_blocks = num_blocks(block_num, offset, fsize, xm->block_size); total_blocks = num_blocks(block_num, offset, fsize, xm->block_size);
cprintf("Block (%lu%s): %u/%" PRId64 " Byte: %" PRId64, cprintf("Block (%lu%s): %u/%" PRId64 " Byte: %" PRId64,
...@@ -3211,10 +3212,10 @@ paste_pixmap(char *str, size_t slen, char *fn, void *apcd) ...@@ -3211,10 +3212,10 @@ paste_pixmap(char *str, size_t slen, char *fn, void *apcd)
} }
if (bufnum >= sizeof(pixmap_buffer) / sizeof(pixmap_buffer[0])) if (bufnum >= sizeof(pixmap_buffer) / sizeof(pixmap_buffer[0]))
return; goto done;
if (pixmap_buffer[bufnum] == NULL) if (pixmap_buffer[bufnum] == NULL)
return; goto done;
if (sw == 0) if (sw == 0)
sw = pixmap_buffer[bufnum]->width - sx; sw = pixmap_buffer[bufnum]->width - sx;
...@@ -3242,6 +3243,7 @@ paste_pixmap(char *str, size_t slen, char *fn, void *apcd) ...@@ -3242,6 +3243,7 @@ paste_pixmap(char *str, size_t slen, char *fn, void *apcd)
if (maskfn != NULL) { if (maskfn != NULL) {
freemask(ctmask); freemask(ctmask);
ctmask = read_pbm(maskfn, true); ctmask = read_pbm(maskfn, true);
free(maskfn);
if (ctmask == NULL) if (ctmask == NULL)
goto done; goto done;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment