httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/support ab.c
Date Tue, 16 May 2000 03:11:15 GMT
trawick     00/05/15 20:11:14

  Modified:    src/ap   ap_base64.c
               src/main util_ebcdic.c
               src/support ab.c
  Log:
  APR-ize the CHARSET_EBCDIC support in ap_base64encode() and
  ap_base64decode().  The app (e.g., Apache, ab) must call a function
  to set up translation.
  
  Revision  Changes    Path
  1.8       +29 -5     apache-2.0/src/ap/ap_base64.c
  
  Index: ap_base64.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_base64.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ap_base64.c	2000/04/29 16:00:29	1.7
  +++ ap_base64.c	2000/05/16 03:11:09	1.8
  @@ -65,7 +65,7 @@
   #include "ap_config.h"
   #include "ap_base64.h"
   #ifdef CHARSET_EBCDIC
  -#include "ebcdic.h"
  +#include "apr_xlate.h"
   #endif				/* CHARSET_EBCDIC */
   
   /* aaaack but it's fast and const should make it shared text page. */
  @@ -110,6 +110,29 @@
   #endif /*CHARSET_EBCDIC*/
   };
   
  +#ifdef CHARSET_EBCDIC
  +static ap_xlate_t *xlate_to_ebcdic;
  +static unsigned char os_toascii[256];
  +
  +API_EXPORT(ap_status_t) ap_base64init_ebcdic(ap_xlate_t *to_ascii,
  +                                             ap_xlate_t *to_ebcdic)
  +{
  +    int i;
  +    ap_size_t inbytes_left, outbytes_left;
  +    ap_status_t rv;
  +    
  +    xlate_to_ebcdic = to_ebcdic;
  +    for (i = 0; i < sizeof(os_toascii); i++) {
  +        os_toascii[i] = i;
  +    }
  +    inbytes_left = outbytes_left = sizeof(os_toascii);
  +    ap_xlate_conv_buffer(to_ascii, os_toascii, &inbytes_left,
  +                         os_toascii, &outbytes_left);
  +
  +    return APR_SUCCESS;
  +}
  +#endif /*CHARSET_EBCDIC*/
  +
   API_EXPORT(int) ap_base64decode_len(const char *bufcoded)
   {
       int nbytesdecoded;
  @@ -128,20 +151,21 @@
   API_EXPORT(int) ap_base64decode(char *bufplain, const char *bufcoded)
   {
   #ifdef CHARSET_EBCDIC
  -    int i;
  +    ap_size_t inbytes_left, outbytes_left;
   #endif				/* CHARSET_EBCDIC */
       int len;
       
       len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
   #ifdef CHARSET_EBCDIC
  -    for (i = 0; i < len; i++)
  -	bufplain[i] = os_toebcdic[bufplain[i]];
  +    inbytes_left = outbytes_left = len;
  +    ap_xlate_conv_buffer(xlate_to_ebcdic, bufplain, &inbytes_left,
  +                         bufplain, &outbytes_left);
   #endif				/* CHARSET_EBCDIC */
       bufplain[len] = '\0';
       return len;
   }
   
  -/* This is the same as ap_base64udecode() except on EBCDIC machines, where
  +/* This is the same as ap_base64decode() except on EBCDIC machines, where
    * the conversion of the output to ebcdic is left out.
    */
   API_EXPORT(int) ap_base64decode_binary(unsigned char *bufplain,
  
  
  
  1.4       +7 -0      apache-2.0/src/main/util_ebcdic.c
  
  Index: util_ebcdic.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_ebcdic.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- util_ebcdic.c	2000/05/15 17:51:22	1.3
  +++ util_ebcdic.c	2000/05/16 03:11:12	1.4
  @@ -97,6 +97,13 @@
           return rv;
       }
       
  +    rv = ap_base64init_ebcdic(ap_hdrs_to_ascii, ap_hdrs_from_ascii);
  +    if (rv) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL,
  +                     "ap_base64init_ebcdic() failed");
  +        return rv;
  +    }
  +    
       return APR_SUCCESS;
   }
   
  
  
  
  1.14      +7 -3      apache-2.0/src/support/ab.c
  
  Index: ab.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/ab.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ab.c	2000/05/16 02:42:57	1.13
  +++ ab.c	2000/05/16 03:11:13	1.14
  @@ -838,14 +838,14 @@
   static void copyright(void)
   {
       if (!use_html) {
  -        printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.13 $>
apache-2.0");
  +        printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.14 $>
apache-2.0");
           printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
           printf("Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n");
           printf("\n");
       }
       else {
           printf("<p>\n");
  -        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i>
apache-2.0<br>\n", VERSION, "$Revision: 1.13 $");
  +        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i>
apache-2.0<br>\n", VERSION, "$Revision: 1.14 $");
           printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
           printf(" Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/<br>\n");
           printf("</p>\n<p>\n");
  @@ -971,9 +971,13 @@
           exit(1);
       }
       status = ap_xlate_open(&from_ascii, APR_DEFAULT_CHARSET, "ISO8859-1", cntxt);
  -
       if (status) {
           fprintf(stderr, "ap_xlate_open(from ASCII)->%d\n", status);
  +        exit(1);
  +    }
  +    status = ap_base64init_ebcdic(to_ascii, from_ascii);
  +    if (status) {
  +        fprintf(stderr, "ap_base64init_ebcdic()->%d\n", status);
           exit(1);
       }
   #endif
  
  
  

Mime
View raw message