From 7ede4e50667d386efa0fc56a7f69ccb3251f6c34 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 3 Oct 2001 20:19:13 +0000 Subject: [PATCH] New function (DLL entry point) to tuck away actual DLL name. 2001-10-03 Tor Lillqvist * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) to tuck away actual DLL name. (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one naming convention for DLLs. * glib/glib.def: g_string_append_printf. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-0 | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-12 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ glib/glib.def | 4 ++-- glib/gutils.c | 33 +++++++++++++++++++++++++-------- glib/gwin32.c | 7 +++---- 11 files changed, 102 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 8d5967dd4..bcd9d19d0 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2001-10-03 Tor Lillqvist + + * glib/gutils.c (Win32) (DllMain): New function (DLL entry point) + to tuck away actual DLL name. + (GLIB_LOCALE_DIR) Use actual DLL name, instead of assuming one + naming convention for DLLs. + + * glib/glib.def: g_string_append_printf. + 2001-10-02 Matthias Clasen * glib/gstrfuncs.c, glib/giochannel.c: documentation update. diff --git a/glib/glib.def b/glib/glib.def index e73bb08bd..ec1b9ff84 100644 --- a/glib/glib.def +++ b/glib/glib.def @@ -546,6 +546,7 @@ EXPORTS g_string_append g_string_append_c g_string_append_len + g_string_append_printf g_string_append_unichar g_string_ascii_down g_string_assign @@ -568,7 +569,6 @@ EXPORTS g_string_prepend_len g_string_prepend_unichar g_string_printf - g_string_printfa g_string_sized_new g_string_truncate g_string_up @@ -695,5 +695,5 @@ EXPORTS ; and vice versa, i.e.: ; compatibility of Dia 0.87 with tml's latest Gtk+ version (2000-12-26) g_dirname=g_path_get_dirname - g_string_sprintfa=g_string_printfa + g_string_sprintfa=g_string_append_printf g_string_sprintf=g_string_printf diff --git a/glib/gutils.c b/glib/gutils.c index 8f08e815d..b3bfa271a 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -1098,18 +1098,37 @@ g_get_codeset (void) #ifdef G_OS_WIN32 +/* DllMain function needed to tuck away the GLib DLL name */ + +static char dll_name[MAX_PATH]; + +BOOL WINAPI +DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + GetModuleFileName ((HMODULE) hinstDLL, dll_name, sizeof (dll_name)); + break; + } + + return TRUE; +} + /* On Windows we don't want any hard-coded path names */ #undef GLIB_LOCALE_DIR -/* It's OK to leak the g_win32_get_...() and g_strdup_printf() results - * below, as this macro is called only once. */ +/* It's OK to leak the g_win32_get_...() and g_path_get_basename() results + * below, as this macro is called only once. + * Use the actual DLL name of the GLib DLL, i.e. don't assume the + * GLib DLL has a certain name. + */ #define GLIB_LOCALE_DIR \ g_win32_get_package_installation_subdirectory \ (GETTEXT_PACKAGE, \ - g_strdup_printf ("libglib-%d.%d-%d.dll", \ - GLIB_MAJOR_VERSION, \ - GLIB_MINOR_VERSION, \ - GLIB_MICRO_VERSION - GLIB_BINARY_AGE), \ + g_path_get_basename (dll_name), \ "share\\locale") #endif /* !G_OS_WIN32 */ @@ -1129,5 +1148,3 @@ _glib_gettext (const gchar *str) } #endif /* ENABLE_NLS */ - - diff --git a/glib/gwin32.c b/glib/gwin32.c index 0604c1fbc..99741e1be 100644 --- a/glib/gwin32.c +++ b/glib/gwin32.c @@ -220,7 +220,7 @@ g_win32_ftruncate (gint fd, * returned string should be deallocated with g_free(). * * Returns: newly-allocated locale name. - */ + **/ gchar * g_win32_getlocale (void) @@ -551,7 +551,7 @@ g_win32_getlocale (void) * The returned string should be deallocated with g_free(). * * Returns: newly-allocated error message - */ + **/ gchar * g_win32_error_message (gint error) { @@ -674,7 +674,6 @@ get_package_directory_from_module (gchar *module_name) * The return value should be freed with g_free() when not needed any longer. **/ - gchar * g_win32_get_package_installation_directory (gchar *package, gchar *dll_name) @@ -756,7 +755,7 @@ g_win32_get_package_installation_directory (gchar *package, * g_win32_get_package_installation_directory() with the @package and * @dll_name parameters. The return value should be freed with * g_free() when no longer needed. - */ + **/ gchar * g_win32_get_package_installation_subdirectory (gchar *package,