[FFmpeg-devel] [PATCH] Fix cmdutils.c:read_file() on Windows.

Michael Niedermayer michaelni
Sat May 22 21:37:25 CEST 2010


On Sat, May 22, 2010 at 01:20:22PM -0300, Ramiro Polla wrote:
> On Sat, May 22, 2010 at 10:23 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Sat, May 22, 2010 at 12:31:49PM +0100, M?ns Rullg?rd wrote:
> >> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> >> > On Fri, May 21, 2010 at 07:05:15PM -0300, Ramiro Polla wrote:
> >> >> r22769 moved reading of the 2pass file to cmdutils.c, and removed the
> >> >> re-attribution of size to the return value of fread(). On Windows, the
> >> >> file size from fseek/ftell returns the total file size (with \r
> >> >> characters), but the return value of fread() (and therefore the number
> >> >> of bytes actually read) don't include \r characters.
> >> >>
> >> >> I attached two possible fixes: one re-attributes size to the return
> >> >> value of fread(), the other opens the file in binary mode.
> >> >>
> >> >> I don't know if any system will choke on the extra 'b' in "rb" on the
> >> >> second option, but anyways I prefer option 1...
> >> >
> >> > I think a "b" in the fopen for both reading and writing would be better,
> >> > I don't like the idea of the 2pass file having different contents on
> >> > Windows.
> >>
> >> A "b" in the mode string is allowed by the standards, so that's the
> >> best solution IMO.
> >
> > agree
> 
> New patch attached opens both reading and writing as binary.

>  cmdutils.c |    2 +-
>  ffmpeg.c   |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> c47023317236ab1d7b82309bd71ba5e02fbc6b5f  binary_logfile.diff

fine with me

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100522/ae8e25a7/attachment.pgp>



More information about the ffmpeg-devel mailing list