aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-07-22 20:48:10 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-07-22 20:49:54 +0200
commit5529727137c054f9f8d9f7e8344aac1df3b9fbaf (patch)
treee4740c45cb7df8c8857c978188fdf4b9510fe881
parente137afa736c9d14bbc2b8cb54370c264b99be0e0 (diff)
downloadfiv-5529727137c054f9f8d9f7e8344aac1df3b9fbaf.tar.gz
fiv-5529727137c054f9f8d9f7e8344aac1df3b9fbaf.tar.xz
fiv-5529727137c054f9f8d9f7e8344aac1df3b9fbaf.zip
Fix thumbnail passing on Windows
LF was converted to CR LF, systematically corrupting bitmap data.
-rw-r--r--fiv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fiv.c b/fiv.c
index 8dcc65a..6e67ad2 100644
--- a/fiv.c
+++ b/fiv.c
@@ -25,6 +25,11 @@
#include <stdio.h>
#include <stdlib.h>
+#ifdef G_OS_WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif // G_OS_WIN32
+
#include "config.h"
#include "fiv-browser.h"
@@ -1807,6 +1812,10 @@ output_thumbnail(const char *path_arg, gboolean extract, const char *size_arg)
exit_fatal("unknown thumbnail size: %s", size_arg);
}
+#ifdef G_OS_WIN32
+ _setmode(fileno(stdout), _O_BINARY);
+#endif // G_OS_WIN32
+
GError *error = NULL;
GFile *file = g_file_new_for_commandline_arg(path_arg);
cairo_surface_t *surface = NULL;