aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-11-27 20:44:55 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-11-27 20:45:15 +0100
commit170b8628fabff2d81606cac052a35f8cf91cc7b2 (patch)
treec9e02294eb2d1e82966a266ad06c8312ae676b51 /networking
parentdc68a5ddac23e34fe00299d55501043bd83ae817 (diff)
downloadbusybox-170b8628fabff2d81606cac052a35f8cf91cc7b2.tar.gz
libbb: smaller and faster decode_base64()
function old new delta decode_base64 195 180 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/httpd.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 961f8cab4..4ffd89c48 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1017,46 +1017,9 @@ static char *encodeString(const char *string)
*/
static void decodeBase64(char *Data)
{
-# if ENABLE_BASE64 || ENABLE_UUDECODE
- /* Call decode_base64() from uuencode.c */
char *eptr = Data;
decode_base64(&eptr, Data);
*eptr = '\0';
-# else
- const unsigned char *in = (const unsigned char *)Data;
- /* The decoded size will be at most 3/4 the size of the encoded */
- unsigned ch = 0;
- int i = 0;
-
- while (*in) {
- int t = *in++;
-
- if (t >= '0' && t <= '9')
- t = t - '0' + 52;
- else if (t >= 'A' && t <= 'Z')
- t = t - 'A';
- else if (t >= 'a' && t <= 'z')
- t = t - 'a' + 26;
- else if (t == '+')
- t = 62;
- else if (t == '/')
- t = 63;
- else if (t == '=')
- t = 0;
- else
- continue;
-
- ch = (ch << 6) | t;
- i++;
- if (i == 4) {
- *Data++ = (char) (ch >> 16);
- *Data++ = (char) (ch >> 8);
- *Data++ = (char) ch;
- i = 0;
- }
- }
- *Data = '\0';
-# endif
}
#endif