Ethereal-dev: [Ethereal-dev] Patches for MingW

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Gisle Vanem" <giva@xxxxxxxxx>
Date: Mon, 18 Aug 2003 20:16:01 +0200
I've built all programs with MingW + gcc 3.3.1 (using the todays snapshot).
Some patches where needed though:

* <ws2tcpip.h> is needed for INET6 code in epan/resolv.c
* MingW already have 'rint()' in <math.h> and
  'mode_t' in <sys/types.h>
* In dftest.c I'm not sure about the 2nd and 5th arg. I
 placed NULL to make it compile and run.

--------------------------------------------------------
diff -u3 -H -B -r ./epan/resolv.c ../epan/resolv.c
--- ./ethereal-2003-08-18/epan/resolv.c Mon Aug 18 19:43:46 2003
+++ ./epan/resolv.c Wed Aug 13 22:31:12 2003
@@ -82,6 +82,10 @@
 # include <adns.h>
 #endif

+#if defined(WIN32) && defined(INET6)
+# include <ws2tcpip.h>
+#endif
+
 #include "packet.h"
 #include "ipv6-utils.h"
 #include "resolv.h"

diff -u3 -H -B -r ./gtk/tcp_graph.c ../gtk/tcp_graph.c
--- ./ethereal-2003-08-18/gtk/tcp_graph.c Mon Aug 18 19:43:46 2003
+++ ./gtk/tcp_graph.c Wed Aug 13 17:47:44 2003
@@ -504,7 +504,7 @@
 static void rtt_delete_unack_from_list (struct unack ** , struct unack * );
 static void rtt_make_elmtlist (struct graph * );
 static void rtt_toggle_seq_origin (struct graph * );
-#ifdef WIN32
+#if defined(WIN32) && !defined(__MINGW32__)
 static int rint (double ); /* compiler template for Windows */
 #endif

@@ -3915,7 +3915,7 @@
   g->x_axis->min = 0;
 }

-#ifdef WIN32
+#if defined(WIN32) && !defined(__MINGW32__)
 /* replacement of Unix rint() for Windows */
 static int rint (double x)
 {

diff -u3 -H -B -r ./util.c ../util.c
--- ./ethereal-2003-08-18/util.c Mon Aug 18 19:43:58 2003
+++ ./util.c Wed Aug 13 17:33:50 2003
@@ -51,8 +51,10 @@

 #ifdef HAVE_IO_H
 #include <io.h>
+#ifndef __MINGW32__
 typedef int mode_t; /* for win32 */
 #endif
+#endif

 #ifdef HAVE_LIBZ
 #include <zlib.h> /* to get the libz version number */

--- ./ethereal-2003-08-18/dftest.c    Mon Aug 18 19:43:46 2003
+++ ./dftest.c Wed Aug 13 22:26:02 2003
@@ -83,7 +83,7 @@
        /* set the c-language locale to the native environment. */
        setlocale(LC_ALL, "");

-       prefs = read_prefs(&gpf_open_errno, &gpf_path, &pf_open_errno, &pf_path);
+       prefs = read_prefs(&gpf_open_errno, NULL, &gpf_path, &pf_open_errno, NULL, &pf_path);
        if (gpf_path != NULL) {
                fprintf(stderr, "can't open global preferences file \"%s\": %s.\n",
                                pf_path, strerror(gpf_open_errno));
--------------------------------------------------------

Gisle V.