[FFmpeg-devel] [PATCH v2 2/2] avcodec/dvdsubdec, dvbsubdec: fix writing ppm

ffmpegagent ffmpegagent at gmail.com
Mon Jan 10 21:55:33 EET 2022


From: softworkz <softworkz at hotmail.com>

fopen needs (b)inary mode

Signed-off-by: softworkz <softworkz at hotmail.com>
---
 libavcodec/dvbsubdec.c | 4 ++--
 libavcodec/dvdsubdec.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 8db9963fda..f65bf960a4 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1394,7 +1394,7 @@ static void png_save(DVBSubContext *ctx, const char *filename, uint32_t *bitmap,
 
     snprintf(fname, sizeof(fname), "%s.ppm", filename);
 
-    f = fopen(fname, "w");
+    f = fopen(fname, "wb");
     if (!f) {
         perror(fname);
         return;
@@ -1416,7 +1416,7 @@ static void png_save(DVBSubContext *ctx, const char *filename, uint32_t *bitmap,
 
     snprintf(fname2, sizeof(fname2), "%s-a.pgm", filename);
 
-    f = fopen(fname2, "w");
+    f = fopen(fname2, "wb");
     if (!f) {
         perror(fname2);
         return;
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index c0f796068e..f3d1a4e2fc 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -509,7 +509,7 @@ static void ppm_save(const char *filename, uint8_t *bitmap, int w, int h,
     int back[3] = {0, 255, 0};  /* green background */
     FILE *f;
 
-    f = fopen(filename, "w");
+    f = fopen(filename, "wb");
     if (!f) {
         perror(filename);
         return;
-- 
ffmpeg-codebot


More information about the ffmpeg-devel mailing list