mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #8688 from howard0su/cleanup_strncpy
Remove warning of -Wstringop-truncation
This commit is contained in:
commit
93abbc66aa
@ -50,7 +50,7 @@ bool CEXIETHERNET::Activate()
|
||||
const int MAX_INTERFACES = 32;
|
||||
for (int i = 0; i < MAX_INTERFACES; ++i)
|
||||
{
|
||||
strncpy(ifr.ifr_name, StringFromFormat("Dolphin%d", i).c_str(), IFNAMSIZ);
|
||||
strncpy(ifr.ifr_name, StringFromFormat("Dolphin%d", i).c_str(), IFNAMSIZ - 1);
|
||||
|
||||
int err;
|
||||
if ((err = ioctl(fd, TUNSETIFF, (void*)&ifr)) < 0)
|
||||
|
@ -420,9 +420,9 @@ static CertECC MakeBlankEccCert(const std::string& issuer, const std::string& na
|
||||
{
|
||||
CertECC cert{};
|
||||
cert.signature.type = SignatureType(Common::swap32(u32(SignatureType::ECC)));
|
||||
std::strncpy(cert.signature.issuer, issuer.c_str(), 0x40);
|
||||
issuer.copy(cert.signature.issuer, sizeof(cert.signature.issuer) - 1);
|
||||
cert.header.public_key_type = PublicKeyType(Common::swap32(u32(PublicKeyType::ECC)));
|
||||
std::strncpy(cert.header.name, name.c_str(), 0x40);
|
||||
name.copy(cert.header.name, sizeof(cert.header.name) - 1);
|
||||
cert.header.id = Common::swap32(key_id);
|
||||
cert.public_key = Common::ec::PrivToPub(private_key);
|
||||
return cert;
|
||||
|
@ -341,8 +341,8 @@ static void CompressAndDumpState(CompressAndDumpState_args save_args)
|
||||
}
|
||||
|
||||
// Setting up the header
|
||||
StateHeader header;
|
||||
strncpy(header.gameID, SConfig::GetInstance().GetGameID().c_str(), 6);
|
||||
StateHeader header{};
|
||||
SConfig::GetInstance().GetGameID().copy(header.gameID, std::size(header.gameID));
|
||||
header.size = g_use_compression ? (u32)buffer_size : 0;
|
||||
header.time = Common::Timer::GetDoubleTime();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user