summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2010-05-23 18:50:15 +0000
committerReinhard Tartler <siretart@tauware.de>2010-05-23 18:50:15 +0000
commita22222dadb6353410d50053f97cafb34eb4121fb (patch)
tree1822fb2dacb7d48c81029d0a7d3351cce5c5af81
parent28631e9393fd8cf55e6f1fca1a6676a8d6755b85 (diff)
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 Originally committed as revision 23261 to svn://svn.ffmpeg.org/ffmpeg/branches/0.6
-rw-r--r--cmdutils.c2
-rw-r--r--ffmpeg.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 80917c3a19..2349b7052e 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -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));
diff --git a/ffmpeg.c b/ffmpeg.c
index 66c80396ce..67b7a51e65 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2093,7 +2093,7 @@ static int av_transcode(AVFormatContext **output_files,
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);