On 8/1/2010 01:03, Antonio Diaz Diaz wrote:
Setting to stdin and stdout implicitly to binary mode at the beginning
of main solved the problems. Something like:
int main( const int argc, const char * const argv )
+ setmode(STDIN_FILENO, O_BINARY);
+ setmode(STDOUT_FILENO, O_BINARY);
Thanks. I have already uploaded rc3. I'll announce it tomorrow.
setmode looks to be available with OS/2 as well, but its unrelated to
Is there some "setmode" function common to Windows and OS/2? OS/2 seems
to use this:
+ _fsetmode( stdin, "b");
+ _fsetmode( stdout, "b");
Sorry, no _fsetmode on win32. I can't seem to find OS/2 docs anywhere,
but some ffmpeg discussion mentions setmode being available to OS/2 as
Elbert, care to comment?
I would consider adding a conditional for binary mode stdin/stdout, but
not litter the code with a conditional per system. Text mode is a
bug, not a feature.
"Actually there's no really good reason to do text mode processing since
it only slows down reading and writing files".
IMHO, that was MS's bad decision for backwards compatibility.
There are some minor issues for win32 too, it doesn't have fchmod()
and fchown() and some other permission related macros. How should
these be dealt with in the long term?
In the short term I expect packagers to comment them out. ;-)
In the medium term I expect most "posix-like environments" (Cygwin,
MinGW) for non-posix systems will implement (or at least fake) them.
"Cygwin aims to provide a complete POSIX layer (similar to that found in
a Linux or other Unix systems) on top of Windows, sacrificing
performance where necessary for compatibility".
mingw developers would rave on how mingw is not posix and doesn't try
to be posix, unless its adding minimalist support for its toolchain
Cygwin however performs flawlessly for lzip, it does try to be posix.
In the long term I hope non-posix systems will become posix-systems or
That would be nice. :)
But suggestions are welcome. :-)
None at the moment, unless you are willing to use autotools, or at
least some compile tests in configure to find out if these functions
Lzip-bug mailing list