Wireshark-dev: [Wireshark-dev] [Patch] sockaddr_storage on Win32

From: Gisle Vanem <giva@xxxxxxxxx>
Date: Tue, 27 Mar 2007 17:42:24 +0200
The #ifdef's in capture_wpcap_packet.c and gtk/capture_if_details_dlg.c
assumes that only MSVC is used to build on Win32. MingW works just
fine.

MingW defines WINVER == 0x400, but it does have sockaddr_storage.

Why can't the structure be moved to a common .h-file? (to keep the
.c-files more clean). Patch attached.

--gv
--- SVN-Latest\capture_wpcap_packet.c	Mon Mar 26 17:52:42 2007
+++ capture_wpcap_packet.c	Tue Mar 27 01:24:07 2007
@@ -51,7 +51,7 @@
 *
 * copied from RFC2553 (and slightly modified because of datatypes) ...
 * XXX - defined more than once, move this to a header file */
-#if (WINVER <= 0x0400)
+#if (WINVER <= 0x0400) && defined(_MSC_VER)
typedef unsigned short eth_sa_family_t;

/*
@@ -82,7 +82,7 @@
              /* __ss_pad1, __ss_align fields is 112 */
};
/* ... copied from RFC2553 */
-#endif /* WINVER */
+#endif /* WINVER && _MSC_VER */


#include <Packet32.h>
--- SVN-Latest\gtk\capture_if_details_dlg.c	Mon Mar 26 17:51:39 2007
+++ gtk\capture_if_details_dlg.c	Tue Mar 27 01:19:21 2007
@@ -35,6 +35,7 @@

#include <wtap.h>
#include <time.h>
+#include <ctype.h>

#include "globals.h"
#include "file.h"
@@ -59,7 +60,7 @@
 *
 * copied from RFC2553 (and slightly modified because of datatypes) ...
 * XXX - defined more than once, move this to a header file */
-#if (WINVER <= 0x0400)
+#if (WINVER <= 0x0400) && defined(_MSC_VER)
typedef unsigned short eth_sa_family_t;

/*
@@ -90,7 +91,7 @@
              /* __ss_pad1, __ss_align fields is 112 */
};
/* ... copied from RFC2553 */
-#endif /* WINVER */
+#endif /* WINVER && _MSC_VER */

#include <Packet32.h>
#include <windows.h>