Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/shared/Utils.cpp

Issue 29331055: Issue #1234 - Remove 'CString' from PluginFilter.* (Closed)
Patch Set: address comments Created Nov. 30, 2015, 3:51 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/shared/Utils.cpp
===================================================================
--- a/src/shared/Utils.cpp
+++ b/src/shared/Utils.cpp
@@ -53,6 +53,16 @@
return (osvi->dwMajorVersion == 6 && osvi->dwMinorVersion >= 2) || osvi->dwMajorVersion > 6;
}
+std::wstring ToWstring(const BSTR b)
+{
+ if (!b)
+ {
+ // A null BSTR pointer is considered semantically equal to the zero-length string.
+ return std::wstring();
+ }
+ return std::wstring(b, ::SysStringLen(b));
+}
+
std::string ToUtf8String(const std::wstring& str)
{
int length = static_cast<int>(str.size());
« src/shared/Utils.h ('K') | « src/shared/Utils.h ('k') | test/UtilTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld