Removes many compilation warnings.

This commit is contained in:
Jean-Michel Vourgère 2011-08-30 16:11:13 -04:00 committed by Brian Bruns
parent c5e92f52b0
commit 0a76d5716f
9 changed files with 52 additions and 98 deletions

View File

@ -51,6 +51,10 @@ extern char *g_input_ptr;
#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();

View File

@ -324,12 +324,12 @@ gmdb_debug_display_cb(GtkWidget *w, gpointer data)
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 @@ gmdb_debug_display(GladeXML *xml, guint32 page)
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) {
}
@ -359,7 +359,7 @@ gmdb_debug_display(GladeXML *xml, guint32 page)
sprintf(line,"%06x ", i);
for(j=0; j<16; j++) {
sprintf(field, "%02x ", fbuf[i+j]);
sprintf(field, "%02x ", ((unsigned char*)fbuf)[i+j]);
strcat(line,field);
}
@ -430,7 +430,7 @@ static void
gmdb_debug_dissect_column(GtkTreeStore *store, GtkTreeIter *parent, char *fbuf, int offset)
{
gchar *str;
char *foff = fbuf + offset;
unsigned char *foff = (unsigned char*)fbuf + offset;
str = g_strdup_printf("Column Type: 0x%02x (%s)", foff[0],
gmdb_val_to_str(column_types, foff[0]));
@ -481,7 +481,7 @@ gmdb_debug_dissect_index2(GtkTreeStore *store, GtkTreeIter *parent, char *fbuf,
(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;
}
@ -530,11 +530,11 @@ gmdb_debug_dissect_row(GtkTreeStore *store, GtkTreeIter *parent, char *fbuf, int
offset + loc1, loc2 - loc1);
}
str = g_strdup_printf("End of data (EOD): 0x%02x (%u)",
fbuf[eod_ptr], fbuf[eod_ptr]);
((unsigned char*)fbuf)[eod_ptr], ((unsigned char*)fbuf)[eod_ptr]);
gmdb_debug_add_item(store, parent, str, eod_ptr, 1);
for (i=0;i<var_cols;i++) {
g_strdup_printf("Var col %d offset: 0x%02x (%u)", var_cols-i,
fbuf[eod_ptr+i+1], fbuf[eod_ptr+i+1]);
((unsigned char*)fbuf)[eod_ptr+i+1], ((unsigned char*)fbuf)[eod_ptr+i+1]);
gmdb_debug_add_item(store, parent, str, eod_ptr + i + 1, 1);
}
str = g_strdup_printf("Num var cols: %u", var_cols);
@ -585,7 +585,7 @@ gmdb_debug_dissect_data_pg4(GtkTreeStore *store, char *fbuf, int offset, int len
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 @@ gmdb_debug_dissect_data_pg4(GtkTreeStore *store, char *fbuf, int offset, int len
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 @@ gmdb_debug_dissect_tabledef_pg4(GtkTreeStore *store, char *fbuf, int offset, int
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 @@ gmdb_debug_dissect_tabledef_pg4(GtkTreeStore *store, char *fbuf, int offset, int
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 @@ gmdb_debug_dissect_tabledef_pg4(GtkTreeStore *store, char *fbuf, int offset, int
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;
@ -881,7 +881,7 @@ gmdb_debug_dissect(GtkTreeStore *store, char *fbuf, int offset, int len)
{
gchar *str;
str = g_strdup_printf("Page Type: 0x%02x (%s)", fbuf[offset],
str = g_strdup_printf("Page Type: 0x%02x (%s)", ((unsigned char*)fbuf)[offset],
gmdb_val_to_str(object_types, fbuf[offset]));
gmdb_debug_add_item(store, NULL, str, 0, 1);
switch (fbuf[offset]) {

View File

@ -72,5 +72,5 @@ struct stat st;
g_free(filepath);
return propswin_xml;
return propswin;
}

View File

@ -62,7 +62,7 @@ GdkPixbuf *pixbuf=NULL;
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 "
@ -129,50 +129,9 @@ gchar *text, *text2;
}
}
static void
gmdb_load_icons(GladeXML *xml)
{
GtkWidget *icon;
char file[256];
GValue value = { 0, };
int i = 0;
char *icons[] = {
"table_icon",
"query_icon",
"form_icon",
"report_icon",
"macro_icon",
"module_icon",
"debug_icon",
NULL
};
char *files[] = {
"table.xpm",
"query.xpm",
"forms.xpm",
"reports.xpm",
"macros.xpm",
"code.xpm",
"debug.xpm",
NULL
};
while (icons[i]) {
icon = glade_xml_get_widget (xml, icons[i]);
g_value_init (&value, G_TYPE_STRING);
g_snprintf(file,256,"%s%s", GMDB_ICONDIR, files[i]);
g_value_set_static_string (&value, file);
g_object_set_property (G_OBJECT (icon), "file" , &value);
g_value_unset (&value);
i++;
}
}
int main(int argc, char *argv[])
{
GtkWidget *gmdb;
GnomeProgram *program;
#ifdef SQL
/* initialize the SQL engine */
@ -181,9 +140,9 @@ GnomeProgram *program;
/* 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,
@ -203,8 +162,6 @@ GnomeProgram *program;
gtk_signal_connect (GTK_OBJECT (gmdb), "delete_event",
GTK_SIGNAL_FUNC (delete_event), NULL);
//gmdb_load_icons(mainwin_xml);
if (argc>1) {
gmdb_file_open(argv[1]);
}

View File

@ -18,6 +18,7 @@
#include "gmdb.h"
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-help.h>
extern GtkWidget *app;
extern MdbHandle *mdb;

View File

@ -80,7 +80,7 @@ gmdb_sql_write_rslt_cb(GtkWidget *w, GladeXML *xml)
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 @@ gmdb_sql_write_rslt_cb(GtkWidget *w, GladeXML *xml)
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 @@ GtkTreeIter iter2;
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 @@ gmdb_sql_execute_cb(GtkWidget *w, GladeXML *xml)
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 @@ gmdb_sql_execute_cb(GtkWidget *w, GladeXML *xml)
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);

View File

@ -157,10 +157,6 @@ int i;
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
long p1;
long p1Len = sizeof(p1);
long sAge = 1023;
long cbAge = sizeof(long);
UCHAR szCol1[60];
SQLINTEGER length;
@ -189,7 +185,7 @@ int i;
while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS)
{
i++;
printf("%d: szCol1 = %s (%d)\n",i,szCol1, length);
printf("%d: szCol1 = %s (%d)\n", i, szCol1, (int)length);
}
if (retcode != SQL_NO_DATA_FOUND)
{

View File

@ -20,6 +20,7 @@
#include <string.h>
#include "mdbsql.h"
#include "parser.h"
extern int mdb_sql_yyinput(char *buf, int need);
%}
%%

View File

@ -23,8 +23,6 @@
#include "dmalloc.h"
#endif
void mdb_dump_results(MdbSQL *sql);
#ifdef HAVE_WORDEXP_H
#define HAVE_WORDEXP
#include <wordexp.h>
@ -32,6 +30,21 @@ void mdb_dump_results(MdbSQL *sql);
char *g_input_ptr;
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
void
mdb_sql_error(MdbSQL* sql, char *fmt, ...)
{
@ -43,21 +56,7 @@ va_list ap;
va_end(ap);
fprintf(stderr,"\n");
}
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;
@ -90,8 +89,6 @@ MdbSQL *sql;
#define _(x) x
#endif
void mdb_sql_bind_all (MdbSQL*);
/**
* mdb_sql_run_query:
* @sql: MDB SQL object to execute the query on.
@ -112,7 +109,7 @@ mdb_sql_run_query (MdbSQL* sql, const gchar* querystr) {
/* begin unsafe */
_mdb_sql (sql);
mdb_sql_clear_error(sql);
sql->error_msg[0]='\0';
if (yyparse()) {
/* end unsafe */
mdb_sql_error (sql, _("Could not parse '%s' command"), querystr);