DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2823 Version: 1.3-current Class Fl_Preferences uses to overwrite preferences file even when data is not changed. Simple reading preferences can result in writing to file. I have traced problem to 2 functions: // add more data to an existing entry void Fl_Preferences::Node::add( const char *line ) { if ( lastEntrySet<0 || lastEntrySet>=nEntry_ ) return; char *&dst = entry_[ lastEntrySet ].value; size_t a = strlen( dst ); size_t b = strlen( line ); dst = (char*)realloc( dst, a+b+1 ); memcpy( dst+a, line, b+1 ); dirty_ = 1; // <= error } Function add() is used only when reading data from a file, there is no reason to mark node as dirty. // add a child to this node and set its path (try to find it first...) Fl_Preferences::Node *Fl_Preferences::Node::addChild( const char *path ) { sprintf( nameBuffer, "%s/%s", path_, path ); char *name = strdup( nameBuffer ); Node *nd = find( name ); free( name ); dirty_ = 1; // <= too early updateIndex(); return nd; } Function addChild() can be used when reading entry from a group. Even if it creates new empty node, there is no need to mark parent node as dirty until there is something written to new node. Link: http://www.fltk.org/str.php?L2823 Version: 1.3-current _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
