cwebp: (windows) open stdout in binary mode

prevents corrupt output. fixes issue #217

Change-Id: If90afb441636144300da66d64f0e7f78505b4060
This commit is contained in:
James Zern 2014-08-29 19:11:41 -07:00
parent 5927e15bc7
commit e9bfb1166d

View File

@ -22,6 +22,7 @@
#include "webp/encode.h"
#include "./example_util.h"
#include "./metadata.h"
#include "./stopwatch.h"
@ -978,7 +979,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;