[FFmpeg-cvslog] r23261 - in branches/0.6: . cmdutils.c ffmpeg.c

siretart subversion
Sun May 23 20:50:15 CEST 2010


Author: siretart
Date: Sun May 23 20:50:15 2010
New Revision: 23261

Log:
Open 2-pass logfile in binary mode for both reading and writing.
This fixes a regression on Windows introduced by r22769 in which the data read
from the file was not properly zero terminated. The file was read as text,
which caused the \r characters to be suppressed. Since the zero termination
happens at the end of the buffer, and there was one byte less read per line,
this caused the remaining space on the buffer to contain random data.


backport r23251 by ramiro

Modified:
   branches/0.6/   (props changed)
   branches/0.6/cmdutils.c
   branches/0.6/ffmpeg.c

Modified: branches/0.6/cmdutils.c
==============================================================================
--- branches/0.6/cmdutils.c	Sun May 23 20:34:18 2010	(r23260)
+++ branches/0.6/cmdutils.c	Sun May 23 20:50:15 2010	(r23261)
@@ -641,7 +641,7 @@ int read_yesno(void)
 
 int read_file(const char *filename, char **bufptr, size_t *size)
 {
-    FILE *f = fopen(filename, "r");
+    FILE *f = fopen(filename, "rb");
 
     if (!f) {
         fprintf(stderr, "Cannot read file '%s': %s\n", filename, strerror(errno));

Modified: branches/0.6/ffmpeg.c
==============================================================================
--- branches/0.6/ffmpeg.c	Sun May 23 20:34:18 2010	(r23260)
+++ branches/0.6/ffmpeg.c	Sun May 23 20:50:15 2010	(r23261)
@@ -2093,7 +2093,7 @@ static int av_transcode(AVFormatContext 
                          pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
                          i);
                 if (codec->flags & CODEC_FLAG_PASS1) {
-                    f = fopen(logfilename, "w");
+                    f = fopen(logfilename, "wb");
                     if (!f) {
                         fprintf(stderr, "Cannot write log file '%s' for pass-1 encoding: %s\n", logfilename, strerror(errno));
                         av_exit(1);



More information about the ffmpeg-cvslog mailing list