Changeset 18051

Show
Ignore:
Timestamp:
04.12.2008 10:54:51 (11 years ago)
Author:
mdewsnip
Message:

Now looks for the opposite endianness file if the desired one doesn't exist, since we can now read both. By Michael Dewsnip from DL Consulting Ltd ( http://www.dlconsulting.com).

Location:
gsdl/trunk/common-src/src/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/common-src/src/lib/gdbmclass.cpp

    r18050 r18051  
    6969  } 
    7070 
     71  text_t gdbm_filename = filename; 
    7172  if (gdbm_mode == GDBM_READER) 
    7273  { 
    73     if (!file_exists(filename)) 
     74    // If the specified GDBM file doesn't exist, try the other extension (we can now read both) 
     75    if (!file_exists(gdbm_filename)) 
    7476    { 
    75       generate_from_txtgz(filename); 
     77      if (ends_with(gdbm_filename, ".ldb")) 
     78      { 
     79    gdbm_filename = substr(gdbm_filename.begin(), gdbm_filename.end() - ((text_t) ".ldb").size()) + ".bdb"; 
     80      } 
     81      else if (ends_with(gdbm_filename, ".bdb")) 
     82      { 
     83    gdbm_filename = substr(gdbm_filename.begin(), gdbm_filename.end() - ((text_t) ".bdb").size()) + ".ldb"; 
     84      } 
    7685    } 
    77   } 
    78  
    79   char *namebuffer = filename.getcstr(); 
     86 
     87    // DEPRECATED -- No longer necessary now that the GDBM library reads both little-endian and big-endian files 
     88    if (!file_exists(gdbm_filename)) 
     89    { 
     90      // We're desperate, so try generating the desired GDBM file from a txtgz file 
     91      gdbm_filename = filename; 
     92      generate_from_txtgz(gdbm_filename); 
     93    } 
     94  } 
     95 
     96  char *namebuffer = gdbm_filename.getcstr(); 
    8097  do { 
    8198#ifdef __WIN32__ 
     
    91108  if (gdbmfile == NULL && logout != NULL) { 
    92109    outconvertclass text_t2ascii; 
    93     (*logout) << text_t2ascii << "database open failed on: " << filename << "\n"; 
     110    (*logout) << text_t2ascii << "database open failed on: " << gdbm_filename << "\n"; 
    94111  } 
    95112 
     
    263280 
    264281 
    265 // DEPRECATED -- No longer necessary now that the GDBM library reads both little-endian and big-endian 
     282// DEPRECATED -- No longer necessary now that the GDBM library reads both little-endian and big-endian files 
    266283void gdbmclass::generate_from_txtgz (text_t filename) 
    267284{ 
  • gsdl/trunk/common-src/src/lib/gdbmclass.h

    r18050 r18051  
    8585  text_t getnextkey (const text_t &key); 
    8686 
    87   // DEPRECATED -- No longer necessary now that the GDBM library reads both little-endian and big-endian 
     87  // DEPRECATED -- No longer necessary now that the GDBM library reads both little-endian and big-endian files 
    8888  void generate_from_txtgz (text_t filename); 
    8989};