From 8898072da1100b6c622d9413762b25392f17c93cf31fefe272bb74273cdb081f Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 30 Sep 2020 21:01:05 +0000 Subject: [PATCH] Accepting request 838832 from home:StefanBruens:branches:X11:wxWidgets - Fix wxPython compatibility issue: Add 0001-Don-t-use-wxASCII_STR-inside-wxART_MAKE_XXX_ID-macro.patch Add 0002-Fix-documented-type-of-wxART_XXX-constants.patch OBS-URL: https://build.opensuse.org/request/show/838832 OBS-URL: https://build.opensuse.org/package/show/X11:wxWidgets/wxWidgets-3_2?expand=0&rev=72 --- ...I_STR-inside-wxART_MAKE_XXX_ID-macro.patch | 179 +++++++++++++++++ ...cumented-type-of-wxART_XXX-constants.patch | 184 ++++++++++++++++++ _service | 4 +- wxWidgets-3_2.changes | 7 + wxWidgets-3_2.spec | 4 + 5 files changed, 376 insertions(+), 2 deletions(-) create mode 100644 0001-Don-t-use-wxASCII_STR-inside-wxART_MAKE_XXX_ID-macro.patch create mode 100644 0002-Fix-documented-type-of-wxART_XXX-constants.patch diff --git a/0001-Don-t-use-wxASCII_STR-inside-wxART_MAKE_XXX_ID-macro.patch b/0001-Don-t-use-wxASCII_STR-inside-wxART_MAKE_XXX_ID-macro.patch new file mode 100644 index 0000000..2c3847d --- /dev/null +++ b/0001-Don-t-use-wxASCII_STR-inside-wxART_MAKE_XXX_ID-macro.patch @@ -0,0 +1,179 @@ +From 93860ce690d7a8d9f9a4d900aa45fdd4839d01b5 Mon Sep 17 00:00:00 2001 +From: Vadim Zeitlin +Date: Sun, 23 Aug 2020 02:44:25 +0200 +Subject: [PATCH 1/2] Don't use wxASCII_STR() inside wxART_MAKE_XXX_ID macros + +This changed the type of the art and client ID values, which broke +compatibility with existing code, notably in wxPython (see +https://github.com/wxWidgets/wxWidgets/pull/1996), and the attempts to +fix this compatibility broke it with all the existing code using +wxART_MAKE_ART_ID() or wxART_MAKE_CLIENT_ID() for their own IDs. + +Keep things simple and just define the macros as they were defined +before 4552009805 (Merge branch 'pr1312-no-unsafe-wxstring-conv', +2020-07-20), except for wxART_MAKE_CLIENT_ID_FROM_STR() whose argument +and produced value was already of wxString type, and use wxASCII_STR() +at the place of use of wxART_XXX constants in wx code. + +This is obviously not ideal as it will require using wxASCII_STR() in +the application code as well, but seems to be the least evil. +--- + include/wx/artprov.h | 12 ++++++------ + include/wx/xrc/xmlres.h | 10 +++++----- + include/wx/xrc/xmlreshandler.h | 20 ++++++++++---------- + 3 files changed, 21 insertions(+), 21 deletions(-) + +diff --git a/include/wx/artprov.h b/include/wx/artprov.h +index b54597659b..6dd2850a82 100644 +--- a/include/wx/artprov.h ++++ b/include/wx/artprov.h +@@ -28,9 +28,9 @@ typedef wxString wxArtClient; + typedef wxString wxArtID; + + #define wxART_MAKE_CLIENT_ID_FROM_STR(id) ((id) + wxASCII_STR("_C")) +-#define wxART_MAKE_CLIENT_ID(id) wxASCII_STR(#id "_C") ++#define wxART_MAKE_CLIENT_ID(id) (#id "_C") + #define wxART_MAKE_ART_ID_FROM_STR(id) (id) +-#define wxART_MAKE_ART_ID(id) wxASCII_STR(#id) ++#define wxART_MAKE_ART_ID(id) (#id) + + // ---------------------------------------------------------------------------- + // Art clients +@@ -154,13 +154,13 @@ public: + // Query the providers for bitmap with given ID and return it. Return + // wxNullBitmap if no provider provides it. + static wxBitmap GetBitmap(const wxArtID& id, +- const wxArtClient& client = wxART_OTHER, ++ const wxArtClient& client = wxASCII_STR(wxART_OTHER), + const wxSize& size = wxDefaultSize); + + // Query the providers for icon with given ID and return it. Return + // wxNullIcon if no provider provides it. + static wxIcon GetIcon(const wxArtID& id, +- const wxArtClient& client = wxART_OTHER, ++ const wxArtClient& client = wxASCII_STR(wxART_OTHER), + const wxSize& size = wxDefaultSize); + + // Helper used by GetMessageBoxIcon(): return the art id corresponding to +@@ -173,13 +173,13 @@ public: + // can be set) + static wxIcon GetMessageBoxIcon(int flags) + { +- return GetIcon(GetMessageBoxIconId(flags), wxART_MESSAGE_BOX); ++ return GetIcon(GetMessageBoxIconId(flags), wxASCII_STR(wxART_MESSAGE_BOX)); + } + + // Query the providers for iconbundle with given ID and return it. Return + // wxNullIconBundle if no provider provides it. + static wxIconBundle GetIconBundle(const wxArtID& id, +- const wxArtClient& client = wxART_OTHER); ++ const wxArtClient& client = wxASCII_STR(wxART_OTHER)); + + // Gets native size for given 'client' or wxDefaultSize if it doesn't + // have native equivalent +diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h +index 8b4710b676..6507afe6d9 100644 +--- a/include/wx/xrc/xmlres.h ++++ b/include/wx/xrc/xmlres.h +@@ -565,27 +565,27 @@ public: + + // Gets a bitmap. + wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets a bitmap from an XmlNode. + wxBitmap GetBitmap(const wxXmlNode* node, +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets an icon. + wxIcon GetIcon(const wxString& param = wxT("icon"), +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets an icon from an XmlNode. + wxIcon GetIcon(const wxXmlNode* node, +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) wxOVERRIDE; + + // Gets an icon bundle. + wxIconBundle GetIconBundle(const wxString& param, +- const wxArtClient& defaultArtClient = wxART_OTHER) wxOVERRIDE; ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER)) wxOVERRIDE; + + // Gets an image list. + wxImageList *GetImageList(const wxString& param = wxT("imagelist")) wxOVERRIDE; +diff --git a/include/wx/xrc/xmlreshandler.h b/include/wx/xrc/xmlreshandler.h +index b478356d6d..7f132b99a9 100644 +--- a/include/wx/xrc/xmlreshandler.h ++++ b/include/wx/xrc/xmlreshandler.h +@@ -85,19 +85,19 @@ public: + virtual wxSize GetPairInts(const wxString& param) = 0; + virtual wxDirection GetDirection(const wxString& param, wxDirection dir = wxLEFT) = 0; + virtual wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxBitmap GetBitmap(const wxXmlNode* node, +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxIcon GetIcon(const wxString& param = wxT("icon"), +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxIcon GetIcon(const wxXmlNode* node, +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) = 0; + virtual wxIconBundle GetIconBundle(const wxString& param, +- const wxArtClient& defaultArtClient = wxART_OTHER) = 0; ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER)) = 0; + virtual wxImageList *GetImageList(const wxString& param = wxT("imagelist")) = 0; + + #if wxUSE_ANIMATIONCTRL +@@ -321,31 +321,31 @@ protected: + return GetImpl()->GetDirection(param, dir); + } + wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetBitmap(param, defaultArtClient, size); + } + wxBitmap GetBitmap(const wxXmlNode* node, +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetBitmap(node, defaultArtClient, size); + } + wxIcon GetIcon(const wxString& param = wxT("icon"), +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetIcon(param, defaultArtClient, size); + } + wxIcon GetIcon(const wxXmlNode* node, +- const wxArtClient& defaultArtClient = wxART_OTHER, ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER), + wxSize size = wxDefaultSize) + { + return GetImpl()->GetIcon(node, defaultArtClient, size); + } + wxIconBundle GetIconBundle(const wxString& param, +- const wxArtClient& defaultArtClient = wxART_OTHER) ++ const wxArtClient& defaultArtClient = wxASCII_STR(wxART_OTHER)) + { + return GetImpl()->GetIconBundle(param, defaultArtClient); + } +-- +2.28.0 + diff --git a/0002-Fix-documented-type-of-wxART_XXX-constants.patch b/0002-Fix-documented-type-of-wxART_XXX-constants.patch new file mode 100644 index 0000000..76c669b --- /dev/null +++ b/0002-Fix-documented-type-of-wxART_XXX-constants.patch @@ -0,0 +1,184 @@ +From 74b7f31ebab4a35e9b80dccca6f6688a27361d07 Mon Sep 17 00:00:00 2001 +From: Vadim Zeitlin +Date: Tue, 25 Aug 2020 16:49:24 +0200 +Subject: [PATCH 2/2] Fix documented type of wxART_XXX constants + +They're (now, and had always been before the recent changes) string +literals, i.e. of type "const char *", rather than "wxString". +--- + interface/wx/artprov.h | 152 +++++++++++++++++++++-------------------- + 1 file changed, 78 insertions(+), 74 deletions(-) + +diff --git a/interface/wx/artprov.h b/interface/wx/artprov.h +index e8c848452f..8f34231527 100644 +--- a/interface/wx/artprov.h ++++ b/interface/wx/artprov.h +@@ -16,80 +16,80 @@ typedef wxString wxArtClient; + typedef wxString wxArtID; + + +-wxArtClient wxART_TOOLBAR; +-wxArtClient wxART_MENU; +-wxArtClient wxART_FRAME_ICON; +- +-wxArtClient wxART_CMN_DIALOG; +-wxArtClient wxART_HELP_BROWSER; +-wxArtClient wxART_MESSAGE_BOX; +-wxArtClient wxART_BUTTON; +-wxArtClient wxART_LIST; +- +-wxArtClient wxART_OTHER; +- +- +-wxArtID wxART_ADD_BOOKMARK; +-wxArtID wxART_DEL_BOOKMARK; +-wxArtID wxART_HELP_SIDE_PANEL; +-wxArtID wxART_HELP_SETTINGS; +-wxArtID wxART_HELP_BOOK; +-wxArtID wxART_HELP_FOLDER; +-wxArtID wxART_HELP_PAGE; +-wxArtID wxART_GO_BACK; +-wxArtID wxART_GO_FORWARD; +-wxArtID wxART_GO_UP; +-wxArtID wxART_GO_DOWN; +-wxArtID wxART_GO_TO_PARENT; +-wxArtID wxART_GO_HOME; +-wxArtID wxART_GOTO_FIRST; +-wxArtID wxART_GOTO_LAST; +-wxArtID wxART_FILE_OPEN; +-wxArtID wxART_FILE_SAVE; +-wxArtID wxART_FILE_SAVE_AS; +-wxArtID wxART_PRINT; +-wxArtID wxART_HELP; +-wxArtID wxART_TIP; +-wxArtID wxART_REPORT_VIEW; +-wxArtID wxART_LIST_VIEW; +-wxArtID wxART_NEW_DIR; +-wxArtID wxART_HARDDISK; +-wxArtID wxART_FLOPPY; +-wxArtID wxART_CDROM; +-wxArtID wxART_REMOVABLE; +-wxArtID wxART_FOLDER; +-wxArtID wxART_FOLDER_OPEN; +-wxArtID wxART_GO_DIR_UP; +-wxArtID wxART_EXECUTABLE_FILE; +-wxArtID wxART_NORMAL_FILE; +-wxArtID wxART_TICK_MARK; +-wxArtID wxART_CROSS_MARK; +-wxArtID wxART_ERROR; +-wxArtID wxART_QUESTION; +-wxArtID wxART_WARNING; +-wxArtID wxART_INFORMATION; +-wxArtID wxART_MISSING_IMAGE; +- +-wxArtID wxART_COPY; +-wxArtID wxART_CUT; +-wxArtID wxART_PASTE; +-wxArtID wxART_DELETE; +-wxArtID wxART_NEW; +- +-wxArtID wxART_UNDO; +-wxArtID wxART_REDO; +- +-wxArtID wxART_PLUS; +-wxArtID wxART_MINUS; +- +-wxArtID wxART_CLOSE; +-wxArtID wxART_QUIT; +- +-wxArtID wxART_FIND; +-wxArtID wxART_FIND_AND_REPLACE; +- +-wxArtID wxART_FULL_SCREEN; +-wxArtID wxART_EDIT; ++const char* wxART_TOOLBAR; ++const char* wxART_MENU; ++const char* wxART_FRAME_ICON; ++ ++const char* wxART_CMN_DIALOG; ++const char* wxART_HELP_BROWSER; ++const char* wxART_MESSAGE_BOX; ++const char* wxART_BUTTON; ++const char* wxART_LIST; ++ ++const char* wxART_OTHER; ++ ++ ++const char* wxART_ADD_BOOKMARK; ++const char* wxART_DEL_BOOKMARK; ++const char* wxART_HELP_SIDE_PANEL; ++const char* wxART_HELP_SETTINGS; ++const char* wxART_HELP_BOOK; ++const char* wxART_HELP_FOLDER; ++const char* wxART_HELP_PAGE; ++const char* wxART_GO_BACK; ++const char* wxART_GO_FORWARD; ++const char* wxART_GO_UP; ++const char* wxART_GO_DOWN; ++const char* wxART_GO_TO_PARENT; ++const char* wxART_GO_HOME; ++const char* wxART_GOTO_FIRST; ++const char* wxART_GOTO_LAST; ++const char* wxART_FILE_OPEN; ++const char* wxART_FILE_SAVE; ++const char* wxART_FILE_SAVE_AS; ++const char* wxART_PRINT; ++const char* wxART_HELP; ++const char* wxART_TIP; ++const char* wxART_REPORT_VIEW; ++const char* wxART_LIST_VIEW; ++const char* wxART_NEW_DIR; ++const char* wxART_HARDDISK; ++const char* wxART_FLOPPY; ++const char* wxART_CDROM; ++const char* wxART_REMOVABLE; ++const char* wxART_FOLDER; ++const char* wxART_FOLDER_OPEN; ++const char* wxART_GO_DIR_UP; ++const char* wxART_EXECUTABLE_FILE; ++const char* wxART_NORMAL_FILE; ++const char* wxART_TICK_MARK; ++const char* wxART_CROSS_MARK; ++const char* wxART_ERROR; ++const char* wxART_QUESTION; ++const char* wxART_WARNING; ++const char* wxART_INFORMATION; ++const char* wxART_MISSING_IMAGE; ++ ++const char* wxART_COPY; ++const char* wxART_CUT; ++const char* wxART_PASTE; ++const char* wxART_DELETE; ++const char* wxART_NEW; ++ ++const char* wxART_UNDO; ++const char* wxART_REDO; ++ ++const char* wxART_PLUS; ++const char* wxART_MINUS; ++ ++const char* wxART_CLOSE; ++const char* wxART_QUIT; ++ ++const char* wxART_FIND; ++const char* wxART_FIND_AND_REPLACE; ++ ++const char* wxART_FULL_SCREEN; ++const char* wxART_EDIT; + + + /** +@@ -200,6 +200,10 @@ wxArtID wxART_EDIT; + + + ++ @note When building with @c wxNO_IMPLICIT_WXSTRING_ENCODING defined (see ++ @ref overview_string for more details), you need to explicitly use ++ wxASCII_STR() around these constants. ++ + Additionally, any string recognized by custom art providers registered using + wxArtProvider::Push may be used. + +-- +2.28.0 + diff --git a/_service b/_service index 3e84a09..8b8771f 100644 --- a/_service +++ b/_service @@ -3,8 +3,8 @@ git git://github.com/wxWidgets/wxWidgets 6cc1d63d68f746cf9e48b75edd119a4cb4309f25 - v3.1.2 - 3.1.3~g@TAG_OFFSET@ + v3.1.4 + 3.1.5~g@TAG_OFFSET@ v(.*) diff --git a/wxWidgets-3_2.changes b/wxWidgets-3_2.changes index f62ffc1..c40135c 100644 --- a/wxWidgets-3_2.changes +++ b/wxWidgets-3_2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Sep 30 17:39:01 UTC 2020 - Stefan Brüns + +- Fix wxPython compatibility issue: + Add 0001-Don-t-use-wxASCII_STR-inside-wxART_MAKE_XXX_ID-macro.patch + Add 0002-Fix-documented-type-of-wxART_XXX-constants.patch + ------------------------------------------------------------------- Wed Aug 19 18:01:10 UTC 2020 - Stefan Brüns diff --git a/wxWidgets-3_2.spec b/wxWidgets-3_2.spec index 5e51071..149239d 100644 --- a/wxWidgets-3_2.spec +++ b/wxWidgets-3_2.spec @@ -87,6 +87,10 @@ Source5: wxWidgets-3_2-rpmlintrc # identify and backport wxPython fixes to wxWidgets. Source6: wxpython-mkdiff.sh Patch1: soversion.diff +# PATCH-FIX-UPSTREAM +Patch2: 0001-Don-t-use-wxASCII_STR-inside-wxART_MAKE_XXX_ID-macro.patch +# PATCH-FIX-UPSTREAM +Patch3: 0002-Fix-documented-type-of-wxART_XXX-constants.patch BuildRequires: autoconf BuildRequires: cppunit-devel BuildRequires: gcc-c++