[patch] Re: More patches soon ...

Nirgal Vourgère <[email protected]> Sun, 6 Mar 2011 12:09:48 +0000
Newsgroups gmane.comp.db.mdb-tools.devel
Message-ID <[email protected]>
On Friday 04 March 2011 18:29:22 Dmitry Nikitin wrote:
> Hi, Nirgal Vourgère!
> You job is greate. Thanks.
> I found your git-repository and compiled worked and new functionality mdbtools.

I don't have a git repository. Brian Burns is the author.
The latest repository is located at https://github.com/brianb/mdbtools.git
I occasionaly update some unoffical debian packages at http://www.nirgal.com/mdbtools/

> But when I would build the RPM package for my distr (Mandriva 2010), the build CFLAGS of:
> CFLAGS="-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL"
> give the errors in sources:
> 
> gcc -DHAVE_CONFIG_H -I. -I../../include  -I../../include -DORBIT2=1 -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libglade-2.0 -I/usr/include/libxml2 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib64/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gail-1.0   -DDATADIR="\"/usr/local/share\"" -DGMDB_ICONDIR="\"/usr/local/share/gmdb/glade/\"" -DGMDB_GLADEDIR="\"/usr/local/share/gmdb/glade/\""    -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -MT main2.o -MD -MP -MF .deps/main2.Tpo -c -o main2.o main2.c
> main2.c: In function ‘gmdb_about_cb’:
> main2.c:75: warning: passing argument 1 of ‘gtk_show_about_dialog’ from incompatible pointer type
> /usr/include/gtk-2.0/gtk/gtkaboutdialog.h:67: note: expected ‘struct GtkWindow *’ but argument is of type ‘struct GtkWidget *’
> main2.c: In function ‘gmdb_help_cb’:
> main2.c:105: error: format not a string literal and no format arguments
> make[3]: *** [main2.o] Error 1
> 
> This errors take the CFLAGS="-Werror=format-security", without this flags compiled as is.

I think it's not the proper way to fix that. It's a very interresting warning/error message my compiler doesn't show. A pity.

I think it's the same problem than using "printf(message)" when you have no idea whether the message might contain "%".

You should use puts(message) or printf("%s", message) in these cases.

Attached is a patch. Does it help?


> Also give errors in build mdbtools with unixODBC:
> Making all in odbc
> make[2]: Вхожу у каталог "/home/luckas/rpm/BUILD/mdbtools-0.6pre1.patched/src/odbc"
> /bin/sh ../../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../include  -I../../include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -I/usr/include   -O2 -g -pipe -Wformat -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT odbc.lo -MD -MP -MF .deps/odbc.Tpo -c -o odbc.lo odbc.c
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include -O2 -g -pipe -Wformat -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -DHAVE_ICONV -DSQL -DHAVE_ICONV -DSQL -DUNIXODBC -MT odbc.lo -MD -MP -MF .deps/odbc.Tpo -c odbc.c  -fPIC -DPIC -o .libs/odbc.o
> odbc.c:223: error: expected declaration specifiers or ‘...’ before ‘SQLROWOFFSET’
> odbc.c:224: error: expected declaration specifiers or ‘...’ before ‘SQLROWSETSIZE’
> odbc.c:220: error: conflicting types for ‘SQLExtendedFetch’
> /usr/include/sqlext.h:1857: note: previous declaration of ‘SQLExtendedFetch’ was here
> odbc.c: In function ‘SQLExtendedFetch’:
> odbc.c:236: error: ‘pcrow’ undeclared (first use in this function)
> odbc.c:236: error: (Each undeclared identifier is reported only once
> odbc.c:236: error: for each function it appears in.)
> odbc.c: At top level:
> odbc.c:1485: error: expected declaration specifiers or ‘...’ before ‘SQLROWCOUNT’
> odbc.c:1482: error: conflicting types for ‘SQLSetStmtOption’
> /usr/include/sql.h:796: note: previous declaration of ‘SQLSetStmtOption’ was here
> make[2]: *** [odbc.lo] Error 1
> 
> My configurations:
> Mandriva 2010.0, x86_64, mdbtools-git-2011-02-28, lib64gtk+2.0_0-devel-2.18.9-1.2mdv2010.0.x86_64, lib64unixODBC-devel-2.2.14-8mdv2010.0.x86_64

Attached is another fix for that one.

> Also I would like propouse a some thinks:
> 1) need to fix maximum varchar (255) for mysql

I read limit is 65535 since mysql 5.0.3.
http://dev.mysql.com/doc/refman/5.0/en/char.html

> 2) need to fix the procedure of sanitize (-S) the dump of MDB files. You already changes dates to utf-8 codepage, and the more "dummy"
> MS windows users and "admins" used the non ASCII symbols for names of tables and columns in the MDB-files, like as cyrilic :(
> May be the procedure of sanitize can replace the symbols in names as transliterate (need check the match of names and length?)
> Now, the replaced only spaces in names as "_", and .... the other non-english symbols taking "____________________________" as name of table.

Sanitize is really buggy.
I would recommand removing it from the code.
All backends should now handle the non ascii characters in table/colum names correctly, quoting them.
Do you really need -S?
If using Jet3, don't forget to set MDB_JET3_CHARSET as described in mdb-schema manual and HACKING file.

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d

_______________________________________________
mdbtools-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mdbtools-dev
odbctypes.diff (text/x-patch, 764 B)
Index: mdbtools-0.6pre1/src/odbc/odbc.c
===================================================================
--- mdbtools-0.6pre1.orig/src/odbc/odbc.c
+++ mdbtools-0.6pre1/src/odbc/odbc.c
@@ -220,8 +220,8 @@
 SQLRETURN SQL_API SQLExtendedFetch(
     SQLHSTMT           hstmt,
     SQLUSMALLINT       fFetchType,
-    SQLROWOFFSET       irow,
-    SQLROWSETSIZE FAR  *pcrow,
+    SQLLEN             irow,
+    SQLULEN           *pcrow,
     SQLUSMALLINT FAR  *rgfRowStatus)
 {
 struct _hstmt *stmt = (struct _hstmt *) hstmt;
@@ -1482,7 +1482,7 @@
 SQLRETURN SQL_API SQLSetStmtOption(
     SQLHSTMT           hstmt,
     SQLUSMALLINT       fOption,
-    SQLROWCOUNT        vParam)
+    SQLULEN            vParam)
 {
 	TRACE("SQLSetStmtOption");
 	return SQL_SUCCESS;
g_warning.diff (text/x-patch, 1.6 KB)
Index: mdbtools-0.6pre1/src/gmdb2/main2.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/main2.c
+++ mdbtools-0.6pre1/src/gmdb2/main2.c
@@ -102,7 +102,7 @@
 
 	gnome_help_display("gmdb.xml", NULL, &error);
 	if (error != NULL) {
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 
Index: mdbtools-0.6pre1/src/gmdb2/prefs.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/prefs.c
+++ mdbtools-0.6pre1/src/gmdb2/prefs.c
@@ -44,7 +44,7 @@
 
 	gnome_help_display("gmdb.xml", "gmdb-prefs", &error);
 	if (error != NULL) {
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 }
Index: mdbtools-0.6pre1/src/gmdb2/schema.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/schema.c
+++ mdbtools-0.6pre1/src/gmdb2/schema.c
@@ -165,7 +165,7 @@
 
 	gnome_help_display("gmdb.xml", "gmdb-schema", &error);
 	if (error != NULL) {
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 }
Index: mdbtools-0.6pre1/src/gmdb2/table_export.c
===================================================================
--- mdbtools-0.6pre1.orig/src/gmdb2/table_export.c
+++ mdbtools-0.6pre1/src/gmdb2/table_export.c
@@ -142,7 +142,7 @@
 
 	gnome_help_display("gmdb.xml", "gmdb-table-export", &error);
 	if (error != NULL) {
-		g_warning (error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 	}
 }