BIND 10 #1774: use uint8_t for "characters" of Name data

BIND 10 Development do-not-reply at isc.org
Thu Jun 21 22:56:14 UTC 2012


#1774: use uint8_t for "characters" of Name data
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:  UnAssigned
  jinmei                             |                Status:  reviewing
                       Type:         |             Milestone:
  defect                             |  Sprint-20120703
                   Priority:         |            Resolution:
  medium                             |             Sensitive:  0
                  Component:         |           Sub-Project:  DNS
  libdns++                           |  Estimated Difficulty:  3
                   Keywords:         |           Total Hours:  0
            Defect Severity:  N/A    |
Feature Depending on Ticket:         |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
Changes (by muks):

 * owner:  muks => UnAssigned
 * status:  assigned => reviewing


Comment:

 Up for review.

 There was one case of `strcmp()` in libdns++, and one of individual
 character compares in the tests. Both were for equality (`strcmp() == 0`
 or `ch1 == ch2`), but if it were for greater or lesser, note that
 `strcmp()` takes `(const char *)` pointers in its args. But it still seems
 to do an unsigned compare internally:

 {{{
 [muks at jurassic ~]$ cat strcmp.c
 #include <stdio.h>
 #include <string.h>

 int
 main (int argc, char *argv[])
 {
   unsigned char *p;
   char a[] = "C";
   char b[] = "D";

   printf ("%d\n", strcmp (a, b));

   p = (unsigned char *) b;
   *p = 0xff;

   printf ("%d\n", strcmp (a, b));

   return 0;
 }
 [muks at jurassic ~]$ gcc -Wall -Wwrite-strings -O2 -o strcmp strcmp.c
 [muks at jurassic ~]$ ./strcmp
 -1
 -188
 [muks at jurassic ~]$
 }}}

-- 
Ticket URL: <http://bind10.isc.org/ticket/1774#comment:8>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list