summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhasso <hasso>2004-10-08 08:17:22 +0000
committerhasso <hasso>2004-10-08 08:17:22 +0000
commiteb1ce6059a00f3f0dd92c965aa5982907b54c00d (patch)
treeebd6583ba2f2f9909c25653d0349662e08c26ecf
parent2e864cfa12724ec20e82f0a24e1be5929e3a0cef (diff)
Compiler warnings fixes round 1.
-rw-r--r--ospfd/ChangeLog5
-rw-r--r--ospfd/ospf_dump.c14
-rw-r--r--ospfd/ospf_dump.h10
-rw-r--r--ospfd/ospf_ism.c2
-rw-r--r--ospfd/ospf_lsa.c2
-rw-r--r--ospfd/ospf_main.c2
-rw-r--r--ospfd/ospf_nsm.c2
-rw-r--r--ospfd/ospf_packet.c7
-rw-r--r--ospfd/ospf_route.c2
-rw-r--r--ospfd/ospf_routemap.c14
-rw-r--r--ospfd/ospf_spf.c6
-rw-r--r--ospfd/ospf_te.c6
-rw-r--r--ospfd/ospf_vty.c42
13 files changed, 60 insertions, 54 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index f71479e8..f326f72f 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-08 Hasso Tepper <hasso at quagga.net>
+
+ * *.[c|h]: Fix compiler warnings: make some strings const, signed ->
+ unsigned, remove unused variables etc.
+
2004-10-07 Greg Troxel <gdt@claude.ir.bbn.com>
* ospf_apiserver.c (ospf_apiserver_unregister_opaque_type): Don't
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index 8b4e78ba..e34f3f62 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -149,7 +149,7 @@ unsigned long term_debug_ospf_nssa = 0;
#define OSPF_AREA_STRING_MAXLEN 16
-char *
+const char *
ospf_area_name_string (struct ospf_area *area)
{
static char buf[OSPF_AREA_STRING_MAXLEN] = "";
@@ -166,7 +166,7 @@ ospf_area_name_string (struct ospf_area *area)
}
#define OSPF_AREA_DESC_STRING_MAXLEN 23
-char *
+const char *
ospf_area_desc_string (struct ospf_area *area)
{
static char buf[OSPF_AREA_DESC_STRING_MAXLEN] = "";
@@ -195,7 +195,7 @@ ospf_area_desc_string (struct ospf_area *area)
}
#define OSPF_IF_STRING_MAXLEN 40
-char *
+const char *
ospf_if_name_string (struct ospf_interface *oi)
{
static char buf[OSPF_IF_STRING_MAXLEN] = "";
@@ -236,7 +236,7 @@ ospf_nbr_state_message (struct ospf_neighbor *nbr, char *buf, size_t size)
LOOKUP (ospf_ism_state_msg, state));
}
-char *
+const char *
ospf_timer_dump (struct thread *t, char *buf, size_t size)
{
struct timeval now;
@@ -326,7 +326,7 @@ ospf_dd_flags_dump (u_char flags, char *buf, size_t size)
void
ospf_lsa_header_dump (struct lsa_header *lsah)
{
- char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
+ const char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
zlog_info (" LSA Header");
zlog_info (" LS age %d", ntohs (lsah->ls_age));
@@ -1484,8 +1484,8 @@ config_write_debug (struct vty *vty)
int write = 0;
int i, r;
- char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
- char *detail_str[] = {"", " send", " recv", "", " detail",
+ const char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
+ const char *detail_str[] = {"", " send", " recv", "", " detail",
" send detail", " recv detail", " detail"};
/* debug ospf ism (status|events|timers). */
diff --git a/ospfd/ospf_dump.h b/ospfd/ospf_dump.h
index 29d06c9a..5f625ca8 100644
--- a/ospfd/ospf_dump.h
+++ b/ospfd/ospf_dump.h
@@ -121,16 +121,16 @@ extern unsigned long term_debug_ospf_zebra;
extern unsigned long term_debug_ospf_nssa;
/* Message Strings. */
-extern char *ospf_packet_type_str[];
+extern const char *ospf_packet_type_str[];
extern char *ospf_lsa_type_str[];
/* Prototypes. */
-char *ospf_area_name_string (struct ospf_area *);
-char *ospf_area_desc_string (struct ospf_area *);
-char *ospf_if_name_string (struct ospf_interface *);
+const char *ospf_area_name_string (struct ospf_area *);
+const char *ospf_area_desc_string (struct ospf_area *);
+const char *ospf_if_name_string (struct ospf_interface *);
void ospf_nbr_state_message (struct ospf_neighbor *, char *, size_t);
char *ospf_options_dump (u_char);
-char *ospf_timer_dump (struct thread *, char *, size_t);
+const char *ospf_timer_dump (struct thread *, char *, size_t);
void ospf_ip_header_dump (struct stream *);
void ospf_packet_dump (struct stream *);
void ospf_lsa_header_dump (struct lsa_header *);
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index 7fa8b460..84a5dc5c 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -553,7 +553,7 @@ struct {
},
};
-static char *ospf_ism_event_str[] =
+const static char *ospf_ism_event_str[] =
{
"NoEvent",
"InterfaceUp",
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 944af64d..3ad6ddf0 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -902,7 +902,7 @@ ospf_router_lsa_update_timer (struct thread *thread)
struct ospf_area *area = getdata (node);
struct ospf_lsa *lsa = area->router_lsa_self;
struct router_lsa *rl;
- char *area_str;
+ const char *area_str;
/* Keep Area ID string. */
area_str = AREA_NAME (area);
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 7e1567ca..47873ba8 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -97,7 +97,7 @@ struct option longopts[] =
struct thread_master *master;
/* Process ID saved for use by init system */
-char *pid_file = PATH_OSPFD_PID;
+const char *pid_file = PATH_OSPFD_PID;
/* Help information display. */
static void
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index 14c75df5..dd5ba7bb 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -640,7 +640,7 @@ struct {
},
};
-static char *ospf_nsm_event_str[] =
+const static char *ospf_nsm_event_str[] =
{
"NoEvent",
"HelloReceived",
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index f1cb91d7..357d697f 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -52,7 +52,7 @@ static void ospf_ls_ack_send_list (struct ospf_interface *, struct list *,
struct in_addr);
/* Packet Type String. */
-char *ospf_packet_type_str[] =
+const char *ospf_packet_type_str[] =
{
"unknown",
"Hello",
@@ -347,7 +347,7 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op)
/* Get MD5 Authentication key from auth_key list. */
if (list_isempty (OSPF_IF_PARAM (oi, auth_crypt)))
- auth_key = "";
+ auth_key = (char *) "";
else
{
ck = getdata (OSPF_IF_PARAM (oi, auth_crypt)->tail);
@@ -1991,12 +1991,11 @@ ospf_recv_packet (int fd, struct interface **ifp)
struct stream *ibuf;
unsigned int ifindex = 0;
struct iovec iov;
- struct cmsghdr *cmsg;
#if defined(CMSG_SPACE)
/* Header and data both require alignment. */
char buff [CMSG_SPACE(SOPT_SIZE_CMSG_IFINDEX_IPV4())];
#else
- char buff [sizeof (*cmsg) + SOPT_SIZE_CMSG_IFINDEX_IPV4()];
+ char buff [sizeof (struct cmsghdr) + SOPT_SIZE_CMSG_IFINDEX_IPV4()];
#endif
struct msghdr msgh;
diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c
index 9280767f..15331fd9 100644
--- a/ospfd/ospf_route.c
+++ b/ospfd/ospf_route.c
@@ -640,7 +640,7 @@ ospf_intra_add_stub (struct route_table *rt, struct router_lsa_link *link,
zlog_info("ospf_intra_add_stub(): Stop");
}
-char *ospf_path_type_str[] =
+const char *ospf_path_type_str[] =
{
"unknown-type",
"intra-area",
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index 64822d61..52fa901b 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -98,7 +98,7 @@ ospf_route_map_event (route_map_event_t event, char *name)
/* Delete rip route map rule. */
int
ospf_route_match_delete (struct vty *vty, struct route_map_index *index,
- char *command, char *arg)
+ const char *command, char *arg)
{
int ret;
@@ -123,7 +123,7 @@ ospf_route_match_delete (struct vty *vty, struct route_map_index *index,
int
ospf_route_match_add (struct vty *vty, struct route_map_index *index,
- char *command, char *arg)
+ const char *command, char *arg)
{
int ret;
@@ -148,7 +148,7 @@ ospf_route_match_add (struct vty *vty, struct route_map_index *index,
int
ospf_route_set_add (struct vty *vty, struct route_map_index *index,
- char *command, char *arg)
+ const char *command, char *arg)
{
int ret;
@@ -174,7 +174,7 @@ ospf_route_set_add (struct vty *vty, struct route_map_index *index,
/* Delete rip route map rule. */
int
ospf_route_set_delete (struct vty *vty, struct route_map_index *index,
- char *command, char *arg)
+ const char *command, char *arg)
{
int ret;
@@ -760,9 +760,11 @@ DEFUN (set_metric_type,
"OSPF[6] external type 2 metric\n")
{
if (strcmp (argv[0], "1") == 0)
- return ospf_route_set_add (vty, vty->index, "metric-type", "type-1");
+ return ospf_route_set_add (vty, vty->index, "metric-type",
+ (char *) "type-1");
if (strcmp (argv[0], "2") == 0)
- return ospf_route_set_add (vty, vty->index, "metric-type", "type-2");
+ return ospf_route_set_add (vty, vty->index, "metric-type",
+ (char *) "type-2");
return ospf_route_set_add (vty, vty->index, "metric-type", argv[0]);
}
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 0fd39fa1..c7c25f8d 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -115,7 +115,7 @@ ospf_vertex_free (struct vertex *v)
}
void
-ospf_vertex_dump(char *msg, struct vertex *v,
+ospf_vertex_dump(const char *msg, struct vertex *v,
int print_nexthops, int print_children)
{
if ( ! IS_DEBUG_OSPF_EVENT)
@@ -245,8 +245,7 @@ ospf_vertex_lookup (struct list *vlist, struct in_addr id, int type)
int
ospf_lsa_has_link (struct lsa_header *w, struct lsa_header *v)
{
- int i;
- int length;
+ unsigned int i, length;
struct router_lsa *rl;
struct network_lsa *nl;
@@ -494,7 +493,6 @@ ospf_nexthop_calculation (struct ospf_area *area,
if (IS_DEBUG_OSPF_EVENT)
{
char buf1[BUFSIZ];
- char buf2[BUFSIZ];
zlog_info("ospf_nexthop_calculation(): considering link "
"type %d link_id %s link_data %s",
l->m[0].type,
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index 1d442501..a4980034 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -1872,8 +1872,10 @@ DEFUN (show_mpls_te_link,
/* Show All Interfaces. */
if (argc == 0)
- LIST_LOOP (iflist, ifp, node)
- show_mpls_te_link_sub (vty, ifp);
+ {
+ LIST_LOOP (iflist, ifp, node)
+ show_mpls_te_link_sub (vty, ifp);
+ }
/* Interface name is specified. */
else
{
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index ab73f7b1..b74a3043 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -49,7 +49,7 @@
#include "ospfd/ospf_dump.h"
-static char *ospf_network_type_str[] =
+const static char *ospf_network_type_str[] =
{
"Null",
"POINTOPOINT",
@@ -2098,8 +2098,8 @@ DEFUN (ospf_neighbor,
{
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
- int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
- int interval = OSPF_POLL_INTERVAL_DEFAULT;
+ unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
+ unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
@@ -2146,8 +2146,8 @@ DEFUN (ospf_neighbor_poll_interval,
{
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
- int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
- int interval = OSPF_POLL_INTERVAL_DEFAULT;
+ unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
+ unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
@@ -2231,7 +2231,7 @@ DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd,
"Timer value in seconds\n")
{
struct ospf *ospf = vty->index;
- int interval;
+ unsigned int interval;
VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
interval = (interval / 10) * 10;
@@ -2248,7 +2248,7 @@ DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd,
"Timer value in seconds\n")
{
struct ospf *ospf = vty->index;
- int interval;
+ unsigned int interval;
if (argc == 1)
{
@@ -2325,7 +2325,7 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth,
return CMD_SUCCESS;
}
-char *ospf_abr_type_descr_str[] =
+const char *ospf_abr_type_descr_str[] =
{
"Unknown",
"Standard (RFC2328)",
@@ -2334,7 +2334,7 @@ char *ospf_abr_type_descr_str[] =
"Alternative Shortcut"
};
-char *ospf_shortcut_mode_descr_str[] =
+const char *ospf_shortcut_mode_descr_str[] =
{
"Default",
"Enabled",
@@ -3132,7 +3132,7 @@ show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self)
return 0;
}
-char *show_database_desc[] =
+const char *show_database_desc[] =
{
"unknown",
"Router Link States",
@@ -3153,7 +3153,7 @@ char *show_database_desc[] =
#define SHOW_OSPF_COMMON_HEADER \
"Link ID ADV Router Age Seq# CkSum"
-char *show_database_header[] =
+const char *show_database_header[] =
{
"",
"Link ID ADV Router Age Seq# CkSum Link count",
@@ -3171,7 +3171,7 @@ char *show_database_header[] =
#endif /* HAVE_OPAQUE_LSA */
};
-char *show_lsa_flags[] =
+const char *show_lsa_flags[] =
{
"Self-originated",
"Checked",
@@ -3222,7 +3222,7 @@ show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa)
vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE);
}
-char *link_type_desc[] =
+const char *link_type_desc[] =
{
"(null)",
"another Router (point-to-point)",
@@ -3231,7 +3231,7 @@ char *link_type_desc[] =
"a Virtual Link",
};
-char *link_id_desc[] =
+const char *link_id_desc[] =
{
"(null)",
"Neighboring Router ID",
@@ -3240,7 +3240,7 @@ char *link_id_desc[] =
"Neighboring Router ID",
};
-char *link_data_desc[] =
+const char *link_data_desc[] =
{
"(null)",
"Router Interface address",
@@ -6641,7 +6641,7 @@ DEFUN (show_ip_ospf_route,
}
-char *ospf_abr_type_str[] =
+const char *ospf_abr_type_str[] =
{
"unknown",
"standard",
@@ -6650,7 +6650,7 @@ char *ospf_abr_type_str[] =
"shortcut"
};
-char *ospf_shortcut_mode_str[] =
+const char *ospf_shortcut_mode_str[] =
{
"default",
"enable",
@@ -6670,7 +6670,7 @@ area_id2str (char *buf, int length, struct ospf_area *area)
}
-char *ospf_int_type_str[] =
+const char *ospf_int_type_str[] =
{
"unknown", /* should never be used. */
"point-to-point",
@@ -6730,7 +6730,7 @@ config_write_interface (struct vty *vty)
if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) &&
params->auth_type != OSPF_AUTH_NOTSET)
{
- char *auth_str;
+ const char *auth_str;
/* Translation tables are not that much help here due to syntax
of the simple option */
@@ -7087,8 +7087,8 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf)
}
-char *distribute_str[] = { "system", "kernel", "connected", "static", "rip",
- "ripng", "ospf", "ospf6", "isis", "bgp"};
+const char *distribute_str[] = { "system", "kernel", "connected", "static",
+ "rip", "ripng", "ospf", "ospf6", "isis", "bgp"};
int
config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
{