libtool-patches
[Top][All Lists]
Advanced

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

Re: Correct arguments to isspace/isalnum


From: Bob Friesenhahn
Subject: Re: Correct arguments to isspace/isalnum
Date: Mon, 27 Sep 2004 13:32:31 -0500 (CDT)

On Mon, 27 Sep 2004, Ralf Wildenhues wrote:

Most systems accept this error, because it's so widespread.
No excuse stating that sign conversion is difficult in C ;)

It seems that the correct answer to this depends on which standard you are conforming to and whether you are using C or C++. In C '89 these functions accept an 'int'. Naturally C++ has made things more correct.

All compilers I have run libltdl through except for GCC produce oodles of warning messages during compilation. Is that how this issue was discovered? If so, what compiler was used?

Bob

2004-09-27  Ralf Wildenhues <address@hidden>

        * libltdl/ltdl.c (load_deplibs, try_dlopen): Cast argument
        to isspace/isalnum correctly.


Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.213
diff -u -r1.213 ltdl.c
--- libltdl/ltdl.c      2 Sep 2004 13:27:24 -0000       1.213
+++ libltdl/ltdl.c      27 Sep 2004 18:13:20 -0000
@@ -736,10 +736,10 @@
  p = deplibs;
  while (*p)
    {
-      if (!isspace ((int) *p))
+      if (!isspace ((unsigned char) *p))
        {
          char *end = p+1;
-         while (*end && !isspace((int) *end))
+         while (*end && !isspace((unsigned char) *end))
            {
              ++end;
            }
@@ -785,14 +790,14 @@
  p = deplibs;
  while (*p)
    {
-      if (isspace ((int) *p))
+      if (isspace ((unsigned char) *p))
        {
          ++p;
        }
      else
        {
          char *end = p+1;
-         while (*end && !isspace ((int) *end))
+         while (*end && !isspace ((unsigned char) *end))
            {
              ++end;
            }
@@ -999,7 +999,7 @@
    int i;
    for (i = 0; i < ext - base_name; ++i)
      {
-       if (isalnum ((int)(base_name[i])))
+       if (isalnum ((unsigned char)(base_name[i])))
          {
            name[i] = base_name[i];
          }


_______________________________________________
Libtool-patches mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/libtool-patches


======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen




reply via email to

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