This commit is contained in:
Dimitris Panokostas 2017-04-22 16:48:41 +02:00
parent a853165ca8
commit eeea4d17ba
3 changed files with 9 additions and 9 deletions

View file

@ -35,7 +35,7 @@ bool LoadConfigByName(const char* name)
txtName->setText(config->Name);
txtDesc->setText(config->Description);
target_cfgfile_load(&changed_prefs, config->FullPath, 0, 0);
strncpy(last_active_config, config->Name, sizeof config->Name);
strncpy(last_active_config, config->Name, sizeof last_active_config);
DisableResume();
RefreshAllPanels();
}
@ -151,9 +151,9 @@ public:
if (!txtName->getText().empty())
{
fetch_configurationpath(filename, sizeof filename);
strncat(filename, txtName->getText().c_str(), 255);
strncat(filename, txtName->getText().c_str(), sizeof filename);
strncat(filename, ".uae", sizeof filename);
strncpy(changed_prefs.description, txtDesc->getText().c_str(), 255);
strncpy(changed_prefs.description, txtDesc->getText().c_str(), sizeof changed_prefs.description);
if (cfgfile_save(&changed_prefs, filename, 0))
RefreshPanelConfig();
}
@ -216,7 +216,7 @@ public:
{
target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0);
}
strncpy(last_active_config, ConfigFilesList[selected_item]->Name, sizeof ConfigFilesList[selected_item]->Name);
strncpy(last_active_config, ConfigFilesList[selected_item]->Name, sizeof last_active_config);
DisableResume();
RefreshAllPanels();
}

View file

@ -177,9 +177,9 @@ public:
char tmp[MAX_DPATH];
if (strlen(changed_prefs.floppyslots[i].df) > 0)
strncpy(tmp, changed_prefs.floppyslots[i].df, sizeof changed_prefs.floppyslots[i].df);
strncpy(tmp, changed_prefs.floppyslots[i].df, sizeof tmp);
else
strncpy(tmp, currentDir, sizeof currentDir);
strncpy(tmp, currentDir, sizeof tmp);
if (SelectFile("Select disk image file", tmp, diskfile_filter))
{
if (strncmp(changed_prefs.floppyslots[i].df, tmp, sizeof changed_prefs.floppyslots[i].df))
@ -237,7 +237,7 @@ public:
{
if (diskfileList.getElementAt(idx).compare(changed_prefs.floppyslots[i].df))
{
strncpy(changed_prefs.floppyslots[i].df, diskfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.floppyslots[i].df));
strncpy(changed_prefs.floppyslots[i].df, diskfileList.getElementAt(idx).c_str(), sizeof changed_prefs.floppyslots[i].df);
disk_insert(i, changed_prefs.floppyslots[i].df);
lstMRUDiskList.erase(lstMRUDiskList.begin() + idx);
lstMRUDiskList.insert(lstMRUDiskList.begin(), changed_prefs.floppyslots[i].df);
@ -296,7 +296,7 @@ public:
removeFileExtension(diskname);
fetch_configurationpath(filename, sizeof filename);
strncat(filename, diskname, sizeof diskname);
strncat(filename, diskname, sizeof filename);
strncat(filename, ".uae", sizeof filename);
snprintf(changed_prefs.description, sizeof changed_prefs.description, "Configuration for disk '%s'", diskname);

View file

@ -309,7 +309,7 @@ public:
{
if (cdfileList.getElementAt(idx).compare(changed_prefs.cdslots[0].name))
{
strncpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.cdslots[0].name));
strncpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str(), sizeof changed_prefs.cdslots[0].name);
changed_prefs.cdslots[0].inuse = true;
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
lstMRUCDList.erase(lstMRUCDList.begin() + idx);