Mercurial > hg > audiodb
diff 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 |
line wrap: on
line diff
--- a/lshlib.cpp Thu Aug 07 01:53:38 2008 +0000 +++ b/lshlib.cpp Thu Aug 07 17:05:22 2008 +0000 @@ -418,13 +418,14 @@ // Optionally load the LSH tables into head-allocated lists in core G::G(char* filename, bool lshInCoreFlag): H(), // default base-class constructor call delays data-structure initialization - indexName(filename), + indexName(0), lshHeader(0), calling_instance(0), add_point_callback(0) { int dbfid = unserialize_lsh_header(filename); - + indexName = new char[O2_INDEX_MAXSTR]; + strncpy(indexName, filename, O2_INDEX_MAXSTR); // COPY THE CONTENTS TO THE NEW POINTER H::initialize_lsh_functions(); // Base-class data-structure initialization unserialize_lsh_functions(dbfid); // populate with on-disk hashfunction values