]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Many small compiler warning fixes, mainly const strings
authorhno <>
Thu, 18 Oct 2001 02:25:01 +0000 (02:25 +0000)
committerhno <>
Thu, 18 Oct 2001 02:25:01 +0000 (02:25 +0000)
19 files changed:
src/authenticate.cc
src/cachemgr.cc
src/client.cc
src/client_side.cc
src/comm.cc
src/ftp.cc
src/globals.h
src/helper.cc
src/http.cc
src/ipc.cc
src/neighbors.cc
src/peer_select.cc
src/protos.h
src/snmp_agent.cc
src/store.cc
src/store_log.cc
src/structs.h
src/tools.cc
src/unlinkd.cc

index 8a918b56298e28a9e4a2eed5bff6b1ca30029caa..5464b3af17d3bfc6f8dbc6256be1354f28bac592 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: authenticate.cc,v 1.30 2001/10/03 20:12:47 hno Exp $
+ * $Id: authenticate.cc,v 1.31 2001/10/17 20:25:01 hno Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -931,7 +931,7 @@ authenticateUserCacheRestart(void)
  * called to add another auth scheme module
  */
 void
-authSchemeAdd(char *type, AUTHSSETUP * setup)
+authSchemeAdd(const char *type, AUTHSSETUP * setup)
 {
     int i;
     debug(29, 4) ("authSchemeAdd: adding %s\n", type);
index 82e5dd482256ecb5369c89bac74d7024237b1dec..a340bf1f2a684858bed5c9244151c45e035036b7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cachemgr.cc,v 1.89 2001/08/31 11:19:12 robertc Exp $
+ * $Id: cachemgr.cc,v 1.90 2001/10/17 20:25:01 hno Exp $
  *
  * DEBUG: section 0     CGI Cache Manager
  * AUTHOR: Duane Wessels
@@ -163,9 +163,9 @@ static struct in_addr no_addr;
  */
 #define safe_free(str) { if (str) { xfree(str); (str) = NULL; } }
 static const char *safe_str(const char *str);
-static char *xstrtok(char **str, char del);
+static const char *xstrtok(char **str, char del);
 static void print_trailer(void);
-static void auth_html(char *host, int port, const char *user_name);
+static void auth_html(const char *host, int port, const char *user_name);
 static void error_html(const char *msg);
 static char *menu_url(cachemgr_request * req, const char *action);
 static int parse_status_line(const char *sline, const char **statusStr);
@@ -192,7 +192,7 @@ is_number(const char *str)
     return strspn(str, "\t -+01234567890./\n") == strlen(str);
 }
 
-static char *
+static const char *
 xstrtok(char **str, char del)
 {
     if (*str) {
@@ -226,7 +226,7 @@ print_trailer(void)
 }
 
 static void
-auth_html(char *host, int port, const char *user_name)
+auth_html(const char *host, int port, const char *user_name)
 {
     if (!user_name)
        user_name = "";
index a044ca154baf6b2f4c69362b4584fe75d8254c00..e860047e9f5bd1a058ef5352ff7baacd45fd2917 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client.cc,v 1.93 2001/02/23 20:59:50 hno Exp $
+ * $Id: client.cc,v 1.94 2001/10/17 20:25:01 hno Exp $
  *
  * DEBUG: section 0     WWW Client
  * AUTHOR: Harvest Derived
@@ -40,8 +40,8 @@
 #endif
 
 /* Local functions */
-static int client_comm_bind(int, char *);
-static int client_comm_connect(int, char *, u_short, struct timeval *);
+static int client_comm_bind(int, const char *);
+static int client_comm_connect(int, const char *, u_short, struct timeval *);
 static void usage(const char *progname);
 static int Now(struct timeval *);
 static SIGHDLR catch;
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
     int keep_alive = 0;
     int opt_noaccept = 0;
     int opt_verbose = 0;
-    char *hostname, *localhost;
+    const char *hostname, *localhost;
     char url[BUFSIZ], msg[BUFSIZ], buf[BUFSIZ];
     char extra_hdrs[BUFSIZ];
     const char *method = "GET";
@@ -355,7 +355,7 @@ main(int argc, char *argv[])
 }
 
 static int
-client_comm_bind(int sock, char *local_host)
+client_comm_bind(int sock, const char *local_host)
 {
     static const struct hostent *hp = NULL;
     static struct sockaddr_in from_addr;
@@ -374,7 +374,7 @@ client_comm_bind(int sock, char *local_host)
 }
 
 static int
-client_comm_connect(int sock, char *dest_host, u_short dest_port, struct timeval *tvp)
+client_comm_connect(int sock, const char *dest_host, u_short dest_port, struct timeval *tvp)
 {
     static const struct hostent *hp = NULL;
     static struct sockaddr_in to_addr;
index 77d433f21c26368bbb967dd8a1e56fb73eab4fa8..13a38608fb225e851032698e2f282c99ecc75c85 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.547 2001/10/12 23:33:01 hno Exp $
+ * $Id: client_side.cc,v 1.548 2001/10/17 20:25:01 hno Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -2559,7 +2559,7 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status,
        if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) {
            int vport;
            char *q;
-           char *protocol_name = "http";
+           const char *protocol_name = "http";
            if (vport_mode)
                vport = (int) ntohs(http->conn->me.sin_port);
            else
index 0156980fb24d495c699845667ef44cc5d972bf84..3960c40c39a642c6b891d8fd9f39e037f0a18e0f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.321 2001/10/10 15:17:40 adrian Exp $
+ * $Id: comm.cc,v 1.322 2001/10/17 20:25:01 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -920,7 +920,7 @@ commHandleWrite(int fd, void *data)
 /* Select for Writing on FD, until SIZE bytes are sent.  Call
  * *HANDLER when complete. */
 void
-comm_write(int fd, char *buf, int size, CWCB * handler, void *handler_data, FREE * free_func)
+comm_write(int fd, const char *buf, int size, CWCB * handler, void *handler_data, FREE * free_func)
 {
     CommWriteStateData *state = fd_table[fd].rwstate;
     debug(5, 5) ("comm_write: FD %d: sz %d: hndl %p: data %p.\n",
@@ -931,7 +931,7 @@ comm_write(int fd, char *buf, int size, CWCB * handler, void *handler_data, FREE
        fd_table[fd].rwstate = NULL;
     }
     fd_table[fd].rwstate = state = memPoolAlloc(comm_write_pool);
-    state->buf = buf;
+    state->buf = (char *) buf;
     state->size = size;
     state->offset = 0;
     state->handler = handler;
index 1010c56c065c5d74acb95699589f25d633bc59f6..261d3fa9aa77c9e10cd6091d0c4e01b0687dc725 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.312 2001/10/10 15:17:41 adrian Exp $
+ * $Id: ftp.cc,v 1.313 2001/10/17 20:25:02 hno Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -163,7 +163,7 @@ static void ftpHackShortcut(FtpStateData * ftpState, FTPSM * nextState);
 static void ftpUnhack(FtpStateData * ftpState);
 static void ftpScheduleReadControlReply(FtpStateData *, int);
 static void ftpHandleControlReply(FtpStateData *);
-static char *ftpHtmlifyListEntry(char *line, FtpStateData * ftpState);
+static char *ftpHtmlifyListEntry(const char *line, FtpStateData * ftpState);
 static void ftpFailed(FtpStateData *, err_type);
 static void ftpFailedErrorMessage(FtpStateData *, err_type);
 
@@ -635,7 +635,7 @@ dots_fill(size_t len)
 }
 
 static char *
-ftpHtmlifyListEntry(char *line, FtpStateData * ftpState)
+ftpHtmlifyListEntry(const char *line, FtpStateData * ftpState)
 {
     LOCAL_ARRAY(char, icon, 2048);
     LOCAL_ARRAY(char, href, 2048 + 40);
@@ -687,7 +687,7 @@ ftpHtmlifyListEntry(char *line, FtpStateData * ftpState)
        return html;
     }
     if ((parts = ftpListParseParts(line, ftpState->flags)) == NULL) {
-       char *p;
+       const char *p;
        snprintf(html, 8192, "%s\n", line);
        for (p = line; *p && xisspace(*p); p++);
        if (*p && !xisspace(*p))
@@ -2378,7 +2378,7 @@ static void
 ftpFailedErrorMessage(FtpStateData * ftpState, err_type error)
 {
     ErrorState *err;
-    char *command, *reply;
+    const char *command, *reply;
     /* Translate FTP errors into HTTP errors */
     err = NULL;
     switch (error) {
@@ -2471,8 +2471,8 @@ ftpSendReply(FtpStateData * ftpState)
 static void
 ftpAppendSuccessHeader(FtpStateData * ftpState)
 {
-    char *mime_type = NULL;
-    char *mime_enc = NULL;
+    const char *mime_type = NULL;
+    const char *mime_enc = NULL;
     String urlpath = ftpState->request->urlpath;
     const char *filename = NULL;
     const char *t = NULL;
index 5600fdbb8f24c802d72c8e626fc2fd38272e00a1..f67ac28f5e6890f9a0a4fe4dbe34cc90141441ba 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.107 2001/10/08 16:18:32 hno Exp $
+ * $Id: globals.h,v 1.108 2001/10/17 20:25:02 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -39,7 +39,7 @@ extern SquidConfig Config;
 extern SquidConfig2 Config2;
 extern char *ConfigFile;       /* NULL */
 extern char *IcpOpcodeStr[];
-extern char *dns_error_message;        /* NULL */
+extern const char *dns_error_message;  /* NULL */
 extern const char *log_tags[];
 extern char tmp_error_buf[ERROR_BUF_SZ];
 extern char *volatile debug_options;   /* NULL */
index 6186d9e5c7b411befd52802581a3c0145e6f6a71..251b121e375321e594bf53d1a7591417c642de5b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: helper.cc,v 1.30 2001/08/29 14:57:35 robertc Exp $
+ * $Id: helper.cc,v 1.31 2001/10/17 20:25:02 hno Exp $
  *
  * DEBUG: section 29    Helper process maintenance
  * AUTHOR: Harvest Derived?
@@ -64,7 +64,7 @@ helperOpenServers(helper * hlp)
     char *progname;
     char *shortname;
     char *procname;
-    char *args[HELPER_MAX_ARGS];
+    const char *args[HELPER_MAX_ARGS];
     char fd_note_buf[FD_DESC_SZ];
     helper_server *srv;
     int nargs = 0;
@@ -140,7 +140,7 @@ helperStatefulOpenServers(statefulhelper * hlp)
     char *progname;
     char *shortname;
     char *procname;
-    char *args[HELPER_MAX_ARGS];
+    const char *args[HELPER_MAX_ARGS];
     char fd_note_buf[FD_DESC_SZ];
     helper_stateful_server *srv;
     int nargs = 0;
index 6935ca923bcf0888346a6d9470c716f1709f4faa..8b1e3579a65dc3ec1b5c3d30b4c22350757316e1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.382 2001/09/18 19:04:28 hno Exp $
+ * $Id: http.cc,v 1.383 2001/10/17 20:25:02 hno Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -878,7 +878,7 @@ httpBuildRequestHeader(request_t * request,
        if (*orig_request->peer_login == '*') {
            /* Special mode, to pass the username to the upstream cache */
            char loginbuf[256];
-           char *username = "-";
+           const char *username = "-";
            if (orig_request->auth_user_request)
                username = authenticateUserRequestUsername(orig_request->auth_user_request);
            snprintf(loginbuf, sizeof(loginbuf), "%s%s", username, orig_request->peer_login + 1);
index 80a3a85788cfc2d8fd450f85970a2760c2d21238..b8638d45306ecfc18c1c84438ad1aafc61b82777 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipc.cc,v 1.25 2001/10/17 19:43:39 hno Exp $
+ * $Id: ipc.cc,v 1.26 2001/10/17 20:25:02 hno Exp $
  *
  * DEBUG: section 54    Interprocess Communication
  * AUTHOR: Duane Wessels
@@ -281,7 +281,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
 #if HAVE_SETSID
     setsid();
 #endif
-    execvp(prog, args);
+    execvp(prog, (char *const *) args);
     debug_log = fdopen(2, "a+");
     debug(50, 0) ("ipcCreate: %s: %s\n", prog, xstrerror());
     _exit(1);
index 8b6c07b71a1362afa97e1404809f825753adee8a..b23f15dd157f8d95e83b1470883d6f4bcaf82de2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.298 2001/10/10 15:17:41 adrian Exp $
+ * $Id: neighbors.cc,v 1.299 2001/10/17 20:25:02 hno Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -66,7 +66,7 @@ static u_short echo_port;
 static int NLateReplies = 0;
 static peer *first_ping = NULL;
 
-char *
+const char *
 neighborTypeStr(const peer * p)
 {
     if (p->type == PEER_NONE)
index 62526c9465fdfeb12d547265fc934000b37a75ad..d5b31b9c46447cc62bacc72ee7b29c3333295841 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.115 2001/04/14 00:25:18 hno Exp $
+ * $Id: peer_select.cc,v 1.116 2001/10/17 20:25:02 hno Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -66,7 +66,7 @@ static struct {
     int timeouts;
 } PeerStats;
 
-static char *DirectStr[] =
+static const char *DirectStr[] =
 {
     "DIRECT_UNKNOWN",
     "DIRECT_NO",
index cabe09ce56704610c844f48c915c1a19730032d7..0e0e88d6c9847216c4f1581833f88a188ab61449 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.417 2001/10/17 19:43:39 hno Exp $
+ * $Id: protos.h,v 1.418 2001/10/17 20:25:03 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -163,7 +163,7 @@ extern void comm_add_close_handler(int fd, PF *, void *);
 extern void comm_remove_close_handler(int fd, PF *, void *);
 extern int comm_udp_sendto(int, const struct sockaddr_in *, int, const void *, int);
 extern void comm_write(int fd,
-    char *buf,
+    const char *buf,
     int size,
     CWCB * handler,
     void *handler_data,
@@ -666,7 +666,7 @@ extern void peerNoteDigestLookup(request_t * request, peer * p, lookup_t lookup)
 extern void peerNoteDigestGone(peer * p);
 extern int neighborUp(const peer * e);
 extern CBDUNL peerDestroy;
-extern char *neighborTypeStr(const peer * e);
+extern const char *neighborTypeStr(const peer * e);
 extern peer_t neighborType(const peer *, const request_t *);
 extern void peerConnectFailed(peer *);
 extern void peerConnectSucceded(peer *);
@@ -769,7 +769,7 @@ extern char *authenticateUserUsername(auth_user_t *);
 extern char *authenticateUserRequestUsername(auth_user_request_t *);
 extern int authenticateValidateUser(auth_user_request_t *);
 extern void authenticateOnCloseConnection(ConnStateData * conn);
-extern void authSchemeAdd(char *type, AUTHSSETUP * setup);
+extern void authSchemeAdd(const char *type, AUTHSSETUP * setup);
 
 extern void refreshAddToList(const char *, int, time_t, int, time_t);
 extern int refreshIsCachable(const StoreEntry *);
@@ -929,8 +929,8 @@ extern void storeHeapPositionUpdate(StoreEntry *, SwapDir *);
 extern void storeSwapFileNumberSet(StoreEntry * e, sfileno filn);
 extern void storeFsInit(void);
 extern void storeFsDone(void);
-extern void storeFsAdd(char *, STSETUP *);
-extern void storeReplAdd(char *, REMOVALPOLICYCREATE *);
+extern void storeFsAdd(const char *, STSETUP *);
+extern void storeReplAdd(const char *, REMOVALPOLICYCREATE *);
 
 /* store_modules.c */
 extern void storeFsSetup(void);
@@ -1082,7 +1082,7 @@ extern int intAverage(int, int, int, int);
 extern double doubleAverage(double, double, int, int);
 extern void debug_trap(const char *);
 extern void logsFlush(void);
-extern char *checkNullString(char *p);
+extern const char *checkNullString(const char *p);
 extern void squid_getrusage(struct rusage *r);
 extern double rusage_cputime(struct rusage *r);
 extern int rusage_maxrss(struct rusage *r);
index cd101f6a4b4fe893148d7661041a01d557104215..4d637d1f60c394a23015c2fd233d2bb902e47f93 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: snmp_agent.cc,v 1.81 2001/08/31 11:19:12 robertc Exp $
+ * $Id: snmp_agent.cc,v 1.82 2001/10/17 20:25:03 hno Exp $
  *
  * DEBUG: section 49     SNMP Interface
  * AUTHOR: Kostas Anagnostakis
@@ -77,7 +77,7 @@ variable_list *
 snmp_confFn(variable_list * Var, snint * ErrP)
 {
     variable_list *Answer = NULL;
-    char *cp = NULL;
+    const char *cp = NULL;
     debug(49, 5) ("snmp_confFn: Processing request with magic %d!\n", Var->name[8]);
     *ErrP = SNMP_ERR_NOERROR;
     switch (Var->name[LEN_SQ_CONF]) {
index ce70b6e6818dac0bf406907588ccb5e3123eadd4..253c768daf0db94a4e82b1bc2078f8d01ed2c7f7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.541 2001/09/07 18:02:46 adrian Exp $
+ * $Id: store.cc,v 1.542 2001/10/17 20:25:03 hno Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -1319,7 +1319,7 @@ storeFsDone(void)
  * called to add another store fs module
  */
 void
-storeFsAdd(char *type, STSETUP * setup)
+storeFsAdd(const char *type, STSETUP * setup)
 {
     int i;
     /* find the number of currently known storefs types */
@@ -1338,7 +1338,7 @@ storeFsAdd(char *type, STSETUP * setup)
  * called to add another store removal policy module
  */
 void
-storeReplAdd(char *type, REMOVALPOLICYCREATE * create)
+storeReplAdd(const char *type, REMOVALPOLICYCREATE * create)
 {
     int i;
     /* find the number of currently known repl types */
index c0ca87ac1bf422d045edf6b3affdf52eeba1cb58..0b5684cdbd47d316a4c2a32caff6a2fc9ac8f2c4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_log.cc,v 1.22 2001/02/17 07:28:50 hno Exp $
+ * $Id: store_log.cc,v 1.23 2001/10/17 20:25:03 hno Exp $
  *
  * DEBUG: section 20    Storage Manager Logging Functions
  * AUTHOR: Duane Wessels
@@ -35,7 +35,7 @@
 
 #include "squid.h"
 
-static char *storeLogTags[] =
+static const char *storeLogTags[] =
 {
     "CREATE",
     "SWAPIN",
index bd93a5086bf9908202c073646cfa948104c84b88..9f59b60f004f480b6d8f677bee2ca3e09ef0143b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.404 2001/10/17 19:43:39 hno Exp $
+ * $Id: structs.h,v 1.405 2001/10/17 20:25:03 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -146,7 +146,7 @@ struct _auth_user_request_t {
  */
 
 struct _authscheme_entry {
-    char *typestr;
+    const char *typestr;
     AUTHSACTIVE *Active;
     AUTHSADDHEADER *AddHeader;
     AUTHSADDTRAILER *AddTrailer;
@@ -177,7 +177,7 @@ struct _authscheme_entry {
 /* private data types */
 struct _authScheme {
     /* pointer to the authscheme_list's string entry */
-    char *typestr;
+    const char *typestr;
     /* the scheme id in the authscheme_list */
     int Id;
     /* the scheme's configuration details. */
@@ -1520,7 +1520,7 @@ struct _StoreEntry {
 };
 
 struct _SwapDir {
-    char *type;
+    const char *type;
     int cur_size;
     int low_size;
     int max_size;
@@ -1658,7 +1658,7 @@ struct _cachemgr_passwd {
 };
 
 struct _refresh_t {
-    char *pattern;
+    const char *pattern;
     regex_t compiled_pattern;
     time_t min;
     double pct;
@@ -2108,7 +2108,7 @@ struct _store_rebuild_data {
  */
 
 struct _storefs_entry {
-    char *typestr;
+    const char *typestr;
     STFSPARSE *parsefunc;
     STFSRECONFIGURE *reconfigurefunc;
     STFSSHUTDOWN *donefunc;
@@ -2119,7 +2119,7 @@ struct _storefs_entry {
  */
 
 struct _storerepl_entry {
-    char *typestr;
+    const char *typestr;
     REMOVALPOLICYCREATE *create;
 };
 
index 3d009a3d770dc244bf2be34e29f1929f13549556..99fc903d92ed2ddc2c1db784406676da53c77163 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.209 2001/08/16 00:16:19 hno Exp $
+ * $Id: tools.cc,v 1.210 2001/10/17 20:25:03 hno Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -761,8 +761,8 @@ logsFlush(void)
        fflush(debug_log);
 }
 
-char *
-checkNullString(char *p)
+const char *
+checkNullString(const char *p)
 {
     return p ? p : "(NULL)";
 }
index 11c3719ddc1feb199f92232f56a83d945339117c..2d71381f1899e77c0d619e7f1ce38da50d510470 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: unlinkd.cc,v 1.43 2001/02/23 20:59:51 hno Exp $
+ * $Id: unlinkd.cc,v 1.44 2001/10/17 20:25:03 hno Exp $
  *
  * DEBUG: section 12    Unlink Daemon
  * AUTHOR: Duane Wessels
@@ -159,7 +159,7 @@ void
 unlinkdInit(void)
 {
     int x;
-    char *args[2];
+    const char *args[2];
     struct timeval slp;
     args[0] = "(unlinkd)";
     args[1] = NULL;