Ethereal development <ethereal-dev@xxxxxxxxxxxx> schrieb am 30.06.04 09:22:13:
>
> On Wed, Jun 30, 2004 at 09:12:12AM +0200, Ulf Lamping wrote:
> > ethereal-dev@xxxxxxxxxxxx schrieb am 30.06.04 08:59:28:
> >
> > What do you mean with some platforms? Some windows platforms?
>
> No, some UNIX platforms (perhaps *all* of them).
Complete missunderstanding by me!
I thought, that any platform needs the O_BINARY flag and Win32 platforms doesn't have them defined from one of the header files.
But it's completely the other way round, as Win32 platforms need it at the open call and unix platforms doesn't know of it.
>
> > The MSDN states, that fcntl.h will include O_BINARY.
>
> What MSDN states doesn't govern what UN*X platforms do.
Well, of course not.
>
> > The comment :
> >
> > /* Win32 needs the O_BINARY flag for open() */
> >
> > should be changed to something more appropriate, like:
> >
> > /* Some platforms needs the O_BINARY flag for open() */
>
> No, if it's to be changed at all, it should be changed to something such
> as
>
> /*
> * On Win32, the "open()" call needs to be given the O_BINARY
> * flag, so that data read from the file doesn't have 0x15
> * followed by 0x12 turned into 0x12 and so that 0x12 written
> * to the file doesn't get turned into 0x15 0x12.
> *
> * O_BINARY isn't defined on UN*X, so we have a choice of
> * #ifdefs selecting one of two "open()" calls (or one of two
> * flag argument values in the "open()" call) or defining
> * O_BINARY as 0 on UN*X and using O_BINARY in the call on
> * all platforms.
> *
> * We choose the latter, as it's a bit less messy.
> */
>
So it might be (a bit smaller):
/* Win32 needs the O_BINARY flag for calls to open(),
* but unix platforms don't know and don't define it, so do it here. */
> And lease note that the definition as 0 happens only if O_BINARY isn't
> otherwise defined; as long as it's done after the include of <fcntl.h>,
> that won't be a problem.
>
Now I understand, defining it to 0 must be done for all *none Windows* platforms.
Regards, ULFL
_______________________________________________________
WEB.DE Video-Mail - Sagen Sie mehr mit bewegten Bildern
Informationen unter: http://freemail.web.de/?mc=021199