| www.delorie.com/archives/browse.cgi | search |
| Date: | Sun, 14 Oct 2001 18:32:33 +0200 |
| From: | "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> |
| Sender: | halo1 AT zahav DOT net DOT il |
| To: | Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk> |
| Message-Id: | <9003-Sun14Oct2001183232+0200-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: | <3BC94DFF.69F35BA0@phekda.freeserve.co.uk> (message from Richard |
| Dawe on Sun, 14 Oct 2001 09:34:07 +0100) | |
| Subject: | Re: fgetpos doesn't check ftell's return code |
| References: | <3BC94DFF DOT 69F35BA0 AT phekda DOT freeserve DOT co DOT uk> |
| 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 |
> Date: Sun, 14 Oct 2001 09:34:07 +0100
> From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
>
> fgetpos doesn't check the return code from ftell. Below is a patch that
> fixes this.
Thanks. However, the code you wrote is a bit unclean: it assumes that
fpos_t is an integral scalar data type:
> + int ret;
> +
> if (stream && pos)
> {
> ! ret = (fpos_t)ftell(stream);
> ! if (ret != -1)
Please modify it so that this knowledge is limited to the single line
which was already in the old version. For example:
long ret;
if (stream && pos)
{
ret = ftell(stream);
if (ret != -1L)
{
*pos = (fpos_t)ret;
return 0;
...
With this (or similar) change, it's okay to commit.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |