[MPlayer-dev-eng] ctype.h functions on win32
Rich Felker
dalias at aerifal.cx
Sun Oct 14 17:40:06 CEST 2007
On Sun, Oct 14, 2007 at 05:25:42PM +0200, Gianluigi Tiesi wrote:
> On Sun, Oct 14, 2007 at 01:01:18AM -0400, Rich Felker wrote:
> > > - char *tmp = realloc(*lineptr, 4096);
> > > + unsigned char *tmp = (unsigned char *) realloc(*lineptr, 4096);
> >
> > Never cast return values of malloc/realloc.
> >
>
> uh? I alwaus used to cast them, I was wrong? :)
> anyway removed as your request
It's utterly useless and clutters the code. These functions return
void* for a very good reason.
> > > Index: input/input.c
> > > ===================================================================
> > > --- input/input.c (revision 24775)
> > > +++ input/input.c (working copy)
> > > @@ -1353,7 +1353,7 @@
> > > return key_names[i].name;
> > > }
> > >
> > > - if(isascii(key)) {
> > > + if(isascii((unsigned char) key)) {
> >
> > isascii is not terribly portable to begin with. Just coding the test
> > explicitly would make more sense...
>
>
> leaved input.c as is, it's a bit unclear for me
[...]
> > > - if(isascii(c)) {
> > > + if(isascii((uint8_t) c)) {
> >
> > if (!(c&0x80))
> >
>
> unclear for me, removed the patch
These should be fixed with the code i suggested..
> > > -double ff_eval2(char *s, double *const_value, const char **const_name,
> > > +double ff_eval2(unsigned char *s, double *const_value, const char **const_name,
> >
> > Changing api here is unfriendly to the caller. Better would be to cast
> > the pointer in the implementation of this function if needed.
> >
> > > -attribute_deprecated double ff_eval(char *s, double *const_value, const char **const_name,
> > > +attribute_deprecated double ff_eval(unsigned char *s, double *const_value, const char **const_name,
> >
> > Ditto.
> >
> > > -int av_get_frame_filename(char *buf, int buf_size,
> > > +int av_get_frame_filename(unsigned char *buf, int buf_size,
>
> you are right, I've removed the patch, added a cast
>
> I'm attaching the revised patches
OK, I'll read them later.
Rich
More information about the MPlayer-dev-eng
mailing list