Index: src/plugin/PluginUtil.cpp |
=================================================================== |
--- a/src/plugin/PluginUtil.cpp |
+++ b/src/plugin/PluginUtil.cpp |
@@ -53,8 +53,23 @@ |
return std::wstring(locationUrl, locationUrl.Length()); |
} |
+/** |
+ * \par Implementation Note |
+ * We call '_wcslwr_s()', which take C-style strings and uses the current locale to determine case. |
sergei
2015/12/16 15:53:16
It still can be just a one line comment "uses the
Eric
2015/12/16 16:38:07
That's reasonable.
|
+ */ |
std::wstring ToLowerString(const std::wstring& s) |
{ |
- return ToWstring(ToCString(s).MakeLower()); |
+ std::wstring lower(s); // Copy the argument |
+ /* |
+ * C++11 provides that 'c_str()' returns the internal array in which the string holds its value. |
+ * Thus we can modify in-place after casting away the 'const' modifier from 'c_str()'. |
sergei
2015/12/16 15:53:16
These two lines are completely redundant.
Eric
2015/12/16 16:38:07
Just because you understand it already doesn't mea
Oleksandr
2016/01/05 22:59:00
From what I remember the consensus on comments is
Eric
2016/01/07 14:34:04
Done.
|
+ * |
+ * Documentation for '_wcslwr_s' https://msdn.microsoft.com/en-us/library/y889wzfw.aspx |
+ * This documentation is incorrect on an important point. |
+ * Regarding parameter validation, it says "length of string" where it should say "length of buffer". |
+ * The call below has argument "length + 1" to include the terminating null character in the buffer. |
sergei
2015/12/16 15:53:16
It does say "Size of the buffer.", so these three
Eric
2015/12/16 16:38:07
It also says "size of string", and it does that (l
Oleksandr
2016/01/05 22:59:00
How about just a comment like:
//NOTE: second para
Eric
2016/01/07 14:34:04
It's not typical for documentation to be incorrect
|
+ */ |
+ _wcslwr_s(const_cast<wchar_t*>(lower.c_str()), lower.length() + 1); |
+ return lower; |
} |