Changeset 1927 for trunk/gsdl/lib
- Timestamp:
- 2001-02-08T13:17:33+13:00 (23 years ago)
- Location:
- trunk/gsdl/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/gsdlunicode.cpp
r1870 r1927 384 384 385 385 mapinconvertclass::mapinconvertclass () { 386 multibyte = 0; 386 387 mapbuflen = 0; 387 388 } … … 425 426 // got a complete character 426 427 if (charlen == 1) { 427 // ascii character 428 output.push_back (mapbuf[0]); 428 if (mapbuf[0] < 0x80) { 429 // ascii character 430 output.push_back (mapbuf[0]); 431 } else { 432 output.push_back (converter.convert((unsigned short)mapbuf[0])); 433 } 429 434 430 435 } else { … … 448 453 449 454 mapoutconvertclass::mapoutconvertclass () { 455 multibyte = 0; 450 456 mapbuflen=0; 451 457 mapbufhere=0; … … 500 506 } else { 501 507 outc = converter.convert (*texthere); 502 mapbuf[0] = (unsigned char)(outc >> 8); 503 mapbuf[1] = (unsigned char)(outc & 0xff); 504 mapbuflen = 2; 508 if (multibyte) { 509 mapbuf[0] = (unsigned char)(outc >> 8); 510 mapbuf[1] = (unsigned char)(outc & 0xff); 511 mapbuflen = 2; 512 } else { 513 mapbuf[0] = outc; 514 mapbuflen = 1; 515 } 505 516 } 506 517 } -
trunk/gsdl/lib/gsdlunicode.h
r1870 r1927 153 153 }; 154 154 155 void set_multibyte (int new_multibyte) {multibyte = new_multibyte;}; 156 155 157 void reset (); 156 158 void convert (text_t &output, status_t &status); … … 160 162 unsigned char mapbuf[MAXMAPCHARLEN]; 161 163 size_t mapbuflen; 164 int multibyte; 162 165 163 166 // note: multiple instances of mapinconvert class are expensive … … 172 175 if (mapbuflen == 0) return 0; 173 176 if (mapbuf[0] < 0x80) return 1; 177 if (!multibyte) return 1; 174 178 return 2; 175 179 } … … 194 198 }; 195 199 200 void set_multibyte (int new_multibyte) {multibyte = new_multibyte;}; 201 196 202 void reset (); 197 203 void convert (char *output, size_t maxlen, … … 202 208 size_t mapbuflen; 203 209 size_t mapbufhere; 210 int multibyte; 204 211 205 212 mapconvert converter;
Note:
See TracChangeset
for help on using the changeset viewer.