adress MODAPP-55

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6491 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2007-12-04 16:22:02 +00:00
1 parent 41a97ef575
commit ae9f41c379
4 files changed
+66 -2

No files matched your search

+47
View File
@@ -55,6 +55,53 @@ SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size
return total;
}
SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len)
{
char *p, *q;
int x = 0;
assert(s);
q = buf;
for(p = s; x < len; p++) {
switch(*p) {
case '<':
if (x + 4 > len -1) {
goto end;
}
*q++ = '&';
*q++ = 'l';
*q++ = 't';
*q++ = ';';
x += 4;
break;
case '>':
if (x + 4 > len -1) {
goto end;
}
*q++ = '&';
*q++ = 'g';
*q++ = 't';
*q++ = ';';
x += 4;
break;
default:
if (x + 1 > len -1) {
goto end;
}
*q++ = *p;
x++;
if (*p == '\0') {
goto end;
}
break;
}
}
end:
return buf;
}
static const char switch_b64_table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";