[xiph-cvs] cvs commit: libshout/src util.c mp3.c
Michael Smith
msmith at xiph.org
Thu Mar 13 06:01:18 PST 2003
msmith 03/03/13 09:01:18
Modified: src util.c mp3.c
Log:
Fix some compiler warnings from mp3.c
Fix a compiler warning in util.c by replacing bogus code (that was incorrectly
locale-dependent) with stuff modified from icecast/src/util.c
Revision Changes Path
1.16 +27 -7 libshout/src/util.c
Index: util.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/util.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- util.c 11 Mar 2003 06:34:38 -0000 1.15
+++ util.c 13 Mar 2003 14:01:18 -0000 1.16
@@ -52,11 +52,11 @@
return ret;
}
-static char base64table[64] = {
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
- 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
- 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
+static char base64table[65] = {
+ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
+ 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
+ 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
+ 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/',
};
/* This isn't efficient, but it doesn't need to be */
@@ -98,6 +98,25 @@
'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'
};
+static char safechars[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
/* modified from libshout1, which credits Rick Franchuk <rickf at transpect.net>.
* Caller must free result. */
char *util_url_encode(const char *data) {
@@ -108,14 +127,14 @@
for (p = data, n = 0; *p; p++) {
n++;
- if (!isalnum((int)*p))
+ if (!safechars[(unsigned char)(*p)])
n += 2;
}
if (!(dest = malloc(n+1)))
return NULL;
for (p = data, q = dest; *p; p++, q++) {
- if (isalnum((int)*p)) {
+ if (safechars[(unsigned char)(*p)]) {
*q = *p;
} else {
*q++ = '%';
@@ -262,3 +281,4 @@
return res;
}
+
<p><p>1.5 +1 -0 libshout/src/mp3.c
Index: mp3.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/mp3.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mp3.c 9 Mar 2003 22:56:45 -0000 1.4
+++ mp3.c 13 Mar 2003 14:01:18 -0000 1.5
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
#include <shout/shout.h>
#include "shout_private.h"
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list