[glib-networking] Use consistent code style for casts



commit bb69e58f7e9ddf9983183c5d19108d4ca634d332
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Mar 11 13:14:32 2018 -0500

    Use consistent code style for casts

 proxy/tests/libproxy.c             |    2 +-
 tls/gnutls/gtlsconnection-gnutls.c |   10 +++++-----
 tls/pkcs11/gpkcs11array.c          |   14 +++++++-------
 tls/pkcs11/gpkcs11pin.c            |    2 +-
 tls/tests/dtls-connection.c        |    2 +-
 tls/tests/mock-pkcs11.c            |   16 ++++++++--------
 6 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/proxy/tests/libproxy.c b/proxy/tests/libproxy.c
index c2594c5..9277291 100644
--- a/proxy/tests/libproxy.c
+++ b/proxy/tests/libproxy.c
@@ -62,7 +62,7 @@ static void
 test_proxy_ignore (gpointer      fixture,
                    gconstpointer user_data)
 {
-  gchar *no_proxy = g_strjoinv (",", (gchar **) ignore_hosts);
+  gchar *no_proxy = g_strjoinv (",", (gchar **)ignore_hosts);
 
   g_setenv ("http_proxy", "http://localhost:8080";, TRUE);
   g_setenv ("no_proxy", no_proxy, TRUE);
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index ce89dfb..c3b1938 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -1144,7 +1144,7 @@ gnutls_source_sync (GTlsConnectionGnutlsSource *gnutls_source)
   gboolean io_waiting, op_waiting;
 
   /* Was the source destroyed earlier in this main context iteration? */
-  if (g_source_is_destroyed ((GSource *) gnutls_source))
+  if (g_source_is_destroyed ((GSource *)gnutls_source))
     return;
 
   g_mutex_lock (&priv->op_mutex);
@@ -1197,7 +1197,7 @@ gnutls_source_dispatch (GSource     *source,
 {
   GDatagramBasedSourceFunc datagram_based_func = (GDatagramBasedSourceFunc) callback;
   GPollableSourceFunc pollable_func = (GPollableSourceFunc) callback;
-  GTlsConnectionGnutlsSource *gnutls_source = (GTlsConnectionGnutlsSource *) source;
+  GTlsConnectionGnutlsSource *gnutls_source = (GTlsConnectionGnutlsSource *)source;
   gboolean ret;
 
   if (G_IS_DATAGRAM_BASED (gnutls_source->base))
@@ -1564,7 +1564,7 @@ g_tls_connection_gnutls_vec_push_func (gnutls_transport_ptr_t  transport_data,
       G_STRUCT_OFFSET (GOutputVector, size))
     /* ABI is compatible */
     {
-      message.vectors = (GOutputVector *) iov;
+      message.vectors = (GOutputVector *)iov;
       message.num_vectors = iovcnt;
     }
   else
@@ -1575,7 +1575,7 @@ g_tls_connection_gnutls_vec_push_func (gnutls_transport_ptr_t  transport_data,
       message.vectors = g_newa (GOutputVector, iovcnt);
       for (i = 0; i < iovcnt; i++)
         {
-          message.vectors[i].buffer = (void *) iov[i].iov_base;
+          message.vectors[i].buffer = (void *)iov[i].iov_base;
           message.vectors[i].size = iov[i].iov_len;
         }
       message.num_vectors = iovcnt;
@@ -1781,7 +1781,7 @@ handshake_thread (GTask        *task,
   /* A timeout, in microseconds, must be provided as a gint64* task_data. */
   g_assert (task_data != NULL);
 
-  timeout = *((gint64 *) task_data);
+  timeout = *((gint64 *)task_data);
   start_time = g_get_monotonic_time ();
   priv->started_handshake = FALSE;
 
diff --git a/tls/pkcs11/gpkcs11array.c b/tls/pkcs11/gpkcs11array.c
index 00d4bda..c3627f4 100644
--- a/tls/pkcs11/gpkcs11array.c
+++ b/tls/pkcs11/gpkcs11array.c
@@ -48,14 +48,14 @@ g_pkcs11_array_new (void)
   array->len = 0;
   array->ref_count = 1;
 
-  return (GPkcs11Array*) array;
+  return (GPkcs11Array *)array;
 }
 
 void
 g_pkcs11_array_add (GPkcs11Array *array,
                     CK_ATTRIBUTE *attr)
 {
-  GRealPkcs11Array *rarray = (GRealPkcs11Array*)array;
+  GRealPkcs11Array *rarray = (GRealPkcs11Array *)array;
 
   g_return_if_fail (array);
   g_return_if_fail (attr);
@@ -133,7 +133,7 @@ g_pkcs11_array_set (GPkcs11Array *array,
   g_return_if_fail (attr->ulValueLen != (CK_ATTRIBUTE_TYPE)-1 || !attr->pValue);
   g_return_if_fail (attr->pValue || !attr->ulValueLen);
 
-  previous = (CK_ATTRIBUTE*)g_pkcs11_array_find (array, attr->type);
+  previous = (CK_ATTRIBUTE *)g_pkcs11_array_find (array, attr->type);
   if (previous == NULL)
     {
       g_pkcs11_array_add (array, attr);
@@ -232,7 +232,7 @@ g_pkcs11_array_find_boolean (GPkcs11Array         *array,
   attr = g_pkcs11_array_find (array, type);
   if (!attr || !attr->pValue || attr->ulValueLen != sizeof (CK_BBOOL))
     return FALSE;
-  *value = *((CK_BBOOL*)attr->pValue) ? TRUE : FALSE;
+  *value = *((CK_BBOOL *)attr->pValue) ? TRUE : FALSE;
   return TRUE;
 }
 
@@ -249,14 +249,14 @@ g_pkcs11_array_find_ulong (GPkcs11Array         *array,
   attr = g_pkcs11_array_find (array, type);
   if (!attr || !attr->pValue || attr->ulValueLen != sizeof (CK_ULONG))
     return FALSE;
-  *value = *((CK_ULONG*)attr->pValue);
+  *value = *((CK_ULONG *)attr->pValue);
   return TRUE;
 }
 
 GPkcs11Array*
 g_pkcs11_array_ref (GPkcs11Array *array)
 {
-  GRealPkcs11Array *rarray = (GRealPkcs11Array*) array;
+  GRealPkcs11Array *rarray = (GRealPkcs11Array *)array;
 
   g_return_val_if_fail (array, NULL);
   g_return_val_if_fail (g_atomic_int_get (&rarray->ref_count) > 0, array);
@@ -267,7 +267,7 @@ g_pkcs11_array_ref (GPkcs11Array *array)
 void
 g_pkcs11_array_unref (GPkcs11Array *array)
 {
-  GRealPkcs11Array *rarray = (GRealPkcs11Array*) array;
+  GRealPkcs11Array *rarray = (GRealPkcs11Array *)array;
   CK_ULONG i;
 
   g_return_if_fail (array);
diff --git a/tls/pkcs11/gpkcs11pin.c b/tls/pkcs11/gpkcs11pin.c
index 8bcb4c0..6578bf4 100644
--- a/tls/pkcs11/gpkcs11pin.c
+++ b/tls/pkcs11/gpkcs11pin.c
@@ -95,7 +95,7 @@ g_pkcs11_pin_set_value (GTlsPassword  *password,
     }
 
   if (length < 0)
-    length = strlen ((gchar *) value);
+    length = strlen ((gchar *)value);
 
   self->pin = p11_kit_pin_new_for_buffer (value, length, destroy);
 }
diff --git a/tls/tests/dtls-connection.c b/tls/tests/dtls-connection.c
index acd7fba..0baa746 100644
--- a/tls/tests/dtls-connection.c
+++ b/tls/tests/dtls-connection.c
@@ -628,7 +628,7 @@ read_test_data_async (TestConnection *test)
 
       check = g_strdup (TEST_DATA);
       g_assert_cmpuint (strlen (check), ==, message.bytes_received);
-      g_assert (strncmp (check, (const char *) buf, message.bytes_received) == 0);
+      g_assert (strncmp (check, (const char *)buf, message.bytes_received) == 0);
       g_free (check);
     }
 
diff --git a/tls/tests/mock-pkcs11.c b/tls/tests/mock-pkcs11.c
index 0f156f7..75a6874 100644
--- a/tls/tests/mock-pkcs11.c
+++ b/tls/tests/mock-pkcs11.c
@@ -76,7 +76,7 @@ static GHashTable *the_objects = NULL;
 static void
 free_session (gpointer data)
 {
-  Session *sess = (Session*)data;
+  Session *sess = (Session *)data;
   if (sess)
     g_hash_table_destroy (sess->objects);
   g_free (sess);
@@ -557,12 +557,12 @@ mock_specific_args_C_InitToken (CK_SLOT_ID slotID,
 
   g_return_val_if_fail (pPin, CKR_PIN_INVALID);
   g_return_val_if_fail (strlen ("TEST PIN") == ulPinLen, CKR_PIN_INVALID);
-  g_return_val_if_fail (strncmp ((gchar*)pPin, "TEST PIN", ulPinLen) == 0, CKR_PIN_INVALID);
+  g_return_val_if_fail (strncmp ((gchar *)pPin, "TEST PIN", ulPinLen) == 0, CKR_PIN_INVALID);
   g_return_val_if_fail (pLabel != NULL, CKR_PIN_INVALID);
-  g_return_val_if_fail (strcmp ((gchar*)pPin, "TEST LABEL") == 0, CKR_PIN_INVALID);
+  g_return_val_if_fail (strcmp ((gchar *)pPin, "TEST LABEL") == 0, CKR_PIN_INVALID);
 
   g_free (the_pin);
-  the_pin = g_strndup ((gchar*)pPin, ulPinLen);
+  the_pin = g_strndup ((gchar *)pPin, ulPinLen);
   n_the_pin = ulPinLen;
   return CKR_OK;
 }
@@ -696,7 +696,7 @@ mock_C_InitPIN (CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pPin,
   g_return_val_if_fail (session, CKR_SESSION_HANDLE_INVALID);
 
   g_free (the_pin);
-  the_pin = g_strndup ((gchar*)pPin, ulPinLen);
+  the_pin = g_strndup ((gchar *)pPin, ulPinLen);
   n_the_pin = ulPinLen;
   return CKR_OK;
 }
@@ -714,12 +714,12 @@ mock_C_SetPIN (CK_SESSION_HANDLE hSession,
   session = g_hash_table_lookup (the_sessions, GUINT_TO_POINTER (hSession));
   g_return_val_if_fail (session, CKR_SESSION_HANDLE_INVALID);
 
-  old = g_strndup ((gchar*)pOldPin, ulOldLen);
+  old = g_strndup ((gchar *)pOldPin, ulOldLen);
   if (!old || !g_str_equal (old, the_pin))
     return CKR_PIN_INCORRECT;
 
   g_free (the_pin);
-  the_pin = g_strndup ((gchar*)pNewPin, ulNewLen);
+  the_pin = g_strndup ((gchar *)pNewPin, ulNewLen);
   n_the_pin = ulNewLen;
   return CKR_OK;
 }
@@ -764,7 +764,7 @@ mock_C_Login (CK_SESSION_HANDLE hSession,
 
   if (pPinLen != strlen (the_pin))
     return CKR_PIN_INCORRECT;
-  if (strncmp ((gchar*)pPin, the_pin, pPinLen) != 0)
+  if (strncmp ((gchar *)pPin, the_pin, pPinLen) != 0)
     return CKR_PIN_INCORRECT;
 
   if (userType == CKU_CONTEXT_SPECIFIC)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]