Changeset 7731
- Timestamp:
- 2004-07-08T15:59:21+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/cfgread.cpp
r7705 r7731 112 112 113 113 text_t curvalue; 114 unsignedchar c1;114 char c1; 115 115 filein.get(c1); 116 116 … … 136 136 137 137 bool inquote=false; 138 unsignedchar quotemark='"';139 unsignedchar preceding; // 1-char state to allow \" and \'138 char quotemark='"'; 139 char preceding; // 1-char state to allow \" and \' 140 140 // see if this is a quoted phrase 141 141 if (c1=='\'' || c1=='\"') { // starts with a quote … … 169 169 // see if current byte is part of a multibyte char (utf-8 only!) 170 170 unsigned short int c; // text_t uses 16bit unicode 171 if (c1 < 0x80) { 172 c=c1; 173 } else if (c1 >= 0xc0 && c1 <= 0xdf) { 171 unsigned char uc1=(unsigned)c1; 172 if (uc1 < 0x80) { 173 c=uc1; 174 } else if (uc1 >= 0xc0 && uc1 <= 0xdf) { 174 175 // 2-byte utf-8 175 176 unsigned char c2; 176 177 // two byte character 177 if (!filein.eof()) filein.get( c2);178 c = (( c1 & 0x1f) << 6) + (c2 & 0x3f);179 } else if ( c1 >= 0xe0 &&c1 <= 0xef) {178 if (!filein.eof()) filein.get((char)c2); // get takes a signed char 179 c = ((uc1 & 0x1f) << 6) + (c2 & 0x3f); 180 } else if (uc1 >= 0xe0 && uc1 <= 0xef) { 180 181 // 3-byte character 181 182 unsigned char c2, c3; 182 if (!filein.eof()) filein.get(c2); 183 if (!filein.eof()) filein.get(c3); 184 c = ((c1 & 0xf) << 12) + ((c2 & 0x3f) << 6) + (c3 & 0x3f); 183 if (!filein.eof()) filein.get((char)c2); 184 if (!filein.eof()) filein.get((char)c3); 185 c = ((uc1 & 0xf) << 12) + ((c2 & 0x3f) << 6) 186 + (c3 & 0x3f); 185 187 } // we don't do group2/plane0 (4,5,6-byte utf-8) 186 188
Note:
See TracChangeset
for help on using the changeset viewer.