[Libreoffice-commits] .: sal/inc sal/util tools/source
Michael Meeks
michael at kemper.freedesktop.org
Thu Jan 19 06:02:22 PST 2012
sal/inc/osl/file.h | 24 ++++++++++++++++++++++++
sal/inc/osl/file.hxx | 26 +++++++++++++++++++++++++-
sal/util/sal.map | 2 +-
tools/source/stream/strmunx.cxx | 2 +-
4 files changed, 51 insertions(+), 3 deletions(-)
New commits:
commit 13a752cdbb9e2c1e2c0f922158f03fc70c12245c
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu Jan 19 14:01:33 2012 +0000
sal: expose a public API for comparing directory items
Windows impl. still pending.
diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
index 0e0d765..3bcd877 100644
--- a/sal/inc/osl/file.h
+++ b/sal/inc/osl/file.h
@@ -316,6 +316,30 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireDirectoryItem(
SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseDirectoryItem(
oslDirectoryItem Item );
+/** Determine if two directory items point the the same underlying file
+
+ The comparison is done first by URL, and then by resolving links to
+ find the target, and finally by comparing inodes on unix.
+
+ @param pItemA [in]
+ A directory handle to compare with another handle
+
+ @param pItemB [in]
+ A directory handle to compare with pItemA
+
+ @return
+ sal_True: if the items point to an identical resource<br>
+ sal_False: if the items point to a different resource, or a fatal error occured<br>
+
+ @see osl_getDirectoryItem()
+
+ @since LibreOffice 3.6
+*/
+
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_identicalDirectoryItem(
+ oslDirectoryItem pItemA,
+ oslDirectoryItem pItemB );
+
/* File types */
typedef enum {
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index d9a1d89..85393f5 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -1389,9 +1389,9 @@ public:
class DirectoryItem: public FileBase
{
+ oslDirectoryItem _pData;
public:
- oslDirectoryItem _pData;
/** Constructor.
*/
@@ -1529,6 +1529,30 @@ public:
return (RC) osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask );
}
+/** Determine if two directory items point the the same underlying file
+
+ The comparison is done first by URL, and then by resolving links to
+ find the target, and finally by comparing inodes on unix.
+
+ @param pItemA [in]
+ A directory handle to compare with another handle
+
+ @param pItemB [in]
+ A directory handle to compare with pItemA
+
+ @return
+ sal_True: if the items point to an identical resource<br>
+ sal_False: if the items point to a different resource, or a fatal error occured<br>
+
+ @see osl_getDirectoryItem()
+
+ @since LibreOffice 3.6
+*/
+ inline sal_Bool isIdenticalTo( const DirectoryItem &pOther )
+ {
+ return osl_identicalDirectoryItem( _pData, pOther._pData );
+ }
+
friend class Directory;
};
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 02610f5..1e9753b 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -613,6 +613,7 @@ LIBO_UDK_3.5 { # symbols available in >= LibO 3.5
LIBO_UDK_3.6 { # symbols available in >= LibO 3.6
global:
osl_unmapMappedFile;
+ osl_identicalDirectoryItem;
} UDK_3.10;
PRIVATE_1.0 {
@@ -647,7 +648,6 @@ PRIVATE_textenc.1 { # LibreOffice 3.6
PRIVATE_file.1 { # LibreOffice 3.6
global:
- osl_identicalDirectoryItem;
osl_getFileOSHandle;
};
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 850eedc..031aaa5 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -146,7 +146,7 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStr
for( size_t i = 0; i < rLockList.size(); ++i )
{
pLock = rLockList[ i ];
- if( osl_identicalDirectoryItem( aItem._pData, pLock->m_aItem._pData) )
+ if( aItem.isIdenticalTo( pLock->m_aItem ) )
{
sal_Bool bDenyByOptions = sal_False;
StreamMode nLockMode = pLock->m_pStream->GetStreamMode();
More information about the Libreoffice-commits
mailing list