[Gnucash-changes] r11924 - gnucash/branches/goffice-update/lib - Fixes for compilation-against gmumble-2.4.

Joshua Sled jsled at cvs.gnucash.org
Sun Nov 13 20:03:04 EST 2005


Author: jsled
Date: 2005-11-13 20:03:03 -0500 (Sun, 13 Nov 2005)
New Revision: 11924
Trac: http://svn.gnucash.org/trac/changeset/11924

Modified:
   gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.c
   gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.h
   gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.c
   gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.h
   gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-outfile-zip.c
   gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-utils.c
Log:
Fixes for compilation-against gmumble-2.4.


Modified: gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.c
===================================================================
--- gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.c	2005-11-13 23:44:40 UTC (rev 11923)
+++ gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.c	2005-11-14 01:03:03 UTC (rev 11924)
@@ -1,5 +1,51 @@
-#include "glib24_26-compat.h"
+#include <goffice/glib24_26-compat.h>
 
+#include <string.h>
+
+static const guint16 days_in_year[2][14] = 
+{  /* 0, jan feb mar apr may  jun  jul  aug  sep  oct  nov  dec */
+  {  0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, 
+  {  0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+};
+
+/* "Julian days" just means an absolute number of days, where Day 1 ==
+ *   Jan 1, Year 1
+ */
+static void
+g_date_update_julian (const GDate *const_d)
+{
+  GDate *d = (GDate *) const_d;
+  GDateYear year;
+  gint index;
+  
+  g_return_if_fail (d != NULL);
+  g_return_if_fail (d->dmy);
+  g_return_if_fail (!d->julian);
+  g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
+  
+  /* What we actually do is: multiply years * 365 days in the year,
+   *  add the number of years divided by 4, subtract the number of
+   *  years divided by 100 and add the number of years divided by 400,
+   *  which accounts for leap year stuff. Code from Steffen Beyer's
+   *  DateCalc. 
+   */
+  
+  year = d->year - 1; /* we know d->year > 0 since it's valid */
+  
+  d->julian_days = year * 365U;
+  d->julian_days += (year >>= 2); /* divide by 4 and add */
+  d->julian_days -= (year /= 25); /* divides original # years by 100 */
+  d->julian_days += year >> 2;    /* divides by 4, which divides original by 400 */
+  
+  index = g_date_is_leap_year (d->year) ? 1 : 0;
+  
+  d->julian_days += days_in_year[index][d->month] + d->day;
+  
+  g_return_if_fail (g_date_valid_julian (d->julian_days));
+  
+  d->julian = TRUE;
+}
+
 /**
  * g_date_get_iso8601_week_of_year:
  * @date: a valid #GDate
@@ -101,6 +147,124 @@
   g_free (cache);
 }
 
+static char *
+unalias_lang (char *lang)
+{
+  return lang;
+}
+
+/* Mask for components of locale spec. The ordering here is from
+ * least significant to most significant
+ */
+enum
+{
+  COMPONENT_CODESET =   1 << 0,
+  COMPONENT_TERRITORY = 1 << 1,
+  COMPONENT_MODIFIER =  1 << 2
+};
+
+/* Break an X/Open style locale specification into components
+ */
+static guint
+explode_locale (const gchar *locale,
+		gchar      **language, 
+		gchar      **territory, 
+		gchar      **codeset, 
+		gchar      **modifier)
+{
+  const gchar *uscore_pos;
+  const gchar *at_pos;
+  const gchar *dot_pos;
+
+  guint mask = 0;
+
+  uscore_pos = strchr (locale, '_');
+  dot_pos = strchr (uscore_pos ? uscore_pos : locale, '.');
+  at_pos = strchr (dot_pos ? dot_pos : (uscore_pos ? uscore_pos : locale), '@');
+
+  if (at_pos)
+    {
+      mask |= COMPONENT_MODIFIER;
+      *modifier = g_strdup (at_pos);
+    }
+  else
+    at_pos = locale + strlen (locale);
+
+  if (dot_pos)
+    {
+      mask |= COMPONENT_CODESET;
+      *codeset = g_strndup (dot_pos, at_pos - dot_pos);
+    }
+  else
+    dot_pos = at_pos;
+
+  if (uscore_pos)
+    {
+      mask |= COMPONENT_TERRITORY;
+      *territory = g_strndup (uscore_pos, dot_pos - uscore_pos);
+    }
+  else
+    uscore_pos = dot_pos;
+
+  *language = g_strndup (locale, uscore_pos - locale);
+
+  return mask;
+}
+
+/*
+ * Compute all interesting variants for a given locale name -
+ * by stripping off different components of the value.
+ *
+ * For simplicity, we assume that the locale is in
+ * X/Open format: language[_territory][.codeset][@modifier]
+ *
+ * TODO: Extend this to handle the CEN format (see the GNUlibc docs)
+ *       as well. We could just copy the code from glibc wholesale
+ *       but it is big, ugly, and complicated, so I'm reluctant
+ *       to do so when this should handle 99% of the time...
+ */
+GSList *
+_g_compute_locale_variants (const gchar *locale)
+{
+  GSList *retval = NULL;
+
+  gchar *language;
+  gchar *territory;
+  gchar *codeset;
+  gchar *modifier;
+
+  guint mask;
+  guint i;
+
+  g_return_val_if_fail (locale != NULL, NULL);
+
+  mask = explode_locale (locale, &language, &territory, &codeset, &modifier);
+
+  /* Iterate through all possible combinations, from least attractive
+   * to most attractive.
+   */
+  for (i = 0; i <= mask; i++)
+    if ((i & ~mask) == 0)
+      {
+	gchar *val = g_strconcat (language,
+				  (i & COMPONENT_TERRITORY) ? territory : "",
+				  (i & COMPONENT_CODESET) ? codeset : "",
+				  (i & COMPONENT_MODIFIER) ? modifier : "",
+				  NULL);
+	retval = g_slist_prepend (retval, val);
+      }
+
+  g_free (language);
+  if (mask & COMPONENT_CODESET)
+    g_free (codeset);
+  if (mask & COMPONENT_TERRITORY)
+    g_free (territory);
+  if (mask & COMPONENT_MODIFIER)
+    g_free (modifier);
+
+  return retval;
+}
+
 /**
  * g_get_language_names:
  * 

Modified: gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.h
===================================================================
--- gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.h	2005-11-13 23:44:40 UTC (rev 11923)
+++ gnucash/branches/goffice-update/lib/goffice-0.0.4/goffice/glib24_26-compat.h	2005-11-14 01:03:03 UTC (rev 11924)
@@ -1,3 +1,8 @@
+#ifndef GLIB24_26_COMPAT_H
+#define GLIB24_26_COMPAT_H
+
+#include <glib.h>
+
 /* from glib-2.6[.6] gdate.h */
 guint        g_date_get_iso8601_week_of_year (const GDate *date);
 
@@ -30,3 +35,5 @@
 
 /* from glib-2.6[.6] gstrfuncs.h */
 guint                 g_strv_length    (gchar       **str_array);
+
+#endif // GLIB24_26_COMPAT_H

Modified: gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.c
===================================================================
--- gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.c	2005-11-13 23:44:40 UTC (rev 11923)
+++ gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.c	2005-11-14 01:03:03 UTC (rev 11924)
@@ -1,7 +1,7 @@
 /** jsled, 2005-11-08: copied from glib-2.6.6 to support libgsf compilation
     against glib-2.4.14. **/
 
-#include "glib24_26_compat.h"
+#include <gsf/glib24_26-compat.h>
 
 /* gstdio.c - wrappers for C library functions
  *
@@ -25,721 +25,10 @@
 
 #include "config.h"
 
-#define G_STDIO_NO_WRAP_ON_UNIX
+//#include <stdio.h>
+#include <string.h>
+//#include <stdlib.h>
 
-#include "glib.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef G_OS_WIN32
-#include <errno.h>
-#include <wchar.h>
-#include <direct.h>
-#include <io.h>
-#endif
-
-//#include "gstdio.h"
-
-#include "galias.h"
-
-#if !defined (G_OS_UNIX) && !defined (G_OS_WIN32) && !defined (G_OS_BEOS)
-#error Please port this to your operating system
-#endif
-
-
-/**
- * g_open:
- * @filename: a pathname in the GLib file name encoding
- * @flags: as in open()
- * @mode: as in open()
- *
- * A wrapper for the POSIX open() function. The open() function is
- * used to convert a pathname into a file descriptor. Note that on
- * POSIX systems file descriptors are implemented by the operating
- * system. On Windows, it's the C library that implements open() and
- * file descriptors. The actual Windows API for opening files is
- * something different.
- *
- * See the C library manual for more details about open().
- *
- * Returns: a new file descriptor, or -1 if an error occurred. The
- * return value can be used exactly like the return value from open().
- * 
- * Since: 2.6
- */
-int
-g_open (const gchar *filename,
-	int          flags,
-	int          mode)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-      
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = _wopen (wfilename, flags, mode);
-      save_errno = errno;
-
-      g_free (wfilename);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {    
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = open (cp_filename, flags, mode);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return open (filename, flags, mode);
-#endif
-}
-
-/**
- * g_rename:
- * @oldfilename: a pathname in the GLib file name encoding
- * @newfilename: a pathname in the GLib file name encoding
- *
- * A wrapper for the POSIX rename() function. The rename() function 
- * renames a file, moving it between directories if required.
- * 
- * See your C library manual for more details about how rename() works
- * on your system. Note in particular that on Windows, it is in
- * general not possible to rename a file if a file with the new name
- * already exists. Also it is not possible in general to rename an
- * open file.
- *
- * Returns: 0 if the renaming succeeded, -1 if an error occurred
- * 
- * Since: 2.6
- */
-int
-g_rename (const gchar *oldfilename,
-	  const gchar *newfilename)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *woldfilename = g_utf8_to_utf16 (oldfilename, -1, NULL, NULL, NULL);
-      wchar_t *wnewfilename;
-      int retval;
-      int save_errno;
-
-      if (woldfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      wnewfilename = g_utf8_to_utf16 (newfilename, -1, NULL, NULL, NULL);
-
-      if (wnewfilename == NULL)
-	{
-	  g_free (woldfilename);
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = _wrename (woldfilename, wnewfilename);
-      save_errno = errno;
-
-      g_free (woldfilename);
-      g_free (wnewfilename);
-      
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_oldfilename = g_locale_from_utf8 (oldfilename, -1, NULL, NULL, NULL);
-      gchar *cp_newfilename;
-      int retval;
-      int save_errno;
-
-      if (cp_oldfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      cp_newfilename = g_locale_from_utf8 (newfilename, -1, NULL, NULL, NULL);
-
-      if (cp_newfilename == NULL)
-	{
-	  g_free (cp_oldfilename);
-	  errno = EINVAL;
-	  return -1;
-	}
-	
-      retval = rename (cp_oldfilename, cp_newfilename);
-      save_errno = errno;
-
-      g_free (cp_oldfilename);
-      g_free (cp_newfilename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return rename (oldfilename, newfilename);
-#endif
-}
-
-/**
- * g_mkdir: 
- * @filename: a pathname in the GLib file name encoding
- * @mode: permissions to use for the newly created directory
- *
- * A wrapper for the POSIX mkdir() function. The mkdir() function 
- * attempts to create a directory with the given name and permissions.
- * 
- * See the C library manual for more details about mkdir().
- *
- * Returns: 0 if the directory was successfully created, -1 if an error 
- *    occurred
- * 
- * Since: 2.6
- */
-int
-g_mkdir (const gchar *filename,
-	 int          mode)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = _wmkdir (wfilename);
-      save_errno = errno;
-
-      g_free (wfilename);
-      
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = mkdir (cp_filename);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return mkdir (filename, mode);
-#endif
-}
-
-/**
- * g_stat: 
- * @filename: a pathname in the GLib file name encoding
- * @buf: a pointer to a <structname>stat</structname> struct, which
- *    will be filled with the file information
- *
- * A wrapper for the POSIX stat() function. The stat() function 
- * returns information about a file.
- * 
- * See the C library manual for more details about stat().
- *
- * Returns: 0 if the information was successfully retrieved, -1 if an error 
- *    occurred
- * 
- * Since: 2.6
- */
-int
-g_stat (const gchar *filename,
-	struct stat *buf)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = _wstat (wfilename, (struct _stat *) buf);
-      save_errno = errno;
-
-      g_free (wfilename);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = stat (cp_filename, buf);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return stat (filename, buf);
-#endif
-}
-
-/**
- * g_lstat: 
- * @filename: a pathname in the GLib file name encoding
- * @buf: a pointer to a <structname>stat</structname> struct, which
- *    will be filled with the file information
- *
- * A wrapper for the POSIX lstat() function. The lstat() function is
- * like stat() except that in the case of symbolic links, it returns
- * information about the symbolic link itself and not the file that it
- * refers to. If the system does not support symbolic links g_lstat()
- * is identical to g_stat().
- * 
- * See the C library manual for more details about lstat().
- *
- * Returns: 0 if the information was successfully retrieved, -1 if an error 
- *    occurred
- * 
- * Since: 2.6
- */
-int
-g_lstat (const gchar *filename,
-	 struct stat *buf)
-{
-#ifdef HAVE_LSTAT
-  /* This can't be Win32, so don't do the widechar dance. */
-  return lstat (filename, buf);
-#else
-  return g_stat (filename, buf);
-#endif
-}
-
-/**
- * g_unlink:
- * @filename: a pathname in the GLib file name encoding
- *
- * A wrapper for the POSIX unlink() function. The unlink() function 
- * deletes a name from the filesystem. If this was the last link to the 
- * file and no processes have it opened, the diskspace occupied by the
- * file is freed.
- * 
- * See your C library manual for more details about unlink(). Note
- * that on Windows, it is in general not possible to delete files that
- * are open to some process, or mapped into memory.
- *
- * Returns: 0 if the name was successfully deleted, -1 if an error 
- *    occurred
- * 
- * Since: 2.6
- */
-int
-g_unlink (const gchar *filename)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = _wunlink (wfilename);
-      save_errno = errno;
-
-      g_free (wfilename);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = unlink (cp_filename);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return unlink (filename);
-#endif
-}
-
-/**
- * g_remove:
- * @filename: a pathname in the GLib file name encoding
- *
- * A wrapper for the POSIX remove() function. The remove() function
- * deletes a name from the filesystem.
- * 
- * See your C library manual for more details about how remove() works
- * on your system. On Unix, remove() removes also directories, as it
- * calls unlink() for files and rmdir() for directories. On Windows,
- * although remove() in the C library only works for files, this
- * function tries first remove() and then if that fails rmdir(), and
- * thus works for both files and directories. Note however, that on
- * Windows, it is in general not possible to remove a file that is
- * open to some process, or mapped into memory.
- *
- * Returns: 0 if the file was successfully removed, -1 if an error 
- *    occurred
- * 
- * Since: 2.6
- */
-int
-g_remove (const gchar *filename)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = _wremove (wfilename);
-      if (retval == -1)
-	retval = _wrmdir (wfilename);
-      save_errno = errno;
-
-      g_free (wfilename);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-      
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = remove (cp_filename);
-      if (retval == -1)
-	retval = rmdir (cp_filename);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return remove (filename);
-#endif
-}
-
-/**
- * g_rmdir:
- * @filename: a pathname in the GLib file name encoding
- *
- * A wrapper for the POSIX rmdir() function. The rmdir() function
- * deletes a directory from the filesystem.
- * 
- * See your C library manual for more details about how rmdir() works
- * on your system.
- *
- * Returns: 0 if the directory was successfully removed, -1 if an error 
- *    occurred
- * 
- * Since: 2.6
- */
-int
-g_rmdir (const gchar *filename)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-      
-      retval = _wrmdir (wfilename);
-      save_errno = errno;
-
-      g_free (wfilename);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = rmdir (cp_filename);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return rmdir (filename);
-#endif
-}
-
-/**
- * g_fopen:
- * @filename: a pathname in the GLib file name encoding
- * @mode: a string describing the mode in which the file should be 
- *   opened
- *
- * A wrapper for the POSIX fopen() function. The fopen() function opens
- * a file and associates a new stream with it. 
- * 
- * See the C library manual for more details about fopen().
- *
- * Returns: A <typename>FILE</typename> pointer if the file was successfully
- *    opened, or %NULL if an error occurred
- * 
- * Since: 2.6
- */
-FILE *
-g_fopen (const gchar *filename,
-	 const gchar *mode)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      wchar_t *wmode;
-      FILE *retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return NULL;
-	}
-
-      wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL);
-
-      if (wmode == NULL)
-	{
-	  g_free (wfilename);
-	  errno = EINVAL;
-	  return NULL;
-	}
-	
-      retval = _wfopen (wfilename, wmode);
-      save_errno = errno;
-
-      g_free (wfilename);
-      g_free (wmode);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      FILE *retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return NULL;
-	}
-
-      retval = fopen (cp_filename, mode);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return fopen (filename, mode);
-#endif
-}
-
-/**
- * g_freopen:
- * @filename: a pathname in the GLib file name encoding
- * @mode: a string describing the mode in which the file should be 
- *   opened
- * @stream: an existing stream which will be reused, or %NULL
- *
- * A wrapper for the POSIX freopen() function. The freopen() function
- * opens a file and associates it with an existing stream.
- * 
- * See the C library manual for more details about freopen().
- *
- * Returns: A <typename>FILE</typename> pointer if the file was successfully
- *    opened, or %NULL if an error occurred.
- * 
- * Since: 2.6
- */
-FILE *
-g_freopen (const gchar *filename,
-	   const gchar *mode,
-	   FILE        *stream)
-{
-#ifdef G_OS_WIN32
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      wchar_t *wmode;
-      FILE *retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return NULL;
-	}
-      
-      wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL);
-
-      if (wmode == NULL)
-	{
-	  g_free (wfilename);
-	  errno = EINVAL;
-	  return NULL;
-	}
-      
-      retval = _wfreopen (wfilename, wmode, stream);
-      save_errno = errno;
-
-      g_free (wfilename);
-      g_free (wmode);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      FILE *retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return NULL;
-	}
-
-      retval = freopen (cp_filename, mode, stream);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-#else
-  return freopen (filename, mode, stream);
-#endif
-}
-
-#define __G_STDIO_C__
-#include "galiasdef.c"
-
 /** ------------------------------------------------------------ **/
 /* START gconvert.c  */
 
@@ -747,6 +36,14 @@
 #include <glib/gconvert.h>
 #include <glib/gthread.h>
 
+typedef struct _GFilenameCharsetCache GFilenameCharsetCache;
+
+struct _GFilenameCharsetCache {
+  gboolean is_utf8;
+  gchar *charset;
+  gchar **filename_charsets;
+};
+
 /**
  * g_get_filename_charsets:
  * @charsets: return location for the %NULL-terminated list of encoding names
@@ -781,71 +78,6 @@
  * Since: 2.6
  */
 gboolean
-g_get_filename_charsets (G_CONST_RETURN gchar ***filename_charsets)
-{
-  static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT;
-  GFilenameCharsetCache *cache = g_static_private_get (&cache_private);
-  const gchar *charset;
-
-  if (!cache)
-    {
-      cache = g_new0 (GFilenameCharsetCache, 1);
-      g_static_private_set (&cache_private, cache, filename_charset_cache_free);
-    }
-
-  g_get_charset (&charset);
-
-  if (!(cache->charset && strcmp (cache->charset, charset) == 0))
-    {
-      const gchar *new_charset;
-      gchar *p;
-      gint i;
-
-      g_free (cache->charset);
-      g_strfreev (cache->filename_charsets);
-      cache->charset = g_strdup (charset);
-      
-      p = getenv ("G_FILENAME_ENCODING");
-      if (p != NULL && p[0] != '\0') 
-	{
-	  cache->filename_charsets = g_strsplit (p, ",", 0);
-	  cache->is_utf8 = (strcmp (cache->filename_charsets[0], "UTF-8") == 0);
-
-	  for (i = 0; cache->filename_charsets[i]; i++)
-	    {
-	      if (strcmp ("@locale", cache->filename_charsets[i]) == 0)
-		{
-		  g_get_charset (&new_charset);
-		  g_free (cache->filename_charsets[i]);
-		  cache->filename_charsets[i] = g_strdup (new_charset);
-		}
-	    }
-	}
-      else if (getenv ("G_BROKEN_FILENAMES") != NULL)
-	{
-	  cache->filename_charsets = g_new0 (gchar *, 2);
-	  cache->is_utf8 = g_get_charset (&new_charset);
-	  cache->filename_charsets[0] = g_strdup (new_charset);
-	}
-      else 
-	{
-	  cache->filename_charsets = g_new0 (gchar *, 3);
-	  cache->is_utf8 = TRUE;
-	  cache->filename_charsets[0] = g_strdup ("UTF-8");
-	  if (!g_get_charset (&new_charset))
-	    cache->filename_charsets[1] = g_strdup (new_charset);
-	}
-    }
-
-  if (filename_charsets)
-    *filename_charsets = (const gchar **)cache->filename_charsets;
-
-  return cache->is_utf8;
-}
-
-#else /* G_PLATFORM_WIN32 */
-
-gboolean
 g_get_filename_charsets (G_CONST_RETURN gchar ***filename_charsets) 
 {
   static const gchar *charsets[] = {
@@ -872,8 +104,6 @@
 #endif
 }
 
-#endif /* G_PLATFORM_WIN32 */
-
 static gchar *
 make_valid_utf8 (const gchar *name)
 {

Modified: gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.h
===================================================================
--- gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.h	2005-11-13 23:44:40 UTC (rev 11923)
+++ gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/glib24_26-compat.h	2005-11-14 01:03:03 UTC (rev 11924)
@@ -5,6 +5,8 @@
 #ifndef __GLIB_24_26_COMPAT_H__
 #define __GLIB_24_26_COMPAT_H__
 
+#include <glib.h>
+
 // START from gstdio.h
 /* gstdio.h - GFilename wrappers for C library functions
  *
@@ -28,8 +30,6 @@
 
 #include <sys/stat.h>
 
-#if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX)
-
 /* Just pass on to the system functions, so there's no potential for data
  * format mismatches, especially with large file interfaces.
  */
@@ -45,48 +45,6 @@
 #define g_fopen   fopen
 #define g_freopen freopen
 
-#else /* ! G_OS_UNIX */
-
-/* Wrappers for C library functions that take pathname arguments. On
- * Unix, the pathname is a file name as it literally is in the file
- * system. On well-maintained systems with consistent users who know
- * what they are doing and no exchange of files with others this would
- * be a well-defined encoding, preferrably UTF-8. On Windows, the
- * pathname is always in UTF-8, even if that is not the on-disk
- * encoding, and not the encoding accepted by the C library or Win32
- * API.
- */
-
-int g_open      (const gchar *filename,
-                 int          flags,
-                 int          mode);
-
-int g_rename    (const gchar *oldfilename,
-                 const gchar *newfilename);
-
-int g_mkdir     (const gchar *filename,
-                 int          mode);
-
-int g_stat      (const gchar *filename,
-                 struct stat *buf);
-
-int g_lstat     (const gchar *filename,
-                 struct stat *buf);
-
-int g_unlink    (const gchar *filename);
-
-int g_remove    (const gchar *filename);
-
-int g_rmdir (const gchar *filename);
-
-FILE *g_fopen   (const gchar *filename,
-                 const gchar *mode);
-
-FILE *g_freopen (const gchar *filename,
-                 const gchar *mode,
-                 FILE        *stream);
-
-#endif /* G_OS_UNIX */
 // END from gstdio.h
 
 // START from gconvert.h

Modified: gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-outfile-zip.c
===================================================================
--- gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-outfile-zip.c	2005-11-13 23:44:40 UTC (rev 11923)
+++ gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-outfile-zip.c	2005-11-14 01:03:03 UTC (rev 11924)
@@ -30,6 +30,10 @@
 #include <time.h>
 #include <zlib.h>
 
+#ifndef HAVE_GLIB26
+#include <gsf/glib24_26-compat.h>
+#endif
+
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "libgsf:zip"
 

Modified: gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-utils.c
===================================================================
--- gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-utils.c	2005-11-13 23:44:40 UTC (rev 11923)
+++ gnucash/branches/goffice-update/lib/libgsf-1.12.3/gsf/gsf-utils.c	2005-11-14 01:03:03 UTC (rev 11924)
@@ -29,6 +29,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#ifndef HAVE_GLIB26
+#include <gsf/glib24_26-compat.h>
+#endif
+
 /*
  * Glib gets this wrong, really.  ARM's floating point format is a weird
  * mixture.



More information about the gnucash-changes mailing list