Bug#645409: Error in patch 010_wx26_trans.patch

Olly Betts olly at survex.com
Sat Oct 15 14:45:43 UTC 2011

Package: jugglemaster
Version: 0.4-5

I noticed an error in 010_wx26_trans.patch (thanks to a compiler warning which
I noticed while checking if the package build with wxwidgets2.8):

@@ -208,25 +208,25 @@

 void JMFrame::setSiteSwap(wxString *newsite) {
-  jmlib->setPattern("Something",(JML_CHAR *)(const char *)*newsite,HR_DEF, DR_DEF);
+  jmlib->setPattern("Something",(JML_CHAR *)(const char *)*newsite->mb_str(wxConvUTF8),HR_DEF, DR_DEF);

 void JMFrame::setStyle(wxString *newstyle) {
-  jmlib->setStyle((JML_CHAR *)(const char *)*newstyle);
+  jmlib->setStyle((JML_CHAR *)(const char *)*newstyle->mb_str(wxConvUTF8));

 void JMFrame::changeSiteSwap(wxCommandEvent& WXUNUSED(event))

The two cases are the same, but looking at the second as there aren't other
parameters so it's clearer:

Before the change, this dereferences the wxString * to give a wxString, which
is then cast to const char * and then to JML_CHAR *

After the change, newstyle->mb_str(wxConvUTF8) returns a pointer to a UTF8
C string, which is then dereferenced to give its first byte, and that byte
value is then cast to a pointer.  That's clearly bogus - the * before
newstyle should be removed.  Then we would cast the UTF-8 C string to const
char * and JML_CHAR * much like before.

I've attached a corrected version of this patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 010_wx26_trans.patch
Type: text/x-diff
Size: 32632 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20111016/05f3b927/attachment-0001.patch>

More information about the Pkg-games-devel mailing list