From: hno <> Date: Thu, 18 Oct 2001 01:43:39 +0000 (+0000) Subject: Many small warning fixes, const and missing prototypes X-Git-Tag: SQUID_3_0_PRE1~1345 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c193c972469469509fed5fbc230266a3187985d2;p=thirdparty%2Fsquid.git Many small warning fixes, const and missing prototypes --- diff --git a/src/acl.cc b/src/acl.cc index fb09281e67..9abf15dc74 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.263 2001/10/17 12:41:49 hno Exp $ + * $Id: acl.cc,v 1.264 2001/10/17 19:43:39 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -348,10 +348,12 @@ aclParseProtoList(void *curlist) intlist **Tail; intlist *q = NULL; char *t = NULL; + protocol_t protocol; for (Tail = curlist; *Tail; Tail = &((*Tail)->next)); while ((t = strtokFile())) { + protocol = urlParseProtocol(t); q = memAllocate(MEM_INTLIST); - q->i = (int) urlParseProtocol(t); + q->i = (int) protocol; *(Tail) = q; Tail = &q->next; } diff --git a/src/asn.cc b/src/asn.cc index d6919f8e00..0ac9f2b167 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.73 2001/10/17 12:41:49 hno Exp $ + * $Id: asn.cc,v 1.74 2001/10/17 19:43:39 hno Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -148,11 +148,12 @@ asnAclInitialize(acl * acls) /* initialize the radix tree structure */ +extern int max_keylen; /* yuck.. this is in lib/radix.c */ + CBDATA_TYPE(ASState); void asnInit(void) { - extern int max_keylen; static int inited = 0; max_keylen = 40; CBDATA_INIT_TYPE(ASState); diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index 00ef4b5532..e4d4d4c37f 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -1,5 +1,5 @@ /* - * $Id: auth_basic.cc,v 1.12 2001/10/17 12:41:50 hno Exp $ + * $Id: auth_basic.cc,v 1.13 2001/10/17 19:43:40 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -361,7 +361,7 @@ authenticateBasicUsername(auth_user_t * auth_user) } static basic_data * -authBasicDataNew() +authBasicDataNew(void) { basic_data *temp; temp = memPoolAlloc(basic_data_pool); diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index 73cb0dd874..f3a8661d7a 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: auth_digest.cc,v 1.8 2001/10/17 17:09:08 hno Exp $ + * $Id: auth_digest.cc,v 1.9 2001/10/17 19:43:41 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -96,11 +96,11 @@ CBDATA_TYPE(authenticateStateData); static void authenticateDigestNonceCacheCleanup(void *data); static digest_nonce_h *authenticateDigestNonceFindNonce(const char *nonceb64); -static digest_nonce_h *authenticateDigestNonceNew(); +static digest_nonce_h *authenticateDigestNonceNew(void); static void authenticateDigestNonceDelete(digest_nonce_h * nonce); -static void authenticateDigestNonceSetup(); -static void authenticateDigestNonceShutdown(); -static void authenticateDigestNonceReconfigure(); +static void authenticateDigestNonceSetup(void); +static void authenticateDigestNonceShutdown(void); +static void authenticateDigestNonceReconfigure(void); static const char *authenticateDigestNonceNonceb64(digest_nonce_h * nonce); static int authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9]); static int authDigestNonceIsStale(digest_nonce_h * nonce); @@ -125,7 +125,7 @@ authDigestNonceEncode(digest_nonce_h * nonce) } static digest_nonce_h * -authenticateDigestNonceNew() +authenticateDigestNonceNew(void) { digest_nonce_h *newnonce = memPoolAlloc(digest_nonce_pool); digest_nonce_h *temp; @@ -210,7 +210,7 @@ authenticateDigestNonceDelete(digest_nonce_h * nonce) } static void -authenticateDigestNonceSetup() +authenticateDigestNonceSetup(void) { if (!digest_nonce_pool) digest_nonce_pool = memPoolCreate("Digest Scheme nonce's", sizeof(digest_nonce_h)); @@ -222,7 +222,7 @@ authenticateDigestNonceSetup() } static void -authenticateDigestNonceShutdown() +authenticateDigestNonceShutdown(void) { /* * We empty the cache of any nonces left in there. @@ -245,7 +245,7 @@ authenticateDigestNonceShutdown() } static void -authenticateDigestNonceReconfigure() +authenticateDigestNonceReconfigure(void) { } @@ -445,20 +445,20 @@ authDigestUserFindUsername(const char *username) } static digest_user_h * -authDigestUserNew() +authDigestUserNew(void) { return memPoolAlloc(digest_user_pool); } static void -authDigestUserSetup() +authDigestUserSetup(void) { if (!digest_user_pool) digest_user_pool = memPoolCreate("Digest Scheme User Data", sizeof(digest_user_h)); } static void -authDigestUserShutdown() +authDigestUserShutdown(void) { /* * Future work: the auth framework could flush it's cache @@ -518,7 +518,7 @@ authDigestAURequestFree(auth_user_request_t * auth_user_request) } static digest_request_h * -authDigestRequestNew() +authDigestRequestNew(void) { digest_request_h *tmp; tmp = memPoolAlloc(digest_request_pool); @@ -527,14 +527,14 @@ authDigestRequestNew() } static void -authDigestRequestSetup() +authDigestRequestSetup(void) { if (!digest_request_pool) digest_request_pool = memPoolCreate("Digest Scheme Request Data", sizeof(digest_request_h)); } static void -authDigestRequestShutdown() +authDigestRequestShutdown(void) { /* No requests should be in progress when we get here */ if (digest_request_pool) { @@ -614,12 +614,12 @@ authSchemeSetup_digest(authscheme_entry_t * authscheme) } static int -authenticateDigestActive() +authenticateDigestActive(void) { return (authdigest_initialised == 1) ? 1 : 0; } static int -authDigestConfigured() +authDigestConfigured(void) { if ((digestConfig != NULL) && (digestConfig->authenticate != NULL) && (digestConfig->authenticateChildren != 0) && diff --git a/src/cache_cf.cc b/src/cache_cf.cc index e239053892..f31fa8358f 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.392 2001/10/17 13:43:06 hno Exp $ + * $Id: cache_cf.cc,v 1.393 2001/10/17 19:43:39 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2136,7 +2136,7 @@ parse_uri_whitespace(int *var) static void dump_uri_whitespace(StoreEntry * entry, const char *name, int var) { - char *s; + const char *s; if (var == URI_WHITESPACE_ALLOW) s = "allow"; else if (var == URI_WHITESPACE_ENCODE) diff --git a/src/cbdata.cc b/src/cbdata.cc index f89ef4e5fb..dd993d6722 100644 --- a/src/cbdata.cc +++ b/src/cbdata.cc @@ -1,6 +1,6 @@ /* - * $Id: cbdata.cc,v 1.41 2001/04/09 21:55:50 hno Exp $ + * $Id: cbdata.cc,v 1.42 2001/10/17 19:43:39 hno Exp $ * * DEBUG: section 45 Callback Data Registry * ORIGINAL AUTHOR: Duane Wessels @@ -95,7 +95,7 @@ int cbdata_types = 0; #define OFFSET_OF(type, member) ((int)(char *)&((type *)0L)->member) void -cbdataInitType(cbdata_type type, char *name, int size, FREE * free_func) +cbdataInitType(cbdata_type type, const char *name, int size, FREE * free_func) { char *label; if (type >= cbdata_types) { @@ -114,7 +114,7 @@ cbdataInitType(cbdata_type type, char *name, int size, FREE * free_func) } cbdata_type -cbdataAddType(cbdata_type type, char *name, int size, FREE * free_func) +cbdataAddType(cbdata_type type, const char *name, int size, FREE * free_func) { if (type) return type; diff --git a/src/cf_gen.cc b/src/cf_gen.cc index fa38d2a6a6..3c04bdedc6 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -1,6 +1,6 @@ /* - * $Id: cf_gen.cc,v 1.42 2001/08/23 13:20:46 robertc Exp $ + * $Id: cf_gen.cc,v 1.43 2001/10/17 19:43:39 hno Exp $ * * DEBUG: none Generate squid.conf.default and cf_parser.h * AUTHOR: Max Okumoto @@ -116,7 +116,7 @@ static void gen_conf(Entry *, FILE *); static void gen_default_if_none(Entry *, FILE *); static void -lineAdd(Line ** L, char *str) +lineAdd(Line ** L, const char *str) { while (*L) L = &(*L)->next; @@ -129,8 +129,8 @@ main(int argc, char *argv[]) { FILE *fp; char *input_filename = argv[1]; - char *output_filename = _PATH_PARSER; - char *conf_filename = _PATH_SQUID_CONF; + const char *output_filename = _PATH_PARSER; + const char *conf_filename = _PATH_SQUID_CONF; int linenum = 0; Entry *entries = NULL; Entry *curr = NULL; diff --git a/src/cf_gen_defines b/src/cf_gen_defines index 0dd50f30d6..ca53e08fd6 100755 --- a/src/cf_gen_defines +++ b/src/cf_gen_defines @@ -3,7 +3,7 @@ BEGIN { print "/* Generated automatically from cf.data.pre" print " * DO NOT EDIT" print "*/" - print "struct { char *name; char *enable; int defined;} defines[] = {" + print "struct { const char *name; const char *enable; int defined;} defines[] = {" define["DELAY_POOLS"]="--enable-delay-pools" define["HTTP_VIOLATIONS"]="--enable-http-violations" define["SQUID_SNMP"]="--enable-snmp" diff --git a/src/ipc.cc b/src/ipc.cc index 5be079ca8f..80a3a85788 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -1,6 +1,6 @@ /* - * $Id: ipc.cc,v 1.24 2001/09/27 21:59:22 hno Exp $ + * $Id: ipc.cc,v 1.25 2001/10/17 19:43:39 hno Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -56,7 +56,7 @@ ipcCloseAllFD(int prfd, int pwfd, int crfd, int cwfd) } int -ipcCreate(int type, const char *prog, char *const args[], const char *name, int *rfd, int *wfd) +ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, int *wfd) { pid_t pid; struct sockaddr_in CS; diff --git a/src/protos.h b/src/protos.h index c8e08886cb..cabe09ce56 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.416 2001/10/17 12:41:49 hno Exp $ + * $Id: protos.h,v 1.417 2001/10/17 19:43:39 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -118,8 +118,8 @@ extern void cbdataUnlock(const void *p); /* Note: Allocations is done using the cbdataAlloc macro */ extern void *cbdataInternalFree(void *p); extern int cbdataValid(const void *p); -extern void cbdataInitType(cbdata_type type, char *label, int size, FREE * free_func); -extern cbdata_type cbdataAddType(cbdata_type type, char *label, int size, FREE * free_func); +extern void cbdataInitType(cbdata_type type, const char *label, int size, FREE * free_func); +extern cbdata_type cbdataAddType(cbdata_type type, const char *label, int size, FREE * free_func); extern int cbdataLocked(const void *p); extern void clientdbInit(void); @@ -1192,7 +1192,7 @@ extern void stringAppend(String * s, const char *buf, int len); */ extern int ipcCreate(int type, const char *prog, - char *const args[], + const char *const args[], const char *name, int *rfd, int *wfd); diff --git a/src/repl/heap/store_repl_heap.cc b/src/repl/heap/store_repl_heap.cc index 9c02798b16..bf8f9e6b8b 100644 --- a/src/repl/heap/store_repl_heap.cc +++ b/src/repl/heap/store_repl_heap.cc @@ -1,6 +1,6 @@ /* - * $Id: store_repl_heap.cc,v 1.7 2001/03/14 22:28:44 wessels Exp $ + * $Id: store_repl_heap.cc,v 1.8 2001/10/17 19:43:41 hno Exp $ * * DEBUG: section ? HEAP based removal policies * AUTHOR: Henrik Nordstrom @@ -255,7 +255,7 @@ createRemovalPolicy_heap(wordlist * args) { RemovalPolicy *policy; HeapPolicyData *heap_data; - char *keytype; + const char *keytype; /* Allocate the needed structures */ policy = cbdataAlloc(RemovalPolicy); heap_data = xcalloc(1, sizeof(*heap_data)); diff --git a/src/structs.h b/src/structs.h index d2d214475e..bd93a5086b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.403 2001/10/10 15:17:42 adrian Exp $ + * $Id: structs.h,v 1.404 2001/10/17 19:43:39 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1435,7 +1435,7 @@ struct _RemovalPolicyNode { }; struct _RemovalPolicy { - char *_type; + const char *_type; void *_data; void (*Free) (RemovalPolicy * policy); void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node); @@ -2153,7 +2153,7 @@ struct _Logfile { }; struct cache_dir_option { - char *name; + const char *name; void (*parse) (SwapDir * sd, const char *option, const char *value, int reconfiguring); void (*dump) (StoreEntry * e, const char *option, SwapDir * sd); };