From 39c6c62abdaae58b9b5bf215d710934705210a8f Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 4 Jan 2014 21:46:00 +0200 Subject: [PATCH] WebParser: Tweaks --- Plugins/PluginWebParser/WebParser.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Plugins/PluginWebParser/WebParser.cpp b/Plugins/PluginWebParser/WebParser.cpp index 6b3b1f04..0ca51d16 100644 --- a/Plugins/PluginWebParser/WebParser.cpp +++ b/Plugins/PluginWebParser/WebParser.cpp @@ -725,18 +725,12 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) if (end == std::wstring::npos) break; std::wstring var = L"["; - var += url.substr(si + 1, end - si); + var.append(url, si + 1, end - si); - const std::wstring result = RmReplaceVariables(rm, var.c_str()); - if (result != var) - { - url.replace(start, end - start + 1, result); - start += result.length(); - } - else - { - start = end; - } + const WCHAR* result = RmReplaceVariables(rm, var.c_str()); + const size_t resultLength = wcslen(result); + url.replace(start, end - start + 1, result, resultLength); + start += resultLength; } measure->url = url;