[easytag] Use ifdef for conditional mingw compilation



commit 366bad57877c899bdd2e5f7f2a9d59cb1dd181da
Author: David King <amigadave amigadave com>
Date:   Sat Apr 27 22:41:48 2013 +0100

    Use ifdef for conditional mingw compilation
    
    Avoid testing the build host in the Makefile and altering which files
    will be built based on it, and instead test for G_OS_WIN32 with ifdef.

 Makefile.am          |    7 +------
 src/browser.c        |    2 --
 src/cddb.c           |    3 +--
 src/charset.c        |    2 --
 src/easytag.c        |    3 +--
 src/et_core.c        |    2 --
 src/id3v24_tag.c     |    2 --
 src/log.c            |    2 --
 src/ogg_tag.c        |    4 +---
 src/picture.c        |    2 --
 src/prefs.c          |    2 --
 src/setting.c        |    2 --
 src/win32/win32dep.c |    7 +++++++
 13 files changed, 11 insertions(+), 29 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 8f157a0..a4fec44 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,11 +26,6 @@ easytag_CFLAGS = \
        $(WARN_CFLAGS) \
        $(EASYTAG_CFLAGS)
 
-if WINDOWS_HOST
-win32_sources = \
-       src/win32/win32dep.c
-endif
-
 easytag_SOURCES = \
        src/id3lib/c_wrapper.cpp \
        src/libapetag/apetaglib.c \
@@ -70,7 +65,7 @@ easytag_SOURCES = \
        src/vcedit.c \
        src/wavpack_header.c \
        src/wavpack_tag.c \
-       $(win32_sources)
+       src/win32/win32dep.c
 
 easytag_headers = \
        src/id3lib/id3_bugfix.h \
diff --git a/src/browser.c b/src/browser.c
index b3bcfb8..0899e88 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -53,9 +53,7 @@
 
 #include <assert.h>
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 /****************
diff --git a/src/cddb.c b/src/cddb.c
index 0301ddb..eeb0b55 100644
--- a/src/cddb.c
+++ b/src/cddb.c
@@ -28,9 +28,8 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#else /* !G_OS_WIN32 */
+#ifndef G_OS_WIN32
 #include <sys/socket.h>
 /* Patch OpenBSD from Jim Geovedi. */
 #include <netinet/in.h>
diff --git a/src/charset.c b/src/charset.c
index 07fd386..8687f65 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -35,9 +35,7 @@
 #include "setting.h"
 #include "log.h"
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 /****************
diff --git a/src/easytag.c b/src/easytag.c
index dbcbd57..7924131 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -57,9 +57,8 @@
 #include "picture.h"
 #include "charset.h"
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#else /* !G_OS_WIN32 */
+#ifndef G_OS_WIN32
 #include <sys/wait.h>
 #endif /* !G_OS_WIN32 */
 
diff --git a/src/et_core.c b/src/et_core.c
index 7bd847c..1c6ad2a 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -65,9 +65,7 @@
 #include "setting.h"
 #include "charset.h"
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 /***************
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index 17004a8..21ec1fe 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -42,9 +42,7 @@
 #include "et_core.h"
 #include "charset.h"
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 #ifdef ENABLE_MP3
diff --git a/src/log.c b/src/log.c
index 908691e..62dfab2 100644
--- a/src/log.c
+++ b/src/log.c
@@ -35,9 +35,7 @@
 #include "setting.h"
 #include "charset.h"
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 /****************
diff --git a/src/ogg_tag.c b/src/ogg_tag.c
index dc71a31..cfbfdcd 100644
--- a/src/ogg_tag.c
+++ b/src/ogg_tag.c
@@ -42,10 +42,8 @@
 #include "setting.h"
 #include "charset.h"
 
-#ifdef G_OS_WIN32
-// for mkstemp
+/* for mkstemp. */
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 /***************
diff --git a/src/picture.c b/src/picture.c
index 1204b8f..be0e8b6 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -40,9 +40,7 @@
 #include "bar.h"
 #include "charset.h"
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 /**************
diff --git a/src/prefs.c b/src/prefs.c
index a53a77c..f6e7ba5 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -41,9 +41,7 @@
 #include "browser.h"
 #include "cddb.h"
 #include "charset.h"
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 /**************
  * Prototypes *
diff --git a/src/setting.c b/src/setting.c
index e1a89e5..412a2a8 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -43,9 +43,7 @@
 #include "cddb.h"
 #include "browser.h"
 
-#ifdef G_OS_WIN32
 #include "win32/win32dep.h"
-#endif /* G_OS_WIN32 */
 
 
 /***************
diff --git a/src/win32/win32dep.c b/src/win32/win32dep.c
index 89f2518..e2ac2d2 100644
--- a/src/win32/win32dep.c
+++ b/src/win32/win32dep.c
@@ -24,6 +24,11 @@
  *
  */
 
+/* Needed for G_OS_WIN32. */
+#include <glib.h>
+
+#ifdef G_OS_WIN32
+
 #include <winsock2.h>
 #include <windows.h>
 #include <io.h>
@@ -649,3 +654,5 @@ et_w32_ftruncate (gint fd, off_t length)
 
     return chsize ((gint)h, length);
 }
+
+#endif /* G_OS_WIN32 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]