Hi,

As noted in earlier messages the sizeof(oid) on a 64 bit machine is 8
bytes due to the use of u_long. This patch ensures that an oid is always
32 bit by using the uint32_t type instead.

For us this also helps with using oid string between libsmi and net-snmp
but I thing the change is valid none the less.

Comments?

commit 09f065ebecda42125044655f898bcd94afee9fc6
Author: Alex Bennee <[EMAIL PROTECTED]>
Date:   Mon Apr 14 13:12:21 2008 +0100

    Use fixed size typedef for oid if it exists.
    
    uint32_t is pretty standard these days, although this patch only uses if 
autoconf finds it.
    The advantage of using a fixed sized type is it's portable across arches, 
and won't ballon
    on 64 bit machines the same way u_long does. MAXSUB_ID only allows for a 32 
bit sub-id
    anyway.

diff --git a/tags/Ext-5-4-1/net-snmp/include/net-snmp/library/asn1.h 
b/tags/Ext-5-4-1/net-snmp/include/net-snmp/library/asn1.h
index baf4b9f..80eb871 100644
--- a/tags/Ext-5-4-1/net-snmp/include/net-snmp/library/asn1.h
+++ b/tags/Ext-5-4-1/net-snmp/include/net-snmp/library/asn1.h
@@ -38,7 +38,13 @@ SOFTWARE.
 
 
 #ifndef MAX_SUBID               /* temporary - duplicate definition protection 
*/
-    typedef u_long  oid;
+
+#ifdef HAVE_UINT32_T
+       typedef uint32_t oid;
+#else
+       typedef u_long  oid;
+#endif
+
 #define MAX_SUBID   0xFFFFFFFF
 #endif
 
diff --git a/tags/Ext-5-4-1/net-snmp/include/net-snmp/types.h 
b/tags/Ext-5-4-1/net-snmp/include/net-snmp/types.h
index 5349d9e..e893843 100644
--- a/tags/Ext-5-4-1/net-snmp/include/net-snmp/types.h
+++ b/tags/Ext-5-4-1/net-snmp/include/net-snmp/types.h
@@ -46,7 +46,13 @@ extern "C" {
 #endif
 
 #ifndef MAX_SUBID               /* temporary - duplicate definition protection 
*/
-typedef u_long  oid;
+
+#ifdef HAVE_UINT32_T
+       typedef uint32_t oid;
+#else
+       typedef u_long  oid;
+#endif
+       
 #define MAX_SUBID   0xFFFFFFFF
 #endif
 

-- 
Alex Bennee
Software Engineer, Cambridge Broadband

------------------------------------------------------------------------------
Cambridge Broadband Networks Limited

Registered in England and Wales under company number: 03879840
Registered office: Selwyn House, Cambridge Business Park, Cowley Road, 
Cambridge CB4 0WZ, UK.
VAT number: GB 741 0186 64

This email and any attachments are private and confidential. If you believe you 
have received this email in error please inform the sender and delete it from 
your mailbox or any other storage mechanism. Cambridge Broadband Networks 
Limited cannot accept liability for any statements made which are clearly the 
individual sender's own and not expressly made on behalf of Cambridge Broadband 
Networks Limited.



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to