You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by co...@apache.org on 2022/06/28 13:30:22 UTC

svn commit: r1902319 - /apr/apr/trunk/encoding/apr_base64.c

Author: covener
Date: Tue Jun 28 13:30:22 2022
New Revision: 1902319

URL: http://svn.apache.org/viewvc?rev=1902319&view=rev
Log:
detab


Modified:
    apr/apr/trunk/encoding/apr_base64.c

Modified: apr/apr/trunk/encoding/apr_base64.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/encoding/apr_base64.c?rev=1902319&r1=1902318&r2=1902319&view=diff
==============================================================================
--- apr/apr/trunk/encoding/apr_base64.c (original)
+++ apr/apr/trunk/encoding/apr_base64.c Tue Jun 28 13:30:22 2022
@@ -26,7 +26,7 @@
 #include "apr_base64.h"
 #if APR_CHARSET_EBCDIC
 #include "apr_xlate.h"
-#endif				/* APR_CHARSET_EBCDIC */
+#endif                /* APR_CHARSET_EBCDIC */
 
 /* Above APR_BASE64_ENCODE_MAX length the encoding can't fit in an int >= 0 */
 #define APR_BASE64_ENCODE_MAX 1610612733
@@ -141,7 +141,7 @@ APR_DECLARE(int) apr_base64_decode(char
     inbytes_left = outbytes_left = len;
     apr_xlate_conv_buffer(xlate_to_ebcdic, bufplain, &inbytes_left,
                           bufplain, &outbytes_left);
-#endif				/* APR_CHARSET_EBCDIC */
+#endif                /* APR_CHARSET_EBCDIC */
     bufplain[len] = '\0';
     return len;
 }
@@ -151,7 +151,7 @@ APR_DECLARE(int) apr_base64_decode(char
  * - on EBCDIC machines, the conversion of the output to ebcdic is left out
  */
 APR_DECLARE(int) apr_base64_decode_binary(unsigned char *bufplain,
-				   const char *bufcoded)
+                   const char *bufcoded)
 {
     int nbytesdecoded;
     register const unsigned char *bufin;
@@ -168,24 +168,24 @@ APR_DECLARE(int) apr_base64_decode_binar
     bufin = (const unsigned char *) bufcoded;
 
     while (nprbytes >= 4) {
-	*(bufout++) =
-	    (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
-	*(bufout++) =
-	    (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
-	*(bufout++) =
-	    (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
-	bufin += 4;
-	nprbytes -= 4;
+    *(bufout++) =
+        (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
+    *(bufout++) =
+        (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
+    *(bufout++) =
+        (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
+    bufin += 4;
+    nprbytes -= 4;
     }
 
     /* Note: (nprbytes == 1) would be an error, so just ignore that case */
     if (nprbytes > 1) {
-	*(bufout++) =
-	    (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
+    *(bufout++) =
+        (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
     }
     if (nprbytes > 2) {
-	*(bufout++) =
-	    (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
+    *(bufout++) =
+        (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
     }
 
     return nbytesdecoded - (int)((4u - nprbytes) & 3u);
@@ -223,30 +223,30 @@ APR_DECLARE(int) apr_base64_encode(char
 
     p = encoded;
     for (i = 0; i < len - 2; i += 3) {
-	*p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
-	*p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
-	                ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
-	*p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
-	                ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
-	*p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
+    *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
+    *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
+                    ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
+    *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
+                    ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
+    *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
     }
     if (i < len) {
-	*p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
-	if (i == (len - 1)) {
-	    *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
-	    *p++ = '=';
-	}
-	else {
-	    *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
-	                    ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
-	    *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
-	}
-	*p++ = '=';
+    *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
+    if (i == (len - 1)) {
+        *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
+        *p++ = '=';
+    }
+    else {
+        *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
+                        ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
+        *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
+    }
+    *p++ = '=';
     }
 
     *p++ = '\0';
     return (unsigned int)(p - encoded);
-#endif				/* APR_CHARSET_EBCDIC */
+#endif                /* APR_CHARSET_EBCDIC */
 }
 
 /* This is the same as apr_base64_encode() except on EBCDIC machines, where
@@ -262,25 +262,25 @@ APR_DECLARE(int) apr_base64_encode_binar
 
     p = encoded;
     for (i = 0; i < len - 2; i += 3) {
-	*p++ = basis_64[(string[i] >> 2) & 0x3F];
-	*p++ = basis_64[((string[i] & 0x3) << 4) |
-	                ((int) (string[i + 1] & 0xF0) >> 4)];
-	*p++ = basis_64[((string[i + 1] & 0xF) << 2) |
-	                ((int) (string[i + 2] & 0xC0) >> 6)];
-	*p++ = basis_64[string[i + 2] & 0x3F];
+    *p++ = basis_64[(string[i] >> 2) & 0x3F];
+    *p++ = basis_64[((string[i] & 0x3) << 4) |
+                    ((int) (string[i + 1] & 0xF0) >> 4)];
+    *p++ = basis_64[((string[i + 1] & 0xF) << 2) |
+                    ((int) (string[i + 2] & 0xC0) >> 6)];
+    *p++ = basis_64[string[i + 2] & 0x3F];
     }
     if (i < len) {
-	*p++ = basis_64[(string[i] >> 2) & 0x3F];
-	if (i == (len - 1)) {
-	    *p++ = basis_64[((string[i] & 0x3) << 4)];
-	    *p++ = '=';
-	}
-	else {
-	    *p++ = basis_64[((string[i] & 0x3) << 4) |
-	                    ((int) (string[i + 1] & 0xF0) >> 4)];
-	    *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
-	}
-	*p++ = '=';
+    *p++ = basis_64[(string[i] >> 2) & 0x3F];
+    if (i == (len - 1)) {
+        *p++ = basis_64[((string[i] & 0x3) << 4)];
+        *p++ = '=';
+    }
+    else {
+        *p++ = basis_64[((string[i] & 0x3) << 4) |
+                        ((int) (string[i + 1] & 0xF0) >> 4)];
+        *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
+    }
+    *p++ = '=';
     }
 
     *p++ = '\0';