summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2022-08-20 17:52:36 +0200
committerAndreas Fankhauser hiddenalpha.ch2022-08-20 17:52:36 +0200
commit71775351a71f085c76378f6450cb6279d72bc50b (patch)
tree74dd0fcaa3e3736feafebf0b0abd89c654adb7fb
parentd6f8e794f77074eb76a1efbfc7f69d488f387950 (diff)
downloadDeflateAndInflate-71775351a71f085c76378f6450cb6279d72bc50b.zip
DeflateAndInflate-71775351a71f085c76378f6450cb6279d72bc50b.tar.gz
Extract windoof kludge to dedicated compilation unit
-rwxr-xr-xconfigure2
-rw-r--r--src/main/c/commonbase.h5
-rw-r--r--src/main/c/zzKludge.c15
3 files changed, 18 insertions, 4 deletions
diff --git a/configure b/configure
index 3acbb1d..57c4c29 100755
--- a/configure
+++ b/configure
@@ -132,6 +132,7 @@ printMakefile () {
printf '%s' 'build/bin/deflate$(BINEXT):'
printf '%s' ' build/obj/main/deflate.o'
+ printf '%s' ' build/obj/main/zzKludge.o'
printf '%s\n' ' build/link/deflate_main.o'
printf '%s\n' ' @echo " LN $@"'
printf '%s\n' ' $(MKDIRS) "$(shell T=$@; echo $${T%/*})"'
@@ -139,6 +140,7 @@ printMakefile () {
printf '%s' 'build/bin/inflate$(BINEXT):'
printf '%s' ' build/obj/main/inflate.o'
+ printf '%s' ' build/obj/main/zzKludge.o'
printf '%s\n' ' build/link/inflate_main.o'
printf '%s\n' ' echo " LN $@"'
printf '%s\n' ' $(MKDIRS) "$(shell T=$@; echo $${T%/*})"'
diff --git a/src/main/c/commonbase.h b/src/main/c/commonbase.h
index 581bf54..f7a353e 100644
--- a/src/main/c/commonbase.h
+++ b/src/main/c/commonbase.h
@@ -21,10 +21,7 @@
#if WINDOOF
-static inline void fixBrokenStdio( void ){
- _setmode(_fileno(stdin), O_BINARY);
- _setmode(_fileno(stdout), O_BINARY);
-}
+void fixBrokenStdio( void );
#else
# define fixBrokenStdio()
#endif
diff --git a/src/main/c/zzKludge.c b/src/main/c/zzKludge.c
new file mode 100644
index 0000000..3d8ad5c
--- /dev/null
+++ b/src/main/c/zzKludge.c
@@ -0,0 +1,15 @@
+#include "commonbase.h"
+
+#if WINDOOF
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <windows.h>
+
+
+void fixBrokenStdio( void ){
+ _setmode(_fileno(stdin), O_BINARY);
+ _setmode(_fileno(stdout), O_BINARY);
+}
+
+#endif /* end WINDOOF */