mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-09 19:06:15 +01:00
win32: add gwin32compat.h, for utf8-renaming compatibility defines
To avoid -Wmissing-prototype warnings, we need to prototype both the original and the _utf8 versions of all of the functions that have had _utf8-renaming on Windows. But duplicating all the prototypes is ugly, so rather than doing them "in-place", move them all to a new header file just for that. https://bugzilla.gnome.org/show_bug.cgi?id=688109
This commit is contained in:
parent
c2acbc0182
commit
08f4f92fed
@ -51,7 +51,8 @@ IGNORE_HFILES = \
|
||||
gvariant-serialiser.h \
|
||||
gvariant-core.h \
|
||||
gvarianttypeinfo.h \
|
||||
gwakeup.h
|
||||
gwakeup.h \
|
||||
gwin32compat.h
|
||||
|
||||
# Images to copy into HTML directory
|
||||
HTML_IMAGES = \
|
||||
|
@ -325,6 +325,7 @@ glibsubinclude_HEADERS = \
|
||||
gversion.h \
|
||||
gversionmacros.h \
|
||||
gwin32.h \
|
||||
gwin32compat.h \
|
||||
gprintf.h
|
||||
|
||||
# This is read by gobject-introspection/misc/ and gtk-doc
|
||||
|
@ -57,6 +57,7 @@
|
||||
#endif
|
||||
|
||||
#include "glibintl.h"
|
||||
#include "gwin32compat.h"
|
||||
|
||||
#if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
|
||||
#error GNU libiconv in use but included iconv.h not from libiconv
|
||||
|
@ -125,15 +125,6 @@ gchar* g_locale_from_utf8 (const gchar *utf8string,
|
||||
/* Convert between the operating system (or C runtime)
|
||||
* representation of file names and UTF-8.
|
||||
*/
|
||||
#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
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gchar* g_filename_to_utf8 (const gchar *opsysstring,
|
||||
gssize len,
|
||||
gsize *bytes_read,
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "gstrfuncs.h"
|
||||
#include "gtestutils.h"
|
||||
#include "glibintl.h"
|
||||
|
||||
#include "gwin32compat.h"
|
||||
|
||||
#if defined (_MSC_VER) && !defined (HAVE_DIRENT_H)
|
||||
#include "../build/win32/dirent/dirent.h"
|
||||
|
@ -34,14 +34,6 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GDir GDir;
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
/* For DLL ABI stability, keep old names for old (non-UTF-8) functionality. */
|
||||
#define g_dir_open g_dir_open_utf8
|
||||
#define g_dir_read_name g_dir_read_name_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
GDir * g_dir_open (const gchar *path,
|
||||
guint flags,
|
||||
GError **error);
|
||||
|
@ -35,14 +35,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_getenv g_getenv_utf8
|
||||
#define g_setenv g_setenv_utf8
|
||||
#define g_unsetenv g_unsetenv_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const gchar * g_getenv (const gchar *variable);
|
||||
gboolean g_setenv (const gchar *variable,
|
||||
const gchar *value,
|
||||
|
@ -77,15 +77,6 @@ GQuark g_file_error_quark (void);
|
||||
/* So other code can generate a GFileError */
|
||||
GFileError g_file_error_from_errno (gint err_no);
|
||||
|
||||
#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
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gboolean g_file_test (const gchar *filename,
|
||||
GFileTest test);
|
||||
gboolean g_file_get_contents (const gchar *filename,
|
||||
@ -164,12 +155,6 @@ const gchar *g_basename (const gchar *file_name);
|
||||
#define g_dirname g_path_get_dirname
|
||||
#endif
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_get_current_dir g_get_current_dir_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gchar *g_get_current_dir (void);
|
||||
gchar *g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC;
|
||||
gchar *g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC;
|
||||
|
@ -272,10 +272,6 @@ GIOStatus g_io_channel_seek_position (GIOChannel *channel,
|
||||
gint64 offset,
|
||||
GSeekType type,
|
||||
GError **error);
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_io_channel_new_file g_io_channel_new_file_utf8
|
||||
#endif
|
||||
|
||||
GIOChannel* g_io_channel_new_file (const gchar *filename,
|
||||
const gchar *mode,
|
||||
GError **error);
|
||||
|
@ -107,6 +107,10 @@
|
||||
#include <glib/deprecated/grel.h>
|
||||
#include <glib/deprecated/gthread.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <glib/gwin32compat.h>
|
||||
#endif
|
||||
|
||||
#undef __GLIB_H_INSIDE__
|
||||
|
||||
#endif /* __G_LIB_H__ */
|
||||
|
@ -186,16 +186,6 @@ typedef enum
|
||||
GQuark g_spawn_error_quark (void);
|
||||
GQuark g_spawn_exit_error_quark (void);
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_spawn_async g_spawn_async_utf8
|
||||
#define g_spawn_async_with_pipes g_spawn_async_with_pipes_utf8
|
||||
#define g_spawn_sync g_spawn_sync_utf8
|
||||
#define g_spawn_command_line_sync g_spawn_command_line_sync_utf8
|
||||
#define g_spawn_command_line_async g_spawn_command_line_async_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gboolean g_spawn_async (const gchar *working_directory,
|
||||
gchar **argv,
|
||||
gchar **envp,
|
||||
|
@ -84,15 +84,6 @@ G_BEGIN_DECLS
|
||||
# define G_INLINE_FUNC
|
||||
#endif /* !G_INLINE_FUNC */
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_get_user_name g_get_user_name_utf8
|
||||
#define g_get_real_name g_get_real_name_utf8
|
||||
#define g_get_home_dir g_get_home_dir_utf8
|
||||
#define g_get_tmp_dir g_get_tmp_dir_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const gchar * g_get_user_name (void);
|
||||
const gchar * g_get_real_name (void);
|
||||
const gchar * g_get_home_dir (void);
|
||||
@ -253,11 +244,6 @@ int atexit (void (*)(void));
|
||||
|
||||
#endif /* G_DISABLE_DEPRECATED */
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_find_program_in_path g_find_program_in_path_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Look for an executable in PATH, following execvp() rules */
|
||||
gchar* g_find_program_in_path (const gchar *program);
|
||||
|
@ -85,13 +85,6 @@ gchar* g_win32_error_message (gint error);
|
||||
|
||||
#ifndef G_DISABLE_DEPRECATED
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef _WIN64
|
||||
#define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8
|
||||
#define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gchar* g_win32_get_package_installation_directory (const gchar *package,
|
||||
const gchar *dll_name);
|
||||
|
||||
|
178
glib/gwin32compat.h
Normal file
178
glib/gwin32compat.h
Normal file
@ -0,0 +1,178 @@
|
||||
/* GLIB - Library of useful routines for C programming
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
||||
#error "Only <glib.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __G_WIN32COMPAT_H__
|
||||
#define __G_WIN32COMPAT_H__
|
||||
|
||||
#include <glib/gtypes.h>
|
||||
#include <glib/gdir.h>
|
||||
#include <glib/giochannel.h>
|
||||
#include <glib/gspawn.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#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
|
||||
|
||||
gchar* g_filename_to_utf8_utf8 (const gchar *opsysstring,
|
||||
gssize len,
|
||||
gsize *bytes_read,
|
||||
gsize *bytes_written,
|
||||
GError **error) G_GNUC_MALLOC;
|
||||
gchar* g_filename_from_utf8_utf8 (const gchar *utf8string,
|
||||
gssize len,
|
||||
gsize *bytes_read,
|
||||
gsize *bytes_written,
|
||||
GError **error) G_GNUC_MALLOC;
|
||||
gchar *g_filename_from_uri_utf8 (const gchar *uri,
|
||||
gchar **hostname,
|
||||
GError **error) G_GNUC_MALLOC;
|
||||
gchar *g_filename_to_uri_utf8 (const gchar *filename,
|
||||
const gchar *hostname,
|
||||
GError **error) G_GNUC_MALLOC;
|
||||
|
||||
|
||||
#define g_dir_open g_dir_open_utf8
|
||||
#define g_dir_read_name g_dir_read_name_utf8
|
||||
|
||||
GDir *g_dir_open_utf8 (const gchar *path,
|
||||
guint flags,
|
||||
GError **error);
|
||||
const gchar *g_dir_read_name_utf8 (GDir *dir);
|
||||
|
||||
|
||||
#define g_getenv g_getenv_utf8
|
||||
#define g_setenv g_setenv_utf8
|
||||
#define g_unsetenv g_unsetenv_utf8
|
||||
|
||||
const gchar *g_getenv_utf8 (const gchar *variable);
|
||||
gboolean g_setenv_utf8 (const gchar *variable,
|
||||
const gchar *value,
|
||||
gboolean overwrite);
|
||||
void g_unsetenv_utf8 (const gchar *variable);
|
||||
|
||||
|
||||
#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
|
||||
|
||||
gboolean g_file_test_utf8 (const gchar *filename,
|
||||
GFileTest test);
|
||||
gboolean g_file_get_contents_utf8 (const gchar *filename,
|
||||
gchar **contents,
|
||||
gsize *length,
|
||||
GError **error);
|
||||
gint g_mkstemp_utf8 (gchar *tmpl);
|
||||
gint g_file_open_tmp_utf8 (const gchar *tmpl,
|
||||
gchar **name_used,
|
||||
GError **error);
|
||||
gchar *g_get_current_dir_utf8 (void);
|
||||
|
||||
|
||||
#define g_io_channel_new_file g_io_channel_new_file_utf8
|
||||
|
||||
GIOChannel *g_io_channel_new_file_utf8 (const gchar *filename,
|
||||
const gchar *mode,
|
||||
GError **error);
|
||||
|
||||
|
||||
#define g_spawn_async g_spawn_async_utf8
|
||||
#define g_spawn_async_with_pipes g_spawn_async_with_pipes_utf8
|
||||
#define g_spawn_sync g_spawn_sync_utf8
|
||||
#define g_spawn_command_line_sync g_spawn_command_line_sync_utf8
|
||||
#define g_spawn_command_line_async g_spawn_command_line_async_utf8
|
||||
|
||||
gboolean g_spawn_async_utf8 (const gchar *working_directory,
|
||||
gchar **argv,
|
||||
gchar **envp,
|
||||
GSpawnFlags flags,
|
||||
GSpawnChildSetupFunc child_setup,
|
||||
gpointer user_data,
|
||||
GPid *child_pid,
|
||||
GError **error);
|
||||
gboolean g_spawn_async_with_pipes_utf8 (const gchar *working_directory,
|
||||
gchar **argv,
|
||||
gchar **envp,
|
||||
GSpawnFlags flags,
|
||||
GSpawnChildSetupFunc child_setup,
|
||||
gpointer user_data,
|
||||
GPid *child_pid,
|
||||
gint *standard_input,
|
||||
gint *standard_output,
|
||||
gint *standard_error,
|
||||
GError **error);
|
||||
gboolean g_spawn_sync_utf8 (const gchar *working_directory,
|
||||
gchar **argv,
|
||||
gchar **envp,
|
||||
GSpawnFlags flags,
|
||||
GSpawnChildSetupFunc child_setup,
|
||||
gpointer user_data,
|
||||
gchar **standard_output,
|
||||
gchar **standard_error,
|
||||
gint *exit_status,
|
||||
GError **error);
|
||||
|
||||
gboolean g_spawn_command_line_sync_utf8 (const gchar *command_line,
|
||||
gchar **standard_output,
|
||||
gchar **standard_error,
|
||||
gint *exit_status,
|
||||
GError **error);
|
||||
gboolean g_spawn_command_line_async_utf8 (const gchar *command_line,
|
||||
GError **error);
|
||||
|
||||
|
||||
#define g_get_user_name g_get_user_name_utf8
|
||||
#define g_get_real_name g_get_real_name_utf8
|
||||
#define g_get_home_dir g_get_home_dir_utf8
|
||||
#define g_get_tmp_dir g_get_tmp_dir_utf8
|
||||
#define g_find_program_in_path g_find_program_in_path_utf8
|
||||
|
||||
const gchar *g_get_user_name_utf8 (void);
|
||||
const gchar *g_get_real_name_utf8 (void);
|
||||
const gchar *g_get_home_dir_utf8 (void);
|
||||
const gchar *g_get_tmp_dir_utf8 (void);
|
||||
gchar *g_find_program_in_path_utf8 (const gchar *program);
|
||||
|
||||
|
||||
#ifdef _WIN64
|
||||
#define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8
|
||||
#define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8
|
||||
#endif
|
||||
|
||||
gchar *g_win32_get_package_installation_directory_utf8 (const gchar *package,
|
||||
const gchar *dll_name);
|
||||
gchar *g_win32_get_package_installation_subdirectory_utf8 (const gchar *package,
|
||||
const gchar *dll_name,
|
||||
const gchar *subdir);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_WIN32COMPAT_H__ */
|
@ -52,13 +52,6 @@ typedef struct _GModule GModule;
|
||||
typedef const gchar* (*GModuleCheckInit) (GModule *module);
|
||||
typedef void (*GModuleUnload) (GModule *module);
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_module_open g_module_open_utf8
|
||||
#define g_module_name g_module_name_utf8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* return TRUE if dynamic module loading is supported */
|
||||
gboolean g_module_supported (void) G_GNUC_CONST;
|
||||
|
||||
@ -98,6 +91,17 @@ gchar* g_module_build_path (const gchar *directory,
|
||||
const gchar *module_name);
|
||||
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
#ifdef G_OS_WIN32
|
||||
#define g_module_open g_module_open_utf8
|
||||
#define g_module_name g_module_name_utf8
|
||||
|
||||
GModule * g_module_open_utf8 (const gchar *file_name,
|
||||
GModuleFlags flags);
|
||||
const gchar *g_module_name_utf8 (GModule *module);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GMODULE_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user