raop: Cosmetic fixes / Match coding style

Reviewed-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
Martin Blanchard 2016-01-31 22:16:00 -06:00 committed by Tanu Kaskinen
parent d623c689e6
commit 6665acac56
8 changed files with 252 additions and 222 deletions

View file

@ -17,10 +17,10 @@
along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
***/
/*
/***
This file was originally inspired by a file developed by
Kungliga Tekniska högskolan
*/
***/
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -37,11 +37,17 @@ static const char base64_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static int pos(char c) {
if (c >= 'A' && c <= 'Z') return c - 'A' + 0;
if (c >= 'a' && c <= 'z') return c - 'a' + 26;
if (c >= '0' && c <= '9') return c - '0' + 52;
if (c == '+') return 62;
if (c == '/') return 63;
if (c >= 'A' && c <= 'Z')
return c - 'A' + 0;
if (c >= 'a' && c <= 'z')
return c - 'a' + 26;
if (c >= '0' && c <= '9')
return c - '0' + 52;
if (c == '+')
return 62;
if (c == '/')
return 63;
return -1;
}
@ -73,8 +79,10 @@ int pa_base64_encode(const void *data, int size, char **str) {
p[2] = '=';
p += 4;
}
*p = 0;
*str = s;
return strlen(s);
}
@ -84,6 +92,7 @@ static unsigned int token_decode(const char *token) {
int i;
unsigned int val = 0;
int marker = 0;
if (strlen(token) < 4)
return DECODE_ERROR;
for (i = 0; i < 4; i++) {
@ -99,8 +108,10 @@ static unsigned int token_decode(const char *token) {
val += lpos;
}
}
if (marker > 2)
return DECODE_ERROR;
return (marker << 24) | val;
}
@ -120,5 +131,6 @@ int pa_base64_decode(const char *str, void *data) {
if (marker < 1)
*q++ = val & 0xff;
}
return q - (unsigned char *) data;
}