Changeset 9515


Ignore:
Timestamp:
2005-03-30T15:50:09+12:00 (19 years ago)
Author:
mdewsnip
Message:

Fixed a fairly obscure bug where isspace was returning true on characters that weren't actually spaces, thus messing up some Unicode values when reading from main.cfg/collect.cfg files on Windows only. Seems that it was an issue with signed/unsigned chars, because casting the isspace argument to a unsigned char fixed the problem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/cfgread.cpp

    r8727 r9515  
    2525
    2626#include "cfgread.h"
    27 #include <ctype.h> // for isspace()
     27#include <cctype> // for isspace()
    2828
    2929int write_ini_line (ofstream &fileout, const text_t &key, const text_t &value) {
     
    116116
    117117  // skip white space
    118   while (!filein.eof() && isspace(c1)) { filein.get(c1); }
     118  while (!filein.eof() && isspace((unsigned char) c1)) { filein.get(c1); }
    119119
    120120    // ignore comments
     
    122122    while (!filein.eof() && c1!='\n' && c1!='\r') { filein.get(c1); }
    123123    // skip white space...
    124     while (!filein.eof() && isspace(c1)) { filein.get(c1); }
     124    while (!filein.eof() && isspace((unsigned char) c1)) { filein.get(c1); }
    125125  }
    126126
     
    148148    // get token or a whole phrase
    149149    while (!filein.eof()) {
    150       if (isspace(c1)) {
     150      if (isspace((unsigned char) c1)) {
    151151    if (! inquote) {
    152152      // end of token, not inside quote marks
Note: See TracChangeset for help on using the changeset viewer.