this patch fixes the mismatch between the variadic open()
and the GTmpFileCallback typedef.
to mute the const gchar* -> gchar* warnings, typecasts
were introduced as needed.
the other option is to make g_open_wrapper() and 
GTmpFileCallback typedef take const gchar* instead.

Signed-off-by: John Spencer <maillist-gnome@barfooze.de>

diff -ur glib-2.32.2.org/gio/glocalfileoutputstream.c glib-2.32.2/gio/glocalfileoutputstream.c
--- glib-2.32.2.org/gio/glocalfileoutputstream.c	2012-11-05 04:29:18.671000003 +0000
+++ glib-2.32.2/gio/glocalfileoutputstream.c	2012-11-05 04:42:27.389000003 +0000
@@ -569,7 +569,7 @@
   else
     open_flags |= O_WRONLY;
 
-  fd = g_open (filename, open_flags, 0666);
+  fd = g_open ((gchar *) filename, open_flags, 0666);
   if (fd == -1)
     {
       int errsv = errno;
@@ -622,7 +622,7 @@
   else
     open_flags |= O_WRONLY;
 
-  fd = g_open (filename, open_flags, mode);
+  fd = g_open ((gchar *) filename, open_flags, mode);
   if (fd == -1)
     {
       int errsv = errno;
@@ -667,7 +667,7 @@
   else
     mode = 0666;
 
-  fd = g_open (filename, O_CREAT | O_APPEND | O_WRONLY | O_BINARY, mode);
+  fd = g_open ((gchar *) filename, O_CREAT | O_APPEND | O_WRONLY | O_BINARY, mode);
   if (fd == -1)
     {
       int errsv = errno;
@@ -802,16 +802,16 @@
    * when finding out if the file we opened was a symlink */
 #ifdef O_NOFOLLOW
   is_symlink = FALSE;
-  fd = g_open (filename, open_flags | O_NOFOLLOW, mode);
+  fd = g_open ((gchar *) filename, open_flags | O_NOFOLLOW, mode);
   if (fd == -1 && errno == ELOOP)
     {
       /* Could be a symlink, or it could be a regular ELOOP error,
        * but then the next open will fail too. */
       is_symlink = TRUE;
-      fd = g_open (filename, open_flags, mode);
+      fd = g_open ((gchar *) filename, open_flags, mode);
     }
 #else
-  fd = g_open (filename, open_flags, mode);
+  fd = g_open ((gchar *) filename, open_flags, mode);
   /* This is racy, but we do it as soon as possible to minimize the race */
   is_symlink = g_file_test (filename, G_FILE_TEST_IS_SYMLINK);
 #endif
@@ -967,7 +967,7 @@
 	  goto err_out;
 	}
 
-      bfd = g_open (backup_filename,
+      bfd = g_open ((gchar *) backup_filename,
 		    O_WRONLY | O_CREAT | O_EXCL | O_BINARY,
 		    original_stat.st_mode & 0777);
 
@@ -1064,7 +1064,7 @@
 	open_flags = O_RDWR | O_CREAT | O_BINARY;
       else
 	open_flags = O_WRONLY | O_CREAT | O_BINARY;
-      fd = g_open (filename, open_flags, mode);
+      fd = g_open ((gchar* ) filename, open_flags, mode);
       if (fd == -1)
 	{
 	  int errsv = errno;
@@ -1137,7 +1137,7 @@
     open_flags |= O_RDWR;
   else
     open_flags |= O_WRONLY;
-  fd = g_open (filename, open_flags, mode);
+  fd = g_open ((gchar *) filename, open_flags, mode);
 
   if (fd == -1 && errno == EEXIST)
     {
diff -ur glib-2.32.2.org/glib/gfileutils.c glib-2.32.2/glib/gfileutils.c
--- glib-2.32.2.org/glib/gfileutils.c	2012-11-05 04:29:18.763000003 +0000
+++ glib-2.32.2/glib/gfileutils.c	2012-11-05 04:52:24.938000002 +0000
@@ -1317,6 +1317,16 @@
  */
 typedef gint (*GTmpFileCallback) (gchar *, gint, gint);
 
+/*
+ * since the GTmpFileCallback typedef is not compatible with the variadic
+ * open() prototype, we use a wrapper (see bug #687600) 
+ */
+gint
+g_open_wrapper(gchar* a, gint b, gint c)
+{
+  return open(a, b, c);
+}
+
 static gint
 get_tmp_file (gchar            *tmpl,
               GTmpFileCallback  f,
@@ -2608,7 +2618,7 @@
   /* This is the backward compatibility system codepage version,
    * thus use normal open().
    */
-  return get_tmp_file (tmpl, (GTmpFileCallback) open,
+  return get_tmp_file (tmpl, (GTmpFileCallback) g_open_wrapper,
 		       O_RDWR | O_CREAT | O_EXCL, 0600);
 }
 
diff -ur glib-2.32.2.org/glib/gfileutils.h glib-2.32.2/glib/gfileutils.h
--- glib-2.32.2.org/glib/gfileutils.h	2012-11-05 04:29:18.759000003 +0000
+++ glib-2.32.2/glib/gfileutils.h	2012-11-05 04:34:39.271000003 +0000
@@ -129,6 +129,7 @@
 
 gint     g_mkdir_with_parents (const gchar *pathname,
                                gint         mode);
+gint     g_open_wrapper       (gchar* filename, gint flags, gint mode);
 
 #ifdef G_OS_WIN32
 
diff -ur glib-2.32.2.org/glib/gkeyfile.c glib-2.32.2/glib/gkeyfile.c
--- glib-2.32.2.org/glib/gkeyfile.c	2012-11-05 04:29:18.785000003 +0000
+++ glib-2.32.2/glib/gkeyfile.c	2012-11-05 04:45:19.056000002 +0000
@@ -691,7 +691,7 @@
           path = g_build_filename (data_dir, sub_dir,
                                    candidate_file, NULL);
 
-          fd = g_open (path, O_RDONLY, 0);
+          fd = g_open ((gchar *) path, O_RDONLY, 0);
 
           if (fd == -1)
             {
@@ -837,7 +837,7 @@
   g_return_val_if_fail (key_file != NULL, FALSE);
   g_return_val_if_fail (file != NULL, FALSE);
 
-  fd = g_open (file, O_RDONLY, 0);
+  fd = g_open ((gchar *) file, O_RDONLY, 0);
 
   if (fd == -1)
     {
diff -ur glib-2.32.2.org/glib/gmappedfile.c glib-2.32.2/glib/gmappedfile.c
--- glib-2.32.2.org/glib/gmappedfile.c	2012-11-05 04:29:18.783000003 +0000
+++ glib-2.32.2/glib/gmappedfile.c	2012-11-05 04:37:35.385000003 +0000
@@ -248,7 +248,7 @@
   g_return_val_if_fail (filename != NULL, NULL);
   g_return_val_if_fail (!error || *error == NULL, NULL);
 
-  fd = g_open (filename, (writable ? O_RDWR : O_RDONLY) | _O_BINARY, 0);
+  fd = g_open ((gchar *) filename, (writable ? O_RDWR : O_RDONLY) | _O_BINARY, 0);
   if (fd == -1)
     {
       int save_errno = errno;
diff -ur glib-2.32.2.org/glib/gstdio.h glib-2.32.2/glib/gstdio.h
--- glib-2.32.2.org/glib/gstdio.h	2012-11-05 04:29:18.787000003 +0000
+++ glib-2.32.2/glib/gstdio.h	2012-11-05 04:35:38.543000003 +0000
@@ -62,7 +62,7 @@
 
 #ifndef __GTK_DOC_IGNORE__
 #define g_chmod   chmod
-#define g_open    open
+#define g_open    g_open_wrapper
 #define g_creat   creat
 #define g_rename  rename
 #define g_mkdir   mkdir
diff -ur glib-2.32.2.org/glib/gtester.c glib-2.32.2/glib/gtester.c
--- glib-2.32.2.org/glib/gtester.c	2012-11-05 04:29:18.753000003 +0000
+++ glib-2.32.2/glib/gtester.c	2012-11-05 04:44:11.543000002 +0000
@@ -671,7 +671,7 @@
 
   if (output_filename)
     {
-      log_fd = g_open (output_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+      log_fd = g_open ((gchar*) output_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
       if (log_fd < 0)
         g_error ("Failed to open log file '%s': %s", output_filename, g_strerror (errno));
     }
diff -ur glib-2.32.2.org/gmodule/gmodule.c glib-2.32.2/gmodule/gmodule.c
--- glib-2.32.2.org/gmodule/gmodule.c	2012-11-05 04:29:18.833000003 +0000
+++ glib-2.32.2/gmodule/gmodule.c	2012-11-05 04:38:43.816000002 +0000
@@ -360,7 +360,7 @@
   GTokenType token;
   GScanner *scanner;
   
-  int fd = g_open (libtool_name, O_RDONLY, 0);
+  int fd = g_open ((gchar *) libtool_name, O_RDONLY, 0);
   if (fd < 0)
     {
       gchar *display_libtool_name = g_filename_display_name (libtool_name);
