From 98da1d2f66ef4df88fef9b696320b44ac841a0b8 Mon Sep 17 00:00:00 2001 From: James Laird Date: Tue, 14 May 2013 09:14:27 +1000 Subject: [PATCH] whitespace fixes --- LICENSE | 2 +- audio.c | 4 ++-- audio_dummy.c | 4 ++-- common.c | 4 ++-- common.h | 1 + mdns.c | 2 +- rtp.c | 2 +- rtsp.c | 22 +++++++++++----------- shairport.c | 4 ++-- 9 files changed, 23 insertions(+), 22 deletions(-) diff --git a/LICENSE b/LICENSE index 6bb1c6077..1f41c5214 100644 --- a/LICENSE +++ b/LICENSE @@ -16,4 +16,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +OTHER DEALINGS IN THE SOFTWARE. diff --git a/audio.c b/audio.c index ccfc93ed1..fbb96bd62 100644 --- a/audio.c +++ b/audio.c @@ -41,11 +41,11 @@ static audio_output *outputs[] = { &audio_dummy, NULL }; - + audio_output *audio_get_output(char *name) { audio_output **out; - + // default to the first if (!name) return outputs[0]; diff --git a/audio_dummy.c b/audio_dummy.c index f93355a7b..67245267d 100644 --- a/audio_dummy.c +++ b/audio_dummy.c @@ -52,11 +52,11 @@ static void play(short buf[], int samples) { // this is all a bit expensive but it's long-term stable. gettimeofday(&tv, NULL); - long long nowtime = tv.tv_usec + 1e6*tv.tv_sec; + long long nowtime = tv.tv_usec + 1e6*tv.tv_sec; if (!starttime) starttime = nowtime; - + samples_played += samples; long long finishtime = starttime + samples_played * 1e6 / Fs; diff --git a/common.c b/common.c index 9824e56cb..89ab4803f 100644 --- a/common.c +++ b/common.c @@ -102,7 +102,7 @@ uint8_t *base64_dec(char *input, int *outlen) { while (inlen++ & 3) BIO_write(bmem, "=", 1); BIO_flush(bmem); - + int bufsize = strlen(input)*3/4 + 1; uint8_t *buf = malloc(bufsize); int nread; @@ -115,7 +115,7 @@ uint8_t *base64_dec(char *input, int *outlen) { return buf; } -static char super_secret_key[] = +static char super_secret_key[] = "-----BEGIN RSA PRIVATE KEY-----\n" "MIIEpQIBAAKCAQEA59dE8qLieItsH1WgjrcFRKj6eUWqi+bGLOX1HL3U3GhC/j0Qg90u3sG/1CUt\n" "wC5vOYvfDmFI6oSFXi5ELabWJmT2dKHzBJKa3k9ok+8t9ucRqMd6DZHJ2YCCLlDRKSKv6kDqnw4U\n" diff --git a/common.h b/common.h index 31f8c5ca8..20c9811a8 100644 --- a/common.h +++ b/common.h @@ -25,6 +25,7 @@ typedef struct { audio_output *output; int buffer_start_fill; int daemonise; + int mdns_internal; } shairport_cfg; extern int debuglev; diff --git a/mdns.c b/mdns.c index 579302adb..5583581d6 100644 --- a/mdns.c +++ b/mdns.c @@ -47,7 +47,7 @@ void mdns_register(void) { if ((mdns_pid = fork())) return; - + char *mdns_apname = malloc(strlen(config.apname) + 14); char *p = mdns_apname; int i; diff --git a/rtp.c b/rtp.c index 5ac3aca93..e9ebc6f97 100644 --- a/rtp.c +++ b/rtp.c @@ -136,7 +136,7 @@ int rtp_setup(SOCKADDR *remote, int cport, int tport) { // we do our own timing and ignore the timing port. // an audio perfectionist may wish to learn the protocol. - + memcpy(&rtp_client, remote, sizeof(rtp_client)); #ifdef AF_INET6 if (rtp_client.SAFAMILY == AF_INET6) { diff --git a/rtsp.c b/rtsp.c index 2f734186f..d25bba9e3 100644 --- a/rtsp.c +++ b/rtsp.c @@ -124,7 +124,7 @@ typedef struct { static rtsp_message * msg_init(void) { rtsp_message *msg = malloc(sizeof(rtsp_message)); - memset(msg, 0, sizeof(rtsp_message)); + memset(msg, 0, sizeof(rtsp_message)); return msg; } @@ -179,7 +179,7 @@ static int msg_handle_line(rtsp_message **pmsg, char *line) { p = strtok_r(NULL, " ", &sp); if (!p) goto fail; - + p = strtok_r(NULL, " ", &sp); if (!p) goto fail; @@ -221,7 +221,7 @@ static rtsp_message * rtsp_read_request(int fd) { rtsp_message *msg = NULL; - ssize_t nread; + ssize_t nread; ssize_t inbuf = 0; int msg_size = -1; @@ -426,7 +426,7 @@ static void handle_announce(rtsp_conn_info *conn, if (!strncmp(cp, "a=rsaaeskey:", 12)) prsaaeskey = cp+12; - + cp = next; } @@ -455,7 +455,7 @@ static void handle_announce(rtsp_conn_info *conn, } memcpy(conn->stream.aeskey, aeskey, 16); free(aeskey); - + int i; for (i=0; istream.fmtp)/sizeof(conn->stream.fmtp[0]); i++) conn->stream.fmtp[i] = atoi(strsep(&pfmtp, " \t")); @@ -503,7 +503,7 @@ static void apple_challenge(int fd, rtsp_message *req, rtsp_message *resp) { memcpy(bp, chall, chall_len); free(chall); bp += chall_len; - + #ifdef AF_INET6 if (fdsa.SAFAMILY == AF_INET6) { struct sockaddr_in6 *sa6 = (struct sockaddr_in6*)(&fdsa); @@ -560,7 +560,7 @@ static int rtsp_auth(char **nonce, rtsp_message *req, rtsp_message *resp) { char *hdr = msg_get_header(req, "Authorization"); if (!hdr || strncmp(hdr, "Digest ", 7)) goto authenticate; - + char *realm = strstr(hdr, "realm=\""); char *username = strstr(hdr, "username=\""); char *response = strstr(hdr, "response=\""); @@ -646,7 +646,7 @@ static void *rtsp_conversation_thread_func(void *vfd) { int fd = *(int*)vfd; socklen_t slen = sizeof(conn.remote); - + fd = accept(fd, (struct sockaddr *)&conn.remote, &slen); if (fd < 0) { perror("failed to accept connection"); @@ -667,7 +667,7 @@ static void *rtsp_conversation_thread_func(void *vfd) { if (rtsp_auth(&auth_nonce, req, resp)) goto respond; - + struct method_handler *mh; for (mh=method_handlers; mh->method; mh++) { if (!strcmp(mh->method, req->method)) { @@ -680,7 +680,7 @@ static void *rtsp_conversation_thread_func(void *vfd) { msg_write_response(fd, resp); msg_free(req); msg_free(resp); - } + } shutdown: if (fd > 0) @@ -731,7 +731,7 @@ void rtsp_listen_loop(void) { if (ret) { die("getaddrinfo failed: %s\n", gai_strerror(ret)); } - + for (p=info; p; p=p->ai_next) { int fd = socket(p->ai_family, p->ai_socktype, IPPROTO_TCP); int yes = 1; diff --git a/shairport.c b/shairport.c index 4ad37b4e0..dd7f08a7a 100644 --- a/shairport.c +++ b/shairport.c @@ -124,7 +124,7 @@ void signal_setup(void) { sa.sa_flags = SA_SIGINFO; sa.sa_sigaction = &sig_ignore; sigaction(SIGUSR1, &sa, NULL); - + sa.sa_sigaction = &sig_shutdown; sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); @@ -144,7 +144,7 @@ int main(int argc, char **argv) { snprintf(config.apname, 20 + 100, "Shairport on %s", hostname); int audio_arg = parse_options(argc, argv); - + config.output = audio_get_output(config.output_name); if (!config.output) { audio_ls_outputs();