Re: Announce: gio merged
- From: Hans Breuer <hans breuer org>
- To: Alexander Larsson <alexl redhat com>
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: Announce: gio merged
- Date: Tue, 27 Nov 2007 22:34:47 +0100
On 26.11.2007 17:25, Alexander Larsson wrote:
> I just commited gio to the glib svn module. As this is a sort of large
> chunk of work I expect there to be some temporary issues to work out.
>
> For instance, its likely that there are some build issues for platforms
> I haven't tested. I got a bunch of solaris fixes for gio-standalone,
> which hopefully survived the merge, but there might still be issues.
>
> I'd also like some help from the win32 folks to make sure this builds in
> all the right ways.
>
Here comes the first chunk ;-)
* gio/gcontenttype.c : use GDir instead of using <dirent.h>
* gio/gcancellable.c gio/gdummyfile.c
gio/glocalfile.c gio/gsimpleasyncresult.c : use HAVE_UNISTD_H
* gio/glocalfile.c : use HAVE_PWD_H
gsocketinputstream.c gsocketoutputstream.c
needs some reimplementation/porting to use winsock specific API.
g_io_modules_ensure_loaded (GIO_MODULE_DIR);
It would be nice if this function would take no parameter to allow
implementation of dynamic DLL placement resolvement in one place.
glocalfile.c needs some more porting to GLib APIs, e.g. g_file_test
Finally gio.symbols should be added to make exporting of symbols (and what
not;) as easy as for glib/gobject and gtk+
Do you want me to commit the uncritical pieces?
Thanks,
Hans
-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it. -- Dilbert
Index: gcancellable.c
===================================================================
--- gcancellable.c (revision 5943)
+++ gcancellable.c (working copy)
@@ -21,9 +21,14 @@
*/
#include <config.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <fcntl.h>
#include <gioerror.h>
+#ifdef G_OS_WIN32
+#include <io.h>
+#endif
#include "gcancellable.h"
#include "glibintl.h"
Index: gcontenttype.c
===================================================================
--- gcontenttype.c (revision 5943)
+++ gcontenttype.c (working copy)
@@ -23,7 +23,6 @@
#include <config.h>
#include <sys/types.h>
-#include <dirent.h>
#include <string.h>
#include <stdio.h>
@@ -787,49 +786,49 @@
static void
enumerate_mimetypes_subdir (const char *dir, const char *prefix, GHashTable *mimetypes)
{
- DIR *d;
- struct dirent *ent;
+ GDir *d;
+ const char *ent;
char *mimetype;
- d = opendir (dir);
+ d = g_dir_open (dir);
if (d)
{
- while ((ent = readdir (d)) != NULL)
+ while ((ent = g_dir_read_name (d)) != NULL)
{
- if (g_str_has_suffix (ent->d_name, ".xml"))
+ if (g_str_has_suffix (ent, ".xml"))
{
- mimetype = g_strdup_printf ("%s/%.*s", prefix, (int) strlen (ent->d_name) - 4, ent->d_name);
+ mimetype = g_strdup_printf ("%s/%.*s", prefix, (int) strlen (ent) - 4, ent);
g_hash_table_insert (mimetypes, mimetype, NULL);
}
}
- closedir (d);
+ g_dir_close (d);
}
}
static void
enumerate_mimetypes_dir (const char *dir, GHashTable *mimetypes)
{
- DIR *d;
- struct dirent *ent;
+ GDir *d;
+ const char *ent;
char *mimedir;
char *name;
mimedir = g_build_filename (dir, "mime", NULL);
- d = opendir (mimedir);
+ d = g_dir_open (mimedir);
if (d)
{
- while ((ent = readdir (d)) != NULL)
+ while ((ent = g_dir_read_name (d)) != NULL)
{
- if (strcmp (ent->d_name, "packages") != 0)
+ if (strcmp (ent, "packages") != 0)
{
- name = g_build_filename (mimedir, ent->d_name, NULL);
+ name = g_build_filename (mimedir, ent, NULL);
if (g_file_test (name, G_FILE_TEST_IS_DIR))
- enumerate_mimetypes_subdir (name, ent->d_name, mimetypes);
+ enumerate_mimetypes_subdir (name, ent, mimetypes);
g_free (name);
}
}
- closedir (d);
+ g_dir_close (d);
}
g_free (mimedir);
Index: gdummyfile.c
===================================================================
--- gdummyfile.c (revision 5943)
+++ gdummyfile.c (working copy)
@@ -27,7 +27,9 @@
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include "gdummyfile.h"
Index: glocalfile.c
===================================================================
--- glocalfile.c (revision 5943)
+++ glocalfile.c (working copy)
@@ -27,7 +27,9 @@
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#if HAVE_SYS_STATFS_H
#include <sys/statfs.h>
@@ -678,7 +680,7 @@
GUnixMount *mount;
guint64 cache_time;
- if (lstat (path, &buf) != 0)
+ if (g_lstat (path, &buf) != 0)
return;
G_LOCK (mount_info_hash);
Index: glocalvfs.c
===================================================================
--- glocalvfs.c (revision 5943)
+++ glocalvfs.c (working copy)
@@ -25,7 +25,9 @@
#include "glocalfile.h"
#include <gio/gdummyfile.h>
#include <sys/types.h>
+#ifdef HAVE_PWD_H
#include <pwd.h>
+#endif
struct _GLocalVfs
{
@@ -130,6 +132,7 @@
user_prefix = g_strdup (g_get_home_dir());
else
{
+#ifdef HAVE_PWD_H
user_name = g_strndup (user_start, user_end - user_start);
passwd_file_entry = getpwnam (user_name);
g_free (user_name);
@@ -138,6 +141,7 @@
passwd_file_entry->pw_dir != NULL)
user_prefix = g_strdup (passwd_file_entry->pw_dir);
else
+#endif
user_prefix = g_strdup (g_get_home_dir ());
}
Index: gsimpleasyncresult.c
===================================================================
--- gsimpleasyncresult.c (revision 5943)
+++ gsimpleasyncresult.c (working copy)
@@ -27,7 +27,9 @@
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "gsimpleasyncresult.h"
#include "gioscheduler.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]