From 27164b8e75f8db1eb06a11c2062fe9baed014289 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 4 Jan 2014 21:47:45 +0200 Subject: [PATCH] Rename EscapeUrl to EncodeUrl --- Common/StringUtil.cpp | 2 +- Common/StringUtil.h | 2 +- Common/StringUtil_Test.cpp | 4 ++-- Library/ConfigParser.cpp | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Common/StringUtil.cpp b/Common/StringUtil.cpp index 0e7f2072..01398a9e 100644 --- a/Common/StringUtil.cpp +++ b/Common/StringUtil.cpp @@ -78,7 +78,7 @@ void EscapeRegExp(std::wstring& str) /* ** Escapes reserved URL characters. */ -void EscapeUrl(std::wstring& str) +void EncodeUrl(std::wstring& str) { size_t pos = 0; while ((pos = str.find_first_of(L" !*'();:@&=+$,/?#[]", pos)) != std::wstring::npos) diff --git a/Common/StringUtil.h b/Common/StringUtil.h index b0178008..50c503ba 100644 --- a/Common/StringUtil.h +++ b/Common/StringUtil.h @@ -38,7 +38,7 @@ inline std::wstring WidenUTF8(const std::string& str) { return Widen(str.c_str() void EscapeRegExp(std::wstring& str); -void EscapeUrl(std::wstring& str); +void EncodeUrl(std::wstring& str); } // namespace StringUtil diff --git a/Common/StringUtil_Test.cpp b/Common/StringUtil_Test.cpp index 16dcbee3..db43c998 100644 --- a/Common/StringUtil_Test.cpp +++ b/Common/StringUtil_Test.cpp @@ -47,10 +47,10 @@ public: Assert::AreEqual(L"\\\\\\^\\$\\|\\(test\\)\\[\\{\\. ing\\+\\*\\?", str.c_str()); } - TEST_METHOD(TestEscapeUrl) + TEST_METHOD(TestEncodeUrl) { std::wstring str = L" !*'();:@test&=+$,/?#[ing]"; - EscapeUrl(str); + EncodeUrl(str); Assert::AreEqual(L"%20%21%2A%27%28%29%3B%3A%40test%26%3D%2B%24%2C%2F%3F%23%5Bing%5D", str.c_str()); } }; diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index 819e42e2..b8ff8271 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -238,7 +238,7 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s Max, Min, EscapeRegExp, - EscapeUrl + EncodeUrl } valueType = ValueType::Raw; if (isKeySelector) @@ -255,9 +255,9 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s { valueType = ValueType::EscapeRegExp; } - else if (_wcsicmp(selectorSz, L"EscapeUrl") == 0) + else if (_wcsicmp(selectorSz, L"EncodeUrl") == 0) { - valueType = ValueType::EscapeUrl; + valueType = ValueType::EncodeUrl; } else { @@ -304,10 +304,10 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s StringUtil::EscapeRegExp(strValue); return true; } - else if (valueType == ValueType::EscapeUrl) + else if (valueType == ValueType::EncodeUrl) { strValue = measure->GetStringValue(); - StringUtil::EscapeUrl(strValue); + StringUtil::EncodeUrl(strValue); return true; }