Remove std::strcpy

This commit is contained in:
Elad 2025-11-02 13:32:49 +02:00
parent dc22584f72
commit ede8382c6a
4 changed files with 5 additions and 4 deletions

View File

@ -25,6 +25,7 @@
#include <string>
#include <vector>
#include <charconv>
#include <string_view>
std::string to_hex(std::uint64_t value, bool prfx = true)
{
@ -85,7 +86,7 @@ int main(int argc, char* argv[])
// Decode address and try to find the object
std::uint64_t addr = -1;
std::from_chars(arg.data() + strlen("--start-address=0x"), arg.data() + arg.size(), addr, 16);
std::from_chars(arg.data() + ("--start-address=0x"sv).size(), arg.data() + arg.size(), addr, 16);
for (int j = 0; j < 0x100'0000; j++)
{

View File

@ -646,7 +646,7 @@ namespace np
for (; it != end; ++it)
{
strcpy(ifr.ifr_name, it->ifr_name);
strcpy_trunc(ifr.ifr_name, it->ifr_name);
if (ioctl(sock, SIOCGIFFLAGS, &ifr) == 0)
{
if (!(ifr.ifr_flags & IFF_LOOPBACK))

View File

@ -169,7 +169,7 @@ bool gui_pad_thread::init()
usetup.id.bustype = BUS_USB;
usetup.id.vendor = 0x1234;
usetup.id.product = 0x1234;
std::strcpy(usetup.name, "RPCS3 GUI Input Device");
strcpy_trunc(usetup.name, "RPCS3 GUI Input Device"sv);
// The ioctls below will enable the device that is about to be created to pass events.
CHECK_IOCTRL_RET(ioctl(m_uinput_fd, UI_SET_EVBIT, EV_KEY));

View File

@ -253,7 +253,7 @@ namespace psf
if (indices[i].param_fmt == format::string)
{
// Find null terminator
value.resize(std::strlen(value.c_str()));
value.resize(value.find_first_of('\0'));
}
result.sfo.emplace(std::piecewise_construct,