Use wrappers for ctype functions to avoid sign extension errors

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • WT2.9.0, 3.3.9
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None

      WT-2677 chased a problem where a 'char' declaration is interpreted as signed on some platforms (like Solaris), but is unsigned on others. The signed interpretation did a sign extension of a char argument to give an invalid input to isprint(), which was undetected on the other platforms. This seems somewhat dangerous. There are only a handful of places where a char (without an explicit signed/unsigned) is used in WT. If we removed these and enforced this policy, errors of this nature would be reduced.

      It seems unlikely we could entirely remove the problem, consider:

      void foo(const char *p)

      Unknown macro: { return (isprint(*p)); }

      Getting rid of char * would be impossible.

              Assignee:
              Donald Anderson
              Reporter:
              Donald Anderson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: