gconvert: Remove old win32 codepage ABI compat code

Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
This commit is contained in:
Christoph Reiter 2017-03-28 07:59:09 +02:00
parent feae4e9f31
commit 713788413d
2 changed files with 59 additions and 131 deletions

View File

@ -1157,35 +1157,6 @@ g_filename_to_utf8 (const gchar *opsysstring,
"UTF-8", charset, bytes_read, bytes_written, error);
}
#if defined (G_OS_WIN32) && !defined (_WIN64)
#undef g_filename_to_utf8
/* Binary compatibility version. Not for newly compiled code. Also not needed for
* 64-bit versions as there should be no old deployed binaries that would use
* the old versions.
*/
gchar*
g_filename_to_utf8 (const gchar *opsysstring,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error)
{
const gchar *charset;
g_return_val_if_fail (opsysstring != NULL, NULL);
if (g_get_charset (&charset))
return strdup_len (opsysstring, len, bytes_read, bytes_written, error);
else
return g_convert (opsysstring, len,
"UTF-8", charset, bytes_read, bytes_written, error);
}
#endif
/**
* g_filename_from_utf8:
* @utf8string: a UTF-8 encoded string.
@ -1228,30 +1199,6 @@ g_filename_from_utf8 (const gchar *utf8string,
charset, "UTF-8", bytes_read, bytes_written, error);
}
#if defined (G_OS_WIN32) && !defined (_WIN64)
#undef g_filename_from_utf8
/* Binary compatibility version. Not for newly compiled code. */
gchar*
g_filename_from_utf8 (const gchar *utf8string,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error)
{
const gchar *charset;
if (g_get_charset (&charset))
return strdup_len (utf8string, len, bytes_read, bytes_written, error);
else
return g_convert (utf8string, len,
charset, "UTF-8", bytes_read, bytes_written, error);
}
#endif
/* Test of haystack has the needle prefix, comparing case
* insensitive. haystack may be UTF-8, but needle must
* contain only ascii. */
@ -1663,29 +1610,6 @@ g_filename_from_uri (const gchar *uri,
return result;
}
#if defined (G_OS_WIN32) && !defined (_WIN64)
#undef g_filename_from_uri
gchar *
g_filename_from_uri (const gchar *uri,
gchar **hostname,
GError **error)
{
gchar *utf8_filename;
gchar *retval = NULL;
utf8_filename = g_filename_from_uri_utf8 (uri, hostname, error);
if (utf8_filename)
{
retval = g_locale_from_utf8 (utf8_filename, -1, NULL, NULL, error);
g_free (utf8_filename);
}
return retval;
}
#endif
/**
* g_filename_to_uri:
* @filename: (type filename): an absolute filename specified in the GLib file
@ -1738,31 +1662,6 @@ g_filename_to_uri (const gchar *filename,
return escaped_uri;
}
#if defined (G_OS_WIN32) && !defined (_WIN64)
#undef g_filename_to_uri
gchar *
g_filename_to_uri (const gchar *filename,
const gchar *hostname,
GError **error)
{
gchar *utf8_filename;
gchar *retval = NULL;
utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
if (utf8_filename)
{
retval = g_filename_to_uri_utf8 (utf8_filename, hostname, error);
g_free (utf8_filename);
}
return retval;
}
#endif
/**
* g_uri_list_extract_uris:
* @uri_list: an URI list
@ -1942,3 +1841,62 @@ g_filename_display_name (const gchar *filename)
return display_name;
}
#ifdef G_OS_WIN32
/* Binary compatibility versions. Not for newly compiled code. */
_GLIB_EXTERN gchar *g_filename_to_utf8_utf8 (const gchar *opsysstring,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error) G_GNUC_MALLOC;
_GLIB_EXTERN gchar *g_filename_from_utf8_utf8 (const gchar *utf8string,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error) G_GNUC_MALLOC;
_GLIB_EXTERN gchar *g_filename_from_uri_utf8 (const gchar *uri,
gchar **hostname,
GError **error) G_GNUC_MALLOC;
_GLIB_EXTERN gchar *g_filename_to_uri_utf8 (const gchar *filename,
const gchar *hostname,
GError **error) G_GNUC_MALLOC;
gchar *
g_filename_to_utf8_utf8 (const gchar *opsysstring,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error)
{
return g_filename_to_utf8 (opsysstring, len, bytes_read, bytes_written, error);
}
gchar *
g_filename_from_utf8_utf8 (const gchar *utf8string,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error)
{
return g_filename_from_utf8 (utf8string, len, bytes_read, bytes_written, error);
}
gchar *
g_filename_from_uri_utf8 (const gchar *uri,
gchar **hostname,
GError **error)
{
return g_filename_from_uri (uri, hostname, error);
}
gchar *
g_filename_to_uri_utf8 (const gchar *filename,
const gchar *hostname,
GError **error)
{
return g_filename_to_uri (filename, hostname, error);
}
#endif

View File

@ -166,36 +166,6 @@ gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC;
GLIB_AVAILABLE_IN_ALL
gchar **g_uri_list_extract_uris (const gchar *uri_list) G_GNUC_MALLOC;
#ifndef __GTK_DOC_IGNORE__
#ifdef G_OS_WIN32
#define g_filename_to_utf8 g_filename_to_utf8_utf8
#define g_filename_from_utf8 g_filename_from_utf8_utf8
#define g_filename_from_uri g_filename_from_uri_utf8
#define g_filename_to_uri g_filename_to_uri_utf8
GLIB_AVAILABLE_IN_ALL
gchar* g_filename_to_utf8_utf8 (const gchar *opsysstring,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error) G_GNUC_MALLOC;
GLIB_AVAILABLE_IN_ALL
gchar* g_filename_from_utf8_utf8 (const gchar *utf8string,
gssize len,
gsize *bytes_read,
gsize *bytes_written,
GError **error) G_GNUC_MALLOC;
GLIB_AVAILABLE_IN_ALL
gchar *g_filename_from_uri_utf8 (const gchar *uri,
gchar **hostname,
GError **error) G_GNUC_MALLOC;
GLIB_AVAILABLE_IN_ALL
gchar *g_filename_to_uri_utf8 (const gchar *filename,
const gchar *hostname,
GError **error) G_GNUC_MALLOC;
#endif
#endif /* __GTK_DOC_IGNORE__ */
G_END_DECLS
#endif /* __G_CONVERT_H__ */