Kaydet (Commit) 42a63dd0 authored tarafından Damjan Jovanovic's avatar Damjan Jovanovic Kaydeden (comit) Caolán McNamara

Resolves: #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.

(cherry picked from commit 72b2f07c)

Change-Id: Ic0053039ce5fd67ad42bf5332ae301d83f1a158d
üst d4d4e00a
......@@ -582,7 +582,7 @@ SbError SbiStream::Open
{
// #??? For write access delete file if it already exists (not for appending)
if( (nStrmMode & StreamMode::WRITE) && !IsAppend() && !IsBinary() &&
if( (nStrmMode & StreamMode::WRITE) && !IsAppend() && !IsBinary() && !IsRandom() &&
xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) )
{
xSFI->kill( aNameStr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment