mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-03-06 21:00:31 +01:00
change usages of deprecated sprintf to snprintf
This commit is contained in:
parent
39504241b9
commit
212286e97e
5 changed files with 15 additions and 15 deletions
|
@ -900,7 +900,7 @@ ARMJIT_Memory::ARMJIT_Memory(melonDS::NDS& nds) : NDS(nds)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char fastmemPidName[snprintf(NULL, 0, "/melondsfastmem%d", getpid()) + 1];
|
char fastmemPidName[snprintf(NULL, 0, "/melondsfastmem%d", getpid()) + 1];
|
||||||
sprintf(fastmemPidName, "/melondsfastmem%d", getpid());
|
snprintf(fastmemPidName, sizeof(fastmemPidName), "/melondsfastmem%d", getpid());
|
||||||
MemoryFile = shm_open(fastmemPidName, O_RDWR | O_CREAT | O_EXCL, 0600);
|
MemoryFile = shm_open(fastmemPidName, O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||||
if (MemoryFile == -1)
|
if (MemoryFile == -1)
|
||||||
{
|
{
|
||||||
|
@ -1600,4 +1600,4 @@ void* ARMJIT_Memory::GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size) co
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,9 +428,9 @@ void EmuThread::run()
|
||||||
double actualfps = (59.8261 * 263.0) / nlines;
|
double actualfps = (59.8261 * 263.0) / nlines;
|
||||||
int inst = emuInstance->instanceID;
|
int inst = emuInstance->instanceID;
|
||||||
if (inst == 0)
|
if (inst == 0)
|
||||||
sprintf(melontitle, "[%d/%.0f] melonDS " MELONDS_VERSION, fps, actualfps);
|
snprintf(melontitle, sizeof(melontitle), "[%d/%.0f] melonDS " MELONDS_VERSION, fps, actualfps);
|
||||||
else
|
else
|
||||||
sprintf(melontitle, "[%d/%.0f] melonDS (%d)", fps, fpstarget, inst+1);
|
snprintf(melontitle, sizeof(melontitle), "[%d/%.0f] melonDS (%d)", fps, fpstarget, inst+1);
|
||||||
changeWindowTitle(melontitle);
|
changeWindowTitle(melontitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,9 +445,9 @@ void EmuThread::run()
|
||||||
|
|
||||||
int inst = emuInstance->instanceID;
|
int inst = emuInstance->instanceID;
|
||||||
if (inst == 0)
|
if (inst == 0)
|
||||||
sprintf(melontitle, "melonDS " MELONDS_VERSION);
|
snprintf(melontitle, sizeof(melontitle), "melonDS " MELONDS_VERSION);
|
||||||
else
|
else
|
||||||
sprintf(melontitle, "melonDS (%d)", inst+1);
|
snprintf(melontitle, sizeof(melontitle), "melonDS (%d)", inst+1);
|
||||||
changeWindowTitle(melontitle);
|
changeWindowTitle(melontitle);
|
||||||
|
|
||||||
SDL_Delay(75);
|
SDL_Delay(75);
|
||||||
|
|
|
@ -187,7 +187,7 @@ void NetplayDialog::doUpdatePlayerList(Netplay::Player* players, int num)
|
||||||
|
|
||||||
char ip[32];
|
char ip[32];
|
||||||
u32 addr = player->Address;
|
u32 addr = player->Address;
|
||||||
sprintf(ip, "%d.%d.%d.%d", addr&0xFF, (addr>>8)&0xFF, (addr>>16)&0xFF, addr>>24);
|
snprintf(ip, sizeof(ip), "%d.%d.%d.%d", addr&0xFF, (addr>>8)&0xFF, (addr>>16)&0xFF, addr>>24);
|
||||||
model->setItem(i, 4, new QStandardItem(ip));
|
model->setItem(i, 4, new QStandardItem(ip));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ void TitleManagerDialog::createTitleItem(u32 category, u32 titleid)
|
||||||
*(u32*)&gamecode[0] = *(u32*)&header.GameCode[0];
|
*(u32*)&gamecode[0] = *(u32*)&header.GameCode[0];
|
||||||
gamecode[4] = '\0';
|
gamecode[4] = '\0';
|
||||||
char extra[128];
|
char extra[128];
|
||||||
sprintf(extra, "\n(title ID: %s · %08x/%08x · version %08x)", gamecode, category, titleid, version);
|
snprintf(extra, sizeof(extra), "\n(title ID: %s · %08x/%08x · version %08x)", gamecode, category, titleid, version);
|
||||||
|
|
||||||
QListWidgetItem* item = new QListWidgetItem(title + QString(extra));
|
QListWidgetItem* item = new QListWidgetItem(title + QString(extra));
|
||||||
item->setIcon(icon);
|
item->setIcon(icon);
|
||||||
|
@ -482,7 +482,7 @@ void TitleImportDialog::accept()
|
||||||
network = new QNetworkAccessManager(this);
|
network = new QNetworkAccessManager(this);
|
||||||
|
|
||||||
char url[256];
|
char url[256];
|
||||||
sprintf(url, "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/%08x%08x/tmd", titleid[1], titleid[0]);
|
snprintf(url, sizeof(url), "http://nus.cdn.t.shop.nintendowifi.net/ccs/download/%08x%08x/tmd", titleid[1], titleid[0]);
|
||||||
|
|
||||||
QNetworkRequest req;
|
QNetworkRequest req;
|
||||||
req.setUrl(QUrl(url));
|
req.setUrl(QUrl(url));
|
||||||
|
|
|
@ -152,14 +152,14 @@ void WifiSettingsDialog::on_cbxDirectAdapter_currentIndexChanged(int sel)
|
||||||
melonDS::AdapterData* adapter = &adapters[sel];
|
melonDS::AdapterData* adapter = &adapters[sel];
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
|
|
||||||
sprintf(tmp, "%02X:%02X:%02X:%02X:%02X:%02X",
|
snprintf(tmp, sizeof(tmp), "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
adapter->MAC[0], adapter->MAC[1], adapter->MAC[2],
|
adapter->MAC[0], adapter->MAC[1], adapter->MAC[2],
|
||||||
adapter->MAC[3], adapter->MAC[4], adapter->MAC[5]);
|
adapter->MAC[3], adapter->MAC[4], adapter->MAC[5]);
|
||||||
ui->lblAdapterMAC->setText(QString(tmp));
|
ui->lblAdapterMAC->setText(QString(tmp));
|
||||||
|
|
||||||
sprintf(tmp, "%d.%d.%d.%d",
|
snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d",
|
||||||
adapter->IP_v4[0], adapter->IP_v4[1],
|
adapter->IP_v4[0], adapter->IP_v4[1],
|
||||||
adapter->IP_v4[2], adapter->IP_v4[3]);
|
adapter->IP_v4[2], adapter->IP_v4[3]);
|
||||||
ui->lblAdapterIP->setText(QString(tmp));
|
ui->lblAdapterIP->setText(QString(tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue