delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/20/03:37:32

Date: Wed, 20 Jun 2001 10:22:15 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <3028-Wed20Jun2001102214+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp-workers AT delorie DOT com
In-reply-to: <200106192111.XAA18883@father.ludd.luth.se> (message from Martin
Str|mberg on Tue, 19 Jun 2001 23:11:45 +0200 (MET DST))
Subject: Re: More signed/unsigned issues
References: <200106192111 DOT XAA18883 AT father DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
> Date: Tue, 19 Jun 2001 23:11:45 +0200 (MET DST)
> 
> Some more corrections.

Thanks.

>        while (s > 0) {
> -       if (--f->_cnt > -f->_bufsiz && *(const char *)ptr != '\n')
> +       if (--f->_cnt > -(long signed int)f->_bufsiz && *(const char *)ptr != 'n')
>           *f->_ptr++ = *(const char *)ptr++;

Isn't it better to introduce a new `long signed int' variable, assign
to it the value of f->_bufsiz, and then use that new variable instead
of f->_bufsiz?  Let the optimizer do the dirty work ;-)

> --- src/libc/compat/ioctl/ioctl.c       1998/06/28 17:25:20     1.2
> +++ src/libc/compat/ioctl/ioctl.c       2001/06/19 21:06:40
> @@ -157,7 +157,7 @@ static int _dos_ioctl(int fd, int cmd, i
>      ** I _do_ like clear APIs.
>      */
>      if(cmd & DOS_XFER){
> -        if(argcx <= __tb_size){ /* Can we use transfer buffer ? */
> +        if(argcx <= (int)__tb_size){ /* Can we use transfer buffer ? */
>              dosmemput((void *)argdx,argcx, __tb);
>              r.x.ds = (__tb>>4) &0xffff;
>              r.x.dx = __tb &0xf;
> @@ -183,7 +183,7 @@ static int _dos_ioctl(int fd, int cmd, i
>      ** parameter after all the registers and the buffer pointer.
>      */
>      if( cmd & DOS_BRAINDEAD  ){
> -        if(xarg <= __tb_size){ /* Can we use transfer buffer ? */
> +        if(xarg <= (int)__tb_size){ /* Can we use transfer buffer ? */
>              dosmemput((void *)argdx,xarg, __tb);
>              r.x.ds = (__tb>>4) &0xffff;
>              r.x.dx = __tb &0xf;

This looks fine to me.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019