From e7aa65fdc44e1989fd837b56db4af59c765f8489 Mon Sep 17 00:00:00 2001 From: Samuel Cormier-Iijima Date: Sat, 1 Mar 2008 20:18:22 -0500 Subject: [PATCH] Removed some warnings, cleaned up includes, and prepared Network*Streams --- gnio/Makefile.am | 21 +++++++++++++++------ gnio/gnetworkinputstream.c | 18 ------------------ gnio/gnetworkinputstream.h | 4 +--- gnio/gnetworkoutputstream.c | 18 ------------------ gnio/gnetworkoutputstream.h | 4 +--- gnio/gtcpclient.h | 36 +++++++++++++++++++++--------------- gnio/gtcpserver.c | 8 ++++---- test/test-tcp-client.c | 2 +- 8 files changed, 43 insertions(+), 68 deletions(-) diff --git a/gnio/Makefile.am b/gnio/Makefile.am index 62cc1bf..74098c3 100644 --- a/gnio/Makefile.am +++ b/gnio/Makefile.am @@ -1,11 +1,20 @@ NULL = -INCLUDES = \ - $(SAMBA_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED +#INCLUDES = \ +# $(SAMBA_CFLAGS) \ +# -I$(top_srcdir) \ +# -I$(top_builddir) \ +# $(GLIB_CFLAGS) \ +# -DG_DISABLE_DEPRECATED + +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"GLib-GIO\" \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + $(GLIB_CFLAGS) \ + $(GLIB_DEBUG_FLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DGIO_COMPILATION lib_LTLIBRARIES=libgnio.la diff --git a/gnio/gnetworkinputstream.c b/gnio/gnetworkinputstream.c index 50eb1a6..a7bdbb6 100644 --- a/gnio/gnetworkinputstream.c +++ b/gnio/gnetworkinputstream.c @@ -25,25 +25,7 @@ #include #include -#include -#ifndef G_OS_WIN32 -# include -# include -# include -#else -# include -# include -# include -# undef HAVE_GETADDRINFO -# define HAVE_GETHOSTBYNAME_THREADSAFE 1 -#endif -#include - -#include "ginetaddress.h" -#include "ginet4address.h" -#include "ginet6address.h" #include "gnetworkinputstream.h" -#include "gnioerror.h" G_DEFINE_TYPE (GNetworkInputStream, g_network_input_stream, G_TYPE_INPUT_STREAM); diff --git a/gnio/gnetworkinputstream.h b/gnio/gnetworkinputstream.h index fb51da5..9d6d42e 100644 --- a/gnio/gnetworkinputstream.h +++ b/gnio/gnetworkinputstream.h @@ -27,8 +27,6 @@ #include #include -#include "gsocket.h" - G_BEGIN_DECLS #define G_TYPE_NETWORK_INPUT_STREAM (g_socket_get_type ()) @@ -53,7 +51,7 @@ struct _GNetworkInputStreamClass GType g_network_input_stream_get_type (void) G_GNUC_CONST; -GNetworkInputStream * g_network_input_stream_new (GSocket *socket); +GNetworkInputStream * g_network_input_stream_new (void); G_END_DECLS diff --git a/gnio/gnetworkoutputstream.c b/gnio/gnetworkoutputstream.c index eecd2db..c32a470 100644 --- a/gnio/gnetworkoutputstream.c +++ b/gnio/gnetworkoutputstream.c @@ -25,25 +25,7 @@ #include #include -#include -#ifndef G_OS_WIN32 -# include -# include -# include -#else -# include -# include -# include -# undef HAVE_GETADDRINFO -# define HAVE_GETHOSTBYNAME_THREADSAFE 1 -#endif -#include - -#include "ginetaddress.h" -#include "ginet4address.h" -#include "ginet6address.h" #include "gnetworkoutputstream.h" -#include "gnioerror.h" G_DEFINE_TYPE (GNetworkOutputStream, g_network_output_stream, G_TYPE_OUTPUT_STREAM); diff --git a/gnio/gnetworkoutputstream.h b/gnio/gnetworkoutputstream.h index b3dfee0..84615e8 100644 --- a/gnio/gnetworkoutputstream.h +++ b/gnio/gnetworkoutputstream.h @@ -27,8 +27,6 @@ #include #include -#include "gsocket.h" - G_BEGIN_DECLS #define G_TYPE_NETWORK_OUTPUT_STREAM (g_socket_get_type ()) @@ -53,7 +51,7 @@ struct _GNetworkOutputStreamClass GType g_network_output_stream_get_type (void) G_GNUC_CONST; -GNetworkOutputStream * g_network_output_stream_new (GSocket *socket); +GNetworkOutputStream * g_network_output_stream_new (void); G_END_DECLS diff --git a/gnio/gtcpclient.h b/gnio/gtcpclient.h index ff71d73..dd87d63 100644 --- a/gnio/gtcpclient.h +++ b/gnio/gtcpclient.h @@ -28,6 +28,8 @@ #include #include +#include +#include G_BEGIN_DECLS @@ -54,27 +56,31 @@ struct _GTcpClientClass GObjectClass parent_class; }; -GType g_tcp_client_get_type (void) G_GNUC_CONST; +GType g_tcp_client_get_type (void) G_GNUC_CONST; -GTcpClient * g_tcp_client_new (const gchar *hostname, - gushort port); +GTcpClient * g_tcp_client_new (const gchar *hostname, + gushort port); -GTcpClient * g_tcp_client_new_from_address (GInetSocketAddress *address); +GTcpClient * g_tcp_client_new_from_address (GInetSocketAddress *address); -gboolean g_tcp_client_connect (GTcpClient *client, - GCancellable *cancellable, - GError **error); +GNetworkInputStream * g_tcp_client_get_input_stream (GTcpClient *client); -void g_tcp_client_connect_async (GTcpClient *client, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); +GNetworkOutputStream * g_tcp_client_get_output_stream (GTcpClient *client); -gboolean g_tcp_client_connect_finish (GTcpClient *client, - GAsyncResult *result, - GError **error); +gboolean g_tcp_client_connect (GTcpClient *client, + GCancellable *cancellable, + GError **error); -void g_tcp_client_close (GTcpClient *client); +void g_tcp_client_connect_async (GTcpClient *client, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean g_tcp_client_connect_finish (GTcpClient *client, + GAsyncResult *result, + GError **error); + +void g_tcp_client_close (GTcpClient *client); G_END_DECLS diff --git a/gnio/gtcpserver.c b/gnio/gtcpserver.c index 6697a5f..aab8c1c 100644 --- a/gnio/gtcpserver.c +++ b/gnio/gtcpserver.c @@ -45,7 +45,7 @@ struct _GTcpServerPrivate static void g_tcp_server_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - GTcpServer *server = G_TCP_SERVER (object); + GTcpServer *server G_GNUC_UNUSED = G_TCP_SERVER (object); switch (prop_id) { @@ -57,7 +57,7 @@ g_tcp_server_get_property (GObject *object, guint prop_id, GValue *value, GParam static void g_tcp_server_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - GTcpServer *server = G_TCP_SERVER (object); + GTcpServer *server G_GNUC_UNUSED = G_TCP_SERVER (object); switch (prop_id) { @@ -69,7 +69,7 @@ g_tcp_server_set_property (GObject *object, guint prop_id, const GValue *value, static void g_tcp_server_finalize (GObject *object) { - GTcpServer *server = G_TCP_SERVER (object); + GTcpServer *server G_GNUC_UNUSED = G_TCP_SERVER (object); if (G_OBJECT_CLASS (g_tcp_server_parent_class)->finalize) (*G_OBJECT_CLASS (g_tcp_server_parent_class)->finalize) (object); @@ -78,7 +78,7 @@ g_tcp_server_finalize (GObject *object) static void g_tcp_server_dispose (GObject *object) { - GTcpServer *server = G_TCP_SERVER (object); + GTcpServer *server G_GNUC_UNUSED = G_TCP_SERVER (object); if (G_OBJECT_CLASS (g_tcp_server_parent_class)->dispose) (*G_OBJECT_CLASS (g_tcp_server_parent_class)->dispose) (object); diff --git a/test/test-tcp-client.c b/test/test-tcp-client.c index d9c7679..f13aae8 100644 --- a/test/test-tcp-client.c +++ b/test/test-tcp-client.c @@ -35,7 +35,7 @@ int main (int argc, char *argv[]) if (!g_tcp_client_connect (client, NULL, &error)) { g_warning (error->message); - return; + return 1; } g_print ("connected!\n"); -- 2.20.1