--------------------- PatchSet 5225 Date: 2002/10/04 21:57:51 Author: rbcollins Branch: rbcollins_cxxtest Tag: (none) Log: (un)signed and type safety Members: src/Store.h:1.1.2.2->1.1.2.3 src/authenticate.cc:1.1.2.1->1.1.2.2 src/enums.h:1.40.2.2->1.40.2.3 src/errorpage.cc:1.1.2.2->1.1.2.3 src/globals.h:1.17->1.17.14.1 src/logfile.cc:1.1.2.1->1.1.2.2 src/stat.c:1.19.2.2->1.19.2.3 src/store.cc:1.1.2.2->1.1.2.3 src/store_dir.c:1.20.22.2->1.20.22.3 src/store_rebuild.c:1.9.44.1->1.9.44.2 src/typedefs.h:1.29.2.1->1.29.2.2 src/auth/digest/auth_digest.cc:1.1.2.2->1.1.2.3 src/auth/digest/auth_digest.h:1.7.28.1->1.7.28.2 Index: squid/src/Store.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/Store.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/Store.h 4 Oct 2002 11:09:07 -0000 1.1.2.2 +++ squid/src/Store.h 4 Oct 2002 21:57:51 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.1.2.2 2002/10/04 11:09:07 rbcollins Exp $ + * $Id: Store.h,v 1.1.2.3 2002/10/04 21:57:51 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -123,7 +123,7 @@ SQUIDCEXTERN void storeBuffer(StoreEntry *); SQUIDCEXTERN void storeBufferFlush(StoreEntry *); SQUIDCEXTERN void storeHashInsert(StoreEntry * e, const cache_key *); -SQUIDCEXTERN void storeSetMemStatus(StoreEntry * e, int); +SQUIDCEXTERN void storeSetMemStatus(StoreEntry * e, mem_status_t); #if STDC_HEADERS SQUIDCEXTERN void storeAppendPrintf(StoreEntry *, const char *,...) PRINTF_FORMAT_ARG2; Index: squid/src/authenticate.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/authenticate.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/authenticate.cc 3 Oct 2002 01:04:33 -0000 1.1.2.1 +++ squid/src/authenticate.cc 4 Oct 2002 21:57:51 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.cc,v 1.1.2.1 2002/10/03 01:04:33 rbcollins Exp $ + * $Id: authenticate.cc,v 1.1.2.2 2002/10/04 21:57:51 rbcollins Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -250,7 +250,7 @@ memPoolFree(pool, address); } -AuthUserRequest::AuthUserRequest():auth_user(NULL), message(NULL), scheme_data (NULL), +AuthUserRequest::AuthUserRequest():auth_user(NULL), scheme_data (NULL), message(NULL), references (0), lastReply (AUTH_ACL_CANNOT_AUTHENTICATE) { } Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.40.2.2 retrieving revision 1.40.2.3 diff -u -r1.40.2.2 -r1.40.2.3 --- squid/src/enums.h 4 Oct 2002 11:09:07 -0000 1.40.2.2 +++ squid/src/enums.h 4 Oct 2002 21:57:51 -0000 1.40.2.3 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.40.2.2 2002/10/04 11:09:07 rbcollins Exp $ + * $Id: enums.h,v 1.40.2.3 2002/10/04 21:57:51 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -343,10 +343,10 @@ ICP_END } icp_opcode; -enum { +typedef enum _mem_status_t { NOT_IN_MEMORY, IN_MEMORY -}; +} mem_status_t; enum { PING_NONE, Index: squid/src/errorpage.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/errorpage.cc,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/errorpage.cc 4 Oct 2002 07:07:25 -0000 1.1.2.2 +++ squid/src/errorpage.cc 4 Oct 2002 21:57:51 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.1.2.2 2002/10/04 07:07:25 rbcollins Exp $ + * $Id: errorpage.cc,v 1.1.2.3 2002/10/04 21:57:51 rbcollins Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -99,6 +99,7 @@ err_type &operator++ (err_type &anErr) { anErr = (err_type)(++(int)anErr); + return anErr; } /* * Function: errorInitialize @@ -727,6 +728,6 @@ } if (*m) memBufPrintf(&content, "%s", m); /* copy tail */ - assert(content.size == strlen(content.buf)); + assert((size_t)content.size == strlen(content.buf)); return content; } Index: squid/src/globals.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/globals.h,v retrieving revision 1.17 retrieving revision 1.17.14.1 diff -u -r1.17 -r1.17.14.1 --- squid/src/globals.h 15 Jul 2002 00:43:58 -0000 1.17 +++ squid/src/globals.h 4 Oct 2002 21:57:52 -0000 1.17.14.1 @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.17 2002/07/15 00:43:58 squidadm Exp $ + * $Id: globals.h,v 1.17.14.1 2002/10/04 21:57:52 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -117,7 +117,7 @@ extern int shutting_down; /* 0 */ extern int reconfiguring; /* 0 */ extern int store_dirs_rebuilding; /* 1 */ -extern int store_swap_size; /* 0 */ +extern unsigned long store_swap_size; /* 0 */ extern unsigned long store_mem_size; /* 0 */ extern time_t hit_only_mode_until; /* 0 */ extern StatCounters statCounter; Index: squid/src/logfile.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/logfile.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/logfile.cc 3 Oct 2002 01:04:35 -0000 1.1.2.1 +++ squid/src/logfile.cc 4 Oct 2002 21:57:52 -0000 1.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: logfile.cc,v 1.1.2.1 2002/10/03 01:04:35 rbcollins Exp $ + * $Id: logfile.cc,v 1.1.2.2 2002/10/04 21:57:52 rbcollins Exp $ * * DEBUG: section 50 Log file handling * AUTHOR: Duane Wessels @@ -136,7 +136,8 @@ /* buffer it */ xmemcpy(lf->buf + lf->offset, buf, len); lf->offset += len; - assert(lf->offset <= lf->bufsz); + assert (lf->offset >= 0); + assert((size_t)lf->offset <= lf->bufsz); } void @@ -180,7 +181,7 @@ static void logfileWriteWrapper(Logfile * lf, const void *buf, size_t len) { - int s; + size_t s; s = FD_WRITE_METHOD(lf->fd, (char const *)buf, len); fd_bytes(lf->fd, s, FD_WRITE); if (s == len) Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.19.2.2 retrieving revision 1.19.2.3 diff -u -r1.19.2.2 -r1.19.2.3 --- squid/src/stat.c 4 Oct 2002 11:09:08 -0000 1.19.2.2 +++ squid/src/stat.c 4 Oct 2002 21:57:52 -0000 1.19.2.3 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.19.2.2 2002/10/04 11:09:08 rbcollins Exp $ + * $Id: stat.c,v 1.19.2.3 2002/10/04 21:57:52 rbcollins Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -481,7 +481,7 @@ storeAppendPrintf(sentry, "\tRequest Disk Hit Ratios:\t5min: %3.1f%%, 60min: %3.1f%%\n", statRequestHitDiskRatio(5), statRequestHitDiskRatio(60)); - storeAppendPrintf(sentry, "\tStorage Swap size:\t%d KB\n", + storeAppendPrintf(sentry, "\tStorage Swap size:\t%lu KB\n", store_swap_size); storeAppendPrintf(sentry, "\tStorage Mem size:\t%d KB\n", (int) (store_mem_size >> 10)); Index: squid/src/store.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/store.cc,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/store.cc 4 Oct 2002 11:09:08 -0000 1.1.2.2 +++ squid/src/store.cc 4 Oct 2002 21:57:52 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.1.2.2 2002/10/04 11:09:08 rbcollins Exp $ + * $Id: store.cc,v 1.1.2.3 2002/10/04 21:57:52 rbcollins Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -654,7 +654,8 @@ if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) return 0; if (STORE_OK == e->store_status) - if (mem->object_sz < Config.Store.minObjectSize) + if (mem->object_sz < 0 || + static_cast(mem->object_sz) < Config.Store.minObjectSize) return 1; if (mem->reply->content_length > -1) if (mem->reply->content_length < (int) Config.Store.minObjectSize) @@ -685,8 +686,8 @@ store_check_cachable_hist.no.negative_cached++; return 0; /* avoid release call below */ } else if ((e->mem_obj->reply->content_length > 0 && - e->mem_obj->reply->content_length > Config.Store.maxObjectSize) || - e->mem_obj->inmem_hi > Config.Store.maxObjectSize) { + static_cast(e->mem_obj->reply->content_length) > Config.Store.maxObjectSize) || + static_cast(e->mem_obj->inmem_hi) > Config.Store.maxObjectSize) { debug(20, 2) ("storeCheckCachable: NO: too big\n"); store_check_cachable_hist.no.too_big++; } else if (e->mem_obj->reply->content_length > (int) Config.Store.maxObjectSize) { @@ -1253,7 +1254,7 @@ * NOTE, this function assumes only two mem states */ void -storeSetMemStatus(StoreEntry * e, int new_status) +storeSetMemStatus(StoreEntry * e, mem_status_t new_status) { MemObject *mem = e->mem_obj; if (new_status == e->mem_status) Index: squid/src/store_dir.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_dir.c,v retrieving revision 1.20.22.2 retrieving revision 1.20.22.3 diff -u -r1.20.22.2 -r1.20.22.3 --- squid/src/store_dir.c 4 Oct 2002 11:09:08 -0000 1.20.22.2 +++ squid/src/store_dir.c 4 Oct 2002 21:57:52 -0000 1.20.22.3 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.c,v 1.20.22.2 2002/10/04 11:09:08 rbcollins Exp $ + * $Id: store_dir.c,v 1.20.22.3 2002/10/04 21:57:52 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -294,7 +294,7 @@ storeEntryInUse()); storeAppendPrintf(sentry, "Maximum Swap Size : %8ld KB\n", (long int) Config.Swap.maxSize); - storeAppendPrintf(sentry, "Current Store Swap Size: %8d KB\n", + storeAppendPrintf(sentry, "Current Store Swap Size: %8lu KB\n", store_swap_size); storeAppendPrintf(sentry, "Current Capacity : %d%% used, %d%% free\n", percent((int) store_swap_size, (int) Config.Swap.maxSize), Index: squid/src/store_rebuild.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_rebuild.c,v retrieving revision 1.9.44.1 retrieving revision 1.9.44.2 diff -u -r1.9.44.1 -r1.9.44.2 --- squid/src/store_rebuild.c 4 Oct 2002 07:07:29 -0000 1.9.44.1 +++ squid/src/store_rebuild.c 4 Oct 2002 21:57:52 -0000 1.9.44.2 @@ -1,6 +1,6 @@ /* - * $Id: store_rebuild.c,v 1.9.44.1 2002/10/04 07:07:29 rbcollins Exp $ + * $Id: store_rebuild.c,v 1.9.44.2 2002/10/04 21:57:52 rbcollins Exp $ * * DEBUG: section 20 Store Rebuild Routines * AUTHOR: Duane Wessels @@ -71,7 +71,7 @@ if (++bucketnum >= store_hash_buckets) { debug(20, 1) (" Completed Validation Procedure\n"); debug(20, 1) (" Validated %d Entries\n", validnum); - debug(20, 1) (" store_swap_size = %dk\n", store_swap_size); + debug(20, 1) (" store_swap_size = %luk\n", store_swap_size); store_dirs_rebuilding--; assert(0 == store_dirs_rebuilding); if (opt_store_doublecheck) Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.29.2.1 retrieving revision 1.29.2.2 diff -u -r1.29.2.1 -r1.29.2.2 --- squid/src/typedefs.h 3 Oct 2002 01:04:36 -0000 1.29.2.1 +++ squid/src/typedefs.h 4 Oct 2002 21:57:52 -0000 1.29.2.2 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.29.2.1 2002/10/03 01:04:36 rbcollins Exp $ + * $Id: typedefs.h,v 1.29.2.2 2002/10/04 21:57:52 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -35,7 +35,6 @@ #define SQUID_TYPEDEFS_H typedef unsigned int store_status_t; -typedef unsigned int mem_status_t; typedef unsigned int ping_status_t; typedef unsigned int swap_status_t; typedef signed int sfileno; Index: squid/src/auth/digest/auth_digest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/digest/Attic/auth_digest.cc,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/auth/digest/auth_digest.cc 4 Oct 2002 07:07:30 -0000 1.1.2.2 +++ squid/src/auth/digest/auth_digest.cc 4 Oct 2002 21:57:52 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: auth_digest.cc,v 1.1.2.2 2002/10/04 07:07:30 rbcollins Exp $ + * $Id: auth_digest.cc,v 1.1.2.3 2002/10/04 21:57:52 rbcollins Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -938,7 +938,7 @@ } else if (strcasecmp(param_str, "nonce_max_duration") == 0) { parse_time_t(&digestConfig->noncemaxduration); } else if (strcasecmp(param_str, "nonce_max_count") == 0) { - parse_int(&digestConfig->noncemaxuses); + parse_int((int *)&digestConfig->noncemaxuses); } else if (strcasecmp(param_str, "nonce_strictness") == 0) { parse_onoff(&digestConfig->NonceStrictness); } else { Index: squid/src/auth/digest/auth_digest.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/digest/auth_digest.h,v retrieving revision 1.7.28.1 retrieving revision 1.7.28.2 diff -u -r1.7.28.1 -r1.7.28.2 --- squid/src/auth/digest/auth_digest.h 3 Oct 2002 01:04:37 -0000 1.7.28.1 +++ squid/src/auth/digest/auth_digest.h 4 Oct 2002 21:57:52 -0000 1.7.28.2 @@ -63,7 +63,7 @@ hash_link hash; /* must be first */ digest_nonce_data noncedata; /* number of uses we've seen of this nonce */ - long nc; + unsigned long nc; /* reference count */ short references; /* the auth_user this nonce has been tied to */ @@ -82,7 +82,7 @@ wordlist *authenticate; time_t nonceGCInterval; time_t noncemaxduration; - int noncemaxuses; + unsigned int noncemaxuses; int NonceStrictness; };