diff -r 715d6147ba3a -r 21a6c17f4e3e src/Ottoman.cpp --- a/src/Ottoman.cpp Thu Sep 24 10:36:08 2009 -0700 +++ b/src/Ottoman.cpp Mon Sep 28 23:39:08 2009 -0700 @@ -42,7 +42,6 @@ Ottoman::Ottoman() :_writeable(true), - _file(NULL), _filename(NULL), _lastVersion(NULL), _current( new OverlayDictionary(&Dictionary::kEmpty) ) @@ -97,9 +96,6 @@ delete _file; _file = curFile; } - - if (changed) - versionsChanged(); return changed; } @@ -200,12 +196,11 @@ if (!lastVersion) lastVersion = new VersionDictionary(dstFile); VersionDictionary *saved = lastVersion->_appendAndOpen(_current->overlay(), - dstFile, - _current->baseReplaced()); + dstFile, + _current->baseReplaced()); // (don't delete _lastVersion: saved->_previousVersion now points to it.) _lastVersion = saved; _current->revertTo(_lastVersion); - versionsChanged(); } bool Ottoman::save() { @@ -221,10 +216,10 @@ } File* Ottoman::_writeTo (const char *dstFileName, bool overwriteAllowed) { - int mode = O_RDWR | O_CREAT | O_TRUNC | O_EXLOCK; + int mode = O_RDWR | O_CREAT | O_TRUNC; if (!overwriteAllowed) mode |= O_EXCL; - File *dstFile = new File(dstFileName, mode); + File *dstFile = new File(dstFileName, mode, true); try { dstFile->write(DictionaryFileHeader()); _append(dstFile); @@ -240,7 +235,6 @@ File *dstFile = _writeTo(dstFileName, overwriteAllowed); free(_filename); _filename = strdup(dstFileName); - delete _file; _file = dstFile; } @@ -248,8 +242,8 @@ if (!_file) return false; char tempFileName[1024]; - strlcpy(tempFileName, _filename, sizeof(tempFileName)-1); - strlcat(tempFileName, "~", sizeof(tempFileName)); + ::strncpy(tempFileName, _filename, sizeof(tempFileName)-1); + ::strncat(tempFileName, "~", sizeof(tempFileName)); File *tempFile; { // Check for conflict in existing file: