From e8dbac8b42e34b2ace5259bf58a3c4bc9dddaa21 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Mon, 29 May 2000 04:15:42 +0000 Subject: [PATCH] DW: - 'max_objsize' was type size_t, which is not always signed. Use ssize_t instead since -1 is a legal value. --- src/cache_cf.cc | 8 ++++---- src/store_dir.cc | 14 +++++++------- src/structs.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 6caa482cee..9828773eab 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.345 2000/05/16 07:06:03 wessels Exp $ + * $Id: cache_cf.cc,v 1.346 2000/05/28 22:15:42 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -197,7 +197,7 @@ static void update_maxobjsize(void) { int i; - size_t ms = -1; + ssize_t ms = -1; for (i = 0; i < Config.cacheSwap.n_configured; i++) { if (Config.cacheSwap.swapDirs[i].max_objsize > ms) @@ -892,12 +892,12 @@ parse_cachedir(cacheSwap * swap) SwapDir *sd; int i; int fs; - size_t maxobjsize; + ssize_t maxobjsize; if ((type_str = strtok(NULL, w_space)) == NULL) self_destruct(); - maxobjsize = (size_t) GetInteger(); + maxobjsize = (ssize_t) GetInteger(); if ((path_str = strtok(NULL, w_space)) == NULL) self_destruct(); diff --git a/src/store_dir.cc b/src/store_dir.cc index f66343bbc7..976e74f11a 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.109 2000/05/16 07:06:07 wessels Exp $ + * $Id: store_dir.cc,v 1.110 2000/05/28 22:15:42 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -35,7 +35,7 @@ #include "squid.h" -static int storeDirValidSwapDirSize(int, size_t); +static int storeDirValidSwapDirSize(int, ssize_t); static void storeDirLRUWalkInitHead(SwapDir * sd); static void *storeDirLRUWalkNext(SwapDir * sd); @@ -82,7 +82,7 @@ storeCreateSwapDirectories(void) * ie any-sized-object swapdirs. This is a good thing. */ static int -storeDirValidSwapDirSize(int swapdir, size_t objsize) +storeDirValidSwapDirSize(int swapdir, ssize_t objsize) { /* * If the swapdir's max_obj_size is -1, then it definitely can @@ -181,9 +181,9 @@ storeDirSelectSwapDir(void) int storeDirSelectSwapDir(const StoreEntry * e) { - size_t objsize; - size_t least_size; - size_t least_objsize; + ssize_t objsize; + ssize_t least_size; + ssize_t least_objsize; int least_load = 1000; int load; int dirn = -1; @@ -191,7 +191,7 @@ storeDirSelectSwapDir(const StoreEntry * e) SwapDir *SD; /* Calculate the object size */ - objsize = objectLen(e); + objsize = (ssize_t) objectLen(e); if (objsize != -1) objsize += e->mem_obj->swap_hdr_sz; /* Initial defaults */ diff --git a/src/structs.h b/src/structs.h index c9188cee13..7b40696844 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.334 2000/05/16 07:06:07 wessels Exp $ + * $Id: structs.h,v 1.335 2000/05/28 22:15:42 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -1346,7 +1346,7 @@ struct _SwapDir { char *path; int index; /* This entry's index into the swapDirs array */ int suggest; - size_t max_objsize; + ssize_t max_objsize; union { #ifdef HEAP_REPLACEMENT struct { -- 2.47.3