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
Logged In: YES
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).
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
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) ?
Changing bug summary as this is a conflict between init_pair
Logged In: YES
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.
(The name firework.c sounds familiar -- maybe it is an
ncurses demo program.)
OK, I've checked in a fixed version.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.