bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Invalid use of 'uchar' in src/tr.c


From: Albert Chin
Subject: Invalid use of 'uchar' in src/tr.c
Date: Wed, 16 Jun 2004 14:03:27 -0500
User-agent: Mutt/1.5.6i

In <sys/types.h> on Tru64 UNIX:
  ...
  /*
   * shorthand type definitions for unsigned storage classes
   */
  typedef uchar_t         uchar;
  typedef ushort_t        ushort;
  typedef uint_t          uint;
  typedef ulong_t         ulong;
  ...

So, use of 'uchar' as a function name is invalid. Patch below against
CVS.

BTW, is the 5.3.0 release a ways off?

-- 
albert chin (address@hidden)

-- snip snip
Index: src/tr.c
===================================================================
RCS file: /cvsroot/coreutils/coreutils/src/tr.c,v
retrieving revision 1.134
diff -u -3 -p -r1.134 tr.c
--- src/tr.c    6 Jun 2004 19:18:49 -0000       1.134
+++ src/tr.c    16 Jun 2004 19:01:19 -0000
@@ -39,7 +39,7 @@ enum { N_CHARS = UCHAR_MAX + 1 };
 /* Convert a possibly-signed character to an unsigned character.  This is
    a bit safer than casting to unsigned char, since it catches some type
    errors that the cast doesn't.  */
-static inline unsigned char uchar (char ch) { return ch; }
+static inline unsigned char unchar (char ch) { return ch; }
 
 /* An unsigned integer type big enough to hold a repeat count or an
    unsigned character.  POSIX requires support for repeat counts as
@@ -864,7 +864,7 @@ star_digits_closebracket (const struct E
     return false;
 
   for (i = idx + 1; i < es->len; i++)
-    if (!ISDIGIT (uchar (es->s[i])) || es->escaped[i])
+    if (!ISDIGIT (unchar (es->s[i])) || es->escaped[i])
       return es_match (es, i, ']');
   return false;
 }
@@ -1533,13 +1533,13 @@ squeeze_filter (char *buf, size_t size, 
             of the input is removed by squeezing repeats.  But most
             uses of this functionality seem to remove less than 20-30%
             of the input.  */
-         for (; i < nr && !in_squeeze_set[uchar (buf[i])]; i += 2)
+         for (; i < nr && !in_squeeze_set[unchar (buf[i])]; i += 2)
            continue;
 
          /* There is a special case when i == nr and we've just
             skipped a character (the last one in buf) that is in
             the squeeze set.  */
-         if (i == nr && in_squeeze_set[uchar (buf[i - 1])])
+         if (i == nr && in_squeeze_set[unchar (buf[i - 1])])
            --i;
 
          if (i >= nr)
@@ -1617,12 +1617,12 @@ read_and_delete (char *buf, size_t size)
          the beginning of a buffer.  It just avoids the copying
          of buf[i] into buf[n_saved] when it would be a NOP.  */
 
-      for (i = 0; i < nr && !in_delete_set[uchar (buf[i])]; i++)
+      for (i = 0; i < nr && !in_delete_set[unchar (buf[i])]; i++)
        continue;
       n_saved = i;
 
       for (++i; i < nr; i++)
-       if (!in_delete_set[uchar (buf[i])])
+       if (!in_delete_set[unchar (buf[i])])
          buf[n_saved++] = buf[i];
     }
   while (n_saved == 0);
@@ -1641,7 +1641,7 @@ read_and_xlate (char *buf, size_t size)
   size_t i;
 
   for (i = 0; i < bytes_read; i++)
-    buf[i] = xlate[uchar (buf[i])];
+    buf[i] = xlate[unchar (buf[i])];
 
   return bytes_read;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]