[gnome-network-displays/cc-tmp: 46/80] cc: replace single line comments with multi-line comments




commit 539a6e6030aa88e4b62b8cfab883f7ccdd1be22a
Author: Anupam Kumar <kyteinsky gmail com>
Date:   Sat Sep 3 18:42:19 2022 +0530

    cc: replace single line comments with multi-line comments

 src/cc/cc-comm.c        | 16 ++++++++--------
 src/cc/cc-common.h      | 27 +++++++++++++++------------
 src/cc/cc-json-helper.c |  4 ++--
 src/nd-cc-sink.c        | 33 ++++++++++++++-------------------
 4 files changed, 39 insertions(+), 41 deletions(-)
---
diff --git a/src/cc/cc-comm.c b/src/cc/cc-comm.c
index aa74409..5751df7 100644
--- a/src/cc/cc-comm.c
+++ b/src/cc/cc-comm.c
@@ -18,7 +18,7 @@
 
 #include "cc-comm.h"
 
-// function decl
+/* function decl */
 static void cc_comm_read_header (CcComm *comm);
 
 /* DEBUG HEX DUMP */
@@ -94,9 +94,9 @@ cc_comm_accept_certificate (GTlsClientConnection *conn,
   return TRUE;
 }
 
-// LISTENER
+/* LISTENER */
 
-// async callback for message read
+/* async callback for message read */
 static void
 cc_comm_message_read_cb (GObject      *source_object,
                          GAsyncResult *res,
@@ -149,7 +149,7 @@ cc_comm_message_read_cb (GObject      *source_object,
   cc_comm_read_header (comm);
 }
 
-// async callback for header read
+/* async callback for header read */
 static void
 cc_comm_header_read_cb (GObject      *source_object,
                         GAsyncResult *res,
@@ -197,7 +197,7 @@ cc_comm_header_read_cb (GObject      *source_object,
       return;
     }
 
-  // if everything is well, read all `io_bytes`
+  /* if everything is well, read all `io_bytes` */
   message_size = GINT32_FROM_BE (*(guint32 *) comm->header_buffer);
   g_debug ("CcComm: Message size: %d", message_size);
 
@@ -213,7 +213,7 @@ cc_comm_header_read_cb (GObject      *source_object,
                                  comm);
 }
 
-// listen to all incoming messages from Chromecast
+/* listen to all incoming messages from Chromecast */
 static void
 cc_comm_read_header (CcComm *comm)
 {
@@ -349,7 +349,7 @@ cc_comm_tls_send (CcComm  * comm,
 
   ostream = g_io_stream_get_output_stream (G_IO_STREAM (comm->con));
 
-  // start sending data synchronously
+  /* start sending data synchronously */
   while (size > 0)
     {
       io_bytes = g_output_stream_write (ostream, message, size, comm->cancellable, error);
@@ -448,7 +448,7 @@ cc_comm_send_request (CcComm       *comm,
 
   switch (message_type)
     {
-    // CAST__CHANNEL__CAST_MESSAGE__PROTOCOL_VERSION__CASTV2_1_3 allows for binary payloads over utf8
+    /* CAST__CHANNEL__CAST_MESSAGE__PROTOCOL_VERSION__CASTV2_1_3 allows for binary payloads over utf8 */
     case CC_MESSAGE_TYPE_AUTH:
       ProtobufCBinaryData binary_payload;
       binary_payload.data = NULL;
diff --git a/src/cc/cc-common.h b/src/cc/cc-common.h
index ce8fc50..598b4d4 100644
--- a/src/cc/cc-common.h
+++ b/src/cc/cc-common.h
@@ -22,9 +22,9 @@
 
 G_BEGIN_DECLS
 
-#define CC_MAX_MSG_SIZE (64 * 1024) // 64KB
-#define CC_MAX_MESSAGE_TIMEOUT (20) // 20 seconds
-// this might pose a problem when there are two gnd applications around
+#define CC_MAX_MSG_SIZE (64 * 1024) /* 64KB */
+#define CC_MAX_MESSAGE_TIMEOUT (20) /* 20 seconds */
+/* this might pose a problem when there are two gnd applications around */
 #define CC_DEFAULT_SENDER_ID "sender-gnd"
 #define CC_DEFAULT_RECEIVER_ID "receiver-0"
 #define CC_MIRRORING_APP_ID "0F5096E8"
@@ -36,7 +36,7 @@ G_BEGIN_DECLS
 #define CC_NAMESPACE_MEDIA "urn:x-cast:com.google.cast.media"
 #define CC_NAMESPACE_WEBRTC "urn:x-cast:com.google.cast.webrtc"
 
-// string switch case
+/* string switch case */
 #define cc_switch(x) \
   const gchar *to_cmp = x; \
   do \
@@ -64,25 +64,28 @@ typedef CcReceivedMessageType CcWaitingFor;
 typedef struct _Stream {
   gint index;
 
-  // Default channel count is 1, e.g. for video.
+  /* Default channel count is 1, e.g. for video. */
   gint channels;
   gint rtp_payload_type;
   gint ssrc;
   gint target_delay;
 
-  // AES Key and IV mask format is very strict: a 32 digit hex string that
-  // must be converted to a 16 digit byte array.
-  // uint8_t aes_key[16];
-  // uint8_t aes_iv_mask[16];
+  /*
+   * AES Key and IV mask format is very strict: a 32 digit hex string that
+   * must be converted to a 16 digit byte array.
+   * uint8_t aes_key[16];
+   * uint8_t aes_iv_mask[16];
+   */
   gchar *aes_iv_mask;
   gchar *aes_key;
   gboolean receiver_rtcp_event_log;
   gchar *receiver_rtcp_dscp;
-  // gint rtp_timebase;
+  /* gint rtp_timebase; */
   gchar *rtp_timebase;
 
-  // The codec parameter field honors the format laid out in RFC 6381:
-  // https://datatracker.ietf.org/doc/html/rfc6381.
+  /* The codec parameter field honors the format laid out in RFC 6381:
+   * https://datatracker.ietf.org/doc/html/rfc6381.
+   */
   gchar *codec_parameter;
 } Stream;
 
diff --git a/src/cc/cc-json-helper.c b/src/cc/cc-json-helper.c
index 9ae0dc9..9b3117a 100644
--- a/src/cc/cc-json-helper.c
+++ b/src/cc/cc-json-helper.c
@@ -127,7 +127,7 @@ cc_json_helper_build_string (/* gboolean pretty_print, */
   JsonNode *root = json_builder_get_root (builder);
   JsonGenerator *gen = json_generator_new ();
 
-  // json_generator_set_pretty (gen, pretty_print);
+  /* json_generator_set_pretty (gen, pretty_print); */
   json_generator_set_root (gen, root);
   gchar *output = json_generator_to_data (gen, NULL);
 
@@ -192,7 +192,7 @@ cc_json_helper_get_message_type (Cast__Channel__CastMessage *message,
         return CC_RWAIT_TYPE_PONG;
       cc_case ("CLOSE") 
         return CC_RWAIT_TYPE_CLOSE;
-      // default
+      /* default */
         return CC_RWAIT_TYPE_UNKNOWN;
     } cc_end
 }
diff --git a/src/nd-cc-sink.c b/src/nd-cc-sink.c
index 6ec5e73..7799f65 100644
--- a/src/nd-cc-sink.c
+++ b/src/nd-cc-sink.c
@@ -16,8 +16,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-// #include <time.h>
-
 #include "gnome-network-displays-config.h"
 #include "nd-cc-sink.h"
 #include "cc/cc-client.h"
@@ -26,8 +24,6 @@
 #include "cc/cc-ctrl.h"
 #include "cc/cc-common.h"
 
-// TODO: add cancellable everywhere
-
 struct _NdCCSink
 {
   GObject        parent_instance;
@@ -66,7 +62,7 @@ enum {
   PROP_LAST = PROP_DISPLAY_NAME,
 };
 
-// interface related functions
+/* interface related functions */
 static void nd_cc_sink_sink_iface_init (NdSinkIface *iface);
 static NdSink * nd_cc_sink_sink_start_stream (NdSink *sink);
 static void nd_cc_sink_sink_stop_stream (NdSink *sink);
@@ -313,7 +309,7 @@ server_create_audio_source_cb (NdCCSink *sink, WfdServer *server)
 static void
 nd_cc_sink_start_webrtc_stream (CcCtrlClosure *closure)
 {
-  // TODO
+  /* TODO */
   g_debug ("Received webrtc stream signal from ctrl");
 }
 
@@ -339,14 +335,14 @@ nd_cc_sink_sink_start_stream (NdSink *sink)
   NdCCSink *self = ND_CC_SINK (sink);
 
   g_autoptr(GError) error = NULL;
-  // gchar six_digits[6];
+  /* gchar six_digits[6]; */
 
   g_return_val_if_fail (self->state == ND_SINK_STATE_DISCONNECTED, NULL);
 
   g_assert (self->server == NULL);
 
-  // self->state = ND_SINK_STATE_ENSURE_FIREWALL;
-  // g_object_notify (G_OBJECT (self), "state");
+  /* self->state = ND_SINK_STATE_ENSURE_FIREWALL;
+  g_object_notify (G_OBJECT (self), "state"); */
 
   self->state = ND_SINK_STATE_WAIT_SOCKET;
   g_object_notify (G_OBJECT (self), "state");
@@ -368,7 +364,7 @@ nd_cc_sink_sink_start_stream (NdSink *sink)
   self->state = ND_SINK_STATE_STREAMING;
   g_object_notify (G_OBJECT (self), "state");
 
-  // TODO: maybe we don't need this part
+  /* TODO: maybe we don't need this part */
   self->server = wfd_server_new ();
   self->server_source_id = gst_rtsp_server_attach (GST_RTSP_SERVER (self->server), NULL);
 
@@ -399,12 +395,14 @@ nd_cc_sink_sink_start_stream (NdSink *sink)
                            self,
                            G_CONNECT_SWAPPED);
 
-  // self->state = ND_SINK_STATE_WAIT_SOCKET;
-  // g_object_notify (G_OBJECT (self), "state");
+  /*
+  self->state = ND_SINK_STATE_WAIT_SOCKET;
+  g_object_notify (G_OBJECT (self), "state");
 
-  // these were originally here
-  // 1. send connect request
-  // 2. send ping
+  these were originally here
+  1. send connect request
+  2. send ping
+  */
 
   return g_object_ref (sink);
 }
@@ -414,9 +412,6 @@ nd_cc_sink_sink_stop_stream_int (NdCCSink *self)
 {
   cc_ctrl_finish (&self->ctrl, NULL);
 
-  // g_cancellable_cancel (self->cancellable);
-  // g_clear_object (&self->cancellable);
-
   self->cancellable = g_cancellable_new ();
 
   /* Destroy the server that is streaming. */
@@ -452,7 +447,7 @@ nd_cc_sink_sink_stop_stream (NdSink *sink)
 * NdCCSink public functions
 ******************************************************************/
 
-// XXX: no use for client
+/* XXX: no use for client */
 NdCCSink *
 nd_cc_sink_new (GSocketClient *client,
                 gchar         *name,


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