Index: perl/agent/agent.xs
===================================================================
--- perl/agent/agent.xs.orig
+++ perl/agent/agent.xs
@@ -394,19 +394,19 @@
         PUSHMARK(sp);
         rarg = newSViv(0);
         arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_mib_handler");
-        sv_setiv(arg, (int) handler);
+        sv_setiv(arg, (IV) handler);
         XPUSHs(sv_2mortal(rarg));
         rarg = newSViv(0);
         arg = newSVrv(rarg, "NetSNMP::agent::reginfo");
-        sv_setiv(arg, (int) reginfo);
+        sv_setiv(arg, (IV) reginfo);
         XPUSHs(sv_2mortal(rarg));
         rarg = newSViv(0);
         arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_agent_request_info");
-        sv_setiv(arg, (int) reqinfo);
+        sv_setiv(arg, (IV) reqinfo);
         XPUSHs(sv_2mortal(rarg));
         rarg = newSViv(0);
         arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_request_infoPtr");
-        sv_setiv(arg, (int) requests);
+        sv_setiv(arg, (IV) requests);
         XPUSHs(sv_2mortal(rarg));
         PUTBACK;
         if (SvTYPE(cb) == SVt_PVCV) {
@@ -567,7 +567,7 @@
 
         rarg = newSViv((int) 0);
         arg = newSVrv(rarg, "netsnmp_oidPtr");
-        sv_setiv(arg, (int) o);
+        sv_setiv(arg, (IV) o);
 
         XPUSHs(rarg);
 
@@ -606,7 +606,7 @@
 
         rarg = newSViv((int) 0);
         arg = newSVrv(rarg, "netsnmp_oidPtr");
-        sv_setiv(arg, (int) o);
+        sv_setiv(arg, (IV) o);
 
         XPUSHs(rarg);
 
@@ -996,7 +996,7 @@
                 request = request->next;
                 rarg = newSViv(0);
                 arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_request_infoPtr");
-                sv_setiv(arg, (int) request);
+                sv_setiv(arg, (IV) request);
                 ST(0) = rarg;
             } else {
                 ST(0) = &sv_undef;
Index: snmplib/md5.c
===================================================================
--- snmplib/md5.c.orig
+++ snmplib/md5.c
@@ -465,7 +465,7 @@
         goto update_end;
 
     i = len;
-    if (((unsigned int) data) % sizeof(long) != 0) {
+    if (((uintptr_t) data) % sizeof(long) != 0) {
         /*
          * this relies on the ability to use integer math and thus we
          * must rely on data that aligns on 32-bit-word-boundries 
Index: snmplib/snmp_logging.c
===================================================================
--- snmplib/snmp_logging.c.orig
+++ snmplib/snmp_logging.c
@@ -380,7 +380,7 @@
             if (facility == -1)  return -1;
             logh->pri_max = pri_max;
             logh->token   = strdup(snmp_log_syslogname(0));
-            logh->magic   = (void *)facility;
+            logh->magic   = (void *)(intptr_t)facility;
 	    snmp_enable_syslog_ident(snmp_log_syslogname(0), facility);
 	}
         break;
@@ -625,7 +625,7 @@
             continue;
         if (logh->type == NETSNMP_LOGHANDLER_SYSLOG) {
             snmp_disable_syslog_entry(logh);
-            snmp_enable_syslog_ident(logh->token,(int)logh->magic);
+            snmp_enable_syslog_ident(logh->token,(int)(intptr_t)logh->magic);
         }
         else if (logh->type == NETSNMP_LOGHANDLER_FILE) {
             snmp_disable_filelog_entry(logh);
@@ -1041,7 +1041,7 @@
 	 */
     if (!(logh->imagic)) {
         const char *ident    = logh->token;
-        int   facility = (int)logh->magic;
+        int   facility = (int)(intptr_t)logh->magic;
         if (!ident)
             ident = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
                                           NETSNMP_DS_LIB_APPTYPE);
Index: snmplib/text_utils.c
===================================================================
--- snmplib/text_utils.c.orig
+++ snmplib/text_utils.c
@@ -460,7 +460,7 @@
     /*
      * get value
      */
-    switch((int)lpi->user_context) {
+    switch((int)(intptr_t)lpi->user_context) {
 
         case PMLP_TYPE_UNSIGNED:
             tvi->value.ul = strtoul(ptr, NULL, 0);
@@ -496,7 +496,7 @@
 
         default:
             snmp_log(LOG_ERR,"unsupported value type %d\n",
-                     (int)lpi->user_context);
+                     (int)(intptr_t)lpi->user_context);
             break;
     }
     
Index: agent/helpers/row_merge.c
===================================================================
--- agent/helpers/row_merge.c.orig
+++ agent/helpers/row_merge.c
@@ -30,7 +30,7 @@
     ret = netsnmp_create_handler("row_merge",
                                   netsnmp_row_merge_helper_handler);
     if (ret) {
-        ret->myvoid = (void *) prefix_len;
+        ret->myvoid = (void *)(intptr_t)prefix_len;
     }
     return ret;
 }
@@ -164,7 +164,7 @@
      * Use the prefix length as supplied during registration, rather
      *  than trying to second-guess what the MIB implementer wanted.
      */
-    int SKIP_OID = (int)handler->myvoid;
+    int SKIP_OID = (int)(intptr_t)handler->myvoid;
 
     DEBUGMSGTL(("helper:row_merge", "Got request (%d): ", SKIP_OID));
     DEBUGMSGOID(("helper:row_merge", reginfo->rootoid, reginfo->rootoid_len));
Index: agent/mibgroup/agent/nsDebug.c
===================================================================
--- agent/mibgroup/agent/nsDebug.c.orig
+++ agent/mibgroup/agent/nsDebug.c
@@ -291,7 +291,7 @@
 
     snmp_set_var_value(index, dbg_tokens[i].token_name,
 		       strlen(dbg_tokens[i].token_name));
-    *loop_context = (void*)i;
+    *loop_context = (void*)(intptr_t)i;
     *data_context = (void*)&dbg_tokens[i];
     return index;
 }
@@ -301,7 +301,7 @@
                       netsnmp_variable_list *index,
                       netsnmp_iterator_info *data)
 {
-    int i = (int)*loop_context;
+    int i = (int)(intptr_t)*loop_context;
 
     for (i++; i<debug_num_tokens; i++) {
         /* skip excluded til mib is updated */
@@ -313,7 +313,7 @@
 
     snmp_set_var_value(index, dbg_tokens[i].token_name,
 		       strlen(dbg_tokens[i].token_name));
-    *loop_context = (void*)i;
+    *loop_context = (void*)(intptr_t)i;
     *data_context = (void*)&dbg_tokens[i];
     return index;
 }
Index: perl/SNMP/SNMP.xs
===================================================================
--- perl/SNMP/SNMP.xs.orig
+++ perl/SNMP/SNMP.xs
@@ -1891,7 +1891,7 @@
       ** we sent in this request.  Note that this is not a valid SNMP PDU,
       ** but that's because a response has not yet been received.
       */
-      return (netsnmp_pdu *)reqid;
+      return (netsnmp_pdu *)(intptr_t)reqid;
    }
 
    /* This code is for synchronous mode support.
@@ -2944,7 +2944,7 @@
               if (verbose) warn("failed\n");
            }
         }
-        RETVAL = (I32)get_tree_head();
+        RETVAL = (IV)get_tree_head();
         }
         OUTPUT:
         RETVAL
@@ -2967,7 +2967,7 @@
         } else {
            if (verbose) warn("Failed reading %s\n", module);
         }
-        RETVAL = (I32)get_tree_head();
+        RETVAL = (IV)get_tree_head();
         }
         OUTPUT:
         RETVAL
@@ -4087,9 +4087,9 @@
 	      }
 
 	      /* Sent okay...  Return the request ID in 'pdu' as an SvIV. */
-	      DBPRT(1,(DBOUT "Okay, request id is %d\n", (int)pdu));
+	      DBPRT(1,(DBOUT "Okay, request id is %d\n", (int)(intptr_t)pdu));
 /*	      XSRETURN_IV((int)pdu); */
-	      XPUSHs(sv_2mortal(newSViv((int)pdu)));
+	      XPUSHs(sv_2mortal(newSViv((int)(intptr_t)pdu)));
 	      XSRETURN(1);
 	   }
 
Index: perl/TrapReceiver/TrapReceiver.xs
===================================================================
--- perl/TrapReceiver/TrapReceiver.xs.orig
+++ perl/TrapReceiver/TrapReceiver.xs
@@ -136,7 +136,7 @@
         {
             HV *hv = newHV();
             SV *rv = newRV_noinc((SV *) hv);
-            SV *rvsub = newRV_noinc((SV *) newSViv((U32) o));
+            SV *rvsub = newRV_noinc((SV *) newSViv((UV) o));
             SV *sv;
             rvsub = sv_bless(rvsub, gv_stashpv("netsnmp_oidPtr", 1));
             hv_store(hv, "oidptr", 6,  rvsub, 0);
