xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] Update: menu item return value


From: Jens Thoms Toerring
Subject: Re: [XForms] Update: menu item return value
Date: Wed, 12 Mar 2014 20:17:38 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Lothar,

On Wed, Mar 12, 2014 at 11:39:25AM -0400, address@hidden wrote:
>    I am able to 'fix' this by replacing in menu.c line ~826 with
> 
> return ( (int) sp->mval[sp->val] );
> 
> (Instead of return ( val_to_index (ob, sp->val));
> 
> However, I don't know whether this breaks anything else.

This looks pretty good to me, thank you! Obviously nobody has
used menus with other than the default values for the last
few years...

> I also noticed that there are functions like isdigit or isspace
> which expect (int) as argument but the typecasting is to (char).
> This may be okay as the compiler figures this out probably....

The cast should actually be to 'unsigned char' (if you find any
places where it's a cast to 'char' please let me know). Background
is that, according to the standard (see section 4.3 in ANSI C89)
these functions expect either an unsigned char or EOF, for all
other argument values the behaviour is undefined. Thus, at least
for systems where 'char' is signed, one needs to cast the argu-
ment of these functions to 'unsigned char' to avoid any chance of
passing an unsuitable value to them.

> Also, a minor issue is that in forms.h there are a number of enumerations
> that have a , following the last argument. My compiler complains about this

I hope I managed to remove all of them - at least according to
C89 a trailing comma isn't allowed (C99 allows it and probably
no compiler in use will get thrown off, but it's better to be
safe). Strange that none of the compilers and static code checkers
I've used ever complained about it.

> and about functions that 'are' not prototypes. Putting (void) into
> the prototype which was declared as (  ) fixed the problem(s).

I've found a single function (fl_unset_clipping) which unfortu-
nately was declared without 'void' as the argument and, of course,
fixed that. Since you're writing about "functions" have you found
any more?

I'll upload a development release (1.3.1) in a short time for
you and others to test and if there are no complaints, move it
into the main line soon. Is that ok with you?

             Thank you very much and best regards, Jens
-- 
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de



reply via email to

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