summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-29 21:08:28 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-03-01 10:43:56 +0000
commit1431c95d19cde8b913d772c9a99c3ebd886e983a (patch)
tree8c36445d0f6faf40cb57cc79e1430dcefe9b1520 /tools
parent05a8216d03b5db559e01dd1808f2805df31c970a (diff)
now restore and use reduced UnlockFile and UnlockRange impls
because its super ugly to have unbalanced lock/unlocks and with the removal of STAR_ENABLE_FILE_LOCKING we can call those methods and now get unchanged behaviour
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/stream.hxx4
-rw-r--r--tools/source/stream/strmunx.cxx29
2 files changed, 29 insertions, 4 deletions
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index 6482fdd4cc7b..c2749ffb866a 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -639,11 +639,9 @@ private:
SvFileStream & operator= (const SvFileStream&);
sal_Bool LockRange( sal_Size nByteOffset, sal_Size nBytes );
- sal_Bool LockFile();
-#ifdef WNT
sal_Bool UnlockRange( sal_Size nByteOffset, sal_Size nBytes );
+ sal_Bool LockFile();
sal_Bool UnlockFile();
-#endif
protected:
virtual sal_Size GetData( void* pData, sal_Size nSize );
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 2df86ce5b4ca..cb55ddc73d6b 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -556,6 +556,22 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes )
/*************************************************************************
|*
+|* SvFileStream::UnlockRange()
+|*
+*************************************************************************/
+
+sal_Bool SvFileStream::UnlockRange( sal_Size nByteOffset, sal_Size nBytes )
+{
+ if ( ! IsOpen() )
+ return sal_False;
+
+ InternalStreamLock::UnlockFile( nByteOffset, nByteOffset+nBytes, this );
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
|* SvFileStream::LockFile()
|*
*************************************************************************/
@@ -567,6 +583,17 @@ sal_Bool SvFileStream::LockFile()
/*************************************************************************
|*
+|* SvFileStream::UnlockFile()
+|*
+*************************************************************************/
+
+sal_Bool SvFileStream::UnlockFile()
+{
+ return UnlockRange( 0UL, 0UL );
+}
+
+/*************************************************************************
+|*
|* SvFileStream::Open()
|*
*************************************************************************/
@@ -688,7 +715,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
void SvFileStream::Close()
{
- InternalStreamLock::UnlockFile( 0, 0, this );
+ UnlockFile();
if ( IsOpen() )
{