[PATCH] Stop using enum for integer constants in image sample
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 30 Mar 2023 19:18:02 +0000 (21:18 +0200)
committerScott Talbert <swt@techie.net>
Wed, 2 Sep 2026 16:48:31 +0000 (12:48 -0400)
This always wasn't the best and started to result in CI failures now as
recent versions of gcc (e.g. 11.3 in Ubuntu 2.2.04) started giving
-Wdeprecated-enum-float-conversion when using REAL_SIZE in the
expressions.

Gbp-Pq: Name 13ebaee247781b7cde1c830b36145aec9ab91127.patch

samples/image/image.cpp

index eb65cd2ffc199ebe96bbfd0460021e87db54cbcf..a0b638bad145e545ba3360123620040306983038 100644 (file)
@@ -613,12 +613,9 @@ private:
 class MyRawBitmapFrame : public wxFrame
 {
 public:
-    enum
-    {
-        BORDER = 15,
-        SIZE = 150,
-        REAL_SIZE = SIZE - 2*BORDER
-    };
+    static const int BORDER = 15;
+    static const int SIZE = 150;
+    static const int REAL_SIZE = SIZE - 2*BORDER;
 
     MyRawBitmapFrame(wxFrame *parent)
         : wxFrame(parent, wxID_ANY, "Raw bitmaps (how exciting)"),