https://github.com/wxWidgets/wxWidgets/pull/24717
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@vadz commented on this pull request.
Sorry, int
/size_t
confusion is a bit of a mess and we can't really fix it easily, but I think we can do at least slightly better than this patch using the suggestions below.
Please let me know if I'm missing something.
> @@ -1004,7 +1004,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const if ( GetBitmapData()->m_bitmapMask ) { wxMemoryBuffer maskbuf ; - int rowBytes = GetBestBytesPerRow( destwidth * kMaskBytesPerPixel ); + int rowBytes = static_cast<int>(GetBestBytesPerRow( destwidth * kMaskBytesPerPixel ));
It looks like we could avoid the cast by just using
⬇️ Suggested change- int rowBytes = static_cast<int>(GetBestBytesPerRow( destwidth * kMaskBytesPerPixel )); + size_t rowBytes = GetBestBytesPerRow( destwidth * kMaskBytesPerPixel );
instead (here and below).
> @@ -1543,23 +1543,23 @@ void wxMask::Init() void *wxMask::GetRawAccess() const { - wxCHECK_MSG( m_maskBitmap, nullptr , wxT("invalid mask") ) ; + wxCHECK_MSG( m_maskBitmap, nullptr , "invalid mask" ) ; return CGBitmapContextGetData(m_maskBitmap); } int wxMask::GetBytesPerRow() const
This one should be changed to return size_t
, it ends up being passed as size_t
argument to e.g. CGBitmapContextCreate()
, so it doesn't make much sense to cast to int
when we need size_t
anyhow.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@Blake-Madden commented on this pull request.
> @@ -1543,23 +1543,23 @@ void wxMask::Init() void *wxMask::GetRawAccess() const { - wxCHECK_MSG( m_maskBitmap, nullptr , wxT("invalid mask") ) ; + wxCHECK_MSG( m_maskBitmap, nullptr , "invalid mask" ) ; return CGBitmapContextGetData(m_maskBitmap); } int wxMask::GetBytesPerRow() const
I'm OK with just removing the "Add casts to suppress implicit conversion warnings" commit. GetBytesPerRow()
is used in a lot of places where it is assigned to int
and I would rather not change the API and risk even more warnings.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@Blake-Madden pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@Blake-Madden commented on this pull request.
> @@ -1543,23 +1543,23 @@ void wxMask::Init() void *wxMask::GetRawAccess() const { - wxCHECK_MSG( m_maskBitmap, nullptr , wxT("invalid mask") ) ; + wxCHECK_MSG( m_maskBitmap, nullptr , "invalid mask" ) ; return CGBitmapContextGetData(m_maskBitmap); } int wxMask::GetBytesPerRow() const
I reverted the int/size_t stuff. The other changes are innocuous.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.