glib/gutils.h Deprecate G_WIN32_DLLMAIN_FOR_DLL_NAME(),

2008-09-13  Tor Lillqvist  <tml@novell.com>

	* glib/gutils.h
	* glib/gwin32.h: Deprecate G_WIN32_DLLMAIN_FOR_DLL_NAME(),
	g_win32_get_package_installation_directory() and
	g_win32_get_package_installation_subdirectory() as their
	documentation has warned for a while. Sorry that I forgot to do
	this before 2.18.0.

	* glib/gwin32.c (g_win32_get_package_installation_directory):
	Print a warning if a non-NULL package parameter is passed to this
	function, as that is deprecated usage, as the documentation says.


svn path=/trunk/; revision=7480
This commit is contained in:
Tor Lillqvist 2008-09-13 20:23:17 +00:00 committed by Tor Lillqvist
parent 005ce779e3
commit e55fca9533
4 changed files with 53 additions and 20 deletions

View File

@ -1,3 +1,16 @@
2008-09-13 Tor Lillqvist <tml@novell.com>
* glib/gutils.h
* glib/gwin32.h: Deprecate G_WIN32_DLLMAIN_FOR_DLL_NAME(),
g_win32_get_package_installation_directory() and
g_win32_get_package_installation_subdirectory() as their
documentation has warned for a while. Sorry that I forgot to do
this before 2.18.0.
* glib/gwin32.c (g_win32_get_package_installation_directory):
Print a warning if a non-NULL package parameter is passed to this
function, as that is deprecated usage, as the documentation says.
2008-09-11 Matthias Clasen <mclasen@redhat.com>
Bug 548321 <string.h> is not included in gi18n-lib.h

View File

@ -430,11 +430,13 @@ const gchar * glib_check_version (guint required_major,
G_END_DECLS
#ifndef G_DISABLE_DEPRECATED
/*
* This macro will be deprecated in the future. This DllMain() is too
* complex. It is recommended to have a DLlMain() that just saves the
* handle to the DLL and then use that handle in normal code instead,
* for instance passing it to
* This macro is deprecated. This DllMain() is too complex. It is
* recommended to write an explicit minimal DLlMain() that just saves
* the handle to the DLL and then use that handle instead, for
* instance passing it to
* g_win32_get_package_installation_directory_of_module().
*
* On Windows, this macro defines a DllMain function that stores the
@ -472,6 +474,9 @@ DllMain (HINSTANCE hinstDLL, \
\
return TRUE; \
}
#endif /* !G_DISABLE_DEPRECATED */
#endif /* G_PLATFORM_WIN32 */
#endif /* __G_UTILS_H__ */

View File

@ -321,10 +321,11 @@ get_package_directory_from_module (const gchar *module_name)
*
* Try to determine the installation directory for a software package.
*
* This function will be deprecated in the future. Use
* This function is deprecated. Use
* g_win32_get_package_installation_directory_of_module() instead.
*
* The use of @package is deprecated. You should always pass %NULL.
* The use of @package is deprecated. You should always pass %NULL. A
* warning is printed if non-NULL is passed as @package.
*
* The original intended use of @package was for a short identifier of
* the package, typically the same identifier as used for
@ -343,7 +344,7 @@ get_package_directory_from_module (const gchar *module_name)
*
* For this reason it is recommeded to always pass %NULL as
* @package to this function, to avoid the temptation to use the
* Registry. In version 2.18 of GLib the @package parameter
* Registry. In version 2.20 of GLib the @package parameter
* will be ignored and this function won't look in the Registry at all.
*
* If @package is %NULL, or the above value isn't found in the
@ -364,11 +365,14 @@ get_package_directory_from_module (const gchar *module_name)
* @package. The string is in the GLib file name encoding,
* i.e. UTF-8. The return value should be freed with g_free() when not
* needed any longer. If the function fails %NULL is returned.
*
* @Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
* g_win32_get_package_installation_directory_of_module() instead.
**/
gchar *
g_win32_get_package_installation_directory (const gchar *package,
const gchar *dll_name)
gchar *
g_win32_get_package_installation_directory_utf8 (const gchar *package,
const gchar *dll_name)
{
static GHashTable *package_dirs = NULL;
G_LOCK_DEFINE_STATIC (package_dirs);
@ -379,8 +383,14 @@ g_win32_get_package_installation_directory (const gchar *package,
DWORD type;
DWORD nbytes;
#if GLIB_CHECK_VERSION (2, 19, 0)
if (package != NULL)
g_warning ("Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and it is ignored.");
#else
if (package != NULL)
{
g_warning ("Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and will not work in GLib after 2.18.");
G_LOCK (package_dirs);
if (package_dirs == NULL)
@ -432,7 +442,7 @@ g_win32_get_package_installation_directory (const gchar *package,
}
G_UNLOCK (package_dirs);
}
#endif
if (dll_name != NULL)
result = get_package_directory_from_module (dll_name);
@ -444,8 +454,6 @@ g_win32_get_package_installation_directory (const gchar *package,
#if !defined (_WIN64)
#undef g_win32_get_package_installation_directory
/* DLL ABI binary compatibility version that uses system codepage file names */
gchar *
@ -482,8 +490,9 @@ g_win32_get_package_installation_directory (const gchar *package,
* @dll_name: The name of a DLL that a package provides, in UTF-8, or %NULL.
* @subdir: A subdirectory of the package installation directory, also in UTF-8
*
* This function will be deprecated in the future. Use
* g_win32_get_package_installation_directory_of_module() instead.
* This function is deprecated. Use
* g_win32_get_package_installation_directory_of_module() and
* g_build_filename() instead.
*
* Returns a newly-allocated string containing the path of the
* subdirectory @subdir in the return value from calling
@ -498,12 +507,16 @@ g_win32_get_package_installation_directory (const gchar *package,
* the GLib file name encoding, i.e. UTF-8. The return value should be
* freed with g_free() when no longer needed. If something goes wrong,
* %NULL is returned.
*
* @Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
* g_win32_get_package_installation_directory_of_module() instead, and
* then construct a subdirectory pathname with g_build_filename().
**/
gchar *
g_win32_get_package_installation_subdirectory (const gchar *package,
const gchar *dll_name,
const gchar *subdir)
g_win32_get_package_installation_subdirectory_utf8 (const gchar *package,
const gchar *dll_name,
const gchar *subdir)
{
gchar *prefix;
gchar *dirname;
@ -518,8 +531,6 @@ g_win32_get_package_installation_subdirectory (const gchar *package,
#if !defined (_WIN64)
#undef g_win32_get_package_installation_subdirectory
/* DLL ABI binary compatibility version that uses system codepage file names */
gchar *

View File

@ -83,6 +83,8 @@ gchar* g_win32_getlocale (void);
*/
gchar* g_win32_error_message (gint error);
#ifndef G_DISABLE_DEPRECATED
#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
@ -93,6 +95,8 @@ gchar* g_win32_get_package_installation_subdirectory (const gchar *pack
const gchar *dll_name,
const gchar *subdir);
#endif
gchar* g_win32_get_package_installation_directory_of_module (gpointer hmodule);
guint g_win32_get_windows_version (void);