summaryrefslogtreecommitdiff
path: root/gweb/giognutls.c
diff options
context:
space:
mode:
authorZhang zhengguang <zhengguang.zhang@intel.com>2014-07-17 02:37:39 (GMT)
committerZhang zhengguang <zhengguang.zhang@intel.com>2014-07-17 02:37:39 (GMT)
commit1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7 (patch)
tree6e991827d28537f7f40f20786c2354fd04a9fdad /gweb/giognutls.c
parentfbe905ab58ecc31fe64c410c5f580cadc30e7f04 (diff)
downloadconnman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.zip
connman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.tar.gz
connman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.tar.bz2
Imported Upstream version 1.24upstream/1.24
Diffstat (limited to 'gweb/giognutls.c')
-rw-r--r--gweb/giognutls.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/gweb/giognutls.c b/gweb/giognutls.c
index 47ff8c4..09dc9e7 100644
--- a/gweb/giognutls.c
+++ b/gweb/giognutls.c
@@ -43,8 +43,8 @@ struct _GIOGnuTLSChannel {
gint fd;
gnutls_certificate_credentials_t cred;
gnutls_session_t session;
- gboolean established;
- gboolean again;
+ bool established;
+ bool again;
};
struct _GIOGnuTLSWatch {
@@ -58,7 +58,7 @@ static volatile int global_init_done = 0;
static inline void g_io_gnutls_global_init(void)
{
- if (__sync_bool_compare_and_swap(&global_init_done, 0, 1) == TRUE)
+ if (__sync_bool_compare_and_swap(&global_init_done, 0, 1))
gnutls_global_init();
}
@@ -69,7 +69,7 @@ static GIOStatus check_handshake(GIOChannel *channel, GError **err)
DBG("channel %p", channel);
- if (gnutls_channel->established == TRUE)
+ if (gnutls_channel->established)
return G_IO_STATUS_NORMAL;
again:
@@ -78,7 +78,7 @@ again:
if (result == GNUTLS_E_INTERRUPTED || result == GNUTLS_E_AGAIN) {
GIOFlags flags = g_io_channel_get_flags(channel);
- if (gnutls_channel->again == TRUE)
+ if (gnutls_channel->again)
return G_IO_STATUS_AGAIN;
if (flags & G_IO_FLAG_NONBLOCK)
@@ -93,7 +93,7 @@ again:
return G_IO_STATUS_ERROR;
}
- gnutls_channel->established = TRUE;
+ gnutls_channel->established = true;
DBG("handshake done");
@@ -121,14 +121,14 @@ again:
DBG("result %zd", result);
if (result == GNUTLS_E_REHANDSHAKE) {
- gnutls_channel->established = FALSE;
+ gnutls_channel->established = false;
goto again;
}
if (result == GNUTLS_E_INTERRUPTED || result == GNUTLS_E_AGAIN) {
GIOFlags flags = g_io_channel_get_flags(channel);
- if (gnutls_channel->again == TRUE)
+ if (gnutls_channel->again)
return G_IO_STATUS_AGAIN;
if (flags & G_IO_FLAG_NONBLOCK)
@@ -172,14 +172,14 @@ again:
DBG("result %zd", result);
if (result == GNUTLS_E_REHANDSHAKE) {
- gnutls_channel->established = FALSE;
+ gnutls_channel->established = false;
goto again;
}
if (result == GNUTLS_E_INTERRUPTED || result == GNUTLS_E_AGAIN) {
GIOFlags flags = g_io_channel_get_flags(channel);
- if (gnutls_channel->again == TRUE)
+ if (gnutls_channel->again)
return G_IO_STATUS_AGAIN;
if (flags & G_IO_FLAG_NONBLOCK)
@@ -215,7 +215,7 @@ static GIOStatus g_io_gnutls_close(GIOChannel *channel, GError **err)
DBG("channel %p", channel);
- if (gnutls_channel->established == TRUE)
+ if (gnutls_channel->established)
gnutls_bye(gnutls_channel->session, GNUTLS_SHUT_RDWR);
if (close(gnutls_channel->fd) < 0) {
@@ -309,7 +309,7 @@ static gboolean g_io_gnutls_dispatch(GSource *source, GSourceFunc callback,
DBG("source %p condition %u", source, condition);
- if (func == NULL)
+ if (!func)
return FALSE;
return func(watch->channel, condition & watch->condition, user_data);
@@ -379,9 +379,9 @@ static ssize_t g_io_gnutls_push_func(gnutls_transport_ptr_t transport_data,
result = write(gnutls_channel->fd, buf, count);
if (result < 0 && errno == EAGAIN)
- gnutls_channel->again = TRUE;
+ gnutls_channel->again = true;
else
- gnutls_channel->again = FALSE;
+ gnutls_channel->again = false;
DBG("result %zd", result);
@@ -399,18 +399,18 @@ static ssize_t g_io_gnutls_pull_func(gnutls_transport_ptr_t transport_data,
result = read(gnutls_channel->fd, buf, count);
if (result < 0 && errno == EAGAIN)
- gnutls_channel->again = TRUE;
+ gnutls_channel->again = true;
else
- gnutls_channel->again = FALSE;
+ gnutls_channel->again = false;
DBG("result %zd", result);
return result;
}
-gboolean g_io_channel_supports_tls(void)
+bool g_io_channel_supports_tls(void)
{
- return TRUE;
+ return true;
}
GIOChannel *g_io_channel_gnutls_new(int fd)