Change length type of BytesToHexString

This commit is contained in:
Jonathan G Rennison
2023-07-05 08:46:01 +01:00
parent f3adb13e34
commit 0f63f9d637
3 changed files with 3 additions and 3 deletions

View File

@@ -74,7 +74,7 @@ void InitializeOldNames();
std::string GenerateUid(std::string_view subject) std::string GenerateUid(std::string_view subject)
{ {
extern void NetworkRandomBytesWithFallback(void *buf, size_t n); extern void NetworkRandomBytesWithFallback(void *buf, size_t n);
extern std::string BytesToHexString(const byte *data, uint length); extern std::string BytesToHexString(const byte *data, size_t length);
uint8 random_bytes[32]; uint8 random_bytes[32];
NetworkRandomBytesWithFallback(random_bytes, lengthof(random_bytes)); NetworkRandomBytesWithFallback(random_bytes, lengthof(random_bytes));

View File

@@ -1299,7 +1299,7 @@ static void NetworkGenerateServerId()
_settings_client.network.network_id = GenerateUid("OpenTTD Server ID"); _settings_client.network.network_id = GenerateUid("OpenTTD Server ID");
} }
std::string BytesToHexString(const byte *data, uint length) std::string BytesToHexString(const byte *data, size_t length)
{ {
std::string hex_output; std::string hex_output;
hex_output.resize(length * 2); hex_output.resize(length * 2);

View File

@@ -162,7 +162,7 @@ StringID GetNetworkErrorMsg(NetworkErrorCode err);
bool NetworkMakeClientNameUnique(std::string &new_name); bool NetworkMakeClientNameUnique(std::string &new_name);
std::string GenerateCompanyPasswordHash(const std::string &password, const std::string &password_server_id, uint32 password_game_seed); std::string GenerateCompanyPasswordHash(const std::string &password, const std::string &password_server_id, uint32 password_game_seed);
std::vector<uint8> GenerateGeneralPasswordHash(const std::string &password, const std::string &password_server_id, uint64 password_game_seed); std::vector<uint8> GenerateGeneralPasswordHash(const std::string &password, const std::string &password_server_id, uint64 password_game_seed);
std::string BytesToHexString(const byte *data, uint length); std::string BytesToHexString(const byte *data, size_t length);
std::string NetworkGenerateRandomKeyString(uint bytes); std::string NetworkGenerateRandomKeyString(uint bytes);
std::string_view ParseCompanyFromConnectionString(const std::string &connection_string, CompanyID *company_id); std::string_view ParseCompanyFromConnectionString(const std::string &connection_string, CompanyID *company_id);