[PATCH 01/15] Cygwin64: Fix winExtDLL build

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
The winExtDLL code assumes that sizeof(oid) == 4. Hence define the
'oid' type as unsigned int when building with MSVC, MinGW or Cygwin.
This patch avoids that building winExtDLL with Cygwin64 fails on the
following statement:

        netsnmp_static_assert(sizeof(oid) == sizeof(UINT));
---
 include/net-snmp/library/oid.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/net-snmp/library/oid.h b/include/net-snmp/library/oid.h
index e7adf41d97ee..8c0b2b70a6cb 100644
--- a/include/net-snmp/library/oid.h
+++ b/include/net-snmp/library/oid.h
@@ -5,6 +5,16 @@
 #include <inttypes.h>
 #endif
 
+#if defined(_WIN32) || defined(__CYGWIN__)
+/*
+ * The winExtDLL implementation assumes that the size of an OID component is
+ * 32 bits. See also the definition of SnmpVarBindList on MSDN
+ * (https://msdn.microsoft.com/en-us/library/windows/desktop/aa378929.aspx).
+ */
+typedef unsigned int oid;
+#define MAX_SUBID   0xFFFFFFFFUL
+#define NETSNMP_PRIo ""
+#else
 #ifndef EIGHTBIT_SUBIDS
 typedef u_long oid;
 #define MAX_SUBID   0xFFFFFFFFUL
@@ -14,5 +24,6 @@ typedef uint8_t oid;
 #define MAX_SUBID   0xFF
 #define NETSNMP_PRIo ""
 #endif
+#endif
 
 #endif /* NETSNMP_LIBRARY_OID_H */
-- 
2.16.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.