lars 99/03/20 07:41:11
Modified: src/main util.c src CHANGES . STATUS Log: Fix ap_uuencode() PR: 3411 Submitted by: Ronald Tschalär <[EMAIL PROTECTED]> Reviewed by: Dirk, Lars, Ronald Revision Changes Path 1.156 +32 -6 apache-1.3/src/main/util.c Index: util.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.155 retrieving revision 1.156 diff -u -r1.155 -r1.156 --- util.c 1999/03/10 17:42:43 1.155 +++ util.c 1999/03/20 15:41:07 1.156 @@ -2020,18 +2020,44 @@ { int i, len = strlen(string); char *p; - char *encoded = (char *) ap_pcalloc(a, (len+2) / 3 * 4); + char *encoded = (char *) ap_palloc(a, (len+2) / 3 * 4); p = encoded; - for (i = 0; i < len; i += 3) { - *p++ = basis_64[string[i] >> 2]; +#ifndef CHARSET_EBCDIC + 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-- = '\0'; - *p-- = '='; - *p-- = '='; + if (i < len) { + *p++ = basis_64[(string[i] >> 2) & 0x3F]; + *p++ = basis_64[((string[i] & 0x3) << 4) | ((int) (string[i + 1] & 0xF0) >> 4)]; + if (i == (len-2)) + *p++ = basis_64[((string[i + 1] & 0xF) << 2)]; + else + *p++ = '='; + *p++ = '='; + } +#else /*CHARSET_EBCDIC*/ + 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]; + } + if (i < len) { + *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)]; + if (i == (len-2)) + *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)]; + else + *p++ = '='; + *p++ = '='; + } +#endif /*CHARSET_EBCDIC*/ + + *p = '\0'; return encoded; } 1.1285 +6 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1284 retrieving revision 1.1285 diff -u -r1.1284 -r1.1285 --- CHANGES 1999/03/19 16:34:45 1.1284 +++ CHANGES 1999/03/20 15:41:08 1.1285 @@ -1,5 +1,11 @@ Changes with Apache 1.3.5 + *) ap_uuencode() always added two trailing '='s and encoding of + 8 bit characters on a machine with signed char may produced + incorrect results. Additionally ap_uuencode() should now + work correctly on EBCDIC platforms. + [Ronald Tschalär <[EMAIL PROTECTED]>] PR#3411 + *) WIN32: Binary installer now runs the configuration DLL before the reboot prompt (which is only given if MSVCRT.DLL system DLL is new or updated). This should avoid the configuration 1.655 +1 -5 apache-1.3/STATUS Index: STATUS =================================================================== RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.654 retrieving revision 1.655 diff -u -r1.654 -r1.655 --- STATUS 1999/03/20 15:25:29 1.654 +++ STATUS 1999/03/20 15:41:10 1.655 @@ -1,5 +1,5 @@ 1.3 STATUS: - Last modified at [$Date: 1999/03/20 15:25:29 $] + Last modified at [$Date: 1999/03/20 15:41:10 $] Release: @@ -116,10 +116,6 @@ to be aware of NO_GETTIMEOFDAY and NO_TIMES as well as implement a times() alternative. Not only that, but with extended_status, we calculate this anyway). - - * Ronald Tschalär's ap_uuencode() bugfix - Message-ID: PR#3411 - Status: Lars +1 (on concept), Dirkx +1 * Juan Gallego's patch to add CSH-style modifiers (:h, :r, :t, :e) to mod_include's variable processing.