You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@hyperreal.org on 1998/01/16 15:23:35 UTC

cvs commit: apachen/src/os/bs2000 ebcdic.c ebcdic.h

martin      98/01/16 06:23:35

  Modified:    src/main buff.c buff.h util.c
               src/modules/standard mod_include.c
               src/os/bs2000 ebcdic.c ebcdic.h
  Log:
  [PORT] EBCDIC: Avoid namespace problems caused by variables with leading underscore
  (pointed out by Dean)
  
  Submitted by:	Dean Gaudet
  
  Revision  Changes    Path
  1.57      +7 -7      apachen/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /home/cvs/apachen/src/main/buff.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -u -r1.56 -r1.57
  --- buff.c	1998/01/13 23:11:07	1.56
  +++ buff.c	1998/01/16 14:22:54	1.57
  @@ -727,12 +727,12 @@
   	buff[ct++] = ch;
       }
   #else /* an EBCDIC machine: do the same, but convert to EBCDIC on the fly: */
  -	ch = _toebcdic[(unsigned char)fb->inptr[i++]];
  -	if (ch == _toebcdic['\012']) {	/* got LF */
  +	ch = os_toebcdic[(unsigned char)fb->inptr[i++]];
  +	if (ch == os_toebcdic['\012']) {  /* got LF */
   	    if (ct == 0)
   		buff[ct++] = '\n';
   /* if just preceeded by CR, replace CR with LF */
  -	    else if (buff[ct - 1] == _toebcdic['\015'])
  +	    else if (buff[ct - 1] == os_toebcdic['\015'])
   		buff[ct - 1] = '\n';
   	    else if (ct < n - 1)
   		buff[ct++] = '\n';
  @@ -790,7 +790,7 @@
   #ifndef CHARSET_EBCDIC
       *buff = fb->inptr[0];
   #else /*CHARSET_EBCDIC*/
  -    *buff = _toebcdic[(unsigned char)fb->inptr[0]];
  +    *buff = os_toebcdic[(unsigned char)fb->inptr[0]];
   #endif /*CHARSET_EBCDIC*/
       return 1;
   }
  @@ -843,7 +843,7 @@
   #ifndef CHARSET_EBCDIC
       ss[0] = c;
   #else
  -    ss[0] = _toascii[(unsigned char)c];
  +    ss[0] = os_toascii[(unsigned char)c];
   #endif
       rc = bwrite(fb, ss, 1);
       /* We do start_chunk() here so that the bputc macro can be smaller
  @@ -871,7 +871,7 @@
   #ifndef CHARSET_EBCDIC
   	return buf[0];
   #else /*CHARSET_EBCDIC*/
  -	return _toebcdic[(unsigned char)buf[0]];
  +	return os_toebcdic[(unsigned char)buf[0]];
   #endif /*CHARSET_EBCDIC*/
   }
   
  @@ -1326,7 +1326,7 @@
   	 * the HTTP protocol.
   	 */
   	if (ch == '\012' || ch == '\015')
  -	    ch = _toebcdic[ch];
  +	    ch = os_toebcdic[ch];
   	if (bputc(ch, fb) != 0)
   	    return -1;
       }
  
  
  
  1.30      +2 -2      apachen/src/main/buff.h
  
  Index: buff.h
  ===================================================================
  RCS file: /home/cvs/apachen/src/main/buff.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -u -r1.29 -r1.30
  --- buff.h	1998/01/13 23:11:07	1.29
  +++ buff.h	1998/01/16 14:22:54	1.30
  @@ -171,11 +171,11 @@
   #else /*CHARSET_EBCDIC*/
   
   #define bgetc(fb)   ( ((fb)->incnt == 0) ? bfilbuf(fb) : \
  -		    ((fb)->incnt--, _toebcdic[(unsigned char)*((fb)->inptr++)]) )
  +		    ((fb)->incnt--, os_toebcdic[(unsigned char)*((fb)->inptr++)]) )
   
   #define bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
   		     (fb)->outcnt == (fb)->bufsiz) ? bflsbuf(c, (fb)) : \
  -		     ((fb)->outbase[(fb)->outcnt++] = _toascii[(unsigned char)c], 0))
  +		     ((fb)->outbase[(fb)->outcnt++] = os_toascii[(unsigned char)c], 0))
   
   #endif /*CHARSET_EBCDIC*/
   API_EXPORT(int) spawn_child_err_buff(pool *, int (*)(void *), void *,
  
  
  
  1.85      +9 -9      apachen/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apachen/src/main/util.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -u -r1.84 -r1.85
  --- util.c	1998/01/13 23:11:14	1.84
  +++ util.c	1998/01/16 14:22:55	1.85
  @@ -1000,7 +1000,7 @@
       xstr[2]=what[0];
       xstr[3]=what[1];
       xstr[4]='\0';
  -    digit = _toebcdic[0xFF & strtol(xstr, NULL, 16)];
  +    digit = os_toebcdic[0xFF & strtol(xstr, NULL, 16)];
   #endif /*CHARSET_EBCDIC*/
       return (digit);
   }
  @@ -1601,7 +1601,7 @@
       bufplain[nbytesdecoded] = '\0';
   #else /*CHARSET_EBCDIC*/
       bufin = (const unsigned char *) bufcoded;
  -    while (pr2six[_toascii[(unsigned char)*(bufin++)]] <= 63);
  +    while (pr2six[os_toascii[(unsigned char)*(bufin++)]] <= 63);
       nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
       nbytesdecoded = ((nprbytes + 3) / 4) * 3;
   
  @@ -1611,18 +1611,18 @@
       bufin = (const unsigned char *) bufcoded;
   
       while (nprbytes > 0) {
  -	*(bufout++) = _toebcdic[
  -	    (unsigned char) (pr2six[_toascii[*bufin]] << 2 | pr2six[_toascii[bufin[1]]] >> 4)];
  -	*(bufout++) = _toebcdic[
  -	    (unsigned char) (pr2six[_toascii[bufin[1]]] << 4 | pr2six[_toascii[bufin[2]]] >> 2)];
  -	*(bufout++) = _toebcdic[
  -	    (unsigned char) (pr2six[_toascii[bufin[2]]] << 6 | pr2six[_toascii[bufin[3]]])];
  +	*(bufout++) = os_toebcdic[
  +	    (unsigned char) (pr2six[os_toascii[*bufin]] << 2 | pr2six[_toascii[bufin[1]]] >> 4)];
  +	*(bufout++) = os_toebcdic[
  +	    (unsigned char) (pr2six[os_toascii[bufin[1]]] << 4 | pr2six[_toascii[bufin[2]]] >> 2)];
  +	*(bufout++) = os_toebcdic[
  +	    (unsigned char) (pr2six[os_toascii[bufin[2]]] << 6 | pr2six[_toascii[bufin[3]]])];
   	bufin += 4;
   	nprbytes -= 4;
       }
   
       if (nprbytes & 03) {
  -	if (pr2six[_toascii[bufin[-2]]] > 63)
  +	if (pr2six[os_toascii[bufin[-2]]] > 63)
   	    nbytesdecoded -= 2;
   	else
   	    nbytesdecoded -= 1;
  
  
  
  1.64      +1 -1      apachen/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apachen/src/modules/standard/mod_include.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -u -r1.63 -r1.64
  --- mod_include.c	1998/01/13 23:11:19	1.63
  +++ mod_include.c	1998/01/16 14:23:32	1.64
  @@ -96,7 +96,7 @@
   #define SIZEFMT_BYTES 0
   #define SIZEFMT_KMG 1
   #ifdef CHARSET_EBCDIC
  -#define RAW_ASCII_CHAR(ch)  _toebcdic[(unsigned char)ch]
  +#define RAW_ASCII_CHAR(ch)  os_toebcdic[(unsigned char)ch]
   #else /*CHARSET_EBCDIC*/
   #define RAW_ASCII_CHAR(ch)  (ch)
   #endif /*CHARSET_EBCDIC*/
  
  
  
  1.2       +4 -4      apachen/src/os/bs2000/ebcdic.c
  
  Index: ebcdic.c
  ===================================================================
  RCS file: /home/cvs/apachen/src/os/bs2000/ebcdic.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- ebcdic.c	1998/01/13 23:11:30	1.1
  +++ ebcdic.c	1998/01/16 14:23:33	1.2
  @@ -27,7 +27,7 @@
   e0    d9 f7 53 54 55 56 57 58  59 5a b2 d4 d6 d2 d3 d5  *..STUVWXYZ......*
   f0    30 31 32 33 34 35 36 37  38 39 b3 7b dc 7d da 7e  *0123456789.{.}.~*
   */
  -unsigned char _toascii[256] = {
  +unsigned char os_toascii[256] = {
   /*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
          0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
   /*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
  @@ -79,7 +79,7 @@
   e0    44 45 42 46 43 47 9c 48  54 51 52 53 58 55 56 57  *................*
   f0    8c 49 cd ce cb cf cc e1  70 c0 de db dc 8d 8e df  *................*
   */
  -unsigned char _toebcdic[256] = {
  +unsigned char os_toebcdic[256] = {
   /*00*/  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
   	0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,  /*................*/
   /*10*/  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
  @@ -123,7 +123,7 @@
   {
   	while (count-- != 0) {
   		*dest++ = (*srce == '\015' || *srce=='\012') 
  -			? *srce : _toascii[*srce];
  +			? *srce : os_toascii[*srce];
   		++srce;
   	}
   }
  @@ -131,7 +131,7 @@
   ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count)
   {
   	while (count-- != 0) {
  -		*dest++ = _toebcdic[*srce++];
  +		*dest++ = os_toebcdic[*srce++];
   	}
   }
   #endif /*CHARSET_EBCDIC*/
  
  
  
  1.2       +2 -2      apachen/src/os/bs2000/ebcdic.h
  
  Index: ebcdic.h
  ===================================================================
  RCS file: /home/cvs/apachen/src/os/bs2000/ebcdic.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- ebcdic.h	1998/01/13 23:11:31	1.1
  +++ ebcdic.h	1998/01/16 14:23:33	1.2
  @@ -1,7 +1,7 @@
   #include <sys/types.h>
   
  -extern const char _toascii[256];
  -extern const char _toebcdic[256];
  +extern const char os_toascii[256];
  +extern const char os_toebcdic[256];
   void ebcdic2ascii(unsigned char *dest, const unsigned char *srce, size_t count);
   void ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count);