summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorHans-Joachim Lankenau <hjs@openoffice.org>2010-12-17 17:08:13 +0100
committerHans-Joachim Lankenau <hjs@openoffice.org>2010-12-17 17:08:13 +0100
commita366a075c8d2ade6c0b4efdd1203f22d30a8bb7b (patch)
tree674cd03a32fb3414a87bc2066362dd8c56e6f94f /ucb
parent4a2bf7287695e8b501657ed2ed082c47cc9c9df0 (diff)
parentb927224032e0ca68961cb6730c02de04f56633a5 (diff)
CWS-TOOLING: integrate CWS fwk160
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/file/shell.cxx38
1 files changed, 19 insertions, 19 deletions
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index f324c93b878f..d045380ae7a1 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -1805,14 +1805,26 @@ shell::write( sal_Int32 CommandId,
{
aFile.close();
err = aFile.open( OpenFlag_Write );
- }
- if( err != osl::FileBase::E_None )
- {
- installError( CommandId,
- TASKHANDLING_NO_OPEN_FILE_FOR_OVERWRITE,
- err );
- return sal_False;
+ if( err != osl::FileBase::E_None )
+ {
+ installError( CommandId,
+ TASKHANDLING_NO_OPEN_FILE_FOR_OVERWRITE,
+ err );
+ return sal_False;
+ }
+
+ // the existing file was just opened and should be overwritten now,
+ // truncate it first
+
+ err = aFile.setSize( 0 );
+ if( err != osl::FileBase::E_None )
+ {
+ installError( CommandId,
+ TASKHANDLING_FILESIZE_FOR_WRITE,
+ err );
+ return sal_False;
+ }
}
}
else
@@ -1844,7 +1856,6 @@ shell::write( sal_Int32 CommandId,
sal_Bool bSuccess = sal_True;
- sal_uInt64 nTotalNumberOfBytes = 0;
sal_uInt64 nWrittenBytes;
sal_Int32 nReadBytes = 0, nRequestedBytes = 32768 /*32k*/;
uno::Sequence< sal_Int8 > seq( nRequestedBytes );
@@ -1901,20 +1912,9 @@ shell::write( sal_Int32 CommandId,
bSuccess = sal_False;
break;
}
-
- nTotalNumberOfBytes += nWrittenBytes;
}
} while( nReadBytes == nRequestedBytes );
- err = aFile.setSize( nTotalNumberOfBytes );
- if( err != osl::FileBase::E_None )
- {
- installError( CommandId,
- TASKHANDLING_FILESIZE_FOR_WRITE,
- err );
- bSuccess = sal_False;
- }
-
err = aFile.close();
if( err != osl::FileBase::E_None )
{