Apply suggestions from code review
This commit is contained in:
parent
d11ab7f751
commit
e88b55bfe1
@ -78,7 +78,7 @@ wxWebViewZoom wxWebView::GetZoom() const
|
||||
}
|
||||
|
||||
// to shut up compilers, this can never be reached logically
|
||||
wxASSERT(false);
|
||||
wxFAIL_MSG("unreachable");
|
||||
return wxWEBVIEW_ZOOM_MEDIUM;
|
||||
}
|
||||
|
||||
@ -106,9 +106,6 @@ void wxWebView::SetZoom(wxWebViewZoom zoom)
|
||||
case wxWEBVIEW_ZOOM_LARGEST:
|
||||
SetZoomFactor(1.6f);
|
||||
break;
|
||||
|
||||
default:
|
||||
wxASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,14 +741,18 @@ bool wxWebViewFactoryEdge::IsAvailable()
|
||||
wxVersionInfo wxWebViewFactoryEdge::GetVersionInfo()
|
||||
{
|
||||
IsAvailable(); // Make sure ms_version string is initialized (if available)
|
||||
long versions[3] = { 0, 0, 0 };
|
||||
wxArrayString tokens = wxStringTokenize(wxWebViewEdgeImpl::ms_version, ". ");
|
||||
for (size_t i = 0; i < 3; i++)
|
||||
{
|
||||
if (tokens.size() > i)
|
||||
tokens[i].ToLong(&versions[i]);
|
||||
}
|
||||
return wxVersionInfo("Microsoft Edge WebView2", versions[0], versions[1], versions[2]);
|
||||
long major = 0,
|
||||
minor = 0,
|
||||
micro = 0;
|
||||
wxStringTokenizer tk(wxWebViewEdgeImpl::ms_version, ". ");
|
||||
// Ignore the return value because if the version component is missing
|
||||
// or invalid (i.e. non-numeric), the only thing we can do is to ignore
|
||||
// it anyhow.
|
||||
tk.GetNextToken().ToLong(&major);
|
||||
tk.GetNextToken().ToLong(&minor);
|
||||
tk.GetNextToken().ToLong(µ);
|
||||
|
||||
return wxVersionInfo("Microsoft Edge WebView2", major, minor, micro);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -58,14 +58,17 @@ wxVersionInfo wxWebViewFactoryIE::GetVersionInfo()
|
||||
wxRegKey key(wxRegKey::HKLM, "Software\\Microsoft\\Internet Explorer");
|
||||
wxString value;
|
||||
key.QueryValue("Version", value);
|
||||
long versions[3] = { 0, 0, 0 };
|
||||
wxArrayString tokens = wxStringTokenize(value, ". ");
|
||||
for (size_t i = 0; i < 3; i++)
|
||||
{
|
||||
if (tokens.size() > i)
|
||||
tokens[i].ToLong(&versions[i]);
|
||||
}
|
||||
return wxVersionInfo("Internet Explorer", versions[0], versions[1], versions[2]);
|
||||
long major = 0,
|
||||
minor = 0,
|
||||
micro = 0;
|
||||
wxStringTokenizer tk(value, ". ");
|
||||
// Ignore the return value because if the version component is missing
|
||||
// or invalid (i.e. non-numeric), the only thing we can do is to ignore
|
||||
// it anyhow.
|
||||
tk.GetNextToken().ToLong(&major);
|
||||
tk.GetNextToken().ToLong(&minor);
|
||||
tk.GetNextToken().ToLong(µ);
|
||||
return wxVersionInfo("Internet Explorer", major, minor, micro);
|
||||
}
|
||||
|
||||
//Convenience function for error conversion
|
||||
|
Loading…
Reference in New Issue
Block a user