# HG changeset patch # User mas01mc # Date 1218128722 0 # Node ID 81ad865402e76c9b4e430b2f101f39358fb20a5b # Parent 896679d8cc396976dffe7636bcadb828ae830752 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. diff -r 896679d8cc39 -r 81ad865402e7 lshlib.cpp --- 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 diff -r 896679d8cc39 -r 81ad865402e7 lshlib.h --- a/lshlib.h Thu Aug 07 01:53:38 2008 +0000 +++ b/lshlib.h Thu Aug 07 17:05:22 2008 +0000 @@ -74,6 +74,8 @@ #define O2_SERIAL_TOKEN_T2 (0xFFFFFFFDU) #define O2_SERIAL_TOKEN_ENDTABLE (0xFFFFFFFEU) +#define O2_INDEX_MAXSTR (512) + unsigned align_up(unsigned x, unsigned w); #define O2_SERIAL_FUNCTIONS_SIZE (align_up(sizeof(float) * O2_SERIAL_MAX_TABLES * O2_SERIAL_MAX_FUNS * O2_SERIAL_MAX_DIM \