mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
There may be issues with running applications in 64-bit mode when
they were written with tacit assumptions about 32-bit platforms.
For example,
* Assuming that a pointer can be cast back and forth to an integer
The reason is that the size of the integer and pointer may be different.
See the description of "[PATCH] Warn when casting a pointer (constant)
to an integer of different size." in the gcc mailing list
http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01881.html
where it was also suggested the use of casts to uintptr_t. This is
what this patch does.
As a result the following warnings are fixed, leaving us with an
almost warning-free compilation in 64-bit platforms:
defaults.c:1446: warning: cast to pointer from integer of different size
defaults.c:1457: warning: cast to pointer from integer of different size
defaults.c:1471: warning: cast to pointer from integer of different size
defaults.c:1486: warning: cast to pointer from integer of different size
icon.c:67: warning: cast from pointer to integer of different size
menu.c:112: warning: cast from pointer to integer of different size
switchmenu.c:452: warning: cast from pointer to integer of different size
window.c:140: warning: cast from pointer to integer of different size
window.c:2217: warning: cast to pointer from integer of different size
workspace.c:135: warning: cast to pointer from integer of different size
workspace.c:214: warning: cast to pointer from integer of different size
workspace.c:634: warning: cast to pointer from integer of different size
workspace.c:1330: warning: cast to pointer from integer of different size
workspace.c:1514: warning: cast to pointer from integer of different size
wfilepanel.c:135: warning: cast from pointer to integer of different size
wfilepanel.c:171: warning: cast from pointer to integer of different size
wfontpanel.c:499: warning: cast to pointer from integer of different size
wfontpanel.c:500: warning: cast to pointer from integer of different size
wfontpanel.c:505: warning: cast to pointer from integer of different size
wfontpanel.c:506: warning: cast to pointer from integer of different size
wfontpanel.c:776: warning: cast from pointer to integer of different size
wfontpanel.c:777: warning: cast from pointer to integer of different size
wfontpanel.c:877: warning: cast from pointer to integer of different size
wfontpanel.c:878: warning: cast from pointer to integer of different size
wpanel.c:363: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:90: warning: cast to pointer from integer of different size
puzzle.c:138: warning: cast from pointer to integer of different size
puzzle.c:225: warning: cast to pointer from integer of different size
wtableview.c:1031: warning: cast to pointer from integer of different size
wtableview.c:1067: warning: cast to pointer from integer of different size
wtableview.c:1069: warning: cast to pointer from integer of different size
wtableview.c:1074: warning: cast to pointer from integer of different size
wtabledelegates.c:234: warning: cast from pointer to integer of different size
wtabledelegates.c:250: warning: cast from pointer to integer of different size
wtabledelegates.c:265: warning: cast from pointer to integer of different size
wtabledelegates.c:287: warning: cast to pointer from integer of different size
wtabledelegates.c:351: warning: cast from pointer to integer of different size
wtabledelegates.c:372: warning: cast from pointer to integer of different size
wtabledelegates.c:393: warning: cast from pointer to integer of different size
wtabledelegates.c:410: warning: cast to pointer from integer of different size
test.c:44: warning: cast from pointer to integer of different size
test.c:47: warning: cast to pointer from integer of different size
test.c:55: warning: cast from pointer to integer of different size
test.c:58: warning: cast from pointer to integer of different size
107 lines
2.5 KiB
C
107 lines
2.5 KiB
C
/*
|
|
* WINGs demo: font lister
|
|
*
|
|
* Copyright (c) 1998-2003 Alfredo K. Kojima
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
* USA.
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <WINGs/WINGs.h>
|
|
#include <WINGs/WUtil.h>
|
|
|
|
void
|
|
wAbort()
|
|
{
|
|
exit(0);
|
|
}
|
|
|
|
void show(WMWidget *self, void *data)
|
|
{
|
|
char buf[60];
|
|
void *d;
|
|
WMLabel *l = (WMLabel*)data;
|
|
d = WMGetHangedData(self);
|
|
sprintf(buf, "%i - 0x%x - 0%o", (int)(uintptr_t)d, (int)(uintptr_t)d,
|
|
(int)(uintptr_t)d);
|
|
WMSetLabelText(l, buf);
|
|
}
|
|
|
|
void quit(WMWidget *self, void *data)
|
|
{
|
|
exit(0);
|
|
}
|
|
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
Display *dpy;
|
|
WMWindow *win;
|
|
WMScreen *scr;
|
|
WMButton *lab, *l0=NULL;
|
|
WMLabel *pos;
|
|
int x, y, c;
|
|
char buf[20];
|
|
|
|
WMInitializeApplication("FontView", &argc, argv);
|
|
|
|
dpy = XOpenDisplay("");
|
|
if (!dpy) {
|
|
wfatal("cant open display");
|
|
exit(0);
|
|
}
|
|
|
|
scr = WMCreateSimpleApplicationScreen(dpy);
|
|
|
|
win = WMCreateWindow(scr, "main");
|
|
WMResizeWidget(win, 20*33, 20+20*9);
|
|
WMSetWindowTitle(win, "Font Chars");
|
|
WMSetWindowCloseAction(win, quit, NULL);
|
|
pos = WMCreateLabel(win);
|
|
WMResizeWidget(pos, 20*33, 20);
|
|
WMMoveWidget(pos, 10, 5);
|
|
|
|
c = 0;
|
|
for (y=0; y<8; y++) {
|
|
for (x=0; x<32; x++, c++) {
|
|
lab = WMCreateCustomButton(win, WBBStateLightMask);
|
|
WMResizeWidget(lab, 20, 20);
|
|
WMMoveWidget(lab, 10+x*20, 30+y*20);
|
|
sprintf(buf, "%c", c);
|
|
WMSetButtonText(lab, buf);
|
|
WMSetButtonAction(lab, show, pos);
|
|
WMHangData(lab, (void*)(uintptr_t)c);
|
|
if (c>0) {
|
|
WMGroupButtons(l0, lab);
|
|
} else {
|
|
l0 = lab;
|
|
}
|
|
}
|
|
}
|
|
WMRealizeWidget(win);
|
|
WMMapSubwidgets(win);
|
|
WMMapWidget(win);
|
|
WMScreenMainLoop(scr);
|
|
return 0;
|
|
}
|
|
|