ctype routines require a cast to (unsigned int)

This commit is contained in:
cxgeorge 2002-09-13 00:33:44 +00:00
parent 11fd685f2c
commit 4b0746edc8

View File

@ -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--;
} }