Win32 Binary Stdout - Mod please read
Posted: 21 Nov 2005 19:48
Hello VLC-Team,
in this Post viewtopic.php?t=14066 I reported some problems with the stdout under Windows.
Neither can I code C nor I have setup a compiling environment. Nevertheless maybe I have found out what went wrong. Maybe it is possible for anyone with a Win32 compilation environment already set-up to verfiy this (maybe the code has also to be tweaked).
My assumption what is going wrong under Win32 is the different Line-Break handling. I think Unix uses something like \n and Win32 something like \r\n for line-breaks.
So I guess something in the
https://trac.videolan.org/vlc/file/trun ... put/file.c
has to be changed.
From:
=====================
if( !strcmp( p_access->psz_name, "-" ) )
{
p_access->p_sys->i_handle = STDOUT_FILENO;
msg_Dbg( p_access, "using stdout" );
}
=====================
To:
=====================
if( !strcmp( p_access->psz_name, "-" ) )
{
if defined(MSDOS) || defined(OS2) || defined(WIN32)
SET_BINARY_MODE(stdout) setmode(fileno(stdout), O_BINARY)
else
define SET_BINARY_MODE(stdout)
endif
p_access->p_sys->i_handle = STDOUT_FILENO;
msg_Dbg( p_access, "using stdout" );
}
=====================
I extracted the code from the cUrl Project.
Can anyone confirm this and (if working) maybe include it in one of the next nightly builds? Thanks a lot and cheers.
Best Regards
Polyphem
in this Post viewtopic.php?t=14066 I reported some problems with the stdout under Windows.
Neither can I code C nor I have setup a compiling environment. Nevertheless maybe I have found out what went wrong. Maybe it is possible for anyone with a Win32 compilation environment already set-up to verfiy this (maybe the code has also to be tweaked).
My assumption what is going wrong under Win32 is the different Line-Break handling. I think Unix uses something like \n and Win32 something like \r\n for line-breaks.
So I guess something in the
https://trac.videolan.org/vlc/file/trun ... put/file.c
has to be changed.
From:
=====================
if( !strcmp( p_access->psz_name, "-" ) )
{
p_access->p_sys->i_handle = STDOUT_FILENO;
msg_Dbg( p_access, "using stdout" );
}
=====================
To:
=====================
if( !strcmp( p_access->psz_name, "-" ) )
{
if defined(MSDOS) || defined(OS2) || defined(WIN32)
SET_BINARY_MODE(stdout) setmode(fileno(stdout), O_BINARY)
else
define SET_BINARY_MODE(stdout)
endif
p_access->p_sys->i_handle = STDOUT_FILENO;
msg_Dbg( p_access, "using stdout" );
}
=====================
I extracted the code from the cUrl Project.
Can anyone confirm this and (if working) maybe include it in one of the next nightly builds? Thanks a lot and cheers.
Best Regards
Polyphem