[Freeciv-Dev] strange code in mavpiew.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
can someone probably explain this code from client/mapview.c?
/**************************************************************************
couldn't get the usual XawScrollbarSetThumb to work. tried everything.
someone please tell me why - pu
**************************************************************************/
void my_XawScrollbarSetThumb(Widget w, float top, float shown)
{
Arg arglist[2];
if(sizeof(float)>sizeof(XtArgVal)) {
XtSetArg(arglist[0], XtCTopOfThumb, &top);
XtSetArg(arglist[1], XtNshown, &shown);
}
else {
XtArgVal *l_top=(XtArgVal*)⊤
XtArgVal *l_shown=(XtArgVal*)&shown;
XtSetArg(arglist[0], XtNtopOfThumb, *l_top);
XtSetArg(arglist[1], XtNshown, *l_shown);
}
XtSetValues(w, arglist, 2);
}
I don't know a single system on earth where the first case is true, so
let's look at the second. It effectively passes the value of l_top,
but with the size of XtArgVal. Since on my system XtArgVal is 64 bit
and float 32, the called procedure reads 32 spam bits, so it crashes
sometimes.
Is there any reason not just to take the first version, which is
currently never used?
Falk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] strange code in mavpiew.c,
Falk Hueffner <=
|
|