mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
WINGs: fix non-portable int conversion for printf in font panel size handling
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.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
35068ba2d2
commit
ae9cb306ef
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user