Changeset 1870 for trunk/gsdl/lib/gsdlunicode.cpp
- Timestamp:
- 2001-01-29T14:54:58+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/gsdlunicode.cpp
r1310 r1870 263 263 // setmapfile will cause loadmapfile to be called when conversion is 264 264 // needed 265 bool mapconvert::setmapfile (const text_t &thegsdlhome, const text_t &theencoding, 266 unsigned short theabsentc) { 265 bool mapconvert::setmapfile (const text_t &themapfile, unsigned short theabsentc) { 267 266 // check to see if the mapfile has been already loaded 268 if (mapdata.loaded && gsdlhome == thegsdlhome && 269 encoding == theencoding && absentc == theabsentc) 270 return true; 267 if (mapdata.loaded && mapfile == themapfile && absentc == theabsentc) return true; 271 268 272 269 unloadmapfile (); 273 gsdlhome = thegsdlhome; 274 encoding = theencoding; 270 mapfile = themapfile; 275 271 absentc = theabsentc; 276 272 … … 281 277 282 278 // loadmapfile should be called before any conversion is done 283 bool mapconvert::loadmapfile (const text_t &thegsdlhome, 284 const text_t &theencoding, 279 bool mapconvert::loadmapfile (const text_t &themapfile, 285 280 unsigned short theabsentc) { 286 281 FILE *mapfilein = (FILE *)NULL; 287 282 288 283 // check to see if the mapfile has been already loaded 289 if (mapdata.loaded && gsdlhome == thegsdlhome && 290 encoding == theencoding && absentc == theabsentc) 291 return true; 284 if (mapdata.loaded && mapfile == themapfile && absentc == theabsentc) return true; 292 285 293 286 unloadmapfile (); 294 gsdlhome = thegsdlhome; 295 encoding = theencoding; 287 mapfile = themapfile; 296 288 absentc = theabsentc; 297 289 298 290 // open the map file 299 text_t filename = filename_cat (gsdlhome, "unicode"); 300 filename = filename_cat (filename, encoding); 301 filename += ".ump"; 302 char *cfilename = filename.getcstr(); 291 char *cfilename = mapfile.getcstr(); 303 292 if (cfilename == (char *)NULL) return false; 304 293 mapfilein = fopen(cfilename, "rb"); … … 359 348 unsigned short mapconvert::convert (unsigned short c) { 360 349 if (!mapdata.loaded) { 361 if (!gsdlhome.empty() && !encoding.empty() && 362 loadmapfile (gsdlhome, encoding, absentc)) { 350 if (!mapfile.empty() && loadmapfile (mapfile, absentc)) { 363 351 // do nothing, successfully loaded database 364 352 } else return absentc;
Note:
See TracChangeset
for help on using the changeset viewer.