All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 5191ced6 authored by Jonathon Duerig's avatar Jonathon Duerig

A pass on fixing up warnings in the code. Might have fixed a couple of bugs too.

parent 19d1f07a
......@@ -215,7 +215,7 @@ string annotated_filename (const char* filepath)
}
// Read in the .ptop file
void read_physical_topology(char *filename) {
void read_physical_topology(char const * filename) {
ifstream ptopfile;
ptopfile.open(filename);
if (!ptopfile.is_open()) {
......@@ -336,7 +336,7 @@ void calculate_switch_MST() {
}
// Read in the .top file
void read_virtual_topology(char *filename) {
void read_virtual_topology(char const * filename) {
ifstream topfile;
topfile.open(filename);
if (!topfile.is_open()) {
......@@ -517,7 +517,7 @@ int type_precheck(int round) {
* the precheck is looking for available pnodes, the second is looking for
* sutiable nodes (ie. at least one vnode could map to it)
*/
char *round_str;
char const * round_str;
if (round == 1) {
round_str = "available";
} else {
......@@ -893,17 +893,17 @@ int main(int argc,char **argv) {
timelimit = 0.0;
timetarget = 0.0;
char* ptopFilename = "";
char* vtopFilename = "";
char const * ptopFilename = "";
char const * vtopFilename = "";
char* vtopOutputFilename = 0;
#ifdef WITH_XML
char* ptopFileFormat;
char* vtopFileFormat;
char* delims = "/";
char* flags = "s:v:l:t:rpPTdH:oguc:nx:y:W:FDf:RS:";
char const * delims = "/";
char const * flags = "s:v:l:t:rpPTdH:oguc:nx:y:W:FDf:RS:";
#else
char* flags = "s:v:l:t:rpPTdH:oguc:nx:y:FDRS:";
char const * flags = "s:v:l:t:rpPTdH:oguc:nx:y:FDRS:";
#endif
while ((ch = getopt(argc,argv,flags)) != -1) {
......
......@@ -124,7 +124,7 @@ tb_featuredesire::tb_featuredesire(fstring _my_name,
break;
case featuredesire::FD_TYPE_GLOBAL_MORE_THAN_ONE:
global = true;
g_more_than_one;
g_more_than_one = true;
}
......
......@@ -102,7 +102,7 @@ static bool populate_links(DOMElement *root, tb_pgraph &pg, tb_sgraph &sg,
static bool populate_type_limits(DOMElement *root,tb_pgraph &pg,tb_sgraph &sg);
static bool populate_policies (DOMElement*root, tb_pgraph &pg, tb_sgraph &sg);
int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
int parse_advertisement(tb_pgraph &pg, tb_sgraph &sg, char const * filename) {
/*
* Fire up the XML parser
*/
......
......@@ -43,7 +43,7 @@
#include <xercesc/sax/HandlerBase.hpp>
XERCES_CPP_NAMESPACE_USE
int parse_advertisement(tb_pgraph &PG, tb_sgraph &SG, char *filename);
int parse_advertisement(tb_pgraph &PG, tb_sgraph &SG, char const * filename);
#endif // for __PARSE_ADVERTISEMENT_RSPEC_H
......
......@@ -74,7 +74,7 @@ int parse_fds_xml (const DOMElement* tag, node_fd_set *fd_set);
map<string, DOMElement*>* ptop_elements = new map<string, DOMElement*>();
int parse_ptop_xml(tb_pgraph &pg, tb_sgraph &sg, char *filename) {
int parse_ptop_xml(tb_pgraph &pg, tb_sgraph &sg, char const * filename) {
/*
* Fire up the XML parser
*/
......
......@@ -42,7 +42,7 @@
#include <xercesc/sax/HandlerBase.hpp>
XERCES_CPP_NAMESPACE_USE
int parse_ptop_xml(tb_pgraph &PG, tb_sgraph &SG, char *filename);
int parse_ptop_xml(tb_pgraph &PG, tb_sgraph &SG, char const * filename);
#endif // for __PARSE_PTOP_XML_H
......
......@@ -105,7 +105,7 @@ DOMElement* appendChildTagWithData (DOMElement* parent,
string generate_virtualNodeId (string virtual_id);
string generate_virtualIfaceId(string node_name, int interface_number);
int parse_request(tb_vgraph &vg, char *filename) {
int parse_request(tb_vgraph &vg, char const * filename) {
/*
* Fire up the XML domParser
*/
......
......@@ -42,7 +42,7 @@
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/sax/HandlerBase.hpp>
int parse_request(tb_vgraph &VG, char *filename);
int parse_request(tb_vgraph &VG, char const * filename);
#endif // for __PARSE_REQUEST_RSPEC_H
......
......@@ -83,7 +83,7 @@ bool populate_vclasses (DOMElement* root, tb_vgraph &vg);
int bind_vtop_subnodes (tb_vgraph &vg);
int parse_vtop_xml(tb_vgraph &vg, char* filename) {
int parse_vtop_xml(tb_vgraph &vg, char const * filename) {
/*
* Initialize the XML parser
......
......@@ -47,7 +47,7 @@
#include <xercesc/sax2/XMLReaderFactory.hpp>
XERCES_CPP_NAMESPACE_USE
int parse_vtop_xml(tb_vgraph &VG, char* filename);
int parse_vtop_xml(tb_vgraph &VG, char const * filename);
#endif // for __PARSE_VTOP_XML_H
......
......@@ -66,8 +66,9 @@ int split_two(string line,char split_char,string &a,string &b,string default_b)
{
size_t space = line.find(split_char);
if (space != string::npos) {
a = line.substr(0,space).c_str();
b = line.substr(++space,line.length() - space).c_str();
a = line.substr(0, space).c_str();
++space;
b = line.substr(space, line.length() - space).c_str();
return 0;
} else {
a = line.c_str();
......
......@@ -83,7 +83,7 @@ static void status_callback(pubsub_handle_t *handle,
static void schedule_updateevent();
static int do_remote_register(char *server);
static int do_remote_register(char const *server);
int
......@@ -91,7 +91,7 @@ main(int argc, char **argv)
{
address_tuple_t tuple;
char *progname;
char *server = NULL;
char const *server = NULL;
char *port = NULL, *lport = NULL;
char *myeid = NULL;
char *pnodeid = NULL;
......@@ -288,7 +288,7 @@ main(int argc, char **argv)
}
int do_remote_register(char *server) {
int do_remote_register(char const *server) {
address_tuple_t tuple;
char buf[BUFSIZ];
......@@ -309,7 +309,7 @@ int do_remote_register(char *server) {
/* Setup a status callback to watch the remote connection. */
if (pubsub_set_status_callback(bosshandle->server,
status_callback,
server, &bosshandle->status) != 0) {
const_cast<char *>(server), &bosshandle->status) != 0) {
error("Could not register status callback!");
}
......
......@@ -113,19 +113,19 @@ static int handles_in_use = 0;
* the Elvin server.
*/
event_handle_t
event_register(char *name, int threaded)
event_register(char const *name, int threaded)
{
return event_register_withkeydata(name, threaded, NULL, 0);
}
event_handle_t
event_register_withkeyfile(char *name, int threaded, char *keyfile) {
event_register_withkeyfile(char const *name, int threaded, char *keyfile) {
return event_register_withkeyfile_withretry(name,
threaded, keyfile, INT_MAX);
}
event_handle_t
event_register_withkeyfile_withretry(char *name, int threaded,
event_register_withkeyfile_withretry(char const *name, int threaded,
char *keyfile, int retrycount)
{
/* Grab the key data and stick it into the handle. */
......@@ -157,7 +157,7 @@ event_register_withkeyfile_withretry(char *name, int threaded,
}
event_handle_t
event_register_withkeydata(char *name, int threaded,
event_register_withkeydata(char const *name, int threaded,
unsigned char *keydata, int keylen){
return event_register_withkeydata_withretry(name, threaded, keydata,
keylen, INT_MAX);
......@@ -165,7 +165,7 @@ event_register_withkeydata(char *name, int threaded,
}
event_handle_t
event_register_withkeydata_withretry(char *name, int threaded,
event_register_withkeydata_withretry(char const *name, int threaded,
unsigned char *keydata, int keylen,
int retrycount)
{
......@@ -653,7 +653,7 @@ event_notification_alloc(event_handle_t handle, address_tuple_t tuple)
TRACE("allocated notification %p\n", notification);
#define EVPUT(name, field) \
({ \
char *foo = (tuple->field ? tuple->field : ADDRESSTUPLE_ALL); \
char const *foo = (tuple->field ? tuple->field : ADDRESSTUPLE_ALL); \
\
event_notification_put_string(handle, notification, name, foo); \
})
......@@ -750,7 +750,7 @@ event_notification_clone(event_handle_t handle,
int
event_notification_get_double(event_handle_t handle,
event_notification_t notification,
char *name, double *value)
char const *name, double *value)
{
if (!handle || !notification || !name || !value) {
ERROR("invalid parameter\n");
......@@ -778,7 +778,7 @@ event_notification_get_double(event_handle_t handle,
int
event_notification_get_int32(event_handle_t handle,
event_notification_t notification,
char *name, int32_t *value)
char const *name, int32_t *value)
{
if (!handle || !notification || !name || !value) {
ERROR("invalid parameter\n");
......@@ -806,7 +806,7 @@ event_notification_get_int32(event_handle_t handle,
int
event_notification_get_int64(event_handle_t handle,
event_notification_t notification,
char *name, int64_t *value)
char const *name, int64_t *value)
{
if (!handle || !notification || !name || !value) {
ERROR("invalid parameter\n");
......@@ -836,7 +836,7 @@ event_notification_get_int64(event_handle_t handle,
int
event_notification_get_opaque_length(event_handle_t handle,
event_notification_t notification,
char *name)
char const *name)
{
char *v;
int len;
......@@ -859,7 +859,7 @@ event_notification_get_opaque_length(event_handle_t handle,
int
event_notification_get_string_length(event_handle_t handle,
event_notification_t notification,
char *name)
char const *name)
{
char *v;
......@@ -888,7 +888,7 @@ event_notification_get_string_length(event_handle_t handle,
int
event_notification_get_opaque(event_handle_t handle,
event_notification_t notification,
char *name, void *buffer, int length)
char const *name, void *buffer, int length)
{
char *v;
int len;
......@@ -927,7 +927,7 @@ event_notification_get_opaque(event_handle_t handle,
int
event_notification_get_string(event_handle_t handle,
event_notification_t notification,
char *name, char *buffer, int length)
char const *name, char *buffer, int length)
{
char *v;
......@@ -968,7 +968,7 @@ event_notification_get_string(event_handle_t handle,
int
event_notification_put_double(event_handle_t handle,
event_notification_t notification,
char *name, double value)
char const *name, double value)
{
if (!handle || !notification || !name) {
ERROR("invalid parameter\n");
......@@ -998,7 +998,7 @@ event_notification_put_double(event_handle_t handle,
int
event_notification_put_int32(event_handle_t handle,
event_notification_t notification,
char *name, int value)
char const *name, int value)
{
if (!handle || !notification || !name) {
ERROR("invalid parameter\n");
......@@ -1029,7 +1029,7 @@ event_notification_put_int32(event_handle_t handle,
int
event_notification_put_int64(event_handle_t handle,
event_notification_t notification,
char *name, int64_t value)
char const *name, int64_t value)
{
if (!handle || !notification || !name) {
ERROR("invalid parameter\n");
......@@ -1061,7 +1061,7 @@ event_notification_put_int64(event_handle_t handle,
int
event_notification_put_opaque(event_handle_t handle,
event_notification_t notification,
char *name, void *buffer, int length)
char const *name, void *buffer, int length)
{
if (!handle || !notification || !buffer || !length) {
ERROR("invalid parameter\n");
......@@ -1093,7 +1093,7 @@ event_notification_put_opaque(event_handle_t handle,
int
event_notification_put_string(event_handle_t handle,
event_notification_t notification,
char *name, char *value)
char const *name, char const *value)
{
if (!handle || !notification || !name || !value) {
ERROR("invalid parameter\n");
......@@ -1123,7 +1123,7 @@ event_notification_put_string(event_handle_t handle,
int
event_notification_remove(event_handle_t handle,
event_notification_t notification, char *name)
event_notification_t notification, char const *name)
{
if (!handle || !notification || !name) {
ERROR("invalid parameter\n");
......@@ -1190,7 +1190,7 @@ static void subscription_callback(pubsub_handle_t *server,
* separate (TAG==FOO || TAG==BAR) clauses.
*/
static int
addclause(char *tag, char *clause, char *exp, int size, int *index)
addclause(char const *tag, char const *clause, char *exp, int size, int *index)
{
int count = 0;
char *bp;
......@@ -2164,7 +2164,7 @@ static char *match_quote(char *str)
return retval;
}
int event_arg_get(char *args, char *key, char **value_out)
int event_arg_get(char *args, char const *key, char **value_out)
{
static char *WHITESPACE = " \t";
......@@ -2220,7 +2220,7 @@ int event_arg_get(char *args, char *key, char **value_out)
return retval;
}
int event_arg_dup(char *args, char *key, char **value_out)
int event_arg_dup(char *args, char const *key, char **value_out)
{
char *value;
int retval;
......
......@@ -88,12 +88,12 @@ typedef pubsub_subscription_t *event_subscription_t;
*/
typedef struct _address_tuple {
char *site; /* Which Emulab site. God only */
char *expt; /* Project and experiment IDs */
char const *expt; /* Project and experiment IDs */
char *group; /* User defined group of nodes */
char *host; /* A specific host */
char *objtype; /* LINK, TRAFGEN, etc ... */
char *objname; /* link0, cbr0, cbr1, etc ... */
char *eventtype; /* START, STOP, UP, DOWN, etc ... */
char const *host; /* A specific host */
char const *objtype; /* LINK, TRAFGEN, etc ... */
char const *objname; /* link0, cbr0, cbr1, etc ... */
char const *eventtype; /* START, STOP, UP, DOWN, etc ... */
int scheduler; /* A dynamic event to schedule */
char *timeline; /* The timeline to schedule under */
} address_tuple, *address_tuple_t;
......@@ -202,14 +202,14 @@ typedef void (*event_subscription_callback_t)(event_handle_t handle,
*/
/* event.c */
event_handle_t event_register(char *name, int threaded);
event_handle_t event_register_withkeyfile(char *name, int threaded,
event_handle_t event_register(char const *name, int threaded);
event_handle_t event_register_withkeyfile(char const *name, int threaded,
char *keyfile);
event_handle_t event_register_withkeydata(char *name, int threaded,
event_handle_t event_register_withkeydata(char const *name, int threaded,
unsigned char *keydata, int len);
event_handle_t event_register_withkeyfile_withretry(char *name, int threaded,
event_handle_t event_register_withkeyfile_withretry(char const *name, int threaded,
char *keyfile, int retrycount);
event_handle_t event_register_withkeydata_withretry(char *name, int threaded,
event_handle_t event_register_withkeydata_withretry(char const *name, int threaded,
unsigned char *keydata, int len,
int retrycount);
int event_unregister(event_handle_t handle);
......@@ -228,42 +228,42 @@ event_notification_t event_notification_clone(event_handle_t handle,
event_notification_t notification);
int event_notification_get_double(event_handle_t handle,
event_notification_t notification,
char *name, double *value);
char const *name, double *value);
int event_notification_get_int32(event_handle_t handle,
event_notification_t notification,
char *name, int32_t *value);
char const *name, int32_t *value);
int event_notification_get_int64(event_handle_t handle,
event_notification_t notification,
char *name, int64_t *value);
char const *name, int64_t *value);
int event_notification_get_opaque_length(event_handle_t handle,
event_notification_t notification,
char *name);
char const *name);
int event_notification_get_string_length(event_handle_t handle,
event_notification_t notification,
char *name);
char const *name);
int event_notification_get_opaque(event_handle_t handle,
event_notification_t notification,
char *name, void *buffer, int length);
char const *name, void *buffer, int length);
int event_notification_get_string(event_handle_t handle,
event_notification_t notification,
char *name, char *buffer, int length);
char const *name, char *buffer, int length);
int event_notification_put_double(event_handle_t handle,
event_notification_t notification,
char *name, double value);
char const *name, double value);
int event_notification_put_int32(event_handle_t handle,
event_notification_t notification,
char *name, int value);
char const *name, int value);
int event_notification_put_int64(event_handle_t handle,
event_notification_t notification,
char *name, int64_t value);
char const *name, int64_t value);
int event_notification_put_opaque(event_handle_t handle,
event_notification_t notification,
char *name, void *buffer, int length);
char const *name, void *buffer, int length);
int event_notification_put_string(event_handle_t handle,
event_notification_t notification,
char *name, char *value);
char const *name, char const *value);
int event_notification_remove(event_handle_t handle,
event_notification_t notification, char *name);
event_notification_t notification, char const *name);
event_subscription_t event_subscribe(event_handle_t handle,
event_notify_callback_t callback,
address_tuple_t tuple, void *data);
......@@ -292,8 +292,8 @@ int event_notification_unpack(event_handle_t handle,
int event_set_idle_period(event_handle_t handle, int seconds) ;
int event_set_failover(event_handle_t handle, int dofail) ;
int event_arg_get(char *args, char *key, char **value);
int event_arg_dup(char *args, char *key, char **value);
int event_arg_get(char *args, char const *key, char **value);
int event_arg_dup(char *args, char const *key, char **value);
typedef enum {
EA_TAG_DONE,
......
......@@ -37,7 +37,7 @@
#include "log.h"
static int usesyslog = 0;
static char *filename;
static char const *filename;
#define LOG_IDENT "Testbed"
/*
......@@ -46,7 +46,7 @@ static char *filename;
* a logfile to which stdout and stderr are redirected.
*/
int
loginit(int slog, char *name)
loginit(int slog, char const *name)
{
if (slog) {
usesyslog = 1;
......
......@@ -30,7 +30,7 @@
extern "C" {
#endif
int loginit(int usesyslog, char *name);
int loginit(int usesyslog, char const *name);
void logsyslog(void);
void logflush(void);
void info(const char *fmt, ...);
......
......@@ -34,6 +34,9 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: boot.c,v 1.11 2006/06/05 16:51:18 christos Exp ");
#ifdef __clang__ /* Fix warning about unused variable */
__attribute__((unused))
#endif
static const char rcsid[] =
"$FreeBSD: releng/10.2/sbin/fsck_msdosfs/boot.c 241807 2012-10-21 12:01:19Z uqs $";
#endif /* not lint */
......
......@@ -34,6 +34,9 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fat.c,v 1.18 2006/06/05 16:51:18 christos Exp $");
#ifdef __clang__ /* Fix warning about unused variable */
__attribute__((unused))
#endif
static const char rcsid[] =
"$FreeBSD: releng/10.2/sbin/fsck_msdosfs/fat.c 268968 2014-07-21 23:23:20Z pfg $";
#endif /* not lint */
......
......@@ -221,7 +221,7 @@ static void *console_agent_looper(void *arg)
if (!event_notification_get_eventtype(
handle, en, evtype, sizeof(evtype))) {
error("couldn't get event type from notification %p\n",
error("couldn't get event type from notification %p\n",
en);
}
else {
......@@ -235,7 +235,7 @@ static void *console_agent_looper(void *arg)
sizeof(argsbuf));
event_notification_get_int32(handle,
en,
"TOKEN",
const_cast<char *>("TOKEN"),
&token);
argsbuf[sizeof(argsbuf) - 1] = '\0';
......
......@@ -182,7 +182,7 @@ RPC_disconnect(xmlrpc_c::clientXmlTransport **transport)
}
int
RPC_invoke(char *method,
RPC_invoke(char const *method,
emulab::EmulabResponse *er_out,
emulab::spa_attr_t tag,
...)
......@@ -237,7 +237,7 @@ RPC_invoke(char *method,
}
int
RPC_invoke(char *pid, char *eid, char *method, emulab::EmulabResponse *er)
RPC_invoke(char *pid, char *eid, char const *method, emulab::EmulabResponse *er)
{
int retval = 0;
xmlrpc_c::clientXmlTransport *transport;
......
......@@ -34,7 +34,7 @@
#include <iostream>
#include "emulab_proxy.h"
int RPC_invoke(char *method,
int RPC_invoke(char const *method,
emulab::EmulabResponse *er_out,
emulab::spa_attr_t tag,
...);
......
......@@ -98,7 +98,7 @@ int simulator_agent_invariant(simulator_agent_t sa)
int add_report_data(simulator_agent_t sa,
sa_report_data_kind_t rdk,
char *data,
char const *data,
unsigned long flags)
{
char *new_data;
......@@ -450,14 +450,17 @@ static int do_reset(simulator_agent_t sa, char *args)
static int do_snapshot(simulator_agent_t sa, char *args)
{
char *loghole_args;
char const *loghole_args;
char *event_args;
int retval = 0;
assert(sa != NULL);
assert(args != NULL);
if (event_arg_get(args, "LOGHOLE_ARGS", &loghole_args) <= 0) {
if (event_arg_get(args, "LOGHOLE_ARGS", &event_args) <= 0) {
loghole_args = "";
} else {
loghole_args = event_args;
}
if (systemf("loghole --port=%d sync %s",
......@@ -490,7 +493,7 @@ static int do_stoprun(simulator_agent_t sa, int token, char *args)
static int strreltime(char *buf, size_t buflen, time_t secs)
{
int hours, mins, retval = 0;
char *signage = "";
char const *signage = "";
assert(buf != NULL);
......@@ -512,7 +515,7 @@ static int strreltime(char *buf, size_t buflen, time_t secs)
return retval;
}
static int do_log(simulator_agent_t sa, char *message)
static int do_log(simulator_agent_t sa, char const *message)
{
time_t current_time;
int retval = -1;
......
......@@ -121,7 +121,7 @@ int simulator_agent_invariant(simulator_agent_t sa);
*/
int add_report_data(simulator_agent_t sa,
sa_report_data_kind_t rdk,
char *data,
char const *data,
unsigned long flags);
/**
......
......@@ -222,9 +222,9 @@ main(int argc, char **argv)
return 0;
}
#if 0
static char notify_debug_string[2*BUFSIZ];
#if 0
static int