Просмотр исходного кода

Merge pull request #221 from Dmitry-Me/reuseIsWhiteSpace

Reuse IsWhiteSpace(), move comment.
Lee Thomason 11 лет назад
Родитель
Сommit
97cfa03865
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      tinyxml2.h

+ 4 - 3
tinyxml2.h

@@ -525,10 +525,8 @@ enum XMLError {
 class XMLUtil
 class XMLUtil
 {
 {
 public:
 public:
-    // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't
-    // correct, but simple, and usually works.
     static const char* SkipWhiteSpace( const char* p )	{
     static const char* SkipWhiteSpace( const char* p )	{
-        while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast<const unsigned char*>(p) ) ) {
+        while( IsWhiteSpace(*p) ) {
             ++p;
             ++p;
         }
         }
         return p;
         return p;
@@ -536,6 +534,9 @@ public:
     static char* SkipWhiteSpace( char* p )				{
     static char* SkipWhiteSpace( char* p )				{
         return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p) ) );
         return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p) ) );
     }
     }
+
+    // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't
+    // correct, but simple, and usually works.
     static bool IsWhiteSpace( char p )					{
     static bool IsWhiteSpace( char p )					{
         return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
         return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );
     }
     }