From 3d65231c425db0d53d95987d9a614e18ebb43e88 Mon Sep 17 00:00:00 2001 From: Victor Arvidsson Date: Thu, 24 Oct 2024 07:26:12 +0200 Subject: [PATCH] Fixed small bug in replace_all. Start_pos should of course be 0... Signed-off-by: Victor Arvidsson --- core/save-profiledata.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/save-profiledata.cpp b/core/save-profiledata.cpp index 5715c698f..0765baf2a 100644 --- a/core/save-profiledata.cpp +++ b/core/save-profiledata.cpp @@ -47,10 +47,10 @@ static std::string video_time(int secs) return format_string_std("%d:%02d:%02d.000,", hours, mins, secs); } -void replace_all(std::string& str, const std::string& old_value, const std::string& new_value) { +static void replace_all(std::string &str, const std::string &old_value, const std::string &new_value) { if (old_value.empty()) return; - size_t start_pos = std::string::npos; + size_t start_pos = 0; while ((start_pos = str.find(old_value, start_pos)) != std::string::npos) { str.replace(start_pos, old_value.length(), new_value); start_pos += new_value.length(); // In case 'new_value' contains 'old_value', like replacing 'x' with 'yx'