> Date: Sun, 13 May 2012 19:37:33 -0700
> From: Paul Eggert
> CC: bug-gnulib@gnu.org, bug-gnu-ut...@gnu.org
>
> Thanks for the diffutils patch. We're a bit better off with something
> even closer to the pre-2006 approach, which took care to convert
> size_t to off_t before negating it, as that i
On 05/12/2012 05:37 PM, Paul Eggert wrote:
> On 05/12/2012 10:41 AM, Bruno Haible wrote:
>> I would suggest to use a function
>>
>>int setmode (int fd, int o_mode);
>
> That would clash with the setmode function defined
> in in FreeBSD etc., which is partly why we
> removed this stuff from di
Thanks for the diffutils patch. We're a bit better off with something
even closer to the pre-2006 approach, which took care to convert
size_t to off_t before negating it, as that is important on hosts where
sizeof (size_t) < sizeof (off_t). Also, it's cleaner to use set_binary_mode
uniformly rath
Paul Eggert wrote:
> With that approach, code like this:
>
>set_binary_mode (current->desc, prev_mode);
>
> yields the following undesirable diagnostic:
>
>io.c:127:8: error: statement with no effect [-Werror=unused-value]
>
> How about something like the following definition instead?
>
On 05/12/2012 07:00 PM, Bruno Haible wrote:
> +# define set_binary_mode(fd, mode) ((void) (fd), (void) (mode), O_BINARY)
With that approach, code like this:
set_binary_mode (current->desc, prev_mode);
yields the following undesirable diagnostic:
io.c:127:8: error: statement with no effect
> From: Bruno Haible
> Cc: bug-gnulib@gnu.org, Eli Zaretskii , bug-gnu-ut...@gnu.org
> Date: Sun, 13 May 2012 04:00:25 +0200
>
> > 'set_binary_mode' would be OK
>
> Good. New proposal attached below.
And here's the patch for Diffutils' io.c to go with the new proposal:
2012-05-13 Eli Zaretski
> From: Bruno Haible
> Cc: bug-gnulib@gnu.org, bug-gnu-ut...@gnu.org
> Date: Sat, 12 May 2012 23:28:12 +0200
>
> > (O_TEXT) [!O_BINARY]: Define if not defined.
>
> Why? You don't need it in the diffutils change.
Yes, I do. See this line:
(void) setmode (current->desc, O_
Paul Eggert wrote:
> > I would suggest to use a function
> >
> >int setmode (int fd, int o_mode);
>
> That would clash with the setmode function defined
> in in FreeBSD etc.
Thanks for the heads-up. Indeed MacOS X, FreeBSD, NetBSD, Minix all have
the same kind of getmode/setmode functions.
On 05/12/2012 10:41 AM, Bruno Haible wrote:
I would suggest to use a function
int setmode (int fd, int o_mode);
That would clash with the setmode function defined
in in FreeBSD etc., which is partly why we
removed this stuff from diffutils.
I agree that it'd be nicer to have a function
wit
Eli Zaretskii wrote:
> * lib/binary-io.h [O_BINARY]: Include io.h on all systems that
> have non-zero O_BINARY.
Not needed, see the other mail.
> (O_TEXT) [!O_BINARY]: Define if not defined.
Why? You don't need it in the diffutils change. Additionally, gnulib's
already d
Eli Zaretskii wrote:
> > > > > -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
> > > > > +# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ ||
> > > > > defined __MINGW32__
> > > > > # include /* declares setmode() */
> > > > > # else
> > > > > # define setmode
> From: Bruno Haible
> Cc: bug-gnulib@gnu.org, bug-gnu-ut...@gnu.org
> Date: Sat, 12 May 2012 21:04:17 +0200
>
> Eli Zaretskii wrote:
> > > I would suggest to use a function
> > >
> > > int setmode (int fd, int o_mode);
> > >
> > > exactly like in Cygwin, so that no code is needed on Cygwin.
> From: Bruno Haible
> Cc: bug-gnulib@gnu.org, bug-gnu-ut...@gnu.org
> Date: Sat, 12 May 2012 20:58:46 +0200
>
> Eli Zaretskii wrote:
> > > Eli Zaretskii wrote:
> > > > -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
> > > > +# if defined __EMX__ || defined __DJGPP__ || defined _
Eli Zaretskii wrote:
> > I would suggest to use a function
> >
> > int setmode (int fd, int o_mode);
> >
> > exactly like in Cygwin, so that no code is needed on Cygwin.
>
> You mean, us it directly, not through a macro?
I meant, through a macro or a function, depending on what's easiest on e
Eli Zaretskii wrote:
> > Eli Zaretskii wrote:
> > > -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
> > > +# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ ||
> > > defined __MINGW32__
> > > # include /* declares setmode() */
> > > # else
> > > # define setmod
> From: Bruno Haible
> Cc: bug-gnu-ut...@gnu.org
> Date: Sat, 12 May 2012 19:47:54 +0200
>
> Eli Zaretskii wrote:
> > -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
> > +# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ || defined
> > __MINGW32__
> > # include
> From: Bruno Haible
> Cc: bug-gnu-ut...@gnu.org
> Date: Sat, 12 May 2012 19:41:39 +0200
>
> But regarding , I am unhappy about another macro UNSET_BINARY.
> If you need
> 1. to reset the value to O_TEXT,
> 2. to get the previous value in return,
> then I would suggest to use a function
>
>
Eli Zaretskii wrote:
> -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
> +# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ || defined
> __MINGW32__
> # include /* declares setmode() */
> # else
> # define setmode _setmode
What is the rationale/benefit for thi
Eli Zaretskii wrote:
> At some point between Diffutils 2.8.7 and 2.9, the code that handles
> binary files was removed from io.c. The changes below resurrect the
> correct behavior. To accomplish this, I needed to add the binary-io
> module, and make changes there as well.
I can't comment on the
> Date: Sat, 12 May 2012 20:05:33 +0300
> From: Eli Zaretskii
>
> 2012-05-12 Eli Zaretskii
>
> * lib/binary-io.h (SET_BINARY) [O_BINARY]: Return the previous mode.
> (UNSET_BINARY): New macro, to reset I/O to text mode.
> (SET_BINARY, UNSET_BINARY): Include _WIN32 in the con
> Date: Sat, 12 May 2012 19:17:01 +0300
> From: Eli Zaretskii
>
> At some point between Diffutils 2.8.7 and 2.9, the code that handles
> binary files was removed from io.c. The changes below resurrect the
> correct behavior. To accomplish this, I needed to add the binary-io
> module, and make c
At some point between Diffutils 2.8.7 and 2.9, the code that handles
binary files was removed from io.c. The changes below resurrect the
correct behavior. To accomplish this, I needed to add the binary-io
module, and make changes there as well. Patches are below.
Thanks.
2012-05-12 Eli Zarets
22 matches
Mail list logo