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

Unified Diff: src/plugin/PluginClass.cpp

Issue 29333350: Issue #3562 - Use 'ToWstring()' to convert BSTR values (Closed)
Patch Set: Created Jan. 11, 2016, 2:32 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
« no previous file with comments | « src/plugin/AdblockPlusDomTraverser.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -170,12 +170,12 @@
if (m_webBrowser2)
{
CComBSTR bstrURL;
- if (SUCCEEDED(m_webBrowser2->get_LocationURL(&bstrURL)) && bstrURL)
+ if (SUCCEEDED(m_webBrowser2->get_LocationURL(&bstrURL)))
{
- url = std::wstring(bstrURL, SysStringLen(bstrURL));
+ url = ToWstring(bstrURL);
}
}
- else
+ if (url.empty())
{
DEBUG_ERROR_LOG(0, 0, 0, "CPluginClass::GetBrowserUrl - Reached with m_webBrowser2 == nullptr");
sergei 2016/01/11 15:39:07 The comment is slightly inconsistent now with the
Eric 2016/01/11 15:59:33 Yeah. I'll fix that. That's an invariant violation
url = m_tab->GetDocumentUrl();
@@ -474,7 +474,7 @@
{
return;
}
- std::wstring url(urlVariant->bstrVal, SysStringLen(urlVariant->bstrVal));
+ std::wstring url = ToWstring(urlVariant->bstrVal);
// If webbrowser2 is equal to top level browser (as set in SetSite), we are
// navigating new page
« no previous file with comments | « src/plugin/AdblockPlusDomTraverser.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld