BIND 10 trac838, updated. e4543dee376bae0e459f9008a2061f2a2529dcee [trac838] Add more comments to skipSpaces() function and fix style problems.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jun 7 06:44:32 UTC 2011


The branch, trac838 has been updated
       via  e4543dee376bae0e459f9008a2061f2a2529dcee (commit)
      from  c4412dfaa0bb8c6e95cb4476e80b648cfa9288f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e4543dee376bae0e459f9008a2061f2a2529dcee
Author: Ocean Wang <wanghaidong at cnnic.cn>
Date:   Tue Jun 7 14:36:53 2011 +0800

    [trac838] Add more comments to skipSpaces() function and fix style problems.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/util/encode/base_n.cc |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/util/encode/base_n.cc b/src/lib/util/encode/base_n.cc
index 8da3ea5..55d8447 100644
--- a/src/lib/util/encode/base_n.cc
+++ b/src/lib/util/encode/base_n.cc
@@ -174,11 +174,15 @@ public:
         return (*this);
     }
     void skipSpaces() {
-        // If *base_ < 0, on Windows platform with Visual Studio compiler
-        // it may trigger _ASSERTE((unsigned)(c + 1) <= 256);
-        // so make sure that the parameter of isspace() is larger than 0
-        while (base_ != base_end_ && ((*base_) >= 0) && isspace(*base_))
-        {
+        // If (char is signed and) *base_ < 0, on Windows platform with Visual
+        // Studio compiler it may trigger _ASSERTE((unsigned)(c + 1) <= 256);
+        // so make sure that the parameter of isspace() is larger than 0.
+        // We don't simply cast it to unsigned char to avoid confusing the
+        // isspace() implementation with a possible extension for values
+        // larger than 127.  Also note the check is not ">= 0"; for systems
+        // where char is unsigned that would always be true and would possibly
+        // trigger a compiler warning that could stop the build.
+        while (base_ != base_end_ && *base_ > 0 && isspace(*base_)) {
             ++base_;
         }
     }




More information about the bind10-changes mailing list