diff --git a/src/common/webview.cpp b/src/common/webview.cpp index 21ab75f5ea..21d5a40c92 100644 --- a/src/common/webview.cpp +++ b/src/common/webview.cpp @@ -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); } } diff --git a/src/msw/webview_edge.cpp b/src/msw/webview_edge.cpp index 06d136708f..cce02e5f21 100644 --- a/src/msw/webview_edge.cpp +++ b/src/msw/webview_edge.cpp @@ -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); } // ---------------------------------------------------------------------------- diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index c584fd32e3..565d377bf3 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -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