]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Make namecache_store() take an unsigned count.
authorJeremy Allison <jra@samba.org>
Wed, 26 Aug 2020 22:45:35 +0000 (15:45 -0700)
committerNoel Power <npower@samba.org>
Mon, 7 Sep 2020 13:23:43 +0000 (13:23 +0000)
Counts can never be negative.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/include/proto.h
source3/libsmb/namecache.c

index ac7b36f005ba76c53a3c471e2396a2362c9ed6b2..dacd9e7fa44a4d726034f93b2fcb59040b9825a8 100644 (file)
@@ -678,7 +678,7 @@ NTSTATUS dos_to_ntstatus(uint8_t eclass, uint32_t ecode);
 
 bool namecache_store(const char *name,
                        int name_type,
-                       int num_names,
+                       size_t num_names,
                        struct ip_service *ip_list);
 bool namecache_fetch(TALLOC_CTX *ctx,
                        const char *name,
index ae22c2fc26a4fc6aabb722602c3430bde9227503..76fab4dfce595e82b4715efb3249625428cb6c69 100644 (file)
 
 static char *ipstr_list_make(TALLOC_CTX *ctx,
                        const struct ip_service *ip_list,
-                       int ip_count)
+                       size_t ip_count)
 {
        char *ipstr_list = NULL;
-       int i;
+       size_t i;
 
        /* arguments checking */
        if (ip_list == NULL) {
@@ -222,13 +222,13 @@ static char *namecache_key(TALLOC_CTX *ctx,
 
 bool namecache_store(const char *name,
                        int name_type,
-                       int num_names,
+                       size_t num_names,
                        struct ip_service *ip_list)
 {
        time_t expiry;
        char *key = NULL;
        char *value_string = NULL;
-       int i;
+       size_t i;
        bool ret = false;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -240,7 +240,7 @@ bool namecache_store(const char *name,
        if ( DEBUGLEVEL >= 5 ) {
                char *addr = NULL;
 
-               DBG_INFO("storing %d address%s for %s#%02x: ",
+               DBG_INFO("storing %zu address%s for %s#%02x: ",
                        num_names, num_names == 1 ? "": "es", name, name_type);
 
                for (i = 0; i < num_names; i++) {