Skip to content

Commit

Permalink
Fix scanf conversion arguments from signed to unsigned where appropri…
Browse files Browse the repository at this point in the history
…ate.
  • Loading branch information
BsAtHome committed Feb 4, 2025
1 parent 9afa49c commit 17fae0a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/emc/task/emcsvr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ static int iniLoad(const char *filename)

// set flags if RCS_DEBUG in ini file
if ((inistring = inifile.Find("RCS_DEBUG", "EMC"))) {
static long int flags;
long unsigned int flags;
if (sscanf(*inistring, "%lx", &flags) < 1) {
perror("failed to parse [EMC] RCS_DEBUG");
}
// clear all flags
clear_rcs_print_flag(PRINT_EVERYTHING);
// set parsed flags
set_rcs_print_flag(flags);
set_rcs_print_flag((long)flags);
}
// output infinite RCS errors by default
max_rcs_errors_to_print = -1;
Expand Down
6 changes: 3 additions & 3 deletions src/emc/task/emctaskmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ void readahead_waiting(void)
int was_open = taskplanopen;
if (was_open) {
emcTaskPlanClose();
if (emc_debug & EMC_DEBUG_INTERP && was_open) {
if ((emc_debug & EMC_DEBUG_INTERP) && was_open) {
rcs_print
("emcTaskPlanClose() called at %s:%d\n",
__FILE__, __LINE__);
Expand Down Expand Up @@ -3146,14 +3146,14 @@ static int iniLoad(const char *filename)

// set flags if RCS_DEBUG in ini file
if ((inistring = inifile.Find("RCS_DEBUG", "EMC"))) {
static long int flags;
long unsigned int flags;
if (sscanf(*inistring, "%lx", &flags) < 1) {
perror("failed to parse [EMC] RCS_DEBUG");
}
// clear all flags
clear_rcs_print_flag(PRINT_EVERYTHING);
// set parsed flags
set_rcs_print_flag(flags);
set_rcs_print_flag((long)flags);
}
// output infinite RCS errors by default
max_rcs_errors_to_print = -1;
Expand Down
4 changes: 2 additions & 2 deletions src/emc/usr_intf/halui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1430,14 +1430,14 @@ static int iniLoad(const char *filename)

// set flags if RCS_DEBUG in ini file
if ((inistring = inifile.Find("RCS_DEBUG", "EMC"))) {
static long int flags;
long unsigned int flags;
if (sscanf(*inistring, "%lx", &flags) < 1) {
perror("failed to parse [EMC] RCS_DEBUG");
}
// clear all flags
clear_rcs_print_flag(PRINT_EVERYTHING);
// set parsed flags
set_rcs_print_flag(flags);
set_rcs_print_flag((long)flags);
}
// output infinite RCS errors by default
max_rcs_errors_to_print = -1;
Expand Down
4 changes: 2 additions & 2 deletions src/emc/usr_intf/shcom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1302,14 +1302,14 @@ int iniLoad(const char *filename)

// set flags if RCS_DEBUG in ini file
if ((inistring = inifile.Find("RCS_DEBUG", "EMC"))) {
static long int flags;
long unsigned int flags;
if (sscanf(*inistring, "%lx", &flags) < 1) {
perror("failed to parse [EMC] RCS_DEBUG");
}
// clear all flags
clear_rcs_print_flag(PRINT_EVERYTHING);
// set parsed flags
set_rcs_print_flag(flags);
set_rcs_print_flag((long)flags);
}
// output infinite RCS errors by default
max_rcs_errors_to_print = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/hal/classicladder/config_gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void GetIOSettings( char ForInputs )
case 2:
text = (char *)gtk_entry_get_text((GtkEntry *)*IOParamEntry);
if ( DeviceTypeValue==DEVICE_TYPE_DIRECT_ACCESS )
sscanf( text, "%X", &pConf->SubDevOrAdr );
sscanf( text, "%X", (unsigned *)&pConf->SubDevOrAdr );
else
pConf->SubDevOrAdr = atoi( text );
break;
Expand Down
2 changes: 1 addition & 1 deletion src/hal/utils/upci.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int upci_scan_bus(void)
devices[num_devs++] = dev;
n = sscanf(lineptr,
"%hx %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
&busdevfunc, &vendordev, &(dev->p.irq),
&busdevfunc, &vendordev, (unsigned *)&(dev->p.irq),
&dev->p.base_addr[0], &dev->p.base_addr[1], &dev->p.base_addr[2],
&dev->p.base_addr[3], &dev->p.base_addr[4], &dev->p.base_addr[5],
&dev->p.rom_base_addr,
Expand Down
2 changes: 1 addition & 1 deletion src/rtapi/uspace_rtapi_parport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static void map_parports() {
}
struct portinfo pi;
pi.port_id = i;
if(fscanf(f, "%hd %hd", &pi.base, &pi.base_hi) != 2) {
if(fscanf(f, "%hu %hu", &pi.base, &pi.base_hi) != 2) {
rtapi_print_msg(RTAPI_MSG_ERR, "Failed to parse base-addr for port #%d\n", i);
fclose(f);
continue;
Expand Down

0 comments on commit 17fae0a

Please sign in to comment.