diff --git a/example/cbor-to-json/cbor-to-json.cc b/example/cbor-to-json/cbor-to-json.cc index 7baa1779..4816c902 100644 --- a/example/cbor-to-json/cbor-to-json.cc +++ b/example/cbor-to-json/cbor-to-json.cc @@ -747,7 +747,7 @@ main1(int argc, char** argv) { if (g_flags.remaining_argc > 1) { return g_usage; } else if (g_flags.remaining_argc == 1) { - in = fopen(g_flags.remaining_argv[0], "r"); + in = fopen(g_flags.remaining_argv[0], "rb"); if (!in) { return std::string("main: cannot read input file"); } diff --git a/example/imageviewer/imageviewer.cc b/example/imageviewer/imageviewer.cc index 37eb73d6..2cf4b1ae 100644 --- a/example/imageviewer/imageviewer.cc +++ b/example/imageviewer/imageviewer.cc @@ -94,7 +94,7 @@ load_image(const char* filename) { FILE* file = stdin; const char* adj_filename = ""; if (filename) { - FILE* f = fopen(filename, "r"); + FILE* f = fopen(filename, "rb"); if (f == NULL) { printf("%s: could not open file\n", filename); return false; diff --git a/example/json-to-cbor/json-to-cbor.cc b/example/json-to-cbor/json-to-cbor.cc index 03cd11b8..3e1b12d3 100644 --- a/example/json-to-cbor/json-to-cbor.cc +++ b/example/json-to-cbor/json-to-cbor.cc @@ -339,7 +339,7 @@ main1(int argc, char** argv) { if (g_flags.remaining_argc > 1) { return g_usage; } else if (g_flags.remaining_argc == 1) { - in = fopen(g_flags.remaining_argv[0], "r"); + in = fopen(g_flags.remaining_argv[0], "rb"); if (!in) { return std::string("main: cannot read input file"); } diff --git a/example/jsonfindptrs/jsonfindptrs.cc b/example/jsonfindptrs/jsonfindptrs.cc index a7bd75ec..56e02cfc 100644 --- a/example/jsonfindptrs/jsonfindptrs.cc +++ b/example/jsonfindptrs/jsonfindptrs.cc @@ -548,7 +548,7 @@ main1(int argc, char** argv) { if (g_flags.remaining_argc > 1) { return g_usage; } else if (g_flags.remaining_argc == 1) { - in = fopen(g_flags.remaining_argv[0], "r"); + in = fopen(g_flags.remaining_argv[0], "rb"); if (!in) { return std::string("main: cannot read input file"); } diff --git a/script/manual-test-parse-number-f64.cc b/script/manual-test-parse-number-f64.cc index c11f27dc..a36cdd75 100644 --- a/script/manual-test-parse-number-f64.cc +++ b/script/manual-test-parse-number-f64.cc @@ -261,7 +261,7 @@ process_file(char* filename) { g_file = NULL; } g_filename = filename; - g_file = fopen(g_filename, "r"); + g_file = fopen(g_filename, "rb"); if (!g_file) { fprintf(stderr, "main: could not open %s\n", g_filename); return false; diff --git a/test/c/testlib/testlib.c b/test/c/testlib/testlib.c index aca8335a..3bad2e68 100644 --- a/test/c/testlib/testlib.c +++ b/test/c/testlib/testlib.c @@ -671,7 +671,7 @@ read_file(wuffs_base__io_buffer* dst, const char* path) { original_path); } - FILE* f = fopen(path, "r"); + FILE* f = fopen(path, "rb"); if (!f) { RETURN_FAIL("read_file(\"%s\"): %s (errno=%d)", path, strerror(errno), errno);