Ticket #12575 (closed build error: fixed)
C++0x compilation error: narrowing conversions in xbm files.
| Reported by: | jan_van_dijk | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | wxGTK | Version: | 2.9-svn |
| Keywords: | c+0x narrowing conversion, gdk, bitmap | Cc: | |
| Blocked By: | Patch: | yes | |
| Blocking: |
Description
gcc refuses to compile trunk/wxGTK in C++0x mode. The culprit is that in the .xbm files char-arrays are initialised with values >127. This does not fly if char==signed char, e.g:
../src/gtk/bdiag.xbm:6:50: error: narrowing conversion of ‘128’ from ‘int’ to ‘char’ inside { } [-fpermissive]
I admit that the REAL problem is upstream: gdk_bitmap_create_from_data should have expected unsigned char instead of char arguments. This has been noted in 2001, but was apparently never fixed, see for example
http://markmail.org/message/7igyd4n7sw7g6lft
... so this observation is merely of theeoretical interest.
The attached patch reimplements the arrays as unsigned char ones, and uses a reinterpret_cast<const char*> in src/gtk/dcclient.cpp
Yes, this is ugly. If anybody has a better idea, please let me know and I will try to prepare and test an alternative patch. Otherwise, please consider this for inclusion. Thank you in advance.
Regards, Jan van Dijk.

