Fix compiler warnings in the IE backend.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-14 13:05:12 +00:00
parent 87d482ec3f
commit 423adfde54

View File

@@ -168,21 +168,23 @@ wxString wxWebViewIE::GetPageSource()
IHTMLDocument2* document = GetDocument(); IHTMLDocument2* document = GetDocument();
IHTMLElement *bodyTag = NULL; IHTMLElement *bodyTag = NULL;
IHTMLElement *htmlTag = NULL; IHTMLElement *htmlTag = NULL;
BSTR bstr; wxString source;
HRESULT hr = document->get_body(&bodyTag); HRESULT hr = document->get_body(&bodyTag);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = bodyTag->get_parentElement(&htmlTag); hr = bodyTag->get_parentElement(&htmlTag);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
BSTR bstr;
htmlTag->get_outerHTML(&bstr); htmlTag->get_outerHTML(&bstr);
source = wxString(bstr);
htmlTag->Release(); htmlTag->Release();
} }
bodyTag->Release(); bodyTag->Release();
} }
document->Release(); document->Release();
return wxString(bstr); return source;
} }
wxWebViewZoom wxWebViewIE::GetZoom() wxWebViewZoom wxWebViewIE::GetZoom()
@@ -193,6 +195,9 @@ wxWebViewZoom wxWebViewIE::GetZoom()
return GetIETextZoom(); return GetIETextZoom();
else else
wxFAIL; wxFAIL;
//Dummy return to stop compiler warnings
return wxWEB_VIEW_ZOOM_MEDIUM;
} }
@@ -304,7 +309,7 @@ wxWebViewZoom wxWebViewIE::GetIEOpticalZoom()
{ {
return wxWEB_VIEW_ZOOM_LARGE; return wxWEB_VIEW_ZOOM_LARGE;
} }
else if (zoom > 145) else /*if (zoom > 145) */ //Using else removes a compiler warning
{ {
return wxWEB_VIEW_ZOOM_LARGEST; return wxWEB_VIEW_ZOOM_LARGEST;
} }
@@ -558,12 +563,11 @@ bool wxWebViewIE::IsEditable()
IHTMLDocument2* document = GetDocument(); IHTMLDocument2* document = GetDocument();
BSTR mode; BSTR mode;
document->get_designMode(&mode); document->get_designMode(&mode);
document->Release();
if(wxString(mode) == "On") if(wxString(mode) == "On")
return true; return true;
else else
return false; return false;
document->Release();
} }
void wxWebViewIE::SelectAll() void wxWebViewIE::SelectAll()
@@ -575,15 +579,17 @@ bool wxWebViewIE::HasSelection()
{ {
IHTMLDocument2* document = GetDocument(); IHTMLDocument2* document = GetDocument();
IHTMLSelectionObject* selection; IHTMLSelectionObject* selection;
BSTR type; wxString sel;
HRESULT hr = document->get_selection(&selection); HRESULT hr = document->get_selection(&selection);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
BSTR type;
selection->get_type(&type); selection->get_type(&type);
sel = wxString(type);
selection->Release(); selection->Release();
} }
document->Release(); document->Release();
return wxString(type) != "None"; return sel != "None";
} }
void wxWebViewIE::DeleteSelection() void wxWebViewIE::DeleteSelection()
@@ -652,16 +658,18 @@ wxString wxWebViewIE::GetSelectedSource()
wxString wxWebViewIE::GetPageText() wxString wxWebViewIE::GetPageText()
{ {
IHTMLDocument2* document = GetDocument(); IHTMLDocument2* document = GetDocument();
BSTR out; wxString text;
IHTMLElement* body; IHTMLElement* body;
HRESULT hr = document->get_body(&body); HRESULT hr = document->get_body(&body);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
BSTR out;
body->get_innerText(&out); body->get_innerText(&out);
text = wxString(out);
body->Release(); body->Release();
} }
document->Release(); document->Release();
return wxString(out); return text;
} }
bool wxWebViewIE::CanExecCommand(wxString command) bool wxWebViewIE::CanExecCommand(wxString command)