From d40e885931c98e41dc5c61f3c365d81fd250c6c4 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 29 Aug 2014 19:11:41 -0700 Subject: [PATCH] cwebp: (windows) open stdout in binary mode prevents corrupt output. fixes issue #217 (cherry picked from commit e9bfb1166db75689ca8ce278d1a18ef8b6042667) Change-Id: If90afb441636144300da66d64f0e7f78505b4060 --- examples/cwebp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/cwebp.c b/examples/cwebp.c index e75f3457..ab181b1b 100644 --- a/examples/cwebp.c +++ b/examples/cwebp.c @@ -22,6 +22,7 @@ #include "webp/encode.h" +#include "./example_util.h" #include "./metadata.h" #include "./stopwatch.h" @@ -981,7 +982,7 @@ int main(int argc, const char *argv[]) { // Open the output if (out_file != NULL) { const int use_stdout = !strcmp(out_file, "-"); - out = use_stdout ? stdout : fopen(out_file, "wb"); + out = use_stdout ? ExUtilSetBinaryMode(stdout) : fopen(out_file, "wb"); if (out == NULL) { fprintf(stderr, "Error! Cannot open output file '%s'\n", out_file); goto Error;