#41 firework demo color code was goofy

closed-fixed
None
5
2005-12-31
2005-06-26
elsapo
No

2.6 version

Warnings compiling under MSVC6

pdcurs26\demos\firework.c(125) : warning C4761:
integral size mismatch in argument; conversion supplied

Same on lines 100, 107, 116, 125, 134, 149

MSVC6

Discussion

  • elsapo

    elsapo - 2005-06-26

    Logged In: YES
    user_id=1195173

    This can be fixed by changing get_colour to return a short,
    and adding a declaration for it at the top of the firework.c
    file (I just tested this).

     
  • elsapo

    elsapo - 2005-06-26

    Logged In: YES
    user_id=1195173

    There have been some changes between 2.6 and the cvs
    version, I've discovered, and In the cvs code, get_colour
    returns a chtype, but I still get this warning; I'm still
    investigating.

     
  • elsapo

    elsapo - 2005-06-26

    Logged In: YES
    user_id=1195173

    The problem in cvs is that get_colour returns chtype, but
    the curses.h declaration for what init_pair takes gives short:

    int PDC_CDECL init_pair Args(( short, short, short ));

    Also, curses.h has this
    #define CHTYPE_LONG 1 /* size of chtype; long */

    which causes chtype to be typedef'd to unsigned long.

    So, which should it be -- are colours supposed to be shorts
    (as in init_pair), or longs (as in chtype) ?

     
  • elsapo

    elsapo - 2005-06-26
    • summary: Warnings compiling under MSVC6 --> Warnings compiling under MSVC6 (both cvs & 2.6)
     
  • elsapo

    elsapo - 2005-06-26
    • summary: Warnings compiling under MSVC6 (both cvs & 2.6) --> (cvs & 2.6) init_pair (short) disagrees with chtype (long)
     
  • elsapo

    elsapo - 2005-06-26

    Logged In: YES
    user_id=1195173

    Changing bug summary as this is a conflict between init_pair
    and chtype

     
  • William McBrine

    William McBrine - 2005-11-21
    • assigned_to: nobody --> wmcbrine
     
  • William McBrine

    William McBrine - 2005-11-21

    Logged In: YES
    user_id=27933

    A short is correct. But you can't change get_colour() to
    return that, because it's also trying to apply A_BOLD, a
    chtype attribute, to its return value (randomly). Of course
    this is all wrong; COLOR_whatever and A_BOLD should never
    meet. The correct procedure is to init a COLOR_PAIR with two
    colors, and OR the value of _that_ (if desired) with A_BOLD.
    The value of a color pair is properly stored in a chtype.

    I'll try to make this more sensible. Thanks for pointing it out.

    The demos are very old, and their quality is uneven. AFAICT
    (with no credits), firework.c predates PDCurses. There's a
    different version in the ncurses package. Both have been
    revised over the years, but this one is still wrong.

    When in doubt, refer to the library itself, as well as to
    the published standards.

     
  • elsapo

    elsapo - 2005-11-21

    Logged In: YES
    user_id=1195173

    (The name firework.c sounds familiar -- maybe it is an
    ncurses demo program.)

     
  • William McBrine

    William McBrine - 2005-11-21

    Logged In: YES
    user_id=27933

    OK, I've checked in a fixed version.

     
  • William McBrine

    William McBrine - 2005-11-21
    • status: open --> pending-fixed
     
  • William McBrine

    William McBrine - 2005-12-09
    • summary: (cvs & 2.6) init_pair (short) disagrees with chtype (long) --> firework demo color code was goofy
     
  • William McBrine

    William McBrine - 2005-12-31
    • status: pending-fixed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks