]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Minor cleanups relating to size_t being unsigned
authorBen Kaduk <kaduk@mit.edu>
Wed, 27 Jun 2012 20:35:20 +0000 (16:35 -0400)
committerBen Kaduk <kaduk@mit.edu>
Tue, 3 Jul 2012 04:43:45 +0000 (00:43 -0400)
In order to use -1 as a sentinel value, we should explicitly cast
to make it clear what we are doing.  It might be better to use
a less convoluted sentinel value such as SIZE_T_MAX, though.

Additionally, since size_t is unsigned and at least as wide as
an int, a loop with int index variable that compares against a
size_t for its termination check could become an infinite loop.
Make the loop index size_t for consistency.

src/plugins/kdb/db2/libdb2/hash/hash_bigkey.c
src/tests/gss-threads/gss-misc.c

index 6874f470378581cc855beec6413a79b3ea70dd4d..e6aa03525a5b7ec0d2788ceab659c304fb70e98a 100644 (file)
@@ -277,7 +277,7 @@ __big_keydata(hashp, pagep, key, val, ndx)
        key->data = hashp->bigkey_buf;
        __put_page(hashp, key_pagep, A_RAW, 0);
 
-       if (key->size == -1)
+       if (key->size == (size_t)-1)
                return (-1);
 
        /* Create an item_info to direct __big_return to the beginning pgno. */
index e52ae288e908e1cfe2c096f59a018888d71c0d58..4fdbde31cdc8f7e33aec191ccfc5eb073b3414ad 100644 (file)
@@ -386,7 +386,7 @@ void display_ctx_flags(flags)
 void print_token(tok)
      gss_buffer_t tok;
 {
-    int i;
+    size_t i;
     unsigned char *p = tok->value;
 
     if (!display_file)