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: Created Nov. 29, 2015, 3:49 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());

Powered by Google App Engine
This is Rietveld