The original code assumed that the (void *) type could be safely converted
to an integer for the printf use, but it is not that simple, as pointed by
gcc when compiling on 32-bits platforms, where pointers do not match
anymore the long (%li) size.

The new code now do the conversions by the rules, so the compiler knows
what is happening and printf always gets the 'int' it expects.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 WINGs/wfontpanel.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/WINGs/wfontpanel.c b/WINGs/wfontpanel.c
index 2d6f77f..019c710 100644
--- a/WINGs/wfontpanel.c
+++ b/WINGs/wfontpanel.c
@@ -699,8 +699,10 @@ static void typefaceClick(WMWidget * w, void *data)
        WMClearList(panel->sizLs);
 
        WM_ITERATE_ARRAY(face->sizes, size, i) {
-               if ((uintptr_t)size != 0) {
-                       sprintf(buffer, "%li", (uintptr_t)size);
+               if (size != NULL) {
+                       int size_int = (int) size;
+
+                       sprintf(buffer, "%i", size_int);
 
                        WMAddListItem(panel->sizLs, buffer);
                }
@@ -798,8 +800,11 @@ static void setFontPanelFontName(FontPanel * panel, const 
char *family, const ch
 
        WM_ITERATE_ARRAY(face->sizes, vsize, i) {
                char buffer[32];
-               if ((uintptr_t)vsize != 0) {
-                       sprintf(buffer, "%li", (uintptr_t)vsize);
+
+               if (vsize != NULL) {
+                       int size_int = (int) vsize;
+
+                       sprintf(buffer, "%i", size_int);
 
                        WMAddListItem(panel->sizLs, buffer);
                }
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to