From: Mike Brady Date: Thu, 29 Nov 2018 12:18:07 +0000 (+0000) Subject: Clang formatted. X-Git-Tag: 3.3RC0~131 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca45d2ecbeea1eac2496bea6cff312f7c2ede571;p=thirdparty%2Fshairport-sync.git Clang formatted. --- diff --git a/common.c b/common.c index f815af91..d8fcbd44 100644 --- a/common.c +++ b/common.c @@ -94,10 +94,9 @@ volatile int debuglev = 0; sigset_t pselect_sigset; - int usleep_uncancellable(useconds_t usec) { - int response; - int oldState; + int response; + int oldState; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); response = usleep_uncancellable(usec); pthread_setcancelstate(oldState, NULL); @@ -107,8 +106,8 @@ int usleep_uncancellable(useconds_t usec) { static uint16_t UDPPortIndex = 0; void resetFreeUDPPort() { - debug(1,"Resetting UDP Port Suggestion to %u",config.udp_port_base); - UDPPortIndex = 0; + debug(1, "Resetting UDP Port Suggestion to %u", config.udp_port_base); + UDPPortIndex = 0; } uint16_t nextFreeUDPPort() { diff --git a/common.h b/common.h index 59492c5f..ece21b1d 100644 --- a/common.h +++ b/common.h @@ -330,7 +330,7 @@ char *get_version_string(); // mallocs a string space -- remember to free it aft void sps_nanosleep(const time_t sec, const long nanosec); // waits for this time, even through interruptions - + int usleep_uncancellable(useconds_t usec); #endif // _COMMON_H diff --git a/rtp.c b/rtp.c index bfb32d75..61c69dd2 100644 --- a/rtp.c +++ b/rtp.c @@ -98,7 +98,7 @@ uint64_t local_to_remote_time_difference_now(rtsp_conn_info *conn) { } void rtp_audio_receiver_cleanup_handler(void *arg) { - int oldState; + int oldState; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); debug(3, "Audio Receiver Cleanup."); rtsp_conn_info *conn = (rtsp_conn_info *)arg; @@ -564,13 +564,13 @@ void *rtp_timing_sender(void *arg) { } void rtp_timing_receiver_cleanup_handler(void *arg) { - int oldState; + int oldState; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); debug(3, "Timing Receiver Cleanup."); rtsp_conn_info *conn = (rtsp_conn_info *)arg; debug(3, "Cancel Timing Requester."); pthread_cancel(conn->timer_requester); - debug(3, "Join Timing Requester."); + debug(3, "Join Timing Requester."); pthread_join(conn->timer_requester, NULL); debug(3, "Close Timing Socket."); close(conn->timing_socket); @@ -867,16 +867,15 @@ static uint16_t bind_port(int ip_family, const char *self_ip_address, uint32_t s int local_socket = socket(ip_family, SOCK_DGRAM, IPPROTO_UDP); if (local_socket == -1) die("Could not allocate a socket."); - + int val = 1; ret = setsockopt(local_socket, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)); if (ret < 0) { char errorstring[1024]; strerror_r(errno, (char *)errorstring, sizeof(errorstring)); - debug(1,"Error %d: \"%s\". Couldn't set SO_REUSEADDR"); + debug(1, "Error %d: \"%s\". Couldn't set SO_REUSEADDR"); } - SOCKADDR myaddr; int tryCount = 0; uint16_t desired_port; diff --git a/rtsp.c b/rtsp.c index 2d1203d7..31af30f9 100644 --- a/rtsp.c +++ b/rtsp.c @@ -571,10 +571,10 @@ enum rtsp_read_request_response rtsp_read_request(rtsp_conn_info *conn, rtsp_mes if (errno == EINTR) continue; if (errno != ECONNRESET) { - char errorstring[1024]; - strerror_r(errno, (char *)errorstring, sizeof(errorstring)); - debug(1, "Connection %d: rtsp_read_request_response_read_error %d: \"%s\".", - conn->connection_number, errno, (char *)errorstring); + char errorstring[1024]; + strerror_r(errno, (char *)errorstring, sizeof(errorstring)); + debug(1, "Connection %d: rtsp_read_request_response_read_error %d: \"%s\".", + conn->connection_number, errno, (char *)errorstring); } reply = rtsp_read_request_response_read_error; goto shutdown; @@ -924,14 +924,15 @@ void handle_setup(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) { "timing_port=%d;server_" "port=%d", conn->local_control_port, conn->local_timing_port, conn->local_audio_port); - msg_add_header(resp, "Transport", resphdr); msg_add_header(resp, "Session", "1"); resp->respcode = 200; - debug(1, "Connection %d: SETUP with UDP ports Control: %d, Timing: %d and Audio: %d.", conn->connection_number, conn->local_control_port, conn->local_timing_port, conn->local_audio_port); + debug(1, "Connection %d: SETUP with UDP ports Control: %d, Timing: %d and Audio: %d.", + conn->connection_number, conn->local_control_port, conn->local_timing_port, + conn->local_audio_port); return; error: @@ -2065,7 +2066,6 @@ void rtsp_conversation_thread_cleanup_function(void *arg) { if (rc) debug(1, "Connection %d: error %d destroying flush_mutex.", conn->connection_number, rc); - debug(2, "Cancel watchdog thread."); pthread_cancel(conn->player_watchdog_thread); int oldState; @@ -2076,7 +2076,6 @@ void rtsp_conversation_thread_cleanup_function(void *arg) { debug(2, "Delete watchdog mutex."); pthread_mutex_destroy(&conn->watchdog_mutex); - debug(3, "Connection %d: Checking play lock.", conn->connection_number); debug_mutex_lock(&playing_conn_lock, 1000000, 3); // get it if (playing_conn == conn) { @@ -2084,7 +2083,7 @@ void rtsp_conversation_thread_cleanup_function(void *arg) { playing_conn = NULL; } debug_mutex_unlock(&playing_conn_lock, 3); - + debug(2, "Connection %d: RTSP thread terminated.", conn->connection_number); conn->running = 0; }