Fix iOS warnings (PR #24717)

13 views
Skip to first unread message

Blake-Madden

unread,
Jul 22, 2024, 6:43:04 AM (5 days ago) Jul 22
to wx-...@googlegroups.com, Subscribed

You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/24717

Commit Summary

  • 5c00a4d Add override to functions
  • 91db2e9 Add casts to suppress implicit conversion warnings
  • 3ab75d6 Remove wxT() macros

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/24717@github.com>

VZ

unread,
Jul 22, 2024, 7:52:53 AM (5 days ago) Jul 22
to wx-...@googlegroups.com, Subscribed

@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.


In src/osx/core/bitmap.cpp:

> @@ -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).


In src/osx/core/bitmap.cpp:

> @@ -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.Message ID: <wxWidgets/wxWidgets/pull/24717/review/2191363507@github.com>

Blake-Madden

unread,
Jul 22, 2024, 8:38:25 AM (5 days ago) Jul 22
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/osx/core/bitmap.cpp:

> @@ -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.Message ID: <wxWidgets/wxWidgets/pull/24717/review/2191457789@github.com>

Blake-Madden

unread,
Jul 22, 2024, 12:46:52 PM (5 days ago) Jul 22
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 1 commit.

  • 3c8de52 Revert "Add casts to suppress implicit conversion warnings"


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/24717/before/3ab75d643841d592a4d4a4948b6721fee5b15e34/after/3c8de5244391efd242a343342fd747c6a5332f5d@github.com>

Blake-Madden

unread,
Jul 22, 2024, 12:47:46 PM (5 days ago) Jul 22
to wx-...@googlegroups.com, Subscribed

@Blake-Madden commented on this pull request.


In src/osx/core/bitmap.cpp:

> @@ -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.Message ID: <wxWidgets/wxWidgets/pull/24717/review/2192069480@github.com>

Reply all
Reply to author
Forward
0 new messages