From: wessels <> Date: Tue, 3 Feb 1998 11:21:10 +0000 (+0000) Subject: lint X-Git-Tag: SQUID_3_0_PRE1~4196 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a200bbd2e122baaa36d2deed6590c97de40961b7;p=thirdparty%2Fsquid.git lint --- diff --git a/src/access_log.cc b/src/access_log.cc index d38f14f4cc..409728bb11 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,7 +1,7 @@ /* - * $Id: access_log.cc,v 1.19 1998/02/02 21:14:54 wessels Exp $ + * $Id: access_log.cc,v 1.20 1998/02/03 04:21:10 wessels Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -198,7 +198,6 @@ accessLogOpen(const char *fname) LogfileStatus = LOG_ENABLE; } -#define SKIP_BASIC_SZ 6 void accessLogLog(AccessLogEntry * al) { diff --git a/src/acl.cc b/src/acl.cc index 8db7571eb8..34d24aa5e7 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.131 1998/02/02 21:59:43 wessels Exp $ + * $Id: acl.cc,v 1.132 1998/02/03 04:21:11 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -1081,7 +1081,6 @@ aclMatchIdent(wordlist * data, const char *ident) return 0; } -#define SKIP_BASIC_SZ 6 static int aclMatchProxyAuth(struct _acl_proxy_auth *p, aclCheck_t * checklist) { @@ -1784,7 +1783,7 @@ aclReadProxyAuth(struct _acl_proxy_auth *p) passwd = strtok(NULL, "\n"); debug(28, 5) ("aclReadProxyAuth: adding new passwords to hash table\n"); while (user != NULL) { - if (strlen(user) > 1 && passwd && strlen(passwd) > 1) { + if ((int)strlen(user) > 1 && passwd && (int) strlen(passwd) > 1) { debug(28, 6) ("aclReadProxyAuth: adding %s, %s to hash table\n", user, passwd); hash_insert(p->hash, xstrdup(user), (void *) xstrdup(passwd)); } diff --git a/src/asn.cc b/src/asn.cc index 4461d06ec1..2844992024 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,5 +1,5 @@ /* - * $Id: asn.cc,v 1.16 1998/02/02 21:16:17 wessels Exp $ + * $Id: asn.cc,v 1.17 1998/02/03 04:21:11 wessels Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -344,10 +344,8 @@ destroyRadixNode(struct radix_node *rn, void *w) static void destroyRadixNodeInfo(as_info * e_info) { - intlist *first, *prev; + intlist *prev = NULL; intlist *data = e_info->as_number; - first = data; - prev = NULL; while (data) { prev = data; data = data->next; diff --git a/src/client_side.cc b/src/client_side.cc index 7d576d1cf1..c8ad526fd0 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.202 1998/02/02 21:16:19 wessels Exp $ + * $Id: client_side.cc,v 1.203 1998/02/03 04:21:12 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -495,7 +495,7 @@ clientPurgeRequest(clientHttpRequest * http) http->http_code = HTTP_OK; } msg = httpReplyHeader(1.0, http->http_code, NULL, 0, 0, -1); - if (strlen(msg) < 8190) + if ((int)strlen(msg) < 8190) strcat(msg, "\r\n"); comm_write(fd, xstrdup(msg), strlen(msg), clientWriteComplete, http, xfree); } @@ -1004,7 +1004,7 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da comm_close(fd); } else if (entry->store_status == STORE_ABORTED) { comm_close(fd); - } else if ((done = clientCheckTransferDone(http)) || size == 0) { + } else if ((done = clientCheckTransferDone(http)) != 0 || size == 0) { debug(12, 5) ("clientWriteComplete: FD %d transfer is DONE\n", fd); /* We're finished case */ if (http->entry->mem_obj->reply->content_length < 0 || !done || diff --git a/src/defines.h b/src/defines.h index 68bbeed2e6..23063686a2 100644 --- a/src/defines.h +++ b/src/defines.h @@ -196,3 +196,5 @@ #define STORE_ENTRY_WITHOUT_MEMOBJ 0 #define STORE_SWAP_BUF DISK_PAGE_SIZE #define VM_WINDOW_SZ DISK_PAGE_SIZE + +#define SKIP_BASIC_SZ ((size_t) 6) diff --git a/src/fqdncache.cc b/src/fqdncache.cc index d8184ee942..0f9927901e 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.78 1998/01/12 04:30:37 wessels Exp $ + * $Id: fqdncache.cc,v 1.79 1998/02/03 04:21:13 wessels Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -928,7 +928,7 @@ var_fqdn_entry(struct variable *vp, oid * name, int *length, int exact, int i = 0; while (fq != NULL) { newname[vp->namelen] = i + 1; - result = compare(name, *length, newname, (int) vp->namelen + 1); + result = snmpCompare(name, *length, newname, (int) vp->namelen + 1); if ((exact && (result == 0)) || (!exact && (result < 0))) { debug(49, 5) ("snmp var_fqdn_entry: yup, a match.\n"); break; diff --git a/src/ftp.cc b/src/ftp.cc index fb91659a61..01d6041000 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.189 1998/02/02 21:16:25 wessels Exp $ + * $Id: ftp.cc,v 1.190 1998/02/03 04:21:14 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -548,7 +548,7 @@ ftpHtmlifyListEntry(char *line, FtpStateData * ftpState) size_t width = Config.Ftp.list_width; ftpListParts *parts; int flags = ftpState->flags; - if (strlen(line) > 1024) { + if ((int)strlen(line) > 1024) { snprintf(html, 8192, "%s\n", line); return html; } @@ -1487,7 +1487,7 @@ ftpReadPasv(FtpStateData * ftpState) ftpSendPort(ftpState); return; } - if (strlen(buf) > 1024) { + if ((int)strlen(buf) > 1024) { debug(9, 1) ("ftpReadPasv: Avoiding potential buffer overflow\n"); ftpSendPort(ftpState); return; @@ -1909,7 +1909,7 @@ ftpUrlWith2f(const request_t * request) if (request->port != urlDefaultPort(request->protocol)) snprintf(portbuf, 32, ":%d", request->port); loginbuf[0] = '\0'; - if (strlen(request->login) > 0) { + if ((int)strlen(request->login) > 0) { strcpy(loginbuf, request->login); if ((t = strchr(loginbuf, ':'))) *t = '\0'; diff --git a/src/http.cc b/src/http.cc index c95492e9d1..d5450fab23 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.234 1998/01/12 04:30:39 wessels Exp $ + * $Id: http.cc,v 1.235 1998/02/03 04:21:15 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -826,13 +826,13 @@ httpBuildRequestHeader(request_t * request, EBIT_SET(cc_flags, CCC_MAXAGE); } else if (strncasecmp(xbuf, "Via:", 4) == 0) { for (s = xbuf + 4; *s && isspace(*s); s++); - if (strlen(viabuf) + strlen(s) < 4000) + if ((int)strlen(viabuf) + (int)strlen(s) < 4000) strcat(viabuf, s); strcat(viabuf, ", "); continue; } else if (strncasecmp(xbuf, "X-Forwarded-For:", 16) == 0) { for (s = xbuf + 16; *s && isspace(*s); s++); - if (strlen(fwdbuf) + strlen(s) < 4000) + if ((int)strlen(fwdbuf) + (int)strlen(s) < 4000) strcat(fwdbuf, s); strcat(fwdbuf, ", "); continue; diff --git a/src/icmp.cc b/src/icmp.cc index c4edfca1c1..74cb82483e 100644 --- a/src/icmp.cc +++ b/src/icmp.cc @@ -1,6 +1,6 @@ /* - * $Id: icmp.cc,v 1.54 1998/01/31 05:31:58 wessels Exp $ + * $Id: icmp.cc,v 1.55 1998/02/03 04:21:16 wessels Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -130,7 +130,7 @@ icmpSend(int fd, void *data) { icmpQueueData *queue = data; int x; - while ((queue = IcmpQueueHead)) { + while ((queue = IcmpQueueHead) != NULL) { x = send(icmp_sock, queue->msg, queue->len, @@ -258,7 +258,7 @@ icmpClose(void) debug(29, 0) ("Closing Pinger socket on FD %d\n", icmp_sock); comm_close(icmp_sock); icmp_sock = -1; - while ((queue = IcmpQueueHead)) { + while ((queue = IcmpQueueHead) != NULL) { IcmpQueueHead = queue->next; if (queue->free_func) queue->free_func(queue->msg); diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 487509d58c..f18a2070cd 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -137,7 +137,6 @@ icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len) const cache_key *key; request_t *icp_request = NULL; int allow = 0; - int pkt_len; aclCheck_t checklist; icp_common_t *reply; int src_rtt = 0; @@ -183,7 +182,6 @@ icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len) entry = storeGet(key); debug(12, 5) ("icpHandleIcpV2: OPCODE %s\n", icp_opcode_str[header.opcode]); if (icpCheckUdpHit(entry, icp_request)) { - pkt_len = sizeof(icp_common_t) + strlen(url) + 1 + 2 + entry->object_len; reply = icpCreateMessage(ICP_HIT, flags, url, header.reqnum, src_rtt); icpUdpSend(fd, &from, reply, LOG_UDP_HIT, icp_request->protocol); break; diff --git a/src/ipcache.cc b/src/ipcache.cc index ca8b24ef92..fae8139d6a 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.153 1998/01/06 05:15:41 wessels Exp $ + * $Id: ipcache.cc,v 1.154 1998/02/03 04:21:17 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -1087,7 +1087,7 @@ var_ipcache_entry(struct variable *vp, oid * name, int *length, int exact, int * for (m = lru_list.head; m; m = m->next, cnt++) { newname[vp->namelen] = cnt; - result = compare(name, *length, newname, (int) vp->namelen + 1); + result = snmpCompare(name, *length, newname, (int) vp->namelen + 1); if ((exact && (result == 0)) || (!exact && (result < 0))) { debug(49, 5) ("snmp var_ipcache_entry: yup, a match.\n"); break; diff --git a/src/net_db.cc b/src/net_db.cc index a30f0fc91a..5e2caeaa3e 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.60 1998/01/12 04:30:06 wessels Exp $ + * $Id: net_db.cc,v 1.61 1998/02/03 04:21:18 wessels Exp $ * * DEBUG: section 37 Network Measurement Database * AUTHOR: Duane Wessels @@ -125,7 +125,7 @@ static void netdbRelease(netdbEntry * n) { net_db_name *x; - net_db_name *next; + net_db_name *next = NULL; for (x = n->hosts; x; x = next) { next = x->next; netdbHashUnlink(x->name); @@ -347,7 +347,7 @@ netdbSaveState(void *foo) return; } next = (netdbEntry *) hash_first(addr_table); - while ((n = next)) { + while ((n = next) != NULL) { next = (netdbEntry *) hash_next(addr_table); if (n->pings_recv == 0) continue; @@ -519,7 +519,7 @@ netdbFreeMemory(void) } for (j = 0; j < i; j++) { n = *(L1 + j); - while ((x = n->hosts)) { + while ((x = n->hosts) != NULL) { n->hosts = x->next; safe_free(x); } @@ -701,7 +701,7 @@ var_netdb_entry(struct variable *vp, oid * name, int *length, int exact, int *va n = (netdbEntry *) hash_first(addr_table); while (n != NULL) { newname[vp->namelen] = cnt++; - result = compare(name, *length, newname, (int) vp->namelen + 1); + result = snmpCompare(name, *length, newname, (int) vp->namelen + 1); if ((exact && (result == 0)) || (!exact && (result < 0))) { debug(49, 5) ("snmp var_netdb_entry: yup, a match.\n"); break; diff --git a/src/peer_select.cc b/src/peer_select.cc index cf1b832e91..77f6473c2f 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.36 1998/01/31 05:32:03 wessels Exp $ + * $Id: peer_select.cc,v 1.37 1998/02/03 04:21:19 wessels Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -328,12 +328,12 @@ peerSelectFoo(ps_state * psstate) debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], request->host); hierarchyNote(&request->hier, code, &psstate->icp, request->host); peerSelectCallback(psstate, NULL); - } else if ((p = psstate->closest_parent_miss)) { + } else if ((p = psstate->closest_parent_miss) != NULL) { code = CLOSEST_PARENT_MISS; debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host); hierarchyNote(&request->hier, code, &psstate->icp, p->host); peerSelectCallback(psstate, p); - } else if ((p = psstate->first_parent_miss)) { + } else if ((p = psstate->first_parent_miss) != NULL) { code = FIRST_PARENT_MISS; debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host); hierarchyNote(&request->hier, code, &psstate->icp, p->host); diff --git a/src/pinger.cc b/src/pinger.cc index f234a5c59f..bd618b254b 100644 --- a/src/pinger.cc +++ b/src/pinger.cc @@ -1,6 +1,6 @@ /* - * $Id: pinger.cc,v 1.29 1998/01/31 05:32:03 wessels Exp $ + * $Id: pinger.cc,v 1.30 1998/02/03 04:21:19 wessels Exp $ * * DEBUG: section 42 ICMP Pinger program * AUTHOR: Duane Wessels @@ -135,7 +135,6 @@ pingerSendEcho(struct in_addr to, int opcode, char *payload, int len) struct icmphdr *icmp = NULL; icmpEchoData *echo; int icmp_pktsize = sizeof(struct icmphdr); - int x; struct sockaddr_in S; memset(pkt, '\0', MAX_PKT_SZ); icmp = (struct icmphdr *) (void *) pkt; @@ -143,7 +142,7 @@ pingerSendEcho(struct in_addr to, int opcode, char *payload, int len) icmp->icmp_code = 0; icmp->icmp_cksum = 0; icmp->icmp_id = icmp_ident; - icmp->icmp_seq = icmp_pkts_sent++; + icmp->icmp_seq = (u_short) icmp_pkts_sent++; echo = (icmpEchoData *) (icmp + 1); echo->opcode = (unsigned char) opcode; echo->tv = current_time; @@ -158,7 +157,7 @@ pingerSendEcho(struct in_addr to, int opcode, char *payload, int len) S.sin_family = AF_INET; S.sin_addr = to; S.sin_port = 0; - x = sendto(icmp_sock, + sendto(icmp_sock, pkt, icmp_pktsize, 0, diff --git a/src/protos.h b/src/protos.h index 3fa15e1e1f..d8fdc600e0 100644 --- a/src/protos.h +++ b/src/protos.h @@ -247,6 +247,7 @@ extern int create_view(char **); extern int create_user(char **); extern int create_community(char **); extern void tokenize(char *, char **, int); +extern int snmpCompare(oid * name1, int len1, oid * name2, int len2); #endif /* SQUID_SNMP */ extern void AppendUdp(icpUdpData *); @@ -516,8 +517,8 @@ extern void storeConvertFile(const cache_key * key, time_t timestamp, time_t lastref, time_t lastmod, - u_num32 refcount, - u_num32 flags, + u_short refcount, + u_short flags, int clean); extern int storeGetNextFile(int *sfileno, int *size); extern StoreEntry * storeAddDiskRestore(const cache_key * key, diff --git a/src/recv-announce.cc b/src/recv-announce.cc index b37733ac82..0a43ac1387 100644 --- a/src/recv-announce.cc +++ b/src/recv-announce.cc @@ -1,7 +1,7 @@ /* - * $Id: recv-announce.cc,v 1.16 1998/02/02 21:16:28 wessels Exp $ + * $Id: recv-announce.cc,v 1.17 1998/02/03 04:21:20 wessels Exp $ * * DEBUG: section 0 Announcement Server * AUTHOR: Harvest Derived @@ -182,7 +182,7 @@ main(int argc, char *argv[]) dup(1); - while (1) { + for(;;) { memset(buf, '\0', RECV_BUF_SIZE); memset(&R, '\0', len = sizeof(R)); diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index e6b65696bc..44519d64d5 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -40,7 +40,6 @@ void snmp_input(); void snmp_trap(); int create_identical(); int parse_var_op_list(); -void setVariable(); struct pbuf *definitelyGetBuf(); int get_community(); @@ -66,16 +65,16 @@ u_long _agentSize; /* fwd: */ -static int check_auth(); -static int bulk_var_op_list(); -static int goodValue(); +static int check_auth(struct snmp_session *, u_char *, int, u_char *, int, usecEntry **); +static int bulk_var_op_list(u_char *, int, u_char *, int, int, int, long *); +static int goodValue(u_char, int, u_char, int); +static void setVariable(u_char *, u_char, int, u_char *, int); /* from usec.c: */ extern void increment_stat(); extern void create_report(); extern void md5Digest(); extern int parse_parameters(); - int init_agent_auth(void) { @@ -124,13 +123,12 @@ init_agent_auth(void) } int -snmp_agent_parse(sn_data, length, out_sn_data, out_length, sourceip, ireqid) - u_char *sn_data; - int length; - u_char *out_sn_data; - int *out_length; - u_long sourceip; /* possibly for authentication */ - long *ireqid; +snmp_agent_parse(u_char *sn_data, + int length, + u_char *out_sn_data, + int *out_length, + u_long sourceip, /* possibly for authentication */ + long *ireqid) { u_char msgtype, type; long zero = 0; @@ -171,7 +169,7 @@ snmp_agent_parse(sn_data, length, out_sn_data, out_length, sourceip, ireqid) } if (ret < 0) { increment_stat(-ret); - if ((sn_data = asn_parse_header(sn_data, &length, &msgtype)) + if ((sn_data = asn_parse_header(sn_data, &length, &msgtype)) != NULL && asn_parse_int(sn_data, &length, &type, &reqid, sizeof(reqid))) { if (msgtype == REPORT_MSG) return 0; @@ -309,7 +307,7 @@ snmp_agent_parse(sn_data, length, out_sn_data, out_length, sourceip, ireqid) if (errstat == SNMP_ERR_NOSUCHNAME) { /* see if we have forwarding turned on */ - if (Config.Snmp.localPort > 0) { + if (Config.Snmp.localPort != 0) { *ireqid = reqid; return 2; } @@ -421,14 +419,13 @@ snmp_agent_parse(sn_data, length, out_sn_data, out_length, sourceip, ireqid) * If any error occurs, an error code is returned. */ int -parse_var_op_list(sn_data, length, out_sn_data, out_length, index, msgtype, action) - u_char *sn_data; - int length; - u_char *out_sn_data; - int out_length; - long *index; - int msgtype; - int action; +parse_var_op_list(u_char *sn_data, + int length, + u_char *out_sn_data, + int out_length, + long *index, + int msgtype, + int action) { u_char type; oid var_name[MAX_NAME_LEN]; @@ -609,11 +606,11 @@ parse_var_op_list(sn_data, length, out_sn_data, out_length, index, msgtype, acti * Returns 1 upon success and 0 upon failure. */ int -create_identical(snmp_in, snmp_out, snmp_length, errstat, errindex) - u_char *snmp_in; - u_char *snmp_out; - int snmp_length; - long errstat, errindex; +create_identical(u_char *snmp_in, + u_char *snmp_out, + int snmp_length, + long errstat, + long errindex) { u_char *sn_data; u_char type; @@ -657,13 +654,12 @@ create_identical(snmp_in, snmp_out, snmp_length, errstat, errindex) } static int -check_auth(session, sn_data, length, pp, plen, ueret) - struct snmp_session *session; - u_char *sn_data; - int length; - u_char *pp; - int plen; - usecEntry **ueret; +check_auth(struct snmp_session *session, + u_char *sn_data, + int length, + u_char *pp, + int plen, + usecEntry **ueret) { usecEntry *ue; Parameters params; @@ -709,7 +705,7 @@ check_auth(session, sn_data, length, pp, plen, ueret) /* verify that the requested qoS is supported by the userName */ - if ((params.qoS & USEC_QOS_AUTHPRIV) > ue->qoS) + if ((u_char) (params.qoS & USEC_QOS_AUTHPRIV) > ue->qoS) return -USEC_STAT_UNSUPPORTED_QOS; xmemcpy(session->authKey, ue->authKey, 16); @@ -747,14 +743,13 @@ check_auth(session, sn_data, length, pp, plen, ueret) } int -get_community(sessionid) - u_char *sessionid; +get_community(char *sessionid) { communityEntry *cp; debug(49, 5) ("get_community: %s\n", sessionid); for (cp = Config.Snmp.communities; cp; cp = cp->next) { debug(49, 5) ("get_community: %s\n", cp->name); - if (!strcmp(cp->name, (char *) sessionid)) + if (!strcmp(cp->name, sessionid)) break; } @@ -772,9 +767,7 @@ get_community(sessionid) } static int -goodValue(inType, inLen, actualType, actualLen) - u_char inType, actualType; - int inLen, actualLen; +goodValue(u_char inType, int inLen, u_char actualType, int actualLen) { if (inLen > actualLen) return FALSE; @@ -782,13 +775,12 @@ goodValue(inType, inLen, actualType, actualLen) } -void -setVariable(var_val, var_val_type, var_val_len, statP, statLen) - u_char *var_val; - u_char var_val_type; - int var_val_len; - u_char *statP; - int statLen; +static void +setVariable(u_char *var_val, + u_char var_val_type, + int var_val_len, + u_char *statP, + int statLen) { int buffersize = 1000; @@ -817,14 +809,13 @@ struct repeater { static int -bulk_var_op_list(sn_data, length, out_sn_data, out_length, non_repeaters, max_repetitions, index) - u_char *sn_data; - int length; - u_char *out_sn_data; - int out_length; - int non_repeaters; - int max_repetitions; - long *index; +bulk_var_op_list(u_char *sn_data, + int length, + u_char *out_sn_data, + int out_length, + int non_repeaters, + int max_repetitions, + long *index) { u_char type; oid var_name[MAX_NAME_LEN]; diff --git a/src/stat.cc b/src/stat.cc index 81b56bbbf5..f710a264f7 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.189 1998/02/03 01:17:07 wessels Exp $ + * $Id: stat.cc,v 1.190 1998/02/03 04:21:24 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -267,7 +267,7 @@ statObjects(StoreEntry * sentry, int vm_or_not) int i; struct _store_client *sc; next = (StoreEntry *) hash_first(store_table); - while (entry = next) { + while ((entry = next) != NULL) { next = (StoreEntry *) hash_next(store_table); mem = entry->mem_obj; if (vm_or_not && mem == NULL) diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index b235051607..72cdfaed3f 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -2,14 +2,16 @@ #define STORE_META_BUFSZ 4096 +struct _rebuild_dir { + int dirn; + FILE *log; + int speed; + int clean; + struct _rebuild_dir *next; +}; + struct storeRebuildState { - struct _rebuild_dir { - int dirn; - FILE *log; - int speed; - int clean; - struct _rebuild_dir *next; - } *rebuild_dir; + struct _rebuild_dir *rebuild_dir; int objcount; /* # objects successfully reloaded */ int expcount; /* # objects expired */ int linecount; /* # lines parsed from cache logfile */ @@ -192,8 +194,8 @@ storeConvertFile(const cache_key * key, time_t timestamp, time_t lastref, time_t lastmod, - u_num32 refcount, - u_num32 flags, + u_short refcount, + u_short flags, int clean) { int fd_r, fd_w; @@ -287,11 +289,11 @@ storeGetNextFile(int *sfileno, int *size) debug(20, 3) ("storeGetNextFile: empty dir.\n"); #endif in_dir = 0; - if ((curlvl2 = (curlvl2 + 1) % Config.cacheSwap.swapDirs[dirn].l2)) + if ((curlvl2 = (curlvl2 + 1) % Config.cacheSwap.swapDirs[dirn].l2) != 0) continue; - if ((curlvl1 = (curlvl1 + 1) % Config.cacheSwap.swapDirs[dirn].l1)) + if ((curlvl1 = (curlvl1 + 1) % Config.cacheSwap.swapDirs[dirn].l1) != 0) continue; - if ((dirn = (dirn + 1) % Config.cacheSwap.n_configured)) + if ((dirn = (dirn + 1) % Config.cacheSwap.n_configured) != 0) continue; else done = 1; @@ -510,8 +512,8 @@ storeDoConvertFromLog(void *data) timestamp, lastref, lastmod, - (u_num32) scan6, /* refcount */ - (u_num32) scan7, /* flags */ + (u_short) scan6, /* refcount */ + (u_short) scan7, /* flags */ d->clean); #if 0 storeDirSwapLog(e); diff --git a/src/store_swapmeta.cc b/src/store_swapmeta.cc index dd687fbf57..8d30e649f6 100644 --- a/src/store_swapmeta.cc +++ b/src/store_swapmeta.cc @@ -7,7 +7,6 @@ int storeBuildMetaData(StoreEntry * e, char *swap_buf_c) { MemObject *mem; - int keylength; int a = STORE_META_TLD_START; char *meta_buf; mem = e->mem_obj; @@ -18,14 +17,10 @@ storeBuildMetaData(StoreEntry * e, char *swap_buf_c) meta_buf = mem->swapout.meta_buf = xmalloc(1024); /* construct header */ /* add Length(int)-Type(char)-Data encoded info */ - if (squid_key_size < 0) - keylength = strlen(e->key); - else - keylength = squid_key_size; meta_buf[0] = META_OK; xmemcpy(&meta_buf[1], &a, sizeof(int)); mem->swapout.meta_len = STORE_META_TLD_START; - addSwapHdr(STORE_META_KEY, keylength, (void *) e->key, + addSwapHdr(STORE_META_KEY, squid_key_size, (void *) e->key, mem->swapout.meta_buf, &mem->swapout.meta_len); addSwapHdr(STORE_META_STD, STORE_HDR_METASIZE, (void *) &e->timestamp, mem->swapout.meta_buf, &mem->swapout.meta_len); diff --git a/src/url.cc b/src/url.cc index 46160eca47..dee6201845 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.74 1998/01/12 04:30:16 wessels Exp $ + * $Id: url.cc,v 1.75 1998/02/03 04:21:26 wessels Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -347,7 +347,7 @@ urlCanonicalClean(const request_t * request) if (request->port != urlDefaultPort(request->protocol)) snprintf(portbuf, 32, ":%d", request->port); loginbuf[0] = '\0'; - if (strlen(request->login) > 0) { + if ((int) strlen(request->login) > 0) { strcpy(loginbuf, request->login); if ((t = strchr(loginbuf, ':'))) *t = '\0';