mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
cwebp: (windows) open stdout in binary mode
prevents corrupt output. fixes issue #217
(cherry picked from commit e9bfb1166d
)
Change-Id: If90afb441636144300da66d64f0e7f78505b4060
This commit is contained in:
parent
4aaf463449
commit
d40e885931
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "webp/encode.h"
|
#include "webp/encode.h"
|
||||||
|
|
||||||
|
#include "./example_util.h"
|
||||||
#include "./metadata.h"
|
#include "./metadata.h"
|
||||||
#include "./stopwatch.h"
|
#include "./stopwatch.h"
|
||||||
|
|
||||||
@ -981,7 +982,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
// Open the output
|
// Open the output
|
||||||
if (out_file != NULL) {
|
if (out_file != NULL) {
|
||||||
const int use_stdout = !strcmp(out_file, "-");
|
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) {
|
if (out == NULL) {
|
||||||
fprintf(stderr, "Error! Cannot open output file '%s'\n", out_file);
|
fprintf(stderr, "Error! Cannot open output file '%s'\n", out_file);
|
||||||
goto Error;
|
goto Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user