aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritsmattkc <itsmattkc@gmail.com>2020-07-29 18:41:46 +1000
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-07-29 12:26:16 +0200
commit5bc323849569a629aa0d187074a9644dde678c12 (patch)
tree8e01cab53ff45939da58143f4dd738e07b71eb9e
parent938d39716488b545b92c28f48acc94a7b8fc9138 (diff)
zbarcam: when reading binary, set stdout to binary mode on windows
Prevents Windows from attempting to convert LF to CRLF on binary data.
-rw-r--r--zbarcam/zbarcam.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/zbarcam/zbarcam.c b/zbarcam/zbarcam.c
index ad30101..4e41346 100644
--- a/zbarcam/zbarcam.c
+++ b/zbarcam/zbarcam.c
@@ -132,6 +132,10 @@ static void data_handler (zbar_image_t *img, const void *userdata)
continue;
}
else if(format == RAW) {
+#ifdef _WIN32
+ _setmode(_fileno(stdout), _O_BINARY);
+#endif
+
if(fwrite(zbar_symbol_get_data(sym),
zbar_symbol_get_data_length(sym),
1, stdout) != 1)

Privacy Policy