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

BIND 10 Development do-not-reply at isc.org
Tue Mar 13 07:08:49 UTC 2012


#1774: use uint8_t for "characters" of Name data
-------------------------------------+-------------------------------------
            Reporter:  jinmei        |                        Owner:
                Type:  defect        |  UnAssigned
            Priority:  medium        |                       Status:  new
           Component:  libdns++      |                    Milestone:  Next-
           Sensitive:  0             |  Sprint-Proposed
         Sub-Project:  DNS           |                     Keywords:
Estimated Difficulty:  0             |              Defect Severity:  N/A
         Total Hours:  0             |  Feature Depending on Ticket:
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
 The libdns++ `Name` class uses std::string as the internal
 representation of name data

 {{{#!c++
 private:
     std::string ndata_;
 }}}

 In retrospect this was probably a suboptimal choice because
 std::string is an alias of basic_string<char>, and char may be signed
 (and may be larger than an 8-bit integer).  Since domain name labels
 can contain any 8-bit character, other parts of the code uses unsigned
 char, uint8_t, etc, and we often need to convert them using a cast.
 It's probably cleaner and possibly even safer if we use an unsigned
 integer in the first place, and ideally an 8-bit unsigned integer.

 From a quick experiment, we won't have to change much of the existing
 code even if we change the type of 'ndata_' to basic_string<uint8_t>,
 so I propose we do this as a clean up task.

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


More information about the bind10-tickets mailing list