[Git][wxwidgets/wxwidgets][master] 3 commits: Avoid -Wcast-qual warnings

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Jun 1, 2025, 10:48:13 AMJun 1
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 4c32c38c
    by Paul Cornett at 2025-06-01T06:50:41-07:00
    Avoid -Wcast-qual warnings
    
  • b9eb9cde
    by Paul Cornett at 2025-06-01T07:28:49-07:00
    Avoid some -Wfloat-conversion warnings
    
  • 05bffdd2
    by Paul Cornett at 2025-06-01T07:34:14-07:00
    Avoid -Wdouble-promotion warning
    

7 changed files:

Changes:

  • include/wx/unix/private/displayx11.h
    ... ... @@ -163,7 +163,7 @@ void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height)
    163 163
             if (status == Success && actual_type == XA_CARDINAL &&
    
    164 164
                 actual_format == 32 && nitems == 4)
    
    165 165
             {
    
    166
    -            const long* p = (long*)data.get();
    
    166
    +            const long* p = (const long*)data.get();
    
    167 167
                 x = p[0];
    
    168 168
                 y = p[1];
    
    169 169
                 width = p[2];
    

  • samples/widgets/widgets.cpp
    ... ... @@ -744,7 +744,7 @@ void WidgetsFrame::InitBook()
    744 744
     
    
    745 745
         wxTreeItemIdValue cookie;
    
    746 746
         tree->EnsureVisible(tree->GetFirstChild(tree->GetRootItem(), cookie));
    
    747
    -    tree->SetMinSize(wxSize(tree->GetBestSize().GetWidth() * 1.1, wxDefaultCoord));
    
    747
    +    tree->SetMinSize(wxSize(tree->GetBestSize().GetWidth() * 9 / 8, wxDefaultCoord));
    
    748 748
     #else
    
    749 749
         if ( !pageSet || !m_book->GetCurrentPage() )
    
    750 750
         {
    

  • src/gtk/toplevel.cpp
    ... ... @@ -581,7 +581,7 @@ wxGetFrameExtents(GdkWindow* window, wxTopLevelWindow::DecorSize* decorSize)
    581 581
         if (wx_is_at_least_gtk3(10))
    
    582 582
             scale = gdk_window_get_scale_factor(window);
    
    583 583
     #endif
    
    584
    -    long* p = (long*)data.get();
    
    584
    +    const long* p = (const long*)data.get();
    
    585 585
         decorSize->left   = int(p[0]) / scale;
    
    586 586
         decorSize->right  = int(p[1]) / scale;
    
    587 587
         decorSize->top    = int(p[2]) / scale;
    

  • src/gtk/webview_webkit2.cpp
    ... ... @@ -1021,7 +1021,7 @@ void wxWebViewWebKit::SetWebkitZoom(float level)
    1021 1021
     
    
    1022 1022
     float wxWebViewWebKit::GetWebkitZoom() const
    
    1023 1023
     {
    
    1024
    -    return webkit_web_view_get_zoom_level(m_web_view);
    
    1024
    +    return float(webkit_web_view_get_zoom_level(m_web_view));
    
    1025 1025
     }
    
    1026 1026
     
    
    1027 1027
     void wxWebViewWebKit::EnableAccessToDevTools(bool enable)
    

  • src/qt/dc.cpp
    ... ... @@ -212,7 +212,7 @@ wxSize wxQtDCImpl::GetPPI() const
    212 212
         if (!srn)
    
    213 213
             return wxSize(m_qtPainter->device()->logicalDpiX(), m_qtPainter->device()->logicalDpiY());
    
    214 214
         qreal dotsPerInch = srn->logicalDotsPerInch();
    
    215
    -    return wxSize(round(dotsPerInch), round(dotsPerInch));
    
    215
    +    return wxSize(std::lround(dotsPerInch), std::lround(dotsPerInch));
    
    216 216
     }
    
    217 217
     
    
    218 218
     void wxQtDCImpl::SetFont(const wxFont& font)
    

  • src/qt/graphics.cpp
    ... ... @@ -84,7 +84,7 @@ private:
    84 84
             for ( size_t i = 0; i < stops.GetCount(); ++i )
    
    85 85
             {
    
    86 86
                 const wxGraphicsGradientStop stop = stops.Item(i);
    
    87
    -            qstops.append(QGradientStop(stop.GetPosition(),
    
    87
    +            qstops.append(QGradientStop(double(stop.GetPosition()),
    
    88 88
                                             stop.GetColour().GetQColor()));
    
    89 89
             }
    
    90 90
     
    
    ... ... @@ -1562,12 +1562,14 @@ wxQtGraphicsRenderer::CreateSubBitmap(const wxGraphicsBitmap& bitmap,
    1562 1562
         const int srcHeight = sourcePixmap.height();
    
    1563 1563
         const int dstWidth = wxRound(w);
    
    1564 1564
         const int dstHeight = wxRound(h);
    
    1565
    +    const int dstX = wxRound(x);
    
    1566
    +    const int dstY = wxRound(y);
    
    1565 1567
     
    
    1566
    -    wxCHECK_MSG(x >= 0.0 && y >= 0.0 && dstWidth > 0 && dstHeight > 0 &&
    
    1567
    -            x + dstWidth <= srcWidth && y + dstHeight <= srcHeight,
    
    1568
    +    wxCHECK_MSG(dstX >= 0 && dstY >= 0 && dstWidth > 0 && dstHeight > 0 &&
    
    1569
    +            dstX + dstWidth <= srcWidth && dstY + dstHeight <= srcHeight,
    
    1568 1570
                 wxNullGraphicsBitmap, wxS("Invalid bitmap region"));
    
    1569 1571
     
    
    1570
    -    QPixmap subPixmap = sourcePixmap.copy(x, y, w, h);
    
    1572
    +    QPixmap subPixmap = sourcePixmap.copy(dstX, dstY, dstWidth, dstHeight);
    
    1571 1573
     
    
    1572 1574
         wxGraphicsBitmap bmpRes;
    
    1573 1575
         bmpRes.SetRefData(new wxQtBitmapData(this, subPixmap));
    

  • src/unix/utilsx11.cpp
    ... ... @@ -405,7 +405,7 @@ static bool wxKwinRunning(Display *display, Window rootWnd)
    405 405
         }
    
    406 406
     
    
    407 407
         return (type == KWIN_RUNNING &&
    
    408
    -                   nitems == 1 && data && ((long*)data.get())[0] == 1);
    
    408
    +                   nitems == 1 && data && ((const long*)data.get())[0] == 1);
    
    409 409
     }
    
    410 410
     
    
    411 411
     // KDE's kwin is Qt-centric so much than no normal method of fullscreen
    

Reply all
Reply to author
Forward
0 new messages