diff options
author | David Robillard <d@drobilla.net> | 2019-03-16 12:20:39 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-03-16 12:25:46 +0100 |
commit | 8b889e27f44a4554d606104644cc66080c540a68 (patch) | |
tree | b887aaef8f868bbf3fe76ab32fc22595847bb686 /src | |
parent | c3f3befe0c0b25c81eaad6bb79fca3d11f9530ce (diff) | |
download | serd-8b889e27f44a4554d606104644cc66080c540a68.tar.gz serd-8b889e27f44a4554d606104644cc66080c540a68.tar.bz2 serd-8b889e27f44a4554d606104644cc66080c540a68.zip |
Set stdin and stdout to binary mode on Windows to preserve newlines
Diffstat (limited to 'src')
-rw-r--r-- | src/serdi.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 <fcntl.h> +#include <io.h> +#endif + #include <assert.h> #include <errno.h> #include <stdlib.h> @@ -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; |