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

Unified Diff: src/plugin/PluginDomTraverserBase.h

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/PluginClass.cpp ('k') | src/plugin/PluginUserSettings.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginDomTraverserBase.h
===================================================================
--- a/src/plugin/PluginDomTraverserBase.h
+++ b/src/plugin/PluginDomTraverserBase.h
@@ -237,9 +237,9 @@
{
std::wstring src;
CComBSTR bstrSrc;
- if (SUCCEEDED(pFrameBrowser->get_LocationURL(&bstrSrc)) && bstrSrc)
+ if (SUCCEEDED(pFrameBrowser->get_LocationURL(&bstrSrc)))
{
- src = std::wstring(bstrSrc,SysStringLen(bstrSrc));
+ src = ToWstring(bstrSrc);
}
if (!src.empty())
{
@@ -274,29 +274,31 @@
{
CComVariant vAttr;
- if (SUCCEEDED(pFrameEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr.vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0)
+ if (SUCCEEDED(pFrameEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr.vt == VT_BSTR)
{
- std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal));
+ std::wstring src = ToWstring(vAttr.bstrVal);
+ if (!src.empty())
+ {
+ // Some times, domain is missing. Should this be added on image src's as well?''
+ // eg. gadgetzone.com.au
+ if (BeginsWith(src, L"//"))
+ {
+ src = L"http:" + src;
+ }
+ // eg. http://w3schools.com/html/html_examples.asp
+ else if (!(BeginsWith(src, L"http") || BeginsWith(src, L"res://")))
+ {
+ src = L"http://" + m_domain + src;
+ }
- // Some times, domain is missing. Should this be added on image src's as well?''
- // eg. gadgetzone.com.au
- if (BeginsWith(src, L"//"))
- {
- src = L"http:" + src;
- }
- // eg. http://w3schools.com/html/html_examples.asp
- else if (!(BeginsWith(src, L"http") || BeginsWith(src, L"res://")))
- {
- src = L"http://" + m_domain + src;
- }
-
- // Check if Iframe should be traversed
- if (OnIFrame(pFrameEl, src, indent))
- {
- CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
- if (pFrameBrowser)
+ // Check if Iframe should be traversed
+ if (OnIFrame(pFrameEl, src, indent))
{
- TraverseDocument(pFrameBrowser, false, indent);
+ CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
+ if (pFrameBrowser)
+ {
+ TraverseDocument(pFrameBrowser, false, indent);
+ }
}
}
}
« no previous file with comments | « src/plugin/PluginClass.cpp ('k') | src/plugin/PluginUserSettings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld