Avoid Clang -Wrange-loop-bind-reference warnings
Avoid -Wcast-qual warnings
Avoid shadowed variable
| ... | ... | @@ -32,7 +32,9 @@ |
| 32 | 32 | #include "wx/protocols/pointer-warp-v1-client-protocol.h"
|
| 33 | 33 | |
| 34 | 34 | #ifdef wxHAVE_WAYLAND_SESSION_MANAGEMENT
|
| 35 | +wxGCC_WARNING_SUPPRESS(cast-qual)
|
|
| 35 | 36 | #include "wx/protocols/xdg-session-management-v1-client-protocol.h"
|
| 37 | +wxGCC_WARNING_RESTORE()
|
|
| 36 | 38 | #endif // wxHAVE_WAYLAND_SESSION_MANAGEMENT
|
| 37 | 39 | |
| 38 | 40 | namespace wxWayland
|
| ... | ... | @@ -4430,7 +4430,7 @@ void wxStringIteratorNode::clear() |
| 4430 | 4430 | template<bool (T)(const wxUniChar& c)>
|
| 4431 | 4431 | inline bool wxStringCheck(const wxString& val)
|
| 4432 | 4432 | {
|
| 4433 | - for ( const auto& ch : val )
|
|
| 4433 | + for ( const auto ch : val )
|
|
| 4434 | 4434 | if (T(ch) == 0)
|
| 4435 | 4435 | return false;
|
| 4436 | 4436 | return true;
|
| ... | ... | @@ -563,7 +563,7 @@ wxString wxJoin(const wxArrayString& arr, const wxChar sep, const wxChar escape) |
| 563 | 563 | str += sep;
|
| 564 | 564 | }
|
| 565 | 565 | |
| 566 | - for ( const auto& ch : arr[n] )
|
|
| 566 | + for ( const auto ch : arr[n] )
|
|
| 567 | 567 | {
|
| 568 | 568 | if ( ch == sep )
|
| 569 | 569 | str += escape; // escape this separator
|
| ... | ... | @@ -1462,7 +1462,7 @@ wxDocTemplateVector GetVisibleTemplates(const wxList& allTemplates) |
| 1462 | 1462 | {
|
| 1463 | 1463 | templates.reserve(totalNumTemplates);
|
| 1464 | 1464 | |
| 1465 | - for ( const auto* item : allTemplates )
|
|
| 1465 | + for ( auto* item : allTemplates )
|
|
| 1466 | 1466 | {
|
| 1467 | 1467 | wxDocTemplate * const temp = (wxDocTemplate *)item;
|
| 1468 | 1468 | if ( temp->IsVisible() )
|
| ... | ... | @@ -402,7 +402,7 @@ wxString wxMarkupParser::Quote(const wxString& text) |
| 402 | 402 | wxString quoted;
|
| 403 | 403 | quoted.reserve(text.length());
|
| 404 | 404 | |
| 405 | - for ( const auto& c : text )
|
|
| 405 | + for ( const auto c : text )
|
|
| 406 | 406 | {
|
| 407 | 407 | unsigned n;
|
| 408 | 408 | for ( n = 0; n < WXSIZEOF(xmlEntities); n++ )
|
| ... | ... | @@ -419,7 +419,7 @@ bool wxNumberFormatter::FromString(wxString s, wxULongLong_t *val) |
| 419 | 419 | // the same thing, but here we really want to accept the "true" unsigned
|
| 420 | 420 | // numbers only, so check for leading minus, possibly preceded by some
|
| 421 | 421 | // whitespace.
|
| 422 | - for ( const auto& c : s )
|
|
| 422 | + for ( const auto c : s )
|
|
| 423 | 423 | {
|
| 424 | 424 | if ( c == '-' )
|
| 425 | 425 | return false;
|
| ... | ... | @@ -1320,7 +1320,7 @@ wxString wxRegEx::QuoteMeta(const wxString& str) |
| 1320 | 1320 | // character were escaped.
|
| 1321 | 1321 | strEscaped.reserve(str.length() * 2);
|
| 1322 | 1322 | |
| 1323 | - for ( const auto& c : str )
|
|
| 1323 | + for ( const auto c : str )
|
|
| 1324 | 1324 | {
|
| 1325 | 1325 | if ( s_strMetaChars.find(c) != wxString::npos )
|
| 1326 | 1326 | {
|
| ... | ... | @@ -1000,7 +1000,7 @@ const wxScopedCharBuffer wxString::ToAscii(char replaceWith) const |
| 1000 | 1000 | wxCharBuffer buffer(length());
|
| 1001 | 1001 | char *dest = buffer.data();
|
| 1002 | 1002 | |
| 1003 | - for ( const auto& c : *this )
|
|
| 1003 | + for ( const auto c : *this )
|
|
| 1004 | 1004 | {
|
| 1005 | 1005 | // FIXME-UTF8: unify substituted char ('_') with wxUniChar ('?')
|
| 1006 | 1006 | *dest++ = c.IsAscii() ? (char)c : replaceWith;
|
| ... | ... | @@ -1280,7 +1280,7 @@ size_t wxString::Replace(const wxString& strOld, |
| 1280 | 1280 | |
| 1281 | 1281 | bool wxString::IsAscii() const
|
| 1282 | 1282 | {
|
| 1283 | - for ( const auto& c : *this )
|
|
| 1283 | + for ( const auto c : *this )
|
|
| 1284 | 1284 | {
|
| 1285 | 1285 | if ( !c.IsAscii() )
|
| 1286 | 1286 | return false;
|
| ... | ... | @@ -1291,7 +1291,7 @@ bool wxString::IsAscii() const |
| 1291 | 1291 | |
| 1292 | 1292 | bool wxString::IsWord() const
|
| 1293 | 1293 | {
|
| 1294 | - for ( const auto& c : *this )
|
|
| 1294 | + for ( const auto c : *this )
|
|
| 1295 | 1295 | {
|
| 1296 | 1296 | if ( !wxIsalpha(c) )
|
| 1297 | 1297 | return false;
|
| ... | ... | @@ -2244,7 +2244,7 @@ match: |
| 2244 | 2244 | int wxString::Freq(wxUniChar ch) const
|
| 2245 | 2245 | {
|
| 2246 | 2246 | int count = 0;
|
| 2247 | - for ( const auto& c : *this )
|
|
| 2247 | + for ( const auto c : *this )
|
|
| 2248 | 2248 | {
|
| 2249 | 2249 | if ( c == ch )
|
| 2250 | 2250 | count ++;
|
| ... | ... | @@ -276,7 +276,7 @@ bool wxTextMeasureBase::DoGetPartialTextExtents(const wxString& text, |
| 276 | 276 | // Calculate the position of each character based on the widths of
|
| 277 | 277 | // the previous characters. This is inexact for not fixed fonts.
|
| 278 | 278 | int n = 0;
|
| 279 | - for ( const auto& c : text )
|
|
| 279 | + for ( const auto c : text )
|
|
| 280 | 280 | {
|
| 281 | 281 | unsigned int c_int = (unsigned int)c;
|
| 282 | 282 |
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | |
| 40 | 40 | static bool wxIsNumeric(const wxString& val)
|
| 41 | 41 | {
|
| 42 | - for ( const auto& c : val )
|
|
| 42 | + for ( const auto c : val )
|
|
| 43 | 43 | {
|
| 44 | 44 | // Allow for "," (French) as well as "." -- in future we should
|
| 45 | 45 | // use wxSystemSettings or other to do better localisation
|
| ... | ... | @@ -324,7 +324,7 @@ void wxTextValidator::OnPaste(wxClipboardTextEvent& event) |
| 324 | 324 | bool hasInvalid = false;
|
| 325 | 325 | |
| 326 | 326 | // Examine all characters one by one.
|
| 327 | - for ( const auto& ch : text )
|
|
| 327 | + for ( const auto ch : text )
|
|
| 328 | 328 | {
|
| 329 | 329 | if ( IsValidChar(ch) )
|
| 330 | 330 | {
|
| ... | ... | @@ -401,7 +401,7 @@ bool wxTextValidator::IsValidChar(const wxUniChar& c) const |
| 401 | 401 | // kept for compatibility reasons.
|
| 402 | 402 | bool wxTextValidator::ContainsOnlyIncludedCharacters(const wxString& str) const
|
| 403 | 403 | {
|
| 404 | - for ( const auto& ch : str )
|
|
| 404 | + for ( const auto ch : str )
|
|
| 405 | 405 | {
|
| 406 | 406 | if ( !IsCharIncluded(ch) )
|
| 407 | 407 | return false;
|
| ... | ... | @@ -413,7 +413,7 @@ bool wxTextValidator::ContainsOnlyIncludedCharacters(const wxString& str) const |
| 413 | 413 | // kept for compatibility reasons.
|
| 414 | 414 | bool wxTextValidator::ContainsExcludedCharacters(const wxString& str) const
|
| 415 | 415 | {
|
| 416 | - for ( const auto& ch : str )
|
|
| 416 | + for ( const auto ch : str )
|
|
| 417 | 417 | {
|
| 418 | 418 | if (IsCharExcluded(ch))
|
| 419 | 419 | return true;
|
| ... | ... | @@ -1401,7 +1401,8 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), |
| 1401 | 1401 | |
| 1402 | 1402 | wxKeyEvent eventChar(wxEVT_CHAR, event);
|
| 1403 | 1403 | |
| 1404 | - if ( long keyCode = wxTranslateKeySymToWXKey(keysym, true /* isChar */) )
|
|
| 1404 | + long keyCode = wxTranslateKeySymToWXKey(keysym, true /* isChar */);
|
|
| 1405 | + if ( keyCode )
|
|
| 1405 | 1406 | {
|
| 1406 | 1407 | // Set Unicode value to the key code if possible, this is useful
|
| 1407 | 1408 | // for keys such as BACKSPACE or ENTER.
|
| ... | ... | @@ -1418,7 +1419,7 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), |
| 1418 | 1419 | {
|
| 1419 | 1420 | // We should already have the corresponding key in US layout,
|
| 1420 | 1421 | // translated from GTK using XKB, in the event.
|
| 1421 | - long keyCode = event.m_keyCode;
|
|
| 1422 | + keyCode = event.m_keyCode;
|
|
| 1422 | 1423 | |
| 1423 | 1424 | if ( (keyCode >= 'A' && keyCode <= 'Z') ||
|
| 1424 | 1425 | keyCode == '[' ||
|
| ... | ... | @@ -1507,7 +1508,7 @@ bool wxWindowGTK::GTKDoInsertTextFromIM(const char* str) |
| 1507 | 1508 | return false;
|
| 1508 | 1509 | |
| 1509 | 1510 | bool processed = false;
|
| 1510 | - for ( const auto& ch : data )
|
|
| 1511 | + for ( const auto ch : data )
|
|
| 1511 | 1512 | {
|
| 1512 | 1513 | event.m_uniChar = ch;
|
| 1513 | 1514 |
| ... | ... | @@ -598,7 +598,7 @@ void wxXmlDocument::AppendToProlog(wxXmlNode *node) |
| 598 | 598 | // returns true if the given string contains only whitespaces
|
| 599 | 599 | bool wxIsWhiteOnly(const wxString& buf)
|
| 600 | 600 | {
|
| 601 | - for ( const auto& c : buf )
|
|
| 601 | + for ( const auto c : buf )
|
|
| 602 | 602 | {
|
| 603 | 603 | if ( c != wxS(' ') && c != wxS('\t') && c != wxS('\n') && c != wxS('\r'))
|
| 604 | 604 | return false;
|
| ... | ... | @@ -946,7 +946,7 @@ bool OutputEscapedString(wxOutputStream& stream, |
| 946 | 946 | wxString escaped;
|
| 947 | 947 | escaped.reserve(str.length());
|
| 948 | 948 | |
| 949 | - for ( const auto& c : str )
|
|
| 949 | + for ( const auto c : str )
|
|
| 950 | 950 | {
|
| 951 | 951 | switch ( c.GetValue() )
|
| 952 | 952 | {
|
| ... | ... | @@ -632,7 +632,7 @@ TEST_CASE_METHOD(IPCFixture, |
| 632 | 632 | |
| 633 | 633 | const wxString s("ping");
|
| 634 | 634 | size_t size = 0;
|
| 635 | - const char* data = (char*) conn.Request( s, &size, wxIPC_PRIVATE);
|
|
| 635 | + const char* data = (const char*) conn.Request( s, &size, wxIPC_PRIVATE);
|
|
| 636 | 636 | |
| 637 | 637 | // Guard against a null return before constructing a wxString from it:
|
| 638 | 638 | // a failed Request() must report cleanly instead of dereferencing null
|
| ... | ... | @@ -667,14 +667,14 @@ TEST_CASE_METHOD(IPCFixture, |
| 667 | 667 | size_t size = 0;
|
| 668 | 668 | const wxString lastExecuteQuery("last_execute");
|
| 669 | 669 | |
| 670 | - char* data = (char*) conn.Request(lastExecuteQuery, &size, wxIPC_PRIVATE);
|
|
| 670 | + const char* data = (const char*) conn.Request(lastExecuteQuery, &size, wxIPC_PRIVATE);
|
|
| 671 | 671 | CHECK( wxString(data) == s );
|
| 672 | 672 | |
| 673 | 673 | |
| 674 | 674 | s = "another execution command!";
|
| 675 | 675 | CHECK( conn.Execute(s.mb_str(), s.length() + 1) );
|
| 676 | 676 | |
| 677 | - data = (char*) conn.Request(lastExecuteQuery, &size, wxIPC_PRIVATE);
|
|
| 677 | + data = (const char*) conn.Request(lastExecuteQuery, &size, wxIPC_PRIVATE);
|
|
| 678 | 678 | CHECK( wxString(data) == s );
|
| 679 | 679 | }
|
| 680 | 680 | |
| ... | ... | @@ -703,12 +703,12 @@ TEST_CASE_METHOD(IPCFixture, |
| 703 | 703 | size_t size = 0;
|
| 704 | 704 | wxString query("get_thread1_request_counter");
|
| 705 | 705 | |
| 706 | - char* data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 706 | + const char* data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 707 | 707 | CHECK( wxString(data) == MESSAGE_ITERATIONS_STRING );
|
| 708 | 708 | |
| 709 | 709 | size = 0;
|
| 710 | 710 | query = "get_error_string";
|
| 711 | - data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 711 | + data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 712 | 712 | |
| 713 | 713 | INFO( wxString(data) );
|
| 714 | 714 | CHECK( wxString(data).empty() );
|
| ... | ... | @@ -755,24 +755,24 @@ TEST_CASE_METHOD(IPCFixture, |
| 755 | 755 | size_t size = 0;
|
| 756 | 756 | wxString query = "get_thread1_request_counter";
|
| 757 | 757 | |
| 758 | - char* data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 758 | + const char* data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 759 | 759 | CHECK( wxString(data) == MESSAGE_ITERATIONS_STRING );
|
| 760 | 760 | |
| 761 | 761 | size = 0;
|
| 762 | 762 | query = "get_thread2_request_counter";
|
| 763 | 763 | |
| 764 | - data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 764 | + data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 765 | 765 | CHECK( wxString(data) == MESSAGE_ITERATIONS_STRING );
|
| 766 | 766 | |
| 767 | 767 | size = 0;
|
| 768 | 768 | query = "get_thread3_request_counter";
|
| 769 | 769 | |
| 770 | - data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 770 | + data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 771 | 771 | CHECK( wxString(data) == MESSAGE_ITERATIONS_STRING );
|
| 772 | 772 | |
| 773 | 773 | size = 0;
|
| 774 | 774 | query = "get_error_string";
|
| 775 | - data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 775 | + data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 776 | 776 | |
| 777 | 777 | INFO( wxString(data) );
|
| 778 | 778 | CHECK( wxString(data).empty() );
|
| ... | ... | @@ -811,7 +811,7 @@ TEST_CASE_METHOD(IPCFixture, |
| 811 | 811 | wxString query = "get_error_string";
|
| 812 | 812 | size_t size = 0;
|
| 813 | 813 | |
| 814 | - char* data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 814 | + const char* data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 815 | 815 | |
| 816 | 816 | INFO( wxString(data) );
|
| 817 | 817 | CHECK( wxString(data).empty() );
|
| ... | ... | @@ -855,7 +855,7 @@ TEST_CASE_METHOD(IPCFixture, |
| 855 | 855 | wxString query = "get_error_string";
|
| 856 | 856 | size_t size = 0;
|
| 857 | 857 | |
| 858 | - char* data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 858 | + const char* data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 859 | 859 | |
| 860 | 860 | INFO( wxString(data) );
|
| 861 | 861 | CHECK( wxString(data).empty() );
|
| ... | ... | @@ -906,7 +906,7 @@ TEST_CASE_METHOD(IPCFixture, |
| 906 | 906 | wxString query = "get_error_string";
|
| 907 | 907 | size_t size = 0;
|
| 908 | 908 | |
| 909 | - char* data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 909 | + const char* data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 910 | 910 | |
| 911 | 911 | INFO( wxString(data) );
|
| 912 | 912 | CHECK( wxString(data).empty() );
|
| ... | ... | @@ -985,24 +985,24 @@ TEST_CASE_METHOD(IPCFixture, |
| 985 | 985 | size_t size = 0;
|
| 986 | 986 | wxString query = "get_thread1_request_counter";
|
| 987 | 987 | |
| 988 | - char* data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 988 | + const char* data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 989 | 989 | CHECK( wxString(data) == MESSAGE_ITERATIONS_STRING );
|
| 990 | 990 | |
| 991 | 991 | size = 0;
|
| 992 | 992 | query = "get_thread2_request_counter";
|
| 993 | 993 | |
| 994 | - data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 994 | + data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 995 | 995 | CHECK( wxString(data) == MESSAGE_ITERATIONS_STRING );
|
| 996 | 996 | |
| 997 | 997 | size = 0;
|
| 998 | 998 | query = "get_thread3_request_counter";
|
| 999 | 999 | |
| 1000 | - data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 1000 | + data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 1001 | 1001 | CHECK( wxString(data) == MESSAGE_ITERATIONS_STRING );
|
| 1002 | 1002 | |
| 1003 | 1003 | size = 0;
|
| 1004 | 1004 | query = "get_error_string";
|
| 1005 | - data = (char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 1005 | + data = (const char*) conn.Request(query, &size, wxIPC_PRIVATE);
|
|
| 1006 | 1006 | |
| 1007 | 1007 | INFO( wxString(data) );
|
| 1008 | 1008 | CHECK( wxString(data).empty() );
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help