From 8b889e27f44a4554d606104644cc66080c540a68 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 16 Mar 2019 12:20:39 +0100 Subject: Set stdin and stdout to binary mode on Windows to preserve newlines --- src/serdi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/serdi.c b/src/serdi.c index 527ada50..03de46fd 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -16,6 +16,11 @@ #include "serd_internal.h" +#ifdef _WIN32 +#include +#include +#endif + #include #include #include @@ -201,6 +206,11 @@ main(int argc, char** argv) return 1; } +#ifdef _WIN32 + _setmode(fileno(stdin), _O_BINARY); + _setmode(fileno(stdout), _O_BINARY); +#endif + const uint8_t* input = (const uint8_t*)argv[a++]; if (from_file) { in_name = in_name ? in_name : input; -- cgit v1.2.1