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

ctype routines require a cast to (unsigned int)

cxgeorge 23 лет назад
Родитель
Сommit
4b0746edc8
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      panda/src/putil/string_utils.cxx

+ 5 - 5
panda/src/putil/string_utils.cxx

@@ -110,18 +110,18 @@ extract_words(const string &str, vector_string &words) {
   int num_words = 0;
   int num_words = 0;
 
 
   size_t pos = 0;
   size_t pos = 0;
-  while (pos < str.length() && isspace(str[pos])) {
+  while (pos < str.length() && isspace((unsigned int)str[pos])) {
     pos++;
     pos++;
   }
   }
   while (pos < str.length()) {
   while (pos < str.length()) {
     size_t word_start = pos;
     size_t word_start = pos;
-    while (pos < str.length() && !isspace(str[pos])) {
+    while (pos < str.length() && !isspace((unsigned int)str[pos])) {
       pos++;
       pos++;
     }
     }
     words.push_back(str.substr(word_start, pos - word_start));
     words.push_back(str.substr(word_start, pos - word_start));
     num_words++;
     num_words++;
 
 
-    while (pos < str.length() && isspace(str[pos])) {
+    while (pos < str.length() && isspace((unsigned int)str[pos])) {
       pos++;
       pos++;
     }
     }
   }
   }
@@ -164,7 +164,7 @@ tokenize(const string &str, vector_string &words, const string &delimiters) {
 string
 string
 trim_left(const string &str) {
 trim_left(const string &str) {
   size_t begin = 0;
   size_t begin = 0;
-  while (begin < str.size() && isspace(str[begin])) {
+  while (begin < str.size() && isspace((unsigned int)str[begin])) {
     begin++;
     begin++;
   }
   }
 
 
@@ -180,7 +180,7 @@ string
 trim_right(const string &str) {
 trim_right(const string &str) {
   size_t begin = 0;
   size_t begin = 0;
   size_t end = str.size();
   size_t end = str.size();
-  while (end > begin && isspace(str[end - 1])) {
+  while (end > begin && isspace((unsigned int)str[end - 1])) {
     end--;
     end--;
   }
   }