Page 1 of 1

Win32 Binary Stdout - Mod please read

Posted: 21 Nov 2005 19:48
by Polyphem
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

Posted: 22 Nov 2005 20:11
by Guest
Tried to compile myself with no luck, run into an error
"windres: share/vlc_win32_rc.rc:15: syntax error"
during final make :(...

Changed this file in the source
https://trac.videolan.org/vlc/file/trun ... put/file.c
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)
setmode (STDOUT_FILENO, O_BINARY);
#endif
p_access->p_sys->i_handle = STDOUT_FILENO;
msg_Dbg( p_access, "using stdout" );
}
==============================

Maybe anyone else can give it a try and report the outcome? Would be thankful.

Best Regards
Polyphem

Posted: 23 Nov 2005 18:15
by Polyphem
After reading this
Additional changes required:

In share/vlc_win32_rc.rc, delete lines 15&16:
PRODUCTVERSION VERSION_NUMBER
FILEVERSION VERSION_NUMBER

Likewise in activex/axvlc_rc.rc, delete lines containing:
PRODUCTVERSION VERSION_NUMBER
FILEVERSION VERSION_NUMBER
here
viewtopic.php?t=12493
finally my VLC Nightly compiled correctly under Cygwin..... and the correction I mentioned in my second posting above WORKS (Hell, I can code C :) )!!! The file-stream to stdout under WIN32 / WindowsXP is now working for me.

This should be changed in
https://trac.videolan.org/vlc/file/trun ... put/file.c
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(WIN32)
setmode (STDOUT_FILENO, O_BINARY);
#endif
p_access->p_sys->i_handle = STDOUT_FILENO;
msg_Dbg( p_access, "using stdout" );
}
==============================
Maybe a Moderator can copy this to the bug-reporting, that it is going to be fixed? Should have no impact on other OS.

Best Regards
Polyphem

Posted: 29 Nov 2005 08:52
by Polyphem
Please add this one to the Bug-Reporting, Thanks.

Regards
Polypehm

Posted: 29 Nov 2005 15:44
by dionoea
Applied. Could i have your name (and email) to add in the THANKS file ?