Mercurial > hg > audiodb
comparison lshlib.cpp @ 309:81ad865402e7
Fixed persistent index bug where indexName identifier was an un protected string pointer rather than a copy of the string. Hence the index name was getting deleted and the test for persistent index was failing.
author | mas01mc |
---|---|
date | Thu, 07 Aug 2008 17:05:22 +0000 |
parents | 896679d8cc39 |
children | 25572f1bd37f |
comparison
equal
deleted
inserted
replaced
308:896679d8cc39 | 309:81ad865402e7 |
---|---|
416 // Read parameters from database file | 416 // Read parameters from database file |
417 // Load the hash functions, close the database | 417 // Load the hash functions, close the database |
418 // Optionally load the LSH tables into head-allocated lists in core | 418 // Optionally load the LSH tables into head-allocated lists in core |
419 G::G(char* filename, bool lshInCoreFlag): | 419 G::G(char* filename, bool lshInCoreFlag): |
420 H(), // default base-class constructor call delays data-structure initialization | 420 H(), // default base-class constructor call delays data-structure initialization |
421 indexName(filename), | 421 indexName(0), |
422 lshHeader(0), | 422 lshHeader(0), |
423 calling_instance(0), | 423 calling_instance(0), |
424 add_point_callback(0) | 424 add_point_callback(0) |
425 { | 425 { |
426 int dbfid = unserialize_lsh_header(filename); | 426 int dbfid = unserialize_lsh_header(filename); |
427 | 427 indexName = new char[O2_INDEX_MAXSTR]; |
428 strncpy(indexName, filename, O2_INDEX_MAXSTR); // COPY THE CONTENTS TO THE NEW POINTER | |
428 H::initialize_lsh_functions(); // Base-class data-structure initialization | 429 H::initialize_lsh_functions(); // Base-class data-structure initialization |
429 unserialize_lsh_functions(dbfid); // populate with on-disk hashfunction values | 430 unserialize_lsh_functions(dbfid); // populate with on-disk hashfunction values |
430 | 431 |
431 // Format1 only needs unserializing if specifically requested | 432 // Format1 only needs unserializing if specifically requested |
432 if(!(lshHeader->flags&O2_SERIAL_FILEFORMAT2) && lshInCoreFlag){ | 433 if(!(lshHeader->flags&O2_SERIAL_FILEFORMAT2) && lshInCoreFlag){ |