mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-10 04:45:48 +01:00
gfileutils: 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:
parent
b67d071321
commit
d1528402ab
@ -2515,114 +2515,57 @@ g_get_current_dir (void)
|
|||||||
#endif /* !G_OS_WIN32 */
|
#endif /* !G_OS_WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
|
||||||
/* NOTE : Keep this part last to ensure nothing in this file uses thn
|
/* Binary compatibility versions. Not for newly compiled code. */
|
||||||
* below binary compatibility versions.
|
|
||||||
*/
|
|
||||||
#if defined (G_OS_WIN32) && !defined (_WIN64)
|
|
||||||
|
|
||||||
/* Binary compatibility versions. Will be called by code compiled
|
_GLIB_EXTERN gboolean g_file_test_utf8 (const gchar *filename,
|
||||||
* against quite old (pre-2.8, I think) headers only, not from more
|
GFileTest test);
|
||||||
* recently compiled code.
|
_GLIB_EXTERN gboolean g_file_get_contents_utf8 (const gchar *filename,
|
||||||
*/
|
gchar **contents,
|
||||||
|
gsize *length,
|
||||||
|
GError **error);
|
||||||
|
_GLIB_EXTERN gint g_mkstemp_utf8 (gchar *tmpl);
|
||||||
|
_GLIB_EXTERN gint g_file_open_tmp_utf8 (const gchar *tmpl,
|
||||||
|
gchar **name_used,
|
||||||
|
GError **error);
|
||||||
|
_GLIB_EXTERN gchar *g_get_current_dir_utf8 (void);
|
||||||
|
|
||||||
#undef g_file_test
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
g_file_test (const gchar *filename,
|
g_file_test_utf8 (const gchar *filename,
|
||||||
GFileTest test)
|
GFileTest test)
|
||||||
{
|
{
|
||||||
gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
|
return g_file_test (filename, test);
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
if (utf8_filename == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
retval = g_file_test_utf8 (utf8_filename, test);
|
|
||||||
|
|
||||||
g_free (utf8_filename);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef g_file_get_contents
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
g_file_get_contents (const gchar *filename,
|
g_file_get_contents_utf8 (const gchar *filename,
|
||||||
gchar **contents,
|
gchar **contents,
|
||||||
gsize *length,
|
gsize *length,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
|
return g_file_get_contents (filename, contents, length, error);
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
if (utf8_filename == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
retval = g_file_get_contents_utf8 (utf8_filename, contents, length, error);
|
|
||||||
|
|
||||||
g_free (utf8_filename);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef g_mkstemp
|
|
||||||
|
|
||||||
static gint
|
|
||||||
wrap_libc_open (const gchar *filename,
|
|
||||||
int flags,
|
|
||||||
int mode)
|
|
||||||
{
|
|
||||||
return open (filename, flags, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_mkstemp (gchar *tmpl)
|
g_mkstemp_utf8 (gchar *tmpl)
|
||||||
{
|
{
|
||||||
/* This is the backward compatibility system codepage version,
|
return g_mkstemp (tmpl);
|
||||||
* thus use normal open().
|
|
||||||
*/
|
|
||||||
return get_tmp_file (tmpl, wrap_libc_open,
|
|
||||||
O_RDWR | O_CREAT | O_EXCL, 0600);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef g_file_open_tmp
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
g_file_open_tmp (const gchar *tmpl,
|
g_file_open_tmp_utf8 (const gchar *tmpl,
|
||||||
gchar **name_used,
|
gchar **name_used,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gchar *utf8_tmpl = g_locale_to_utf8 (tmpl, -1, NULL, NULL, error);
|
return g_file_open_tmp (tmpl, name_used, error);
|
||||||
gchar *utf8_name_used;
|
|
||||||
gint retval;
|
|
||||||
|
|
||||||
if (utf8_tmpl == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
retval = g_file_open_tmp_utf8 (utf8_tmpl, &utf8_name_used, error);
|
|
||||||
|
|
||||||
if (retval == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (name_used)
|
|
||||||
*name_used = g_locale_from_utf8 (utf8_name_used, -1, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
g_free (utf8_name_used);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef g_get_current_dir
|
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
g_get_current_dir (void)
|
g_get_current_dir_utf8 (void)
|
||||||
{
|
{
|
||||||
gchar *utf8_dir = g_get_current_dir_utf8 ();
|
return g_get_current_dir ();
|
||||||
gchar *dir = g_locale_from_utf8 (utf8_dir, -1, NULL, NULL, NULL);
|
|
||||||
g_free (utf8_dir);
|
|
||||||
return dir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -176,33 +176,6 @@ gchar *g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC;
|
|||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
gchar *g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC;
|
gchar *g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC;
|
||||||
|
|
||||||
#ifndef __GTK_DOC_IGNORE__
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
#define g_file_test g_file_test_utf8
|
|
||||||
#define g_file_get_contents g_file_get_contents_utf8
|
|
||||||
#define g_mkstemp g_mkstemp_utf8
|
|
||||||
#define g_file_open_tmp g_file_open_tmp_utf8
|
|
||||||
#define g_get_current_dir g_get_current_dir_utf8
|
|
||||||
|
|
||||||
GLIB_AVAILABLE_IN_ALL
|
|
||||||
gboolean g_file_test_utf8 (const gchar *filename,
|
|
||||||
GFileTest test);
|
|
||||||
GLIB_AVAILABLE_IN_ALL
|
|
||||||
gboolean g_file_get_contents_utf8 (const gchar *filename,
|
|
||||||
gchar **contents,
|
|
||||||
gsize *length,
|
|
||||||
GError **error);
|
|
||||||
GLIB_AVAILABLE_IN_ALL
|
|
||||||
gint g_mkstemp_utf8 (gchar *tmpl);
|
|
||||||
GLIB_AVAILABLE_IN_ALL
|
|
||||||
gint g_file_open_tmp_utf8 (const gchar *tmpl,
|
|
||||||
gchar **name_used,
|
|
||||||
GError **error);
|
|
||||||
GLIB_AVAILABLE_IN_ALL
|
|
||||||
gchar *g_get_current_dir_utf8 (void);
|
|
||||||
#endif /* G_OS_WIN32 */
|
|
||||||
#endif /* __GTK_DOC_IGNORE__ */
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __G_FILEUTILS_H__ */
|
#endif /* __G_FILEUTILS_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user