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: fix up error log message Created Jan. 11, 2016, 3:57 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,14 +170,17 @@
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
{
- DEBUG_ERROR_LOG(0, 0, 0, "CPluginClass::GetBrowserUrl - Reached with m_webBrowser2 == nullptr");
+ DEBUG_GENERAL(L"CPluginClass::GetBrowserUrl - Reached with m_webBrowser2 == nullptr (probable invariant violation)");
+ }
+ if (url.empty())
+ {
url = m_tab->GetDocumentUrl();
}
return url;
@@ -474,7 +477,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