Commit e55fca95 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

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
parent 005ce779
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
......
......@@ -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__ */
......@@ -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 *
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment