aboutsummaryrefslogtreecommitdiff
path: root/networking/httpd.c
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/httpd.c
parentdc68a5ddac23e34fe00299d55501043bd83ae817 (diff)
downloadbusybox-w32-170b8628fabff2d81606cac052a35f8cf91cc7b2.tar.gz
busybox-w32-170b8628fabff2d81606cac052a35f8cf91cc7b2.tar.bz2
busybox-w32-170b8628fabff2d81606cac052a35f8cf91cc7b2.zip
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 '')
-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)
1017 */ 1017 */
1018static void decodeBase64(char *Data) 1018static void decodeBase64(char *Data)
1019{ 1019{
1020# if ENABLE_BASE64 || ENABLE_UUDECODE
1021 /* Call decode_base64() from uuencode.c */
1022 char *eptr = Data; 1020 char *eptr = Data;
1023 decode_base64(&eptr, Data); 1021 decode_base64(&eptr, Data);
1024 *eptr = '\0'; 1022 *eptr = '\0';
1025# else
1026 const unsigned char *in = (const unsigned char *)Data;
1027 /* The decoded size will be at most 3/4 the size of the encoded */
1028 unsigned ch = 0;
1029 int i = 0;
1030
1031 while (*in) {
1032 int t = *in++;
1033
1034 if (t >= '0' && t <= '9')
1035 t = t - '0' + 52;
1036 else if (t >= 'A' && t <= 'Z')
1037 t = t - 'A';
1038 else if (t >= 'a' && t <= 'z')
1039 t = t - 'a' + 26;
1040 else if (t == '+')
1041 t = 62;
1042 else if (t == '/')
1043 t = 63;
1044 else if (t == '=')
1045 t = 0;
1046 else
1047 continue;
1048
1049 ch = (ch << 6) | t;
1050 i++;
1051 if (i == 4) {
1052 *Data++ = (char) (ch >> 16);
1053 *Data++ = (char) (ch >> 8);
1054 *Data++ = (char) ch;
1055 i = 0;
1056 }
1057 }
1058 *Data = '\0';
1059# endif
1060} 1023}
1061#endif 1024#endif
1062 1025