INN commit: trunk (frontends/getlist.c lib/qio.c storage/timecaf/caf.c)

INN Commit rra at isc.org
Sun Apr 3 13:23:45 UTC 2016


    Date: Sunday, April 3, 2016 @ 06:23:45
  Author: iulius
Revision: 9996

Unsigned integers cannot be negative (reported by cppcheck)

Modified:
  trunk/frontends/getlist.c
  trunk/lib/qio.c
  trunk/storage/timecaf/caf.c

-----------------------+
 frontends/getlist.c   |    3 ++-
 lib/qio.c             |    6 +++---
 storage/timecaf/caf.c |    4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

Modified: frontends/getlist.c
===================================================================
--- frontends/getlist.c	2016-04-03 13:22:47 UTC (rev 9995)
+++ frontends/getlist.c	2016-04-03 13:23:45 UTC (rev 9996)
@@ -237,8 +237,9 @@
             break;
         case 'p':
             port = atoi(optarg);
-            if (port <= 0)
+            if (port == 0) {
                 die("%s is not a valid port number", optarg);
+            }
             break;
         case 'R':
             reader = true;

Modified: lib/qio.c
===================================================================
--- lib/qio.c	2016-04-03 13:22:47 UTC (rev 9995)
+++ lib/qio.c	2016-04-03 13:23:45 UTC (rev 9996)
@@ -144,11 +144,11 @@
     while (1) {
         nleft = qp->_end - qp->_start;
 
-        /* If nleft <= 0, the buffer currently contains no data that hasn't
-           previously been returned by QIOread, so we can overwrite the
+        /* If (unsigned) nleft = 0, the buffer currently contains no data that
+           hasn't previously been returned by QIOread, so we can overwrite the
            buffer with new data.  Otherwise, first check the existing data
            to see if we have a full line. */
-        if (nleft <= 0) {
+        if (nleft == 0) {
             qp->_start = qp->_buffer;
             qp->_end = qp->_buffer;
         } else {

Modified: storage/timecaf/caf.c
===================================================================
--- storage/timecaf/caf.c	2016-04-03 13:22:47 UTC (rev 9995)
+++ storage/timecaf/caf.c	2016-04-03 13:23:45 UTC (rev 9996)
@@ -1433,9 +1433,9 @@
 	return -1;
     }
 
-    /* compute amount of  actual data in file. */
+    /* compute amount of actual data in file. */
     datasize = statbuf.st_size - head.StartDataBlock;
-    if (datasize <= 0) {
+    if (datasize == 0) {
 	/* nothing in the file, set percentfree==0 so won't bother cleaning */
 	percentfree = 0;
     } else {



More information about the inn-committers mailing list