mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
refactor(Core/Misc): string handling and use smart pointer for strand (#22351)
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <filesystem>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "direct.h"
|
||||
@@ -184,7 +185,8 @@ void HandleArgs(int argc, char* arg[])
|
||||
case 'i':
|
||||
if (c + 1 < argc) // all ok
|
||||
{
|
||||
strcpy(input_path, arg[(c++) + 1]);
|
||||
std::strncpy(input_path, arg[(c++) + 1], MAX_PATH_LENGTH - 1);
|
||||
input_path[MAX_PATH_LENGTH - 1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -194,7 +196,8 @@ void HandleArgs(int argc, char* arg[])
|
||||
case 'o':
|
||||
if (c + 1 < argc) // all ok
|
||||
{
|
||||
strcpy(output_path, arg[(c++) + 1]);
|
||||
std::strncpy(output_path, arg[(c++) + 1], MAX_PATH_LENGTH - 1);
|
||||
output_path[MAX_PATH_LENGTH - 1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -282,7 +285,8 @@ uint32 ReadMapDBC()
|
||||
for (uint32 x = 0; x < map_count; ++x)
|
||||
{
|
||||
map_ids[x].id = dbc.getRecord(x).getUInt(0);
|
||||
strcpy(map_ids[x].name, dbc.getRecord(x).getString(1));
|
||||
std::strncpy(map_ids[x].name, dbc.getRecord(x).getString(1), sizeof(map_ids[x].name) - 1);
|
||||
map_ids[x].name[sizeof(map_ids[x].name) - 1] = '\0';
|
||||
}
|
||||
printf("Done! (%u maps loaded)\n", (uint32)map_count);
|
||||
return map_count;
|
||||
|
||||
Reference in New Issue
Block a user