+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
+2001-09-30 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gwin32.c
+ * glib/gwin32.h
+ * glib/glib.def: Remove own implementation of dirent
+ functions. Instead, gcc (mingw) users should go ahead and use the
+ <dirent.h> included with the mingw gcc, and the dirent functions
+ included in libmingw32, while MSVC users can use the same (public
+ domain) code, extracted from mingw-runtime sources and placed in
+ build/win32/dirent.[ch].
+
+ * glib/gwin32.c (get_package_directory_from_module,
+ g_win32_get_package_installation_directory): Use static lock to
+ protect static hash table.
+
Sat Sep 29 02:33:14 2001 George Lebl <jirka@5z.com>
* tests/testglib.c (main): cast the string size to gulong and use %lu
g_utf8_to_utf16
g_utf8_validate
g_vsnprintf
- g_win32_closedir
g_win32_error_message
g_win32_ftruncate
g_win32_get_package_installation_directory
g_win32_get_package_installation_subdirectory
g_win32_getlocale
- g_win32_opendir
- g_win32_readdir
- g_win32_rewinddir
glib_binary_age
glib_interface_age
glib_major_version
return 0;
}
-DIR*
-g_win32_opendir (const char *dirname)
-{
- DIR *result;
- gchar *mask;
- guint k;
-
- g_return_val_if_fail (dirname != NULL, NULL);
-
- result = g_new0 (DIR, 1);
- result->find_file_data = g_new0 (WIN32_FIND_DATA, 1);
- result->dir_name = g_strdup (dirname);
-
- k = strlen (result->dir_name);
- if (k && result->dir_name[k - 1] == '\\')
- {
- result->dir_name[k - 1] = '\0';
- }
- mask = g_strdup_printf ("%s\\*", result->dir_name);
-
- result->find_file_handle = (guint) FindFirstFile (mask,
- (LPWIN32_FIND_DATA) result->find_file_data);
- g_free (mask);
-
- if (result->find_file_handle == (guint) INVALID_HANDLE_VALUE)
- {
- int error = GetLastError ();
-
- g_free (result->dir_name);
- g_free (result->find_file_data);
- g_free (result);
- switch (error)
- {
- default:
- errno = EIO;
- return NULL;
- }
- }
- result->just_opened = TRUE;
-
- return result;
-}
-
-struct dirent*
-g_win32_readdir (DIR *dir)
-{
- gchar *basename;
-
- g_return_val_if_fail (dir != NULL, NULL);
-
- if (dir->just_opened)
- dir->just_opened = FALSE;
- else
- {
- if (!FindNextFile ((HANDLE) dir->find_file_handle,
- (LPWIN32_FIND_DATA) dir->find_file_data))
- {
- int error = GetLastError ();
-
- switch (error)
- {
- case ERROR_NO_MORE_FILES:
- return NULL;
- default:
- errno = EIO;
- return NULL;
- }
- }
- }
-
- basename = g_path_get_basename (((LPWIN32_FIND_DATA) dir->find_file_data)->cFileName);
-
- strcpy (dir->readdir_result.d_name, basename);
-
- g_free (basename);
-
- return &dir->readdir_result;
-}
-
-void
-g_win32_rewinddir (DIR *dir)
-{
- gchar *mask;
-
- g_return_if_fail (dir != NULL);
-
- if (!FindClose ((HANDLE) dir->find_file_handle))
- g_warning ("gwin_rewinddir(): FindClose() failed\n");
-
- mask = g_strdup_printf ("%s\\*", dir->dir_name);
- dir->find_file_handle = (guint) FindFirstFile (mask,
- (LPWIN32_FIND_DATA) dir->find_file_data);
- g_free (mask);
-
- if (dir->find_file_handle == (guint) INVALID_HANDLE_VALUE)
- {
- int error = GetLastError ();
-
- switch (error)
- {
- default:
- errno = EIO;
- return;
- }
- }
- dir->just_opened = TRUE;
-}
-
-gint
-g_win32_closedir (DIR *dir)
-{
- g_return_val_if_fail (dir != NULL, -1);
-
- if (!FindClose ((HANDLE) dir->find_file_handle))
- {
- int error = GetLastError ();
-
- switch (error)
- {
- default:
- errno = EIO; return -1;
- }
- }
-
- g_free (dir->dir_name);
- g_free (dir->find_file_data);
- g_free (dir);
-
- return 0;
-}
#endif
/* MSVC 5.0 headers don't have latest language and sublanguage codes */
get_package_directory_from_module (gchar *module_name)
{
static GHashTable *module_dirs = NULL;
+ G_LOCK_DEFINE_STATIC (module_dirs);
HMODULE hmodule = NULL;
gchar *fn;
gchar *p;
gchar *result;
+ G_LOCK (module_dirs);
+
if (module_dirs == NULL)
module_dirs = g_hash_table_new (g_str_hash, g_str_equal);
result = g_hash_table_lookup (module_dirs, module_name ? module_name : "");
if (result)
- return g_strdup (result);
+ {
+ G_UNLOCK (module_dirs);
+ return g_strdup (result);
+ }
if (module_name)
{
fn = g_malloc (MAX_PATH);
if (!GetModuleFileName (hmodule, fn, MAX_PATH))
- return NULL;
+ {
+ G_UNLOCK (module_dirs);
+ return NULL;
+ }
#ifdef G_WITH_CYGWIN
/* In Cygwin we need to have POSIX paths */
g_hash_table_insert (module_dirs, module_name ? module_name : "", fn);
+ G_UNLOCK (module_dirs);
+
return g_strdup (fn);
}
gchar *dll_name)
{
static GHashTable *package_dirs = NULL;
+ G_LOCK_DEFINE_STATIC (package_dirs);
gchar *result = NULL;
gchar *key;
HKEY reg_key = NULL;
if (package != NULL)
{
+ G_LOCK (package_dirs);
+
if (package_dirs == NULL)
package_dirs = g_hash_table_new (g_str_hash, g_str_equal);
result = g_hash_table_lookup (package_dirs, package);
if (result && result[0])
- return g_strdup (result);
+ {
+ G_UNLOCK (package_dirs);
+ return g_strdup (result);
+ }
key = g_strconcat ("Software\\", package, NULL);
RegCloseKey (reg_key);
g_free (key);
-
- }
- if (result)
- {
- g_hash_table_insert (package_dirs, package, result);
- return g_strdup (result);
+
+ if (result)
+ {
+ g_hash_table_insert (package_dirs, package, result);
+ G_UNLOCK (package_dirs);
+ return g_strdup (result);
+ }
+ G_UNLOCK (package_dirs);
}
if (dll_name != NULL)
*/
# define ftruncate(fd, size) g_win32_ftruncate (fd, size)
-/* -lmingw32 also has emulations for these, but we need our own
- * for MSVC anyhow, so we might aswell use them always.
- */
-# define opendir g_win32_opendir
-# define readdir g_win32_readdir
-# define rewinddir g_win32_rewinddir
-# define closedir g_win32_closedir
-# define NAME_MAX 255
-
-struct dirent
-{
- gchar d_name[NAME_MAX + 1];
-};
-
-struct DIR
-{
- gchar *dir_name;
- gboolean just_opened;
- guint find_file_handle;
- gpointer find_file_data;
- struct dirent readdir_result;
-};
-typedef struct DIR DIR;
-
-/* emulation functions */
gint g_win32_ftruncate (gint f,
guint size);
-DIR* g_win32_opendir (const gchar *dirname);
-struct dirent* g_win32_readdir (DIR *dir);
-void g_win32_rewinddir (DIR *dir);
-gint g_win32_closedir (DIR *dir);
-
#endif /* G_OS_WIN32 */
/* The MS setlocale uses locale names of the form "English_United