mirror of
https://github.com/bradgrantham/apple2e.git
synced 2026-04-21 03:19:48 +00:00
use snprintf instead of sprintf
This commit is contained in:
+4
-4
@@ -1608,7 +1608,7 @@ struct MAINboard : board_base
|
||||
sw->enabled = true;
|
||||
if(debug & DEBUG_SWITCH) printf("Set %s\n", sw->name.c_str());
|
||||
post_soft_switch_mode_change();
|
||||
static char reason[512]; sprintf(reason, "set %s", sw->name.c_str());
|
||||
static char reason[512]; snprintf(reason, sizeof(reason), "set %s", sw->name.c_str());
|
||||
repage_regions(reason);
|
||||
}
|
||||
return true;
|
||||
@@ -1619,7 +1619,7 @@ struct MAINboard : board_base
|
||||
sw->enabled = false;
|
||||
if(debug & DEBUG_SWITCH) printf("Clear %s\n", sw->name.c_str());
|
||||
post_soft_switch_mode_change();
|
||||
static char reason[512]; sprintf(reason, "clear %s", sw->name.c_str());
|
||||
static char reason[512]; snprintf(reason, sizeof(reason), "clear %s", sw->name.c_str());
|
||||
repage_regions(reason);
|
||||
}
|
||||
return true;
|
||||
@@ -1856,7 +1856,7 @@ struct MAINboard : board_base
|
||||
sw->enabled = true;
|
||||
if(debug & DEBUG_SWITCH) printf("Set %s\n", sw->name.c_str());
|
||||
post_soft_switch_mode_change();
|
||||
static char reason[512]; sprintf(reason, "set %s", sw->name.c_str());
|
||||
static char reason[512]; snprintf(reason, sizeof(reason), "set %s", sw->name.c_str());
|
||||
repage_regions(reason);
|
||||
}
|
||||
return true;
|
||||
@@ -1867,7 +1867,7 @@ struct MAINboard : board_base
|
||||
sw->enabled = false;
|
||||
if(debug & DEBUG_SWITCH) printf("Clear %s\n", sw->name.c_str());
|
||||
post_soft_switch_mode_change();
|
||||
static char reason[512]; sprintf(reason, "clear %s", sw->name.c_str());
|
||||
static char reason[512]; snprintf(reason, sizeof(reason), "clear %s", sw->name.c_str());
|
||||
repage_regions(reason);
|
||||
}
|
||||
return true;
|
||||
|
||||
+6
-6
@@ -1935,17 +1935,17 @@ void iterate(const ModeHistory& history, unsigned long long current_byte, float
|
||||
{
|
||||
static char speed_cstr[10];
|
||||
if(megahertz >= 100000.0) {
|
||||
sprintf(speed_cstr, "very fast");
|
||||
snprintf(speed_cstr, sizeof(speed_cstr), "very fast");
|
||||
} else if(megahertz >= 10000.0) {
|
||||
sprintf(speed_cstr, "%5.2f GHz", megahertz);
|
||||
snprintf(speed_cstr, sizeof(speed_cstr), "%5.2f GHz", megahertz);
|
||||
} else if(megahertz >= 1000.0) {
|
||||
sprintf(speed_cstr, "%5.3f GHz", megahertz);
|
||||
snprintf(speed_cstr, sizeof(speed_cstr), "%5.3f GHz", megahertz);
|
||||
} else if(megahertz >= 100.0) {
|
||||
sprintf(speed_cstr, "%5.1f MHz", megahertz);
|
||||
snprintf(speed_cstr, sizeof(speed_cstr), "%5.1f MHz", megahertz);
|
||||
} else if(megahertz >= 10.0) {
|
||||
sprintf(speed_cstr, "%5.2f MHz", megahertz);
|
||||
snprintf(speed_cstr, sizeof(speed_cstr), "%5.2f MHz", megahertz);
|
||||
} else {
|
||||
sprintf(speed_cstr, "%5.3f MHz", megahertz);
|
||||
snprintf(speed_cstr, sizeof(speed_cstr), "%5.3f MHz", megahertz);
|
||||
}
|
||||
speed_textbox->set_content(speed_cstr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user