Author: damjan Date: Tue Nov 3 19:09:04 2015 New Revision: 1712377 URL: http://svn.apache.org/viewvc?rev=1712377&view=rev Log: #i61277# Basic open file with random access erases all data. StarBasic tries to emulate truncation of files opened for writing by deleting them before opening them (if they exist). However there are exclusion to the truncation behaviour when the file is opened in append mode or is a binary file. Another exclusion - that was missing with disasterous consequences - is that the file should not be truncated when opened in random access mode.
Modified: openoffice/trunk/main/basic/source/runtime/iosys.cxx Modified: openoffice/trunk/main/basic/source/runtime/iosys.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/basic/source/runtime/iosys.cxx?rev=1712377&r1=1712376&r2=1712377&view=diff ============================================================================== --- openoffice/trunk/main/basic/source/runtime/iosys.cxx (original) +++ openoffice/trunk/main/basic/source/runtime/iosys.cxx Tue Nov 3 19:09:04 2015 @@ -665,7 +665,7 @@ SbError SbiStream::Open { // #??? For write access delete file if it already exists (not for appending) - if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() && + if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() && !IsRandom() && xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) ) { xSFI->kill( aNameStr );