From 74a1498eeebc0bc2ae3cf7c9138f4af5c6f16369 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 17 May 2025 22:44:48 +0200 Subject: [PATCH] Remove unnecessary use of wxLogXXX("%s") Just pass the strings directly to wxLogXXX functions as this works correctly after the changes of the parent commit. --- samples/calendar/calendar.cpp | 2 +- samples/debugrpt/debugrpt.cpp | 2 +- samples/grid/griddemo.cpp | 6 +++--- samples/image/image.cpp | 2 +- samples/listctrl/listtest.cpp | 2 +- samples/statbar/statbar.cpp | 2 +- samples/svg/svgtest.cpp | 2 +- samples/webview/webview.cpp | 17 ++++++++++------- src/common/debugrpt.cpp | 4 ++-- src/common/imagtiff.cpp | 4 ++-- src/common/msgout.cpp | 2 +- utils/ifacecheck/src/ifacecheck.cpp | 2 +- 12 files changed, 25 insertions(+), 22 deletions(-) diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 104782da6c..5edf5eb072 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -666,7 +666,7 @@ void MyFrame::OnCalRClick(wxMouseEvent& event) break; } - wxLogMessage("%s", msg); + wxLogMessage(msg); } #if wxUSE_DATEPICKCTRL diff --git a/samples/debugrpt/debugrpt.cpp b/samples/debugrpt/debugrpt.cpp index 4073f007a9..c8a2983cb6 100644 --- a/samples/debugrpt/debugrpt.cpp +++ b/samples/debugrpt/debugrpt.cpp @@ -79,7 +79,7 @@ protected: s << '\t' << reply[n] << '\n'; } - wxLogMessage("%s", s); + wxLogMessage(s); return true; } diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index b98cb27128..a93defedf0 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -1704,7 +1704,7 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev ) logBuf << " (shift down)"; if ( ev.ControlDown() ) logBuf << " (control down)"; - wxLogMessage( "%s", logBuf ); + wxLogMessage(logBuf); // you must call event skip if you want default grid processing // @@ -1810,7 +1810,7 @@ void GridFrame::OnSelectCell( wxGridEvent& ev ) if ( grid->GetColPos( ev.GetCol() ) != ev.GetCol() ) logBuf << " *** Column moved, current position: " << grid->GetColPos( ev.GetCol() ); - wxLogMessage( "%s", logBuf ); + wxLogMessage(logBuf); // you must call Skip() if you want the default processing // to occur in wxGrid @@ -1837,7 +1837,7 @@ LogRangeSelectEvent(wxGridRangeSelectEvent& ev, const char* suffix) << ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F') << ", AltDown: "<< (ev.AltDown() ? 'T':'F') << ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )"; - wxLogMessage( "%s", logBuf ); + wxLogMessage(logBuf); ev.Skip(); } diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 57fdead43b..6337c3c1dd 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -1418,7 +1418,7 @@ void MyFrame::OnImageInfo( wxCommandEvent &WXUNUSED(event) ) } } - wxLogMessage("%s", info); + wxLogMessage(info); } } diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index 9a3256b1a5..8a055b0a96 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -861,7 +861,7 @@ void MyFrame::OnGetColOrder(wxCommandEvent& WXUNUSED(event)) n, m_listCtrl->GetColumnIndexFromOrder(n)); } - wxLogMessage("%s", msg); + wxLogMessage(msg); } #endif // wxHAS_LISTCTRL_COLUMN_ORDER diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp index 26d06db1b8..b46cf24f52 100644 --- a/samples/statbar/statbar.cpp +++ b/samples/statbar/statbar.cpp @@ -683,7 +683,7 @@ void MyFrame::OnShowFieldsRect(wxCommandEvent& WXUNUSED(event)) } } - wxLogMessage("%s", msg); + wxLogMessage(msg); } void MyFrame::OnUpdateStatusBarToggle(wxUpdateUIEvent& event) diff --git a/samples/svg/svgtest.cpp b/samples/svg/svgtest.cpp index 574246253a..ec8373e465 100644 --- a/samples/svg/svgtest.cpp +++ b/samples/svg/svgtest.cpp @@ -492,6 +492,6 @@ void MyPage::OnDraw(wxDC& dc) break; } - wxLogStatus("%s", pageDescriptions[m_index]); + wxLogStatus(pageDescriptions[m_index]); } diff --git a/samples/webview/webview.cpp b/samples/webview/webview.cpp index 7a644ce495..1a9862e1e6 100644 --- a/samples/webview/webview.cpp +++ b/samples/webview/webview.cpp @@ -1128,8 +1128,10 @@ void WebFrame::OnNavigationRequest(wxWebViewEvent& evt) m_info->Dismiss(); } - wxLogMessage("%s", "Navigation request to '" + evt.GetURL() + "' (target='" + - evt.GetTarget() + "')" + ((evt.IsTargetMainFrame()) ? " mainFrame" : "")); + wxLogMessage("Navigation request to '%s' (target='%s')%s", + evt.GetURL(), + evt.GetTarget(), + evt.IsTargetMainFrame() ? " mainFrame" : ""); //If we don't want to handle navigation then veto the event and navigation //will not take place, we also need to stop the loading animation @@ -1149,7 +1151,7 @@ void WebFrame::OnNavigationRequest(wxWebViewEvent& evt) */ void WebFrame::OnNavigationComplete(wxWebViewEvent& evt) { - wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'"); + wxLogMessage("Navigation complete; url='%s'", evt.GetURL()); UpdateState(); } @@ -1161,7 +1163,7 @@ void WebFrame::OnDocumentLoaded(wxWebViewEvent& evt) //Only notify if the document is the main frame, not a subframe if(evt.GetURL() == m_browser->GetCurrentURL()) { - wxLogMessage("%s", "Document loaded; url='" + evt.GetURL() + "'"); + wxLogMessage("Document loaded; url='%s'", evt.GetURL()); } UpdateState(); } @@ -1178,7 +1180,7 @@ void WebFrame::OnNewWindow(wxWebViewEvent& evt) flag = " (user)"; } - wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'" + flag); + wxLogMessage("New window; url='%s'%s", evt.GetURL(), flag); //If we handle new window events then create a new frame if (!m_tools_handle_new_window->IsChecked()) @@ -1217,7 +1219,7 @@ void WebFrame::OnNewWindowFeatures(wxWebViewEvent &evt) void WebFrame::OnTitleChanged(wxWebViewEvent& evt) { SetTitle(GetPrivatePrefix() + evt.GetString()); - wxLogMessage("%s", "Title changed; title='" + evt.GetString() + "'"); + wxLogMessage("Title changed; title='%s'", evt.GetString()); } void WebFrame::OnFullScreenChanged(wxWebViewEvent & evt) @@ -1673,7 +1675,8 @@ void WebFrame::OnError(wxWebViewEvent& evt) WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER); } - wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" + category + " (" + evt.GetString() + ")'"); + wxLogMessage("Error; url='%s', error='%s (%s)'", + evt.GetURL(), category, evt.GetString()); //Show the info bar with an error m_info->ShowMessage(_("An error occurred loading ") + evt.GetURL() + "\n" + diff --git a/src/common/debugrpt.cpp b/src/common/debugrpt.cpp index 8abf8c9a53..6993903f51 100644 --- a/src/common/debugrpt.cpp +++ b/src/common/debugrpt.cpp @@ -585,7 +585,7 @@ bool wxDebugReport::DoProcess() msg += _("\nPlease send this report to the program maintainer, thank you!\n"); - wxLogMessage(wxT("%s"), msg); + wxLogMessage(msg); // we have to do this or the report would be deleted, and we don't even // have any way to ask the user if he wants to keep it from here @@ -735,7 +735,7 @@ bool wxDebugReportUpload::DoProcess() { for ( size_t n = 0; n < count; n++ ) { - wxLogWarning(wxT("%s"), errors[n]); + wxLogWarning(errors[n]); } } diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index cf044d33bb..c3d976ab54 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -77,13 +77,13 @@ extern "C" static void TIFFwxWarningHandler(const char* module, const char *fmt, va_list ap) { - wxLogWarning("%s", FormatTiffMessage(module, fmt, ap)); + wxLogWarning(FormatTiffMessage(module, fmt, ap)); } static void TIFFwxErrorHandler(const char* module, const char *fmt, va_list ap) { - wxLogError("%s", FormatTiffMessage(module, fmt, ap)); + wxLogError(FormatTiffMessage(module, fmt, ap)); } } // extern "C" diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp index f378871ed5..21608a8db5 100644 --- a/src/common/msgout.cpp +++ b/src/common/msgout.cpp @@ -191,7 +191,7 @@ void wxMessageOutputLog::Output(const wxString& str) out.Replace(wxT("\t"), wxT(" ")); - wxLogMessage(wxT("%s"), out); + wxLogMessage(out); } #endif // wxUSE_BASE diff --git a/utils/ifacecheck/src/ifacecheck.cpp b/utils/ifacecheck/src/ifacecheck.cpp index dd29fefb69..b5e64e48b9 100644 --- a/utils/ifacecheck/src/ifacecheck.cpp +++ b/utils/ifacecheck/src/ifacecheck.cpp @@ -393,7 +393,7 @@ int IfaceCheckApp::CompareClasses(const wxClass* iface, const wxClass* api) for (unsigned int j=0; jGetAsString(true, true, true, true); - wxLogWarning("%s", warning); + wxLogWarning(warning); count++; if (overloads.GetCount()>1)