Complete.Org: Mailing Lists: Archives: freeciv-dev: May 1999:
Re: [Freeciv-Dev] Unaligned access with Xaw client
Home

Re: [Freeciv-Dev] Unaligned access with Xaw client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: pebl@xxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] Unaligned access with Xaw client
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Tue, 11 May 1999 11:37:18 +1000 (EST)

Peter Berg Larsen <pebl@xxxxxxxxxx> wrote:

> Every time I use or press the scrollbar I get a unaligned access
> warning. I have traced it to the my_XawScrollbarSetThumb function.

> GDB 4.16 (alpha-dec-osf4.0), Copyright 1996 Free Software Foundation, Inc...
            ^^^^^
I guess that the following previous email may be relevant,
though I'm not sure if its solution is correct or not.
(Hmm, I couldn't find this email in the complete.org archives...)

-- David

------- Start of forwarded message -------
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] strange code in mavpiew.c
Mime-Version: 1.0
From: Falk Hueffner <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: 09 Feb 1999 14:49:00 +0100
In-Reply-To: schaefer@xxxxxxxxxxxxxxxxxxxxxxxxxxx's message of "Fri, 5 Feb 1999 
18:46:44 +0100"
Lines: 36
User-Agent: Gnus/5.070059 (Pterodactyl Gnus v0.59) XEmacs/21.2(beta3) (Aglaia)
X-Loop: freeciv-dev@xxxxxxxxxxx
Precedence: bulk
Content-Type: text
Content-Length: 1148

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*)&top;
    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
------- End of forwarded message -------

[Prev in Thread] Current Thread [Next in Thread]