Browse Source

Fix extra warnings

Serj Kalichev 10 years ago
parent
commit
3ce65522b8

+ 2 - 0
bin/clish.c

@@ -407,5 +407,7 @@ static void help(int status, const char *argv0)
  */
 static void sighandler(int signo)
 {
+	signo = signo; /* Happy compiler */
+
 	return;
 }

+ 1 - 1
bin/konf.c

@@ -46,7 +46,7 @@ int main(int argc, char **argv)
 	char *line = NULL;
 	char *str = NULL;
 	const char *socket_path = KONFD_SOCKET_PATH;
-	unsigned i = 0;
+	int i = 0;
 
 	/* Signal vars */
 	struct sigaction sigpipe_act;

+ 4 - 2
bin/konfd.c

@@ -93,7 +93,7 @@ struct options {
 int main(int argc, char **argv)
 {
 	int retval = -1;
-	unsigned i;
+	int i;
 	char *str;
 	konf_tree_t *conf;
 	lub_bintree_t bufs;
@@ -329,7 +329,7 @@ err:
 /*--------------------------------------------------------- */
 static char * process_query(int sock, konf_tree_t * conf, char *str)
 {
-	unsigned i;
+	int i;
 	int res;
 	konf_tree_t *iconf;
 	konf_tree_t *tmpconf;
@@ -453,6 +453,8 @@ static char * process_query(int sock, konf_tree_t * conf, char *str)
 static void sighandler(int signo)
 {
 	sigterm = 1;
+
+	signo = signo; /* Happy compiler */
 }
 
 /*--------------------------------------------------------- */

+ 2 - 0
clish/callback_access.c

@@ -68,6 +68,8 @@ bool_t clish_access_callback(const clish_shell_t * shell, const char *access)
 	lub_string_free(full_access);
 	free(group_list);
 #endif
+	shell = shell; /* Happy compiler */
+
 	return allowed;
 }
 

+ 4 - 0
clish/callback_script.c

@@ -166,6 +166,10 @@ int clish_dryrun_callback(clish_context_t *context,
 	if (out)
 		*out = NULL;
 
+	context = context; /* Happy compiler */
+	action = action; /* Happy compiler */
+	script = script; /* Happy compiler */
+
 	return 0;
 }
 

+ 1 - 1
clish/command.h

@@ -71,7 +71,7 @@ void clish_command__set_viewid(clish_command_t * instance, const char *viewid);
 void clish_command__force_viewid(clish_command_t * instance, const char *viewid);
 void clish_command__set_pview(clish_command_t * instance, clish_view_t * view);
 clish_view_t *clish_command__get_pview(const clish_command_t * instance);
-unsigned clish_command__get_depth(const clish_command_t * instance);
+int clish_command__get_depth(const clish_command_t * instance);
 clish_config_t *clish_command__get_config(const clish_command_t *instance);
 clish_view_restore_t clish_command__get_restore(const clish_command_t * instance);
 const clish_command_t * clish_command__get_orig(const clish_command_t * instance);

+ 3 - 1
clish/command/command.c

@@ -172,6 +172,8 @@ void clish_command_insert_param(clish_command_t * this, clish_param_t * param)
 /*--------------------------------------------------------- */
 int clish_command_help(const clish_command_t *this)
 {
+	this = this; /* Happy compiler */
+
 	return 0;
 }
 
@@ -372,7 +374,7 @@ clish_view_t *clish_command__get_pview(const clish_command_t * this)
 }
 
 /*--------------------------------------------------------- */
-unsigned clish_command__get_depth(const clish_command_t * this)
+int clish_command__get_depth(const clish_command_t * this)
 {
 	if (!this->pview)
 		return 0;

+ 1 - 0
clish/param/param.c

@@ -185,6 +185,7 @@ void clish_param_help(const clish_param_t * this, clish_help_t *help)
 void clish_param_help_arrow(const clish_param_t * this, size_t offset)
 {
 	fprintf(stderr, "%*c\n", (int)offset, '^');
+	this = this; /* Happy compiler */
 }
 
 /*--------------------------------------------------------- */

+ 1 - 1
clish/ptype/ptype.c

@@ -148,7 +148,7 @@ static const char *method_names[] = {
 /*--------------------------------------------------------- */
 const char *clish_ptype_method__get_name(clish_ptype_method_e method)
 {
-	int max_method = sizeof(method_names) / sizeof(char *);
+	unsigned int max_method = sizeof(method_names) / sizeof(char *);
 
 	if (method >= max_method)
 		return NULL;

+ 31 - 0
clish/shell/shell_execute.c

@@ -55,6 +55,9 @@ static int clish_close(clish_context_t *context, const lub_argv_t *argv,
 	argv = argv; /* not used */
 	this->state = SHELL_STATE_CLOSING;
 
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return 0;
 }
 
@@ -104,6 +107,9 @@ static int clish_source_internal(clish_context_t *context,
 static int clish_source(clish_context_t *context, const lub_argv_t *argv,
 	const char *script, char **out)
 {
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return (clish_source_internal(context, argv, BOOL_TRUE));
 }
 
@@ -116,6 +122,9 @@ static int clish_source(clish_context_t *context, const lub_argv_t *argv,
 static int clish_source_nostop(clish_context_t *context, const lub_argv_t *argv,
 	const char *script, char **out)
 {
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return (clish_source_internal(context, argv, BOOL_FALSE));
 }
 
@@ -131,6 +140,9 @@ static int clish_overview(clish_context_t *context, const lub_argv_t *argv,
 
 	tinyrl_printf(this->tinyrl, "%s\n", context->shell->overview);
 
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return 0;
 }
 
@@ -166,6 +178,10 @@ static int clish_history(clish_context_t *context, const lub_argv_t *argv,
 			tinyrl_history_entry__get_index(entry),
 			tinyrl_history_entry__get_line(entry));
 	}
+
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return 0;
 }
 
@@ -435,6 +451,9 @@ static int clish_nested_up(clish_context_t *context, const lub_argv_t *argv,
 	}
 	this->depth--;
 
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return 0;
 }
 
@@ -445,6 +464,11 @@ static int clish_nested_up(clish_context_t *context, const lub_argv_t *argv,
 static int clish_nop(clish_context_t *context, const lub_argv_t *argv,
 	const char *script, char **out)
 {
+	context = context; /* Happy compiler */
+	argv = argv; /* Happy compiler */
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return 0;
 }
 
@@ -466,6 +490,9 @@ static int clish_wdog(clish_context_t *context, const lub_argv_t *argv,
 
 	this->wdog_timeout = (unsigned int)atoi(arg);
 
+	script = script; /* Happy compiler */
+	out = out; /* Happy compiler */
+
 	return 0;
 }
 
@@ -479,6 +506,10 @@ static int clish_macros(clish_context_t *context, const lub_argv_t *argv,
 	if (!script) /* Nothing to do */
 		return 0;
 	*out = lub_string_dup(script);
+
+	context = context; /* Happy compiler */
+	argv = argv; /* Happy compiler */
+
 	return 0;
 }
 

+ 18 - 2
clish/shell/shell_expat.c

@@ -268,6 +268,8 @@ static void clish_expat_element_end(void *data, const char *el)
 	if (doc->current) {
 		doc->current = doc->current->parent;
 	}
+
+	el = el; /* Happy compiler */
 }
 
 /** Free a node, its children and its attributes
@@ -312,6 +314,7 @@ clish_xmldoc_t *clish_xmldoc_read(const char *filename)
 	int fd;
 	char *buffer;
 	XML_Parser parser;
+	ssize_t res;
 
 	doc = malloc(sizeof(clish_xmldoc_t));
 	if (!doc)
@@ -332,7 +335,11 @@ clish_xmldoc_t *clish_xmldoc_read(const char *filename)
 		goto error_open;
 	fstat(fd, &sb);
 	buffer = malloc(sb.st_size+1);
-	read(fd, buffer, sb.st_size);
+	res = read(fd, buffer, sb.st_size);
+	if (res < 0) {
+		close(fd);
+		goto error_parse;
+	}
 	buffer[sb.st_size] = 0;
 	close(fd);
 
@@ -378,21 +385,29 @@ int clish_xmldoc_is_valid(clish_xmldoc_t *doc)
 
 int clish_xmldoc_error_caps(clish_xmldoc_t *doc)
 {
+	doc = doc; /* Happy compiler */
+
 	return CLISH_XMLERR_NOCAPS;
 }
 
 int clish_xmldoc_get_err_line(clish_xmldoc_t *doc)
 {
+	doc = doc; /* Happy compiler */
+
 	return -1;
 }
 
 int clish_xmldoc_get_err_col(clish_xmldoc_t *doc)
 {
+	doc = doc; /* Happy compiler */
+
 	return -1;
 }
 
 const char *clish_xmldoc_get_err_msg(clish_xmldoc_t *doc)
 {
+	doc = doc; /* Happy compiler */
+
 	return "";
 }
 
@@ -444,7 +459,7 @@ char *clish_xmlnode_fetch_attr(clish_xmlnode_t *node,
 int clish_xmlnode_get_content(clish_xmlnode_t *node, char *content,
 			      unsigned int *contentlen)
 {
-	int minlen = 1;
+	unsigned int minlen = 1;
 
 	if (node && content && contentlen) {
 		clish_xmlnode_t *children = node->children;
@@ -504,6 +519,7 @@ void clish_xmlnode_print(clish_xmlnode_t *node, FILE *out)
 
 void clish_xml_release(void *p)
 {
+	p = p; /* Happy compiler */
 	/* nothing to release */
 }
 

+ 1 - 1
clish/shell/shell_help.c

@@ -106,7 +106,7 @@ void clish_shell_help(clish_shell_t *this, const char *line)
 	clish_help_t help;
 	size_t max_width = 0;
 	const clish_command_t *cmd;
-	int i;
+	unsigned int i;
 
 	help.name = lub_argv_new(NULL, 0);
 	help.help = lub_argv_new(NULL, 0);

+ 1 - 0
clish/shell/shell_wdog.c

@@ -40,6 +40,7 @@ int clish_shell_keypress_fn(tinyrl_t *tinyrl, int key)
 		tinyrl__set_timeout(tinyrl, this->idle_timeout);
 	}
 
+	key = key; /* Happy compiler */
 	return 0;
 }
 

+ 28 - 9
clish/shell/shell_xml.c

@@ -191,6 +191,8 @@ process_clish_module(clish_shell_t * shell, clish_xmlnode_t * element, void *par
 		shell->global = clish_shell_find_create_view(shell,
 			"global", "");
 	process_children(shell, element, shell->global);
+
+	parent = parent; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
@@ -241,6 +243,8 @@ process_view_end:
 	clish_xml_release(depth);
 	clish_xml_release(restore);
 	clish_xml_release(access);
+
+	parent = parent; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
@@ -272,11 +276,13 @@ static void process_ptype(clish_shell_t * shell, clish_xmlnode_t * element, void
 	clish_xml_release(pattern);
 	clish_xml_release(method_name);
 	clish_xml_release(preprocess_name);
+
+	parent = parent; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
-static void
-process_overview(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
+static void process_overview(clish_shell_t *shell, clish_xmlnode_t *element,
+	void *parent)
 {
 	char *content = NULL;
 	unsigned int content_len = 2048;
@@ -304,6 +310,8 @@ process_overview(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
 
 	if (content)
 		free(content);
+
+	parent = parent; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
@@ -669,8 +677,8 @@ process_param(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
 }
 
 /* ------------------------------------------------------ */
-static void
-process_action(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
+static void process_action(clish_shell_t *shell, clish_xmlnode_t *element,
+	void *parent)
 {
 	clish_action_t *action = NULL;
 	char *builtin = clish_xmlnode_fetch_attr(element, "builtin");
@@ -704,11 +712,13 @@ process_action(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
 
 	clish_xml_release(builtin);
 	clish_xml_release(shebang);
+
+	shell = shell; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
-static void
-process_detail(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
+static void process_detail(clish_shell_t *shell, clish_xmlnode_t *element,
+	void *parent)
 {
 	clish_command_t *cmd = (clish_command_t *) parent;
 
@@ -722,6 +732,8 @@ process_detail(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
 
 	if (text)
 		free(text);
+
+	shell = shell; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
@@ -807,8 +819,8 @@ process_namespace_end:
 }
 
 /* ------------------------------------------------------ */
-static void
-process_config(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
+static void process_config(clish_shell_t *shell, clish_xmlnode_t *element,
+	void *parent)
 {
 	clish_command_t *cmd = (clish_command_t *)parent;
 	clish_config_t *config;
@@ -891,10 +903,13 @@ process_config(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
 	clish_xml_release(seq);
 	clish_xml_release(unique);
 	clish_xml_release(depth);
+
+	shell = shell; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
-static void process_var(clish_shell_t * shell, clish_xmlnode_t * element, void *parent)
+static void process_var(clish_shell_t *shell, clish_xmlnode_t *element,
+	void *parent)
 {
 	clish_var_t *var = NULL;
 	char *name = clish_xmlnode_fetch_attr(element, "name");
@@ -925,6 +940,8 @@ static void process_var(clish_shell_t * shell, clish_xmlnode_t * element, void *
 	clish_xml_release(value);
 
 	process_children(shell, element, var);
+
+	parent = parent; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */
@@ -962,6 +979,8 @@ process_hotkey(clish_shell_t *shell, clish_xmlnode_t* element, void *parent)
 
 	clish_xml_release(key);
 	clish_xml_release(cmd);
+
+	shell = shell; /* Happy compiler */
 }
 
 /* ------------------------------------------------------ */

+ 2 - 3
clish/view/view.c

@@ -318,12 +318,11 @@ void clish_view_insert_nspace(clish_view_t * this, clish_nspace_t * nspace)
 /*--------------------------------------------------------- */
 void clish_view_clean_proxy(clish_view_t * this)
 {
-	int i;
+	unsigned int i;
 
 	/* Iterate namespace instances */
-	for (i = 0; i < this->nspacec; i++) {
+	for (i = 0; i < this->nspacec; i++)
 		clish_nspace_clean_proxy(this->nspacev[i]);
-	}
 }
 
 /*---------------------------------------------------------

+ 1 - 1
konf/buf/buf.c

@@ -145,7 +145,7 @@ int konf_buf_read(konf_buf_t *this)
 /*--------------------------------------------------------- */
 char * konf_buf_string(char *buf, int len)
 {
-	unsigned i;
+	int i;
 	char *str;
 
 	for (i = 0; i < len; i++) {

+ 1 - 1
konf/query/query.c

@@ -87,7 +87,7 @@ void konf_query_free(konf_query_t *this)
 /* Parse query */
 int konf_query_parse(konf_query_t *this, int argc, char **argv)
 {
-	unsigned i = 0;
+	int i = 0;
 	int pwdc = 0;
 
 	static const char *shortopts = "suoedtp:q:r:l:f:inh:";

+ 1 - 0
tinyrl/tinyrl.c

@@ -261,6 +261,7 @@ static void changed_line(tinyrl_t * this)
 /*----------------------------------------------------------------------- */
 static int tinyrl_timeout_default(tinyrl_t *this)
 {
+	this = this; /* Happy compiler */
 	/* Return -1 to close session on timeout */
 	return -1;
 }

+ 1 - 0
tinyrl/vt100/vt100.c

@@ -48,6 +48,7 @@ tinyrl_vt100_escape_t tinyrl_vt100_escape_decode(const tinyrl_vt100_t *this,
 		break;
 	}
 
+	this = this; /* Happy compiler */
 	return result;
 }