]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
3.1.2 pretty-print using clang-format
authorMike Brady <mikebrady@eircom.net>
Thu, 7 Sep 2017 11:02:00 +0000 (12:02 +0100)
committerMike Brady <mikebrady@eircom.net>
Thu, 7 Sep 2017 11:02:00 +0000 (12:02 +0100)
alac.c
common.c
player.c
player.h
rtp.c
rtsp.c
shairport.c
tinysvcmdns.c
tinysvcmdns.h

diff --git a/alac.c b/alac.c
index d8b6ac9ce93781ef49bcad34f7eedee6a48bddcb..a8761894addd166f31428877ec71700d7424421e 100644 (file)
--- a/alac.c
+++ b/alac.c
@@ -1004,7 +1004,7 @@ alac_file *alac_create(int samplesize, int numchannels) {
     newfile->numchannels = numchannels;
     newfile->bytespersample = (samplesize / 8) * numchannels;
   } else {
-    fprintf(stderr, "FIXME: can not allocate memory for a new file in alac_cxreate."); 
+    fprintf(stderr, "FIXME: can not allocate memory for a new file in alac_cxreate.");
   }
   return newfile;
 }
index c3a5e5b17e759ae3d7c9e02a3388c9a91dd51ff4..1bea3a91dac4aa917481c7972dfc9760dd7f87f6 100644 (file)
--- a/common.c
+++ b/common.c
@@ -259,7 +259,7 @@ char *base64_enc(uint8_t *input, int length) {
   BIO_get_mem_ptr(b64, &bptr);
 
   char *buf = (char *)malloc(bptr->length);
-  if (buf==NULL)
+  if (buf == NULL)
     die("could not allocate memory for buf in base64_enc");
   if (bptr->length) {
     memcpy(buf, bptr->data, bptr->length - 1);
index fe3bb3508e8f8f39e4678b8388ace145e34a0d55..091a193d6d388442bffcef9afb02cd657f57a411 100644 (file)
--- a/player.c
+++ b/player.c
@@ -710,10 +710,12 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
     if ((conn->time_of_last_audio_packet != 0) && (conn->stop == 0) &&
         (config.dont_check_timeout == 0)) {
       uint64_t ct = config.timeout; // go from int to 64-bit int
-//      if (conn->packet_count>500) { //for testing -- about 4 seconds of play first
+      //      if (conn->packet_count>500) { //for testing -- about 4 seconds of play first
       if ((local_time_now > conn->time_of_last_audio_packet) &&
           (local_time_now - conn->time_of_last_audio_packet >= ct << 32)) {
-        debug(1, "As Yeats almost said, \"Too long a silence / can make a stone of the heart\" from RTSP conversation %d.",conn->connection_number);
+        debug(1, "As Yeats almost said, \"Too long a silence / can make a stone of the heart\" "
+                 "from RTSP conversation %d.",
+              conn->connection_number);
         conn->stop = 1;
         pthread_kill(conn->thread, SIGUSR1);
       }
@@ -1830,12 +1832,13 @@ static void *player_thread_func(void *arg) {
               } else if ((sync_error < 0) && ((-sync_error) > filler_length)) {
                 // debug(1, "Large negative sync error: %lld. Inserting silence.", sync_error);
                 size_t silence_length = -sync_error;
-                if (silence_length>(filler_length*5))
-                  silence_length = filler_length*5;
-                  
+                if (silence_length > (filler_length * 5))
+                  silence_length = filler_length * 5;
+
                 char *long_silence = malloc(conn->output_bytes_per_frame * silence_length);
                 if (long_silence == NULL)
-                  die("Failed to allocate memory for a long_silence buffer of %d frames.",silence_length);
+                  die("Failed to allocate memory for a long_silence buffer of %d frames.",
+                      silence_length);
                 memset(long_silence, 0, conn->output_bytes_per_frame * silence_length);
                 config.output->play((short *)long_silence, silence_length);
                 free(long_silence);
@@ -2187,8 +2190,8 @@ static void *player_thread_func(void *arg) {
   rc = pthread_mutex_destroy(&conn->vol_mutex);
   if (rc)
     debug(1, "Error destroying vol_mutex variable.");
-  
-  debug(1, "Player thread exit on RTSP conversation thread %d.",conn->connection_number);
+
+  debug(1, "Player thread exit on RTSP conversation thread %d.", conn->connection_number);
   if (outbuf)
     free(outbuf);
   if (silence)
@@ -2440,7 +2443,7 @@ void player_flush(int64_t timestamp, rtsp_conn_info *conn) {
 
 int player_play(rtsp_conn_info *conn) {
   // need to use conn in place of streram below. Need to put the stream as a parameter to he
-  if (conn->player_thread!=NULL)
+  if (conn->player_thread != NULL)
     die("Trying to create a second player thread for this RTSP session");
   if (config.buffer_start_fill > BUFFER_FRAMES)
     die("specified buffer starting fill %d > buffer size %d", config.buffer_start_fill,
@@ -2450,7 +2453,7 @@ int player_play(rtsp_conn_info *conn) {
   send_ssnc_metadata('pbeg', NULL, 0, 1);
 #endif
   pthread_t *pt = malloc(sizeof(pthread_t));
-  if (pt==NULL)
+  if (pt == NULL)
     die("Couldn't allocate space for pthread_t");
   conn->player_thread = pt;
   size_t size = (PTHREAD_STACK_MIN + 256 * 1024);
@@ -2466,17 +2469,17 @@ int player_play(rtsp_conn_info *conn) {
 
 void player_stop(rtsp_conn_info *conn) {
   if (conn->player_thread) {
-               conn->player_thread_please_stop = 1;
-               pthread_cond_signal(&conn->flowcontrol); // tell it to give up
-               pthread_kill(*conn->player_thread, SIGUSR1);
-               pthread_join(*conn->player_thread, NULL);
+    conn->player_thread_please_stop = 1;
+    pthread_cond_signal(&conn->flowcontrol); // tell it to give up
+    pthread_kill(*conn->player_thread, SIGUSR1);
+    pthread_join(*conn->player_thread, NULL);
 #ifdef CONFIG_METADATA
-               send_ssnc_metadata('pend', NULL, 0, 1);
+    send_ssnc_metadata('pend', NULL, 0, 1);
 #endif
-               command_stop();
-               free(conn->player_thread);
-               conn->player_thread = NULL;
+    command_stop();
+    free(conn->player_thread);
+    conn->player_thread = NULL;
   } else {
-       debug(3,"player thread of RTSP conversation %d is already deleted.",conn->connection_number);
+    debug(3, "player thread of RTSP conversation %d is already deleted.", conn->connection_number);
   }
 }
index 9eee0956d04f8c89dc41ca5798c9704e1050ceb5..db612e0b0510ef638c601bb749541900b742849f 100644 (file)
--- a/player.h
+++ b/player.h
@@ -60,7 +60,7 @@ typedef struct {
   int stop;
   int running;
   pthread_t thread;
-  
+
   // pthread_t *ptp;
   pthread_t *player_thread;
 
diff --git a/rtp.c b/rtp.c
index 405dbd6efd530dc84eb0d5aad708db1ddae58c10..ee7f02c5cfb569bbf45a66cefc246a2516e98283 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -254,7 +254,8 @@ void *rtp_control_receiver(void *arg) {
         debug(3, "Too-short retransmitted audio packet received in control port, ignored.");
       }
     } else
-      debug(1, "Control Port -- Unknown RTP packet of type 0x%02X length %d, ignored.", packet[1], nread);
+      debug(1, "Control Port -- Unknown RTP packet of type 0x%02X length %d, ignored.", packet[1],
+            nread);
   }
 
   debug(3, "Control RTP thread interrupted. terminating.");
@@ -290,7 +291,8 @@ void *rtp_timing_sender(void *arg) {
     // debug(1,"Send a timing request");
 
     if (!conn->rtp_running)
-      debug(1,"rtp_timing_sender called without active stream in RTSP conversation thread %d!",conn->connection_number);
+      debug(1, "rtp_timing_sender called without active stream in RTSP conversation thread %d!",
+            conn->connection_number);
 
     // debug(1, "Requesting ntp timestamp exchange.");
 
@@ -639,8 +641,8 @@ void rtp_setup(SOCKADDR *local, SOCKADDR *remote, int cport, int tport, uint32_t
   inet_ntop(conn->connection_ip_family, self_addr, conn->self_ip_string,
             sizeof(conn->self_ip_string));
 
-  debug(1, "Set up play connection from %s to self at %s on RTSP conversation thread %d.", conn->client_ip_string,
-        conn->self_ip_string, conn->connection_number);
+  debug(1, "Set up play connection from %s to self at %s on RTSP conversation thread %d.",
+        conn->client_ip_string, conn->self_ip_string, conn->connection_number);
 
   // set up a the record of the remote's control socket
   struct addrinfo hints;
@@ -713,7 +715,7 @@ void get_reference_timestamp_stuff(int64_t *timestamp, uint64_t *timestamp_time,
   pthread_mutex_lock(&conn->reference_time_mutex);
   *timestamp = conn->reference_timestamp;
   *timestamp_time = conn->reference_timestamp_time;
-  //if ((*timestamp == 0) && (*timestamp_time == 0)) {
+  // if ((*timestamp == 0) && (*timestamp_time == 0)) {
   //  debug(1,"Reference timestamp is invalid.");
   //}
   *remote_timestamp_time = conn->remote_reference_timestamp_time;
diff --git a/rtsp.c b/rtsp.c
index 08b156ce14e20ef95f4b9c37e5458d4d3c11068d..f1ae9a377e35e730b7f907b8b1aa34e1bf19a721 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -266,9 +266,10 @@ static void cleanup_threads(void) {
   // debug(2, "culling threads.");
   for (i = 0; i < nconns;) {
     if (conns[i]->running == 0) {
-      debug(3, "found RTSP connection thread %d in a non-running state.",conns[i]->connection_number);
+      debug(3, "found RTSP connection thread %d in a non-running state.",
+            conns[i]->connection_number);
       pthread_join(conns[i]->thread, &retval);
-      debug(3, "RTSP connection thread %d deleted...",conns[i]->connection_number);
+      debug(3, "RTSP connection thread %d deleted...", conns[i]->connection_number);
       free(conns[i]);
       nconns--;
       if (nconns)
@@ -467,7 +468,7 @@ static enum rtsp_read_request_response rtsp_read_request(rtsp_conn_info *conn,
   while (msg_size < 0) {
     memory_barrier();
     if (conn->stop != 0) {
-      debug(3, "RTSP conversation thread %d shutdown requested.",conn->connection_number);
+      debug(3, "RTSP conversation thread %d shutdown requested.", conn->connection_number);
       reply = rtsp_read_request_response_immediate_shutdown_requested;
       goto shutdown;
     }
@@ -475,7 +476,7 @@ static enum rtsp_read_request_response rtsp_read_request(rtsp_conn_info *conn,
 
     if (nread == 0) {
       // a blocking read that returns zero means eof -- implies connection closed
-      debug(3, "RTSP conversation thread %d -- connection closed.",conn->connection_number);
+      debug(3, "RTSP conversation thread %d -- connection closed.", conn->connection_number);
       reply = rtsp_read_request_response_channel_closed;
       goto shutdown;
     }
@@ -602,7 +603,7 @@ static void msg_write_response(int fd, rtsp_message *resp) {
 }
 
 static void handle_record(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3,"Connection %d: RECORD",conn->connection_number);
+  debug(3, "Connection %d: RECORD", conn->connection_number);
   resp->respcode = 200;
   // I think this is for telling the client what the absolute minimum latency
   // actually is,
@@ -637,7 +638,7 @@ static void handle_record(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
 }
 
 static void handle_options(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3, "Connection %d: OPTIONS",conn->connection_number);
+  debug(3, "Connection %d: OPTIONS", conn->connection_number);
   resp->respcode = 200;
   msg_add_header(resp, "Public", "ANNOUNCE, SETUP, RECORD, "
                                  "PAUSE, FLUSH, TEARDOWN, "
@@ -645,25 +646,28 @@ static void handle_options(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
 }
 
 static void handle_teardown(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3, "Connection %d: TEARDOWN",conn->connection_number);
-  //if (!rtsp_playing())
+  debug(3, "Connection %d: TEARDOWN", conn->connection_number);
+  // if (!rtsp_playing())
   //  debug(1, "This RTSP connection thread (%d) doesn't think it's playing, but "
   //           "it's sending a response to teardown anyway",conn->connection_number);
   resp->respcode = 200;
   msg_add_header(resp, "Connection", "close");
-  
-       debug(3, "TEARDOWN: synchronously terminating the player thread of RTSP conversation thread %d (2).",conn->connection_number);
-       //if (rtsp_playing()) {
-               player_stop(conn);
-               debug(3, "TEARDOWN: successful termination of playing thread of RTSP conversation thread %d.",conn->connection_number);
-       //}
+
+  debug(3,
+        "TEARDOWN: synchronously terminating the player thread of RTSP conversation thread %d (2).",
+        conn->connection_number);
+  // if (rtsp_playing()) {
+  player_stop(conn);
+  debug(3, "TEARDOWN: successful termination of playing thread of RTSP conversation thread %d.",
+        conn->connection_number);
+  //}
 }
 
 static void handle_flush(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3, "Connection %d: FLUSH",conn->connection_number);
-//  if (!rtsp_playing())
-//    debug(1, "This RTSP conversation thread (%d) doesn't think it's playing, but "
- //            "it's sending a response to flush anyway",conn->connection_number);
+  debug(3, "Connection %d: FLUSH", conn->connection_number);
+  //  if (!rtsp_playing())
+  //    debug(1, "This RTSP conversation thread (%d) doesn't think it's playing, but "
 //            "it's sending a response to flush anyway",conn->connection_number);
   char *p = NULL;
   uint32_t rtptime = 0;
   char *hdr = msg_get_header(req, "RTP-Info");
@@ -690,7 +694,7 @@ static void handle_flush(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *
 }
 
 static void handle_setup(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3,"Connection %d: SETUP",conn->connection_number);
+  debug(3, "Connection %d: SETUP", conn->connection_number);
   int cport, tport;
   int lsport, lcport, ltport;
   uint32_t active_remote = 0;
@@ -828,14 +832,15 @@ static void handle_setup(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *
   return;
 
 error:
-  warn("Error in setup request -- unlocking play lock on RTSP conversation thread %d.",conn->connection_number);
+  warn("Error in setup request -- unlocking play lock on RTSP conversation thread %d.",
+       conn->connection_number);
   playing_conn = NULL;
   pthread_mutex_unlock(&play_lock);
   resp->respcode = 451; // invalid arguments
 }
 
 static void handle_ignore(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(1, "Connection thread %d: IGNORE",conn->connection_number);
+  debug(1, "Connection thread %d: IGNORE", conn->connection_number);
   resp->respcode = 200;
 }
 
@@ -1289,12 +1294,12 @@ static void handle_set_parameter_metadata(rtsp_conn_info *conn, rtsp_message *re
 #endif
 
 static void handle_get_parameter(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3,"Connection %d: GET_PARAMETER",conn->connection_number);
+  debug(3, "Connection %d: GET_PARAMETER", conn->connection_number);
   resp->respcode = 200;
 }
 
 static void handle_set_parameter(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3,"Connection %d: SET_PARAMETER",conn->connection_number);
+  debug(3, "Connection %d: SET_PARAMETER", conn->connection_number);
   // if (!req->contentlength)
   //    debug(1, "received empty SET_PARAMETER request.");
 
@@ -1385,29 +1390,32 @@ static void handle_set_parameter(rtsp_conn_info *conn, rtsp_message *req, rtsp_m
 }
 
 static void handle_announce(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
-  debug(3,"Connection %d: ANNOUNCE",conn->connection_number);
+  debug(3, "Connection %d: ANNOUNCE", conn->connection_number);
   int have_the_player = 0;
 
   // interrupt session if permitted
   if (pthread_mutex_trylock(&play_lock) == 0) {
     have_the_player = 1;
   } else {
-       if (playing_conn) {
-               debug(1,"RTSP Conversation thread %d already playing when asked by thread %d.",playing_conn->connection_number,conn->connection_number);
-       } else {
-               debug(1,"play_lock locked but no playing_conn.");
-       }
+    if (playing_conn) {
+      debug(1, "RTSP Conversation thread %d already playing when asked by thread %d.",
+            playing_conn->connection_number, conn->connection_number);
+    } else {
+      debug(1, "play_lock locked but no playing_conn.");
+    }
     if (config.allow_session_interruption == 1) {
       // some other thread has the player ... ask it to relinquish the thread
       if (playing_conn) {
-        debug(1, "ANNOUNCE: playing connection %d being interrupted by connection %d.",playing_conn->connection_number,conn->connection_number);
+        debug(1, "ANNOUNCE: playing connection %d being interrupted by connection %d.",
+              playing_conn->connection_number, conn->connection_number);
         if (playing_conn == conn) {
           debug(1, "ANNOUNCE asking to stop itself.");
         } else {
           playing_conn->stop = 1;
           memory_barrier();
           pthread_kill(playing_conn->thread, SIGUSR1);
-          usleep(1000000); // here, it is possible for other connections to come in and nab the player.
+          usleep(
+              1000000); // here, it is possible for other connections to come in and nab the player.
         }
       } else {
         die("Non existent the_playing_conn with play_lock enabled.");
@@ -1422,8 +1430,8 @@ static void handle_announce(rtsp_conn_info *conn, rtsp_message *req, rtsp_messag
   }
 
   if (have_the_player) {
-    playing_conn = conn;  // the present connection is now playing
-    debug(3,"RTSP conversation thread %d has acquired play lock.",conn->connection_number);
+    playing_conn = conn; // the present connection is now playing
+    debug(3, "RTSP conversation thread %d has acquired play lock.", conn->connection_number);
     resp->respcode = 456; // 456 - Header Field Not Valid for Resource
     char *paesiv = NULL;
     char *prsaaeskey = NULL;
@@ -1502,14 +1510,16 @@ static void handle_announce(rtsp_conn_info *conn, rtsp_message *req, rtsp_messag
 
     char *hdr = msg_get_header(req, "X-Apple-Client-Name");
     if (hdr) {
-      debug(1, "Play connection from device named \"%s\" on RTSP conversation thread %d.", hdr,conn->connection_number);
+      debug(1, "Play connection from device named \"%s\" on RTSP conversation thread %d.", hdr,
+            conn->connection_number);
 #ifdef CONFIG_METADATA
       send_metadata('ssnc', 'snam', hdr, strlen(hdr), req, 1);
 #endif
     }
     hdr = msg_get_header(req, "User-Agent");
     if (hdr) {
-      debug(1, "Play connection from user agent \"%s\" on RTSP conversation thread %d.", hdr,conn->connection_number);
+      debug(1, "Play connection from user agent \"%s\" on RTSP conversation thread %d.", hdr,
+            conn->connection_number);
 #ifdef CONFIG_METADATA
       send_metadata('ssnc', 'snua', hdr, strlen(hdr), req, 1);
 #endif
@@ -1522,7 +1532,8 @@ static void handle_announce(rtsp_conn_info *conn, rtsp_message *req, rtsp_messag
 
 out:
   if (resp->respcode != 200 && resp->respcode != 453) {
-    debug(1,"Error in handling ANNOUNCE on conversation thread %d. Unlocking the play lock.",conn->connection_number);
+    debug(1, "Error in handling ANNOUNCE on conversation thread %d. Unlocking the play lock.",
+          conn->connection_number);
     playing_conn = NULL;
     pthread_mutex_unlock(&play_lock);
   }
@@ -1552,7 +1563,7 @@ static void apple_challenge(int fd, rtsp_message *req, rtsp_message *resp) {
 
   int chall_len;
   uint8_t *chall = base64_dec(hdr, &chall_len);
-  if (chall==NULL) 
+  if (chall == NULL)
     die("null chall in apple_challenge");
   uint8_t buf[48], *bp = buf;
   int i;
@@ -1590,7 +1601,7 @@ static void apple_challenge(int fd, rtsp_message *req, rtsp_message *resp) {
 
   uint8_t *challresp = rsa_apply(buf, buflen, &resplen, RSA_MODE_AUTH);
   char *encoded = base64_enc(challresp, resplen);
-  if (encoded==NULL)
+  if (encoded == NULL)
     die("could not allocate memory for \"encoded\"");
   // strip the padding.
   char *padding = strchr(encoded, '=');
@@ -1775,11 +1786,12 @@ static void *rtsp_conversation_thread_func(void *pconn) {
   char *hdr, *auth_nonce = NULL;
 
   enum rtsp_read_request_response reply;
-  
-  while (conn->stop==0) {
+
+  while (conn->stop == 0) {
     reply = rtsp_read_request(conn, &req);
     if (reply == rtsp_read_request_response_ok) {
-      debug(3, "RTSP thread %d received an RTSP Packet of type \"%s\":",conn->connection_number, req->method),
+      debug(3, "RTSP thread %d received an RTSP Packet of type \"%s\":", conn->connection_number,
+            req->method),
           debug_print_msg_headers(3, req);
       resp = msg_init();
       resp->respcode = 400;
@@ -1803,22 +1815,25 @@ static void *rtsp_conversation_thread_func(void *pconn) {
           }
         }
         if (method_selected == 0)
-          debug(1, "RTSP thread %d: Unrecognised and unhandled rtsp request \"%s\".",conn->connection_number, req->method);
+          debug(1, "RTSP thread %d: Unrecognised and unhandled rtsp request \"%s\".",
+                conn->connection_number, req->method);
       }
-      debug(3, "RTSP thread %d: RTSP Response:",conn->connection_number);
+      debug(3, "RTSP thread %d: RTSP Response:", conn->connection_number);
       debug_print_msg_headers(3, resp);
       msg_write_response(conn->fd, resp);
       msg_free(req);
       msg_free(resp);
     } else {
-       if ((reply==rtsp_read_request_response_immediate_shutdown_requested) ||
-               (reply==rtsp_read_request_response_channel_closed)) {
-        debug(3, "Synchronously terminate playing thread of RTSP conversation thread %d.",conn->connection_number);
+      if ((reply == rtsp_read_request_response_immediate_shutdown_requested) ||
+          (reply == rtsp_read_request_response_channel_closed)) {
+        debug(3, "Synchronously terminate playing thread of RTSP conversation thread %d.",
+              conn->connection_number);
         player_stop(conn);
-        debug(3, "Successful termination of playing thread of RTSP conversation thread %d.",conn->connection_number);
-                               debug(3, "Request termination of RTSP conversation thread %d.",conn->connection_number);
-                               conn->stop = 1;
-       } else {
+        debug(3, "Successful termination of playing thread of RTSP conversation thread %d.",
+              conn->connection_number);
+        debug(3, "Request termination of RTSP conversation thread %d.", conn->connection_number);
+        conn->stop = 1;
+      } else {
         debug(1, "rtsp_read_request error %d, packet ignored.", (int)reply);
       }
     }
@@ -1829,12 +1844,12 @@ static void *rtsp_conversation_thread_func(void *pconn) {
   if (auth_nonce)
     free(auth_nonce);
   rtp_terminate(conn);
-  if (playing_conn==conn) {
-    debug(3,"Unlocking play lock on RTSP conversation thread %d.",conn->connection_number);
+  if (playing_conn == conn) {
+    debug(3, "Unlocking play lock on RTSP conversation thread %d.", conn->connection_number);
     playing_conn = NULL;
     pthread_mutex_unlock(&play_lock);
-       }
-  debug(1, "RTSP conversation thread %d terminated.",conn->connection_number);
+  }
+  debug(1, "RTSP conversation thread %d terminated.", conn->connection_number);
   //  please_shutdown = 0;
   conn->running = 0;
   return NULL;
@@ -2011,8 +2026,8 @@ void rtsp_listen_loop(void) {
           send_ssnc_metadata('clip', strdup(remote_ip4), strlen(remote_ip4), 1);
           send_ssnc_metadata('svip', strdup(ip4), strlen(ip4), 1);
 #endif
-          debug(1, "New RTSP connection from %s:%u to self at %s:%u on conversation thread %d.", remote_ip4, rport, ip4,
-                tport,conn->connection_number);
+          debug(1, "New RTSP connection from %s:%u to self at %s:%u on conversation thread %d.",
+                remote_ip4, rport, ip4, tport, conn->connection_number);
         }
 #ifdef AF_INET6
         if (local_info->SAFAMILY == AF_INET6) {
@@ -2032,8 +2047,8 @@ void rtsp_listen_loop(void) {
           send_ssnc_metadata('clip', strdup(remote_ip6), strlen(remote_ip6), 1);
           send_ssnc_metadata('svip', strdup(ip6), strlen(ip6), 1);
 #endif
-          debug(1, "New RTSP connection from [%s]:%u to self at [%s]:%u on conversation thread %d.", remote_ip6, rport, ip6,
-                tport,conn->connection_number);
+          debug(1, "New RTSP connection from [%s]:%u to self at [%s]:%u on conversation thread %d.",
+                remote_ip6, rport, ip6, tport, conn->connection_number);
         }
 #endif
 
@@ -2048,8 +2063,8 @@ void rtsp_listen_loop(void) {
       ret = pthread_create(&conn->thread, NULL, rtsp_conversation_thread_func,
                            conn); // also acts as a memory barrier
       if (ret)
-        die("Failed to create RTSP receiver thread %d!",conn->connection_number);
-      debug(3,"Successfully created RTSP receiver thread %d.",conn->connection_number);
+        die("Failed to create RTSP receiver thread %d!", conn->connection_number);
+      debug(3, "Successfully created RTSP receiver thread %d.", conn->connection_number);
       conn->running = 1; // this must happen before the thread is tracked
       track_thread(conn);
     }
index 613b15ec050f359dc7b5a5c6dd00a7eb2f0cef5b..6249d636954d6973537e878a7311ed12cfd9db65 100644 (file)
@@ -478,10 +478,11 @@ int parse_options(int argc, char **argv) {
           config.packet_stuffing = ST_basic;
         else if (strcasecmp(str, "soxr") == 0)
 #ifdef HAVE_LIBSOXR
-        config.packet_stuffing = ST_soxr;
+          config.packet_stuffing = ST_soxr;
 #else
-        die("The soxr option not available because this version of shairport-sync was built without libsoxr "
-            "support. Change the \"general/interpolation\" setting in the configuration file.");
+          die("The soxr option not available because this version of shairport-sync was built "
+              "without libsoxr "
+              "support. Change the \"general/interpolation\" setting in the configuration file.");
 #endif
         else
           die("Invalid interpolation option choice. It should be \"basic\" or \"soxr\"");
@@ -848,7 +849,8 @@ int parse_options(int argc, char **argv) {
 #ifdef HAVE_LIBSOXR
         config.packet_stuffing = ST_soxr;
 #else
-        die("The soxr option not available because this version of shairport-sync was built without libsoxr "
+        die("The soxr option not available because this version of shairport-sync was built "
+            "without libsoxr "
             "support. Change the -S option setting.");
 #endif
       else
@@ -971,7 +973,7 @@ int main(int argc, char **argv) {
   char *basec = strdup(argv[0]);
   char *bname = basename(basec);
   appName = strdup(bname);
-  if (appName==NULL)
+  if (appName == NULL)
     die("can not allocate memory for the app name!");
   free(basec);
 
@@ -996,7 +998,7 @@ int main(int argc, char **argv) {
     endianness = SS_BIG_ENDIAN;
   else
     die("Can not recognise the endianness of the processor.");
-    
+
   // set non-zero / non-NULL default values here
   // but note that audio back ends also have a chance to set defaults
 
index 7ae35bb6a859d4ed692a3e6aa930c6374a787a9a..ab6c80f03a101a1a80564fca1b83f568ad951baa 100644 (file)
@@ -127,7 +127,7 @@ char *nlabel_to_str(const uint8_t *name) {
   assert(name != NULL);
 
   label = labelp = malloc(256);
-  
+
   if (label) {
     for (p = name; *p; p++) {
       strncpy(labelp, (char *)p + 1, *p);
@@ -820,8 +820,8 @@ struct mdns_pkt *mdns_parse_pkt(uint8_t *pkt_buf, size_t pkt_len) {
     return NULL;
 
   MALLOC_ZERO_STRUCT(pkt, mdns_pkt);
-  
-  if (pkt==NULL)
+
+  if (pkt == NULL)
     die("cannot allocate memory for \"pkt\" in tinysvcmdns.c.");
 
   // parse header
@@ -1600,7 +1600,7 @@ struct mdns_service *mdnsd_register_svc(struct mdnsd *svr, const char *instance_
   if (inst_nlabel) {
     nlabel = join_nlabel(inst_nlabel, type_nlabel);
   } else {
-    die("could not allocate memory for \"inst_nlabel\" in tinysvcmdns");  
+    die("could not allocate memory for \"inst_nlabel\" in tinysvcmdns");
   }
 
   // create TXT record
index dd24b22ac6b92068518363bd11d7c4a30df03a44..a8a19a9feb128e8344ad493a4200492f22e47dda 100644 (file)
@@ -47,8 +47,8 @@
 
 #define MALLOC_ZERO_STRUCT(x, type)                                                                \
   x = malloc(sizeof(struct type));                                                                 \
-  if (x)                                                                 \
-  memset(x, 0, sizeof(struct type));
+  if (x)                                                                                           \
+    memset(x, 0, sizeof(struct type));
 
 #define DECL_MALLOC_ZERO_STRUCT(x, type) struct type *MALLOC_ZERO_STRUCT(x, type)