From 3d5b46615cfc6d238075a9a1666c29f6f54decbe Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 18 Dec 2021 12:46:47 -0800 Subject: [PATCH] NetPlayClient: Use fmt::join for MD5Sum --- Source/Core/Core/NetPlayClient.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 115b101499..ff9dca8c22 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -2465,7 +2465,6 @@ bool NetPlayClient::DoAllPlayersHaveGame() static std::string MD5Sum(const std::string& file_path, std::function report_progress) { - std::string output_string; std::vector data(8 * 1024 * 1024); u64 read_offset = 0; mbedtls_md5_context ctx; @@ -2479,7 +2478,7 @@ static std::string MD5Sum(const std::string& file_path, std::function { size_t read_size = std::min(static_cast(data.size()), game_size - read_offset); if (!file->Read(read_offset, read_size, data.data())) - return output_string; + return ""; mbedtls_md5_update_ret(&ctx, data.data(), read_size); read_offset += read_size; @@ -2487,17 +2486,14 @@ static std::string MD5Sum(const std::string& file_path, std::function int progress = static_cast(static_cast(read_offset) / static_cast(game_size) * 100); if (!report_progress(progress)) - return output_string; + return ""; } std::array output; mbedtls_md5_finish_ret(&ctx, output.data()); // Convert to hex - for (u8 n : output) - output_string += fmt::format("{:02x}", n); - - return output_string; + return fmt::format("{:02x}", fmt::join(output, "")); } void NetPlayClient::ComputeMD5(const SyncIdentifier& sync_identifier)