Skip to content

Commit

Permalink
Coverity fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
colinleroy committed Jan 2, 2024
1 parent b7e7f38 commit 82b1331
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
18 changes: 10 additions & 8 deletions src/quicktake/qt-edit-image.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void qt_convert_image_with_crop(const char *filename, uint16 sx, uint16 sy, uint

get_program_disk();

snprintf(args, 128, "%s %d %d %d %d", imgname, sx, sy, ex, ey);
snprintf(args, BUF_SIZE + 15, "%s %d %d %d %d", imgname, sx, sy, ex, ey);

if (!strcmp(magic, QTKT_MAGIC)) {
exec("qtktconv", args);
Expand Down Expand Up @@ -288,11 +288,6 @@ void hgr_print(void) {
cputs("Printing...\r\n");
/* Calculate X boundaries */
switch (angle) {
case 0:
case 180:
sx = 12;
ex = HGR_WIDTH - 12;
break;
case 90:
case 270:
if (resize) {
Expand All @@ -302,6 +297,13 @@ void hgr_print(void) {
sx = 32;
ex = HGR_WIDTH - 32;
}
break;
case 0:
case 180:
default:
sx = 12;
ex = HGR_WIDTH - 12;
break;
}

/* Set line width */
Expand Down Expand Up @@ -583,11 +585,11 @@ void convert_temp_to_hgr(const char *ifname, const char *ofname, uint16 p_width,
uint8 *ptr;
#endif
uint8 scaled_dx, scaled_dy, prev_scaled_dx, prev_scaled_dy;
int8 xdir, ydir;
int8 xdir = 1, ydir = 1;
int8 cur_err;
int8 err2, err1;

uint8 invert_coords;
uint8 invert_coords = 0;

/* Used for both Sierra and Bayer */
register int8 *regptr1, *regptr2, *regptr3;
Expand Down
4 changes: 2 additions & 2 deletions src/quicktake/qt-menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static void get_one_picture(uint8 num_pics) {
}

static void set_camera_name(const char *name) {
char buf[31];
char buf[32];

if (name == NULL) {
return;
Expand Down Expand Up @@ -242,7 +242,7 @@ static void take_picture(void) {
static void show_thumbnails(uint8 num_pics) {
uint8 i = 0;
thumb_info info;
char c;
char c = 0;
char thumb_buf[32];
FILE *fp;

Expand Down
7 changes: 4 additions & 3 deletions src/quicktake/qt1x0-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ uint8 qt1x0_set_speed(uint16 speed) {
platform_sleep(1);

switch(speed) {
case 9600:
return qt1x0_send_ping();

case 19200:
#ifdef __CC65__
spd_code = SER_BAUD_19200;
Expand All @@ -165,6 +162,10 @@ uint8 qt1x0_set_speed(uint16 speed) {
#endif
str_speed[SPD_CMD_IDX] = 0x30;
break;

case 9600:
default:
return qt1x0_send_ping();
}

printf("Setting speed to %u...\n", speed);
Expand Down
14 changes: 5 additions & 9 deletions src/quicktake/qt200-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,14 @@ static uint8 qt200_send_ping(void) {
uint8 qt200_set_speed(uint16 speed) {
#define SPD_CMD_IDX 0x04
// {????,CMD , ????,????,SPD }
char str_speed[] = {0x01,FUJI_CMD_SPEED,0x01,0x00,0x04};
int spd_code;

switch(speed) {
case 9600:
char str_speed[] = {0x01,FUJI_CMD_SPEED,0x01,0x00,0x00};
#ifdef __CC65__
spd_code = SER_BAUD_9600;
int spd_code = SER_BAUD_9600;
#else
spd_code = B9600;
int spd_code = B9600;
#endif
str_speed[SPD_CMD_IDX] = 0x00;
break;

switch(speed) {
case 19200:
#ifdef __CC65__
spd_code = SER_BAUD_19200;
Expand Down
2 changes: 1 addition & 1 deletion src/stp/stp_send_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ void stp_send_file(char *remote_dir, char recursive) {
if (recursive && d) {
goto read_next_ent;
}
all_ents_read:
if (dir) {
free(dir);
}
all_ents_read:
clrzone(0, 5, scrw - 1, PAGE_HEIGHT - 1);
gotoxy(0, start_y + 3);
cprintf("Hit a key to continue.");
Expand Down

0 comments on commit 82b1331

Please sign in to comment.