The latest MingW 3.5 now has a ftruncate() function in <unistd.h>:
int ftruncate (int, off_t);
This causes a incompatible refinition when GLib 2.x (gwin32.h) gets
included before <unistd.h>:
gint g_win32_ftruncate (gint, guint);
Since Ethereal doesn't use ftruncate(), I suggest (for it to compile
on MingW), we #undef it before including <unistd.h> in some files.
A cludge, but I can't see a better way at the moment.
--gv
diff -u3 -Hb -r ethereal-2004-11-25\gtk\file_dlg.c .\gtk\file_dlg.c
--- ethereal-2004-11-25\gtk\file_dlg.c Wed Oct 27 22:28:37 2004
+++ .\gtk\file_dlg.c Thu Nov 25 13:14:59 2004
@@ -59,6 +59,10 @@
#include "merge.h"
#include "util.h"
+#ifdef WIN32 /* incompatible ftruncate() in GLib and <unistd.h> */
+#undef ftruncate
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff -u3 -Hb -r ethereal-2004-11-25\gtk\follow_dlg.c .\gtk\follow_dlg.c
--- ethereal-2004-11-25\gtk\follow_dlg.c Tue Nov 16 07:21:32 2004
+++ .\gtk\follow_dlg.c Thu Nov 25 13:15:38 2004
@@ -34,6 +34,10 @@
#include <io.h> /* open/close on win32 */
#endif
+#ifdef WIN32 /* incompatible ftruncate() in GLib and <unistd.h> */
+#undef ftruncate
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff -u3 -Hb -r ethereal-2004-11-25\gtk\main.c .\gtk\main.c
--- ethereal-2004-11-25\gtk\main.c Sat Oct 30 16:50:51 2004
+++ .\gtk\main.c Thu Nov 25 13:14:46 2004
@@ -48,6 +48,10 @@
#include <string.h>
#include <ctype.h>
+#ifdef WIN32 /* incompatible ftruncate() in GLib and <unistd.h> */
+#undef ftruncate
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff -u3 -Hb -r ethereal-2004-11-25\gtk\rtp_analysis.c .\gtk\rtp_analysis.c
--- ethereal-2004-11-25\gtk\rtp_analysis.c Sun Oct 17 21:14:47 2004
+++ .\gtk\rtp_analysis.c Thu Nov 25 13:20:16 2004
@@ -79,6 +79,10 @@
#include <fcntl.h>
#include <string.h>
+#ifdef WIN32 /* incompatible ftruncate() in GLib and <unistd.h> */
+#undef ftruncate
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff -u3 -Hb -r ethereal-2004-11-25\mergecap.c .\mergecap.c
--- ethereal-2004-11-25\mergecap.c Thu Oct 28 23:36:52 2004
+++ .\mergecap.c Thu Nov 25 13:11:34 2004
@@ -16,6 +16,10 @@
#include <errno.h>
#include <glib.h>
+#ifdef WIN32 /* incompatible ftruncate() in GLib and <unistd.h> */
+#undef ftruncate
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif