From cb8c5a925fc22819626cbe4525b1d334db75d071 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 11 May 2008 15:34:37 +0000 Subject: Some misc fixes. consts, base64 optimisation (not that it will be with us long anyway), and c comments git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/coling@2407 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/rtp/base64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/modules/rtp/base64.c') diff --git a/src/modules/rtp/base64.c b/src/modules/rtp/base64.c index 043ef5a8..980b018e 100644 --- a/src/modules/rtp/base64.c +++ b/src/modules/rtp/base64.c @@ -37,16 +37,16 @@ #include "base64.h" -static char base64_chars[] = +static const char base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static int pos(char c) { - char *p; - for (p = base64_chars; *p; p++) - if (*p == c) - return p - base64_chars; - return -1; + 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; } int pa_base64_encode(const void *data, int size, char **str) -- cgit