[patch] warnings

Nirgal <[email protected]> Thu, 25 Aug 2011 20:27:44 +0000
Newsgroups gmane.comp.db.mdb-tools.devel
Message-ID <[email protected]>
The attached patch fixes many compilation warnings.
Remaining warnings are real problems not trivial to fix...
That's all for today :)

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev

_______________________________________________
mdbtools-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mdbtools-dev
warnings.diff (text/x-patch, 9.2 KB)
Index: mdbtools-0.6pre1/src/sql/parser.y
===================================================================
--- mdbtools-0.6pre1.orig/src/sql/parser.y
+++ mdbtools-0.6pre1/src/sql/parser.y
@@ -19,6 +19,8 @@
  */
 #include "mdbsql.h"
 
+int yylex(void);
+int yyerror(char *);
 
 MdbSQL *_mdb_sql(MdbSQL *sql)
 {
Index: mdbtools-0.6pre1/src/util/mdb-schema.c
===================================================================
--- mdbtools-0.6pre1.orig/src/util/mdb-schema.c
+++ mdbtools-0.6pre1/src/util/mdb-schema.c
@@ -42,9 +42,8 @@
 		exit (1);
 	}
 
-	int digit_optind = 0;
 	while (1) {
-		int this_option_optind = optind ? optind : 1;
+		//int this_option_optind = optind ? optind : 1;
 		int option_index = 0;
 		static struct option long_options[] = {
 			{"table", 1, NULL, 'T'},
Index: mdbtools-0.6pre1/src/libmdb/index.c
===================================================================
--- mdbtools-0.6pre1.orig/src/libmdb/index.c
+++ mdbtools-0.6pre1/src/libmdb/index.c
@@ -718,11 +718,12 @@
 
 void mdb_index_walk(MdbTableDef *table, MdbIndex *idx)
 {
-MdbHandle *mdb = table->entry->mdb;
-int cur_pos = 0;
-unsigned char marker;
-MdbColumn *col;
-unsigned int i;
+/*
+	MdbHandle *mdb = table->entry->mdb;
+	int cur_pos = 0;
+	unsigned char marker;
+	MdbColumn *col;
+	unsigned int i;
 
 	if (idx->num_keys!=1) return;
 
@@ -734,6 +735,7 @@
 		col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
 		//printf("column %d coltype %d col_size %d (%d)\n",i,col->col_type, mdb_col_fixed_size(col), col->col_size);
 	}
+*/
 }
 void 
 mdb_index_dump(MdbTableDef *table, MdbIndex *idx)
Index: mdbtools-0.6pre1/src/libmdb/data.c
===================================================================
--- mdbtools-0.6pre1.orig/src/libmdb/data.c
+++ mdbtools-0.6pre1/src/libmdb/data.c
@@ -244,7 +244,6 @@
 	MdbHandle *mdb = table->entry->mdb;
 	MdbColumn *col;
 	unsigned int i;
-	int rc;
 	int row_start;
 	size_t row_size;
 	int delflag, lookupflag;
@@ -290,7 +289,7 @@
 	/* use num_cols instead of num_fields -- bsb 03/04/02 */
 	for (i = 0; i < table->num_cols; i++) {
 		col = g_ptr_array_index(table->columns,fields[i].colnum);
-		rc = _mdb_attempt_bind(mdb, col, fields[i].is_null,
+		_mdb_attempt_bind(mdb, col, fields[i].is_null,
 			fields[i].start, fields[i].siz);
 	}
 
Index: mdbtools-0.6pre1/src/gmdb2/main2.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/main2.c
+++ mdbtools-0.6pre1/src/gmdb2/main2.c
@@ -62,7 +62,7 @@
 	if (!pixbuf)
 		pixbuf = gdk_pixbuf_new_from_file (GMDB_ICONDIR "logo.xpm", NULL);
 
-  	gtk_show_about_dialog (parent,
+  	gtk_show_about_dialog ((GtkWindow*)parent,
    		"authors", authors,
 		"comments", _("GNOME MDB Viewer is a grapical interface to "
 			"MDB Tools. It lets you view and export data and schema "
@@ -172,7 +172,6 @@
 int main(int argc, char *argv[]) 
 {
 GtkWidget *gmdb;
-GnomeProgram *program;
 
 #ifdef SQL
 	/* initialize the SQL engine */
@@ -181,9 +180,9 @@
 	/* initialize MDB Tools library */
 	mdb_init();
 
-        /* Initialize GNOME */
-	       /* Initialize gnome program */
-	program = gnome_program_init ("gmdb", "0.2",
+	/* Initialize GNOME */
+	/* Initialize gnome program */
+	gnome_program_init ("gmdb", MDB_VERSION_NO,
 		LIBGNOMEUI_MODULE, argc, argv,
 		GNOME_PARAM_POPT_TABLE, NULL,
 		GNOME_PARAM_HUMAN_READABLE_NAME,
Index: mdbtools-0.6pre1/src/gmdb2/debug.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/debug.c
+++ mdbtools-0.6pre1/src/gmdb2/debug.c
@@ -324,12 +324,12 @@
 static void
 gmdb_debug_display(GladeXML *xml, guint32 page)
 {
-	unsigned char *fbuf;
-	unsigned char *tbuf;
+	char *fbuf;
+	char *tbuf;
 	int length;
 	int i, j;
-	gchar line[80];
-	gchar field[10];
+	char line[80];
+	char field[10];
 	GtkTextBuffer *buffer;
 	GtkTextIter iter;
 	GtkTextView *textview;
@@ -349,8 +349,8 @@
 
 	lseek(mdb->f->fd, page * mdb->fmt->pg_size, SEEK_SET);
 	
-	fbuf = (unsigned char *) g_malloc(mdb->fmt->pg_size);
-	tbuf = (unsigned char *) g_malloc0( (mdb->fmt->pg_size / 16) * 80);
+	fbuf = g_malloc(mdb->fmt->pg_size);
+	tbuf = g_malloc0( (mdb->fmt->pg_size / 16) * 80);
 	length = read(mdb->f->fd, fbuf, mdb->fmt->pg_size);
 	if (length<mdb->fmt->pg_size) {
 	}
@@ -481,7 +481,7 @@
 		(flags & MDB_IDX_REQUIRED) ? " Required" : "",
 		NULL);
 	if (strcmp(str, "Index Flags:") == 0) {
-		gchar *str2 = g_strconcat(str, " None");
+		gchar *str2 = g_strconcat(str, " None", NULL);
 		g_free(str);
 		str = str2;
 	}
@@ -585,7 +585,7 @@
 	gchar *str;
 	int num_rows, i, row_start, row_len;
 	guint32 tdef;
-	GtkTreeIter *container;
+	//GtkTreeIter *container;
 
 	str = g_strdup_printf("Page free space: %u", get_uint16(fbuf+offset+2));
 	gmdb_debug_add_item(store, NULL, str, offset+2, 2);
@@ -612,7 +612,7 @@
 			row_len = (get_uint16(fbuf+offset+14+(i-1)*2) 
 				& 0x0FFF) - row_start;
 		str = g_strdup_printf("Row %d", i+1);
-		container = gmdb_debug_add_item(store, NULL, str,
+		/*container = */gmdb_debug_add_item(store, NULL, str,
 			row_start, row_len); 
 		
 		/* usage pages have parent id of 0 (database) and do not 
@@ -722,9 +722,9 @@
 		container = gmdb_debug_add_item(store, NULL, str, -1, 0);
 	}
 	for (i=0;i<num_idx;i++) {
-		GtkTreeIter *node;
+		/*GtkTreeIter *node;*/
 		str = g_strdup_printf("Index %d", i+1);
-		node = gmdb_debug_add_item(store, container, str, newbase, 12);
+		/*node = */gmdb_debug_add_item(store, container, str, newbase, 12);
 		//gmdb_debug_dissect_index1(store, node, fbuf, offset+63);
 		newbase += 12;
 	}
@@ -734,7 +734,7 @@
 	str = g_strdup("Column Info");
 	container = gmdb_debug_add_item(store, NULL, str, -1, 0);
 	for (i=0;i<num_cols;i++) {
-		GtkTreeIter *node, *subnode;
+		GtkTreeIter *node/*, *subnode*/;
 //		char *tmpstr;
 		int namelen;
 
@@ -742,7 +742,7 @@
 		node = gmdb_debug_add_item(store, container, str, -1, 0);
 
 		str = g_strdup("Data");
-		subnode = gmdb_debug_add_item(store, node, str, infobase, 25);
+		/*subnode = */gmdb_debug_add_item(store, node, str, infobase, 25);
 		//gmdb_debug_dissect_column(store, subnode, fbuf, infobase);
 		infobase += 25;
 
Index: mdbtools-0.6pre1/src/gmdb2/sql.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/sql.c
+++ mdbtools-0.6pre1/src/gmdb2/sql.c
@@ -80,7 +80,7 @@
 	
 	filesel = glade_xml_get_widget (xml, "export_dialog");
 	sql_xml = g_object_get_data(G_OBJECT(filesel), "sql_xml");
-	printf("sql_xml %lu\n",sql_xml);
+	//printf("sql_xml %p\n",sql_xml);
 
 	gmdb_export_get_delimiter(xml, delimiter, 10);
 	gmdb_export_get_lineterm(xml, lineterm, 5);
@@ -102,7 +102,7 @@
 	glist = gtk_tree_view_get_columns(GTK_TREE_VIEW(treeview));
 	i = 0;
 	if (need_headers)  {
-		while (col = g_list_nth_data(glist, i)) {
+		while ((col = g_list_nth_data(glist, i))) {
 			gchar *title;
 			if (i>0) fputs(delimiter, outfile);
 			title = g_strdup(gtk_tree_view_column_get_title(col));
@@ -304,7 +304,7 @@
 		selection_data,
 		GDK_SELECTION_TYPE_STRING,
 		8,  /* 8 bits per character. */
-		tablename, strlen(tablename));
+		(guchar*)tablename, strlen(tablename));
 }
 static void gmdb_sql_dnd_datareceived_cb(
         GtkWidget *w,
@@ -351,11 +351,10 @@
 	gchar *bound_data[256];
 	int i;
 	MdbSQLColumn *sqlcol;
-	gchar *titles[256];
 	GtkTextBuffer *txtbuffer;
 	GtkTextIter start, end;
 	GtkWidget *textview, *combo, *treeview, *store;
-	GtkWidget *window;
+	/*GtkWidget *window;*/
 	GList *history;
 	GType *gtypes;
 	GtkTreeIter iter;
@@ -405,8 +404,7 @@
 
 	store = (GtkWidget *) gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
 	if (store) {
-		i=0;
-		while (column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i)) {
+		while ((column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), 0))) {
 			gtk_tree_view_remove_column(GTK_TREE_VIEW(treeview), column);
 		}
 		gtk_widget_destroy(store);
Index: mdbtools-0.6pre1/include/mdbsql.h
===================================================================
--- mdbtools-0.6pre1.orig/include/mdbsql.h
+++ mdbtools-0.6pre1/include/mdbsql.h
@@ -51,6 +51,10 @@
 #undef YY_INPUT
 #define YY_INPUT(b, r, ms) (r = mdb_sql_yyinput(b, ms));
 
+#define mdb_sql_has_error(sql) ((sql)->error_msg[0] ? 1 : 0)
+#define mdb_sql_last_error(sql) ((sql)->error_msg)
+
+void mdb_sql_error(MdbSQL* sql, char *fmt, ...);
 extern MdbSQL *_mdb_sql(MdbSQL *sql);
 extern MdbSQL *mdb_sql_init();
 extern MdbSQLSarg *mdb_sql_alloc_sarg();
Index: mdbtools-0.6pre1/src/gmdb2/info.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/info.c
+++ mdbtools-0.6pre1/src/gmdb2/info.c
@@ -72,5 +72,5 @@
 
 	g_free(filepath);
 
-	return propswin_xml;
+	return propswin;
 }
Index: mdbtools-0.6pre1/src/sql/mdbsql.c
===================================================================
--- mdbtools-0.6pre1.orig/src/sql/mdbsql.c
+++ mdbtools-0.6pre1/src/sql/mdbsql.c
@@ -44,21 +44,11 @@
 	va_end(ap);
 	fprintf(stderr,"\n");
 }
-void
+static void
 mdb_sql_clear_error(MdbSQL* sql)
 {
 	sql->error_msg[0]='\0';
 }
-char *
-mdb_sql_last_error(MdbSQL* sql)
-{
-	return sql->error_msg;
-}
-unsigned char
-mdb_sql_has_error(MdbSQL* sql)
-{
-	return (sql->error_msg[0] ? 1 : 0);
-}
 int mdb_sql_yyinput(char *buf, int need)
 {
 int cplen, have;
@@ -91,8 +81,6 @@
 #define _(x) x
 #endif
 
-void mdb_sql_bind_all (MdbSQL*);
-
 /**
  * mdb_sql_run_query:
  * @sql: MDB SQL object to execute the query on.