aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-16 12:20:39 +0100
committerDavid Robillard <d@drobilla.net>2019-03-16 12:25:46 +0100
commit8b889e27f44a4554d606104644cc66080c540a68 (patch)
treeb887aaef8f868bbf3fe76ab32fc22595847bb686 /src
parentc3f3befe0c0b25c81eaad6bb79fca3d11f9530ce (diff)
downloadserd-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.c10
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;