From 19cf44b979ca6d0c69aef9a4524d876fafc0fb25 Mon Sep 17 00:00:00 2001 From: hiro Date: Thu, 4 Aug 2005 14:18:07 +0000 Subject: braced some Unix-specific code with ifdef. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@467 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 6 ++++++ ChangeLog.ja | 6 ++++++ src/compose.c | 6 ++++++ src/main.c | 6 +++++- src/socket.c | 16 ++++++++++++++++ src/socket.h | 2 ++ 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a3079658..0dc1ce3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-08-04 + + * src/compose.c + src/main.c + src/socket.[ch]: braced Unix-specific code with #ifdef G_OS_UNIX. + 2005-08-04 * configure.in: add -mms-bitfields to CFLAGS if the target is MinGW. diff --git a/ChangeLog.ja b/ChangeLog.ja index 62ee4afa..cdfd0f42 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,9 @@ +2005-08-04 + + * src/compose.c + src/main.c + src/socket.[ch]: Unix 特有のコードを #ifdef G_OS_UNIX で括った。 + 2005-08-04 * configure.in: ターゲットが MinGW の場合は -mms-bitfields を CFLAGS diff --git a/src/compose.c b/src/compose.c index eca3aba2..b48f0cfb 100644 --- a/src/compose.c +++ b/src/compose.c @@ -280,6 +280,7 @@ static gboolean attach_property_key_pressed (GtkWidget *widget, gboolean *cancelled); static void compose_exec_ext_editor (Compose *compose); +#ifdef G_OS_UNIX static gint compose_exec_ext_editor_real (const gchar *file); static gboolean compose_ext_editor_kill (Compose *compose); static gboolean compose_input_cb (GIOChannel *source, @@ -287,6 +288,7 @@ static gboolean compose_input_cb (GIOChannel *source, gpointer data); static void compose_set_ext_editor_sensitive (Compose *compose, gboolean sensitive); +#endif /* G_OS_UNIX */ static void compose_undo_state_changed (UndoMain *undostruct, gint undo_state, @@ -5087,6 +5089,7 @@ static gboolean attach_property_key_pressed(GtkWidget *widget, static void compose_exec_ext_editor(Compose *compose) { +#ifdef G_OS_UNIX gchar *tmp; pid_t pid; gint pipe_fds[2]; @@ -5150,8 +5153,10 @@ static void compose_exec_ext_editor(Compose *compose) } g_free(tmp); +#endif /* G_OS_UNIX */ } +#ifdef G_OS_UNIX static gint compose_exec_ext_editor_real(const gchar *file) { static gchar *def_cmd = "emacs %s"; @@ -5326,6 +5331,7 @@ static void compose_set_ext_editor_sensitive(Compose *compose, gtk_widget_set_sensitive(compose->exteditor_btn, sensitive); gtk_widget_set_sensitive(compose->linewrap_btn, sensitive); } +#endif /* G_OS_UNIX */ /** * compose_undo_state_changed: diff --git a/src/main.c b/src/main.c index eaf79a1d..53c6609d 100644 --- a/src/main.c +++ b/src/main.c @@ -38,7 +38,9 @@ #include #include #include -#include +#ifdef G_OS_UNIX +# include +#endif #include #if HAVE_LOCALE_H @@ -341,7 +343,9 @@ int main(int argc, char *argv[]) inc_autocheck_timer_init(mainwin); /* ignore SIGPIPE signal for preventing sudden death of program */ +#ifdef G_OS_UNIX signal(SIGPIPE, SIG_IGN); +#endif if (cmd.receive_all) inc_all_account_mail(mainwin, FALSE); diff --git a/src/socket.c b/src/socket.c index 499a46a4..2f6f4562 100644 --- a/src/socket.c +++ b/src/socket.c @@ -124,6 +124,7 @@ static gint sock_connect_by_getaddrinfo (const gchar *hostname, gushort port); #endif +#ifdef G_OS_UNIX static void sock_address_list_free (GList *addr_list); static gboolean sock_connect_async_cb (GIOChannel *source, @@ -144,6 +145,7 @@ static SockLookupData *sock_get_address_info_async SockAddrFunc func, gpointer data); static gint sock_get_address_info_async_cancel (SockLookupData *lookup_data); +#endif /* G_OS_UNIX */ gint sock_init(void) @@ -380,12 +382,14 @@ static gint fd_check_io(gint fd, GIOCondition cond) } } +#ifdef G_OS_UNIX static sigjmp_buf jmpenv; static void timeout_handler(gint sig) { siglongjmp(jmpenv, 1); } +#endif static gint sock_connect_with_timeout(gint sock, const struct sockaddr *serv_addr, @@ -393,6 +397,7 @@ static gint sock_connect_with_timeout(gint sock, guint timeout_secs) { gint ret; +#ifdef G_OS_UNIX void (*prev_handler)(gint); alarm(0); @@ -404,11 +409,14 @@ static gint sock_connect_with_timeout(gint sock, return -1; } alarm(timeout_secs); +#endif ret = connect(sock, serv_addr, addrlen); +#ifdef G_OS_UNIX alarm(0); signal(SIGALRM, prev_handler); +#endif return ret; } @@ -416,6 +424,7 @@ static gint sock_connect_with_timeout(gint sock, struct hostent *my_gethostbyname(const gchar *hostname) { struct hostent *hp; +#ifdef G_OS_UNIX void (*prev_handler)(gint); alarm(0); @@ -428,17 +437,22 @@ struct hostent *my_gethostbyname(const gchar *hostname) return NULL; } alarm(io_timeout); +#endif if ((hp = gethostbyname(hostname)) == NULL) { +#ifdef G_OS_UNIX alarm(0); signal(SIGALRM, prev_handler); +#endif fprintf(stderr, "%s: unknown host.\n", hostname); errno = 0; return NULL; } +#ifdef G_OS_UNIX alarm(0); signal(SIGALRM, prev_handler); +#endif return hp; } @@ -571,6 +585,7 @@ SockInfo *sock_connect(const gchar *hostname, gushort port) return sockinfo; } +#ifdef G_OS_UNIX static void sock_address_list_free(GList *addr_list) { GList *cur; @@ -964,6 +979,7 @@ static gint sock_get_address_info_async_cancel(SockLookupData *lookup_data) return 0; } +#endif /* G_OS_UNIX */ gint sock_printf(SockInfo *sock, const gchar *format, ...) diff --git a/src/socket.h b/src/socket.h index 60ee30fc..3865970b 100644 --- a/src/socket.h +++ b/src/socket.h @@ -79,9 +79,11 @@ guint sock_add_watch (SockInfo *sock, GIOCondition condition, struct hostent *my_gethostbyname (const gchar *hostname); SockInfo *sock_connect (const gchar *hostname, gushort port); +#ifdef G_OS_UNIX gint sock_connect_async (const gchar *hostname, gushort port, SockConnectFunc func, gpointer data); gint sock_connect_async_cancel (gint id); +#endif /* Basic I/O functions */ gint sock_printf (SockInfo *sock, const gchar *format, ...) -- cgit v1.2.3