Re: PATCH: tools/winegcc/utils.c -- casts

2003-11-03 Thread Dimitrie O. Paun
On November 3, 2003 08:01 am, Ferenc Wagner wrote: > This will be a windows application after all... Running on > native Windows. We can not use Unixism, or can we? By the Yes, but it can be a Winelib app as well. Theoretically we should use only stuff that is portable between libc and msvcrt.

Re: PATCH: tools/winegcc/utils.c -- casts

2003-11-03 Thread Ferenc Wagner
"Dimitrie O. Paun" <[EMAIL PROTECTED]> writes: > If we know for sure that size_t is unsigned (is it > always?), than the min() will work just fine. Oh yes, now I get it! It works because -1 is the largest unsigned integer! Amazing... not too transparent, though. > Otherwise, we can rewrite tha

Re: PATCH: tools/winegcc/utils.c -- casts

2003-11-03 Thread Dimitrie O. Paun
On November 3, 2003 06:09 am, Ferenc Wagner wrote: > In libc-2.1 and later, yes it should. According to MSDN > (and pre-2.1 libc docs), it should not. OK, so we need to care about n not being the size of the required buffer. > Seems like this is the case under Windows. Not under any > reasonab

Re: PATCH: tools/winegcc/utils.c -- casts

2003-11-03 Thread Ferenc Wagner
"Dimitrie O. Paun" <[EMAIL PROTECTED]> writes: > On October 30, 2003 07:28 pm, Ferenc Wagner wrote: > >>> -if (n > -1 && n < size) return p; >>> - size = min( size*2, n+1 ); >>> +if (n > -1 && (size_t)n < size) return p; >>> + size = min( size*2, (size_t)n+1 ); >> >> Once a

Re: PATCH: tools/winegcc/utils.c -- casts

2003-11-03 Thread Dimitrie O. Paun
On October 30, 2003 07:28 pm, Ferenc Wagner wrote: > > -if (n > -1 && n < size) return p; > > - size = min( size*2, n+1 ); > > +if (n > -1 && (size_t)n < size) return p; > > + size = min( size*2, (size_t)n+1 ); > > Once at it, could you please explain to me what the hell is

Re: PATCH: tools/winegcc/utils.c -- casts

2003-11-01 Thread Ferenc Wagner
Gerald Pfeifer <[EMAIL PROTECTED]> writes: > Add proper casts to avoid signed vs. unsigned mismatches in strmake(). > -if (n > -1 && n < size) return p; > - size = min( size*2, n+1 ); > +if (n > -1 && (size_t)n < size) return p; > + size = min( size*2, (size_t)n+1 ); Once