浏览代码

Ensure enum is printed properly

Dmitry-Me 11 年之前
父节点
当前提交
400f1199ea
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      tinyxml2.cpp

+ 2 - 1
tinyxml2.cpp

@@ -1956,8 +1956,9 @@ void XMLDocument::PrintError() const
             TIXML_SNPRINTF( buf2, LEN, "%s", _errorStr2 );
         }
 
+        TIXMLASSERT( INT_MIN <= _errorID && _errorID <= INT_MAX );
         printf( "XMLDocument error id=%d '%s' str1=%s str2=%s\n",
-                _errorID, ErrorName(), buf1, buf2 );
+                static_cast<int>( _errorID ), ErrorName(), buf1, buf2 );
     }
 }