Merge branch 'V5-5-patches' into V5-6-patches

* V5-5-patches:
  Remove C99 length specifier 'z' and use a cast instead
diff --git a/agent/kernel.c b/agent/kernel.c
index d246c39..00fde77 100644
--- a/agent/kernel.c
+++ b/agent/kernel.c
@@ -107,16 +107,17 @@
 klookup(unsigned long off, void *target, size_t siz)
 {
     int             result;
+
     if (kd == NULL)
         return 0;
     result = kvm_read(kd, off, target, siz);
     if (result != siz) {
 #if HAVE_KVM_OPENFILES
-        snmp_log(LOG_ERR, "kvm_read(*, %lx, %p, %zx) = %d: %s\n", off,
-                 target, siz, result, kvm_geterr(kd));
+        snmp_log(LOG_ERR, "kvm_read(*, %lx, %p, %x) = %d: %s\n", off,
+                 target, (unsigned) siz, result, kvm_geterr(kd));
 #else
         snmp_log(LOG_ERR, "kvm_read(*, %lx, %p, %d) = %d: ", off, target,
-                 siz, result);
+                 (unsigned) siz, result);
         snmp_log_perror("klookup");
 #endif
         return 0;
@@ -219,7 +220,7 @@
         return 0;
 
     if ((retsiz = klseek((off_t) off)) != off) {
-        snmp_log(LOG_ERR, "klookup(%lx, %p, %zd): ", off, target, siz);
+        snmp_log(LOG_ERR, "klookup(%lx, %p, %d): ", off, target, (int) siz);
         snmp_log_perror("klseek");
         return (0);
     }
@@ -229,12 +230,13 @@
              * these happen too often on too many architectures to print them
              * unless we're in debugging mode. People get very full log files. 
              */
-            snmp_log(LOG_ERR, "klookup(%lx, %p, %zd): ", off, target, siz);
+            snmp_log(LOG_ERR, "klookup(%lx, %p, %d): ", off, target, (int) siz);
             snmp_log_perror("klread");
         }
         return (0);
     }
-    DEBUGMSGTL(("verbose:kernel:klookup", "klookup(%lx, %p, %zd) succeeded", off, target, siz));
+    DEBUGMSGTL(("verbose:kernel:klookup", "klookup(%lx, %p, %d) succeeded",
+                off, target, (int) siz));
     return (1);
 }
 
diff --git a/agent/mibgroup/host/data_access/swinst_apt.c b/agent/mibgroup/host/data_access/swinst_apt.c
index 8b37b45..c7606d2 100644
--- a/agent/mibgroup/host/data_access/swinst_apt.c
+++ b/agent/mibgroup/host/data_access/swinst_apt.c
@@ -94,8 +94,8 @@
 	memcpy(entry->swDate, "\0\0\1\1\0\0\0\0", 8);
     }
     pclose(p);
-    DEBUGMSGTL(("swinst:load:arch"," loaded %zd entries\n",
-                CONTAINER_SIZE(container)));
+    DEBUGMSGTL(("swinst:load:arch"," loaded %d entries\n",
+                (int) CONTAINER_SIZE(container)));
 
     return 0;
 }
diff --git a/agent/mibgroup/host/data_access/swrun_procinfo.c b/agent/mibgroup/host/data_access/swrun_procinfo.c
index 6f22a7b..14640e1 100644
--- a/agent/mibgroup/host/data_access/swrun_procinfo.c
+++ b/agent/mibgroup/host/data_access/swrun_procinfo.c
@@ -123,8 +123,8 @@
     }
     free(proc_table);
 
-    DEBUGMSGTL(("swrun:load:arch"," loaded %zd entries\n",
-                CONTAINER_SIZE(container)));
+    DEBUGMSGTL(("swrun:load:arch"," loaded %d entries\n",
+                (int) CONTAINER_SIZE(container)));
 
     return 0;
 }
diff --git a/agent/mibgroup/if-mib/data_access/interface_sysctl.c b/agent/mibgroup/if-mib/data_access/interface_sysctl.c
index 72560a4..cce3881 100644
--- a/agent/mibgroup/if-mib/data_access/interface_sysctl.c
+++ b/agent/mibgroup/if-mib/data_access/interface_sysctl.c
@@ -352,11 +352,12 @@
     if_list = (u_char*)malloc(if_list_size);
     if (if_list == NULL) {
         snmp_log(LOG_ERR, "could not allocate memory for interface info "
-                 "(%zu bytes)\n", if_list_size);
+                 "(%u bytes)\n", (unsigned) if_list_size);
         return -3;
     } else {
         DEBUGMSGTL(("access:interface:container:sysctl",
-                    "allocated %zu bytes for if_list\n", if_list_size));
+                    "allocated %u bytes for if_list\n",
+                    (unsigned) if_list_size));
     }
 
     if (sysctl(sysctl_oid, sizeof(sysctl_oid)/sizeof(int), if_list,
diff --git a/testing/fulltests/unit-tests/T016read_config_clib.c b/testing/fulltests/unit-tests/T016read_config_clib.c
index c11a591..06ceed5 100644
--- a/testing/fulltests/unit-tests/T016read_config_clib.c
+++ b/testing/fulltests/unit-tests/T016read_config_clib.c
@@ -54,8 +54,8 @@
     result = (p->pf) (p->readfrom, &str, &len);
     offset = result ? result - p->readfrom : -1;
     OKF(offset == p->expected_offset,
-        ("test %d: expected offset %zd, got offset %" NETSNMP_PRIz "d",
-         i, p->expected_offset, offset));
+        ("test %d: expected offset %" NETSNMP_PRIz "d, got offset %"
+         NETSNMP_PRIz "d", i, p->expected_offset, offset));
     if (offset == p->expected_offset) {
         OKF(len == p->expected_len,
             ("test %d: expected length %" NETSNMP_PRIz "d, got length %"