]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Compiler warnings fixes round 1.
authorhasso <hasso>
Fri, 8 Oct 2004 08:17:22 +0000 (08:17 +0000)
committerhasso <hasso>
Fri, 8 Oct 2004 08:17:22 +0000 (08:17 +0000)
13 files changed:
ospfd/ChangeLog
ospfd/ospf_dump.c
ospfd/ospf_dump.h
ospfd/ospf_ism.c
ospfd/ospf_lsa.c
ospfd/ospf_main.c
ospfd/ospf_nsm.c
ospfd/ospf_packet.c
ospfd/ospf_route.c
ospfd/ospf_routemap.c
ospfd/ospf_spf.c
ospfd/ospf_te.c
ospfd/ospf_vty.c

index f71479e860aca4f43d5c7589ead4d22bb2174fde..f326f72fa78b76e63e56bb227dab0d9428742543 100644 (file)
@@ -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
index 8b4e78ba70cf621c312dc8afef6ed5afec3549b3..e34f3f62544a93937793795041964972097a16cc 100644 (file)
@@ -149,7 +149,7 @@ unsigned long term_debug_ospf_nssa = 0;
 
 \f
 #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). */
index 29d06c9a5362797a9a9cd39916620a138d791806..5f625ca863d54615bb8ad03fb1304b52f377292c 100644 (file)
@@ -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 *);
index 7fa8b460db84627827eee7b7e0da94a2d9545d5f..84a5dc5c4f57751153f5bfc4256972d5b82570da 100644 (file)
@@ -553,7 +553,7 @@ struct {
   },
 };  
 
-static char *ospf_ism_event_str[] =
+const static char *ospf_ism_event_str[] =
 {
   "NoEvent",
   "InterfaceUp",
index 944af64d8fb5b5d7fb783050aa766072080f2b8c..3ad6ddf04507fc287a089eaaf5d1221c7c603fb1 100644 (file)
@@ -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);
index 7e1567ca8b93c34fb299727b3b432ba35b053323..47873ba8a9f92c5e51d08ba4a50740c1218cb7c1 100644 (file)
@@ -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
index 14c75df5caafebd9f378b3e98da10b27407c7a3c..dd5ba7bb2f9c2585105106f9aff680fb6b5f8dae 100644 (file)
@@ -640,7 +640,7 @@ struct {
   },
 };
 
-static char *ospf_nsm_event_str[] =
+const static char *ospf_nsm_event_str[] =
 {
   "NoEvent",
   "HelloReceived",
index f1cb91d7d4bdfe21708088b9276a4feed11350d9..357d697fd0216173faf531fbb8400087fdb3a230 100644 (file)
@@ -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;
 
index 9280767f22ec7108d3886a47b39f44366aa9001d..15331fd9c43633922590967e4a2a1892776318f6 100644 (file)
@@ -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",
index 64822d618bd72b0f34421ff1750e8617694eaa5c..52fa901b047cc0b01c772912a954f8c5c612185e 100644 (file)
@@ -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]);
 }
index 0fd39fa17888527ffb245384cc2c796452cf53e6..c7c25f8d4eb5e78c90d0e205d535740c16ef9a07 100644 (file)
@@ -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,
index 1d4425017a7bb05163480dfdd1a8901ce93263d2..a4980034aa175db57c9011df3e6d1fb03459f84d 100644 (file)
@@ -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
     {
index ab73f7b132fd0511fa93a5a693b953203c53d8f3..b74a30438736076000571d67a8b241ccb3333e6c 100644 (file)
@@ -49,7 +49,7 @@
 #include "ospfd/ospf_dump.h"
 
 \f
-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,
 }
 
 \f
-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)
 }
 
 \f
-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)
 }
 
 \f
-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)
 {