mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 05:17:40 -07:00
change usages of deprecated sprintf to snprintf
This commit is contained in:
parent
e0475b06f6
commit
b7e933a32e
@ -717,7 +717,7 @@ ARMJIT_Memory::ARMJIT_Memory(melonDS::NDS& nds) : NDS(nds)
|
||||
}
|
||||
#else
|
||||
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);
|
||||
if (MemoryFile == -1)
|
||||
{
|
||||
@ -1432,4 +1432,4 @@ void* ARMJIT_Memory::GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size) co
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,9 +428,9 @@ void EmuThread::run()
|
||||
double actualfps = (59.8261 * 263.0) / nlines;
|
||||
int inst = emuInstance->instanceID;
|
||||
if (inst == 0)
|
||||
sprintf(melontitle, "[%d/%.0f] melonDS " MELONDS_VERSION, fps, actualfps);
|
||||
snprintf(melontitle, sizeof(melontitle), "[%d/%.0f] melonDS " MELONDS_VERSION, fps, actualfps);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -445,9 +445,9 @@ void EmuThread::run()
|
||||
|
||||
int inst = emuInstance->instanceID;
|
||||
if (inst == 0)
|
||||
sprintf(melontitle, "melonDS " MELONDS_VERSION);
|
||||
snprintf(melontitle, sizeof(melontitle), "melonDS " MELONDS_VERSION);
|
||||
else
|
||||
sprintf(melontitle, "melonDS (%d)", inst+1);
|
||||
snprintf(melontitle, sizeof(melontitle), "melonDS (%d)", inst+1);
|
||||
changeWindowTitle(melontitle);
|
||||
|
||||
SDL_Delay(75);
|
||||
|
@ -187,7 +187,7 @@ void NetplayDialog::doUpdatePlayerList(Netplay::Player* players, int num)
|
||||
|
||||
char ip[32];
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void TitleManagerDialog::createTitleItem(u32 category, u32 titleid)
|
||||
*(u32*)&gamecode[0] = *(u32*)&header.GameCode[0];
|
||||
gamecode[4] = '\0';
|
||||
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));
|
||||
item->setIcon(icon);
|
||||
@ -481,7 +481,7 @@ void TitleImportDialog::accept()
|
||||
network = new QNetworkAccessManager(this);
|
||||
|
||||
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;
|
||||
req.setUrl(QUrl(url));
|
||||
|
@ -152,14 +152,14 @@ void WifiSettingsDialog::on_cbxDirectAdapter_currentIndexChanged(int sel)
|
||||
melonDS::AdapterData* adapter = &adapters[sel];
|
||||
char tmp[64];
|
||||
|
||||
sprintf(tmp, "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
adapter->MAC[0], adapter->MAC[1], adapter->MAC[2],
|
||||
adapter->MAC[3], adapter->MAC[4], adapter->MAC[5]);
|
||||
snprintf(tmp, sizeof(tmp), "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
adapter->MAC[0], adapter->MAC[1], adapter->MAC[2],
|
||||
adapter->MAC[3], adapter->MAC[4], adapter->MAC[5]);
|
||||
ui->lblAdapterMAC->setText(QString(tmp));
|
||||
|
||||
sprintf(tmp, "%d.%d.%d.%d",
|
||||
adapter->IP_v4[0], adapter->IP_v4[1],
|
||||
adapter->IP_v4[2], adapter->IP_v4[3]);
|
||||
snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d",
|
||||
adapter->IP_v4[0], adapter->IP_v4[1],
|
||||
adapter->IP_v4[2], adapter->IP_v4[3]);
|
||||
ui->lblAdapterIP->setText(QString(tmp));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user