From 0dd7ab194f4b606be1d923da6c42d4ee7bf9c87c Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 14 Nov 2010 18:55:34 +0000 Subject: [PATCH] Fixed that %10, %11, etc. doesn't work. --- Library/Library.vcproj | 2 +- Library/Meter.cpp | 8 ++++---- Library/MeterString.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Library/Library.vcproj b/Library/Library.vcproj index c6ddaef1..0fdf335d 100644 --- a/Library/Library.vcproj +++ b/Library/Library.vcproj @@ -1,7 +1,7 @@ 0; --i) { - wsprintf(buffer, L"%%%i", i + 1); + wsprintf(buffer, L"%%%i", i); size_t start = 0; size_t pos = std::wstring::npos; @@ -607,8 +607,8 @@ std::wstring CMeter::ReplaceMeasures(std::wstring source) pos = source.find(buffer, start); if (pos != std::wstring::npos) { - source.replace(source.begin() + pos, source.begin() + pos + wcslen(buffer), stringValues[i]); - start = pos + stringValues[i].length(); + source.replace(source.begin() + pos, source.begin() + pos + wcslen(buffer), stringValues[i - 1]); + start = pos + stringValues[i - 1].length(); } } while(pos != std::wstring::npos); } diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index fd31cef7..7d851ff5 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -447,9 +447,9 @@ bool CMeterString::Update() // Create the actual text (i.e. replace %1, %2, .. with the measure texts) std::wstring tmpText = m_Text; - for (size_t i = 0; i < stringValues.size(); ++i) + for (size_t i = stringValues.size(); i > 0; --i) { - wsprintf(buffer, L"%%%i", i + 1); + wsprintf(buffer, L"%%%i", i); size_t start = 0; size_t pos = std::wstring::npos; @@ -459,8 +459,8 @@ bool CMeterString::Update() pos = tmpText.find(buffer, start); if (pos != std::wstring::npos) { - tmpText.replace(tmpText.begin() + pos, tmpText.begin() + pos + wcslen(buffer), stringValues[i]); - start = pos + stringValues[i].length(); + tmpText.replace(tmpText.begin() + pos, tmpText.begin() + pos + wcslen(buffer), stringValues[i - 1]); + start = pos + stringValues[i - 1].length(); } } while(pos != std::wstring::npos); }