Codechange: replace char* with std::string_view

This commit is contained in:
Rubidium
2025-04-27 18:31:42 +02:00
committed by rubidium42
parent e1859df1c0
commit 49ef3eee13
25 changed files with 53 additions and 49 deletions

View File

@@ -574,12 +574,12 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCmdNames()
auto p = std::make_unique<Packet>(this, ADMIN_PACKET_SERVER_CMD_NAMES);
for (uint16_t i = 0; i < CMD_END; i++) {
const char *cmdname = GetCommandName(static_cast<Commands>(i));
std::string_view cmdname = GetCommandName(static_cast<Commands>(i));
/* Should COMPAT_MTU be exceeded, start a new packet
* (magic 5: 1 bool "more data" and one uint16_t "command id", one
* byte for string '\0' termination and 1 bool "no more data" */
if (!p->CanWriteToPacket(strlen(cmdname) + 5)) {
if (!p->CanWriteToPacket(cmdname.size() + 5)) {
p->Send_bool(false);
this->SendPacket(std::move(p));