Kaydet (Commit) 13a752cd authored tarafından Michael Meeks's avatar Michael Meeks

sal: expose a public API for comparing directory items

Windows impl. still pending.
üst 9f03ad24
...@@ -316,6 +316,30 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireDirectoryItem( ...@@ -316,6 +316,30 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_acquireDirectoryItem(
SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseDirectoryItem( SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseDirectoryItem(
oslDirectoryItem Item ); 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 */ /* File types */
typedef enum { typedef enum {
......
...@@ -1389,9 +1389,9 @@ public: ...@@ -1389,9 +1389,9 @@ public:
class DirectoryItem: public FileBase class DirectoryItem: public FileBase
{ {
oslDirectoryItem _pData;
public: public:
oslDirectoryItem _pData;
/** Constructor. /** Constructor.
*/ */
...@@ -1529,6 +1529,30 @@ public: ...@@ -1529,6 +1529,30 @@ public:
return (RC) osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask ); 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; friend class Directory;
}; };
......
...@@ -613,6 +613,7 @@ LIBO_UDK_3.5 { # symbols available in >= LibO 3.5 ...@@ -613,6 +613,7 @@ LIBO_UDK_3.5 { # symbols available in >= LibO 3.5
LIBO_UDK_3.6 { # symbols available in >= LibO 3.6 LIBO_UDK_3.6 { # symbols available in >= LibO 3.6
global: global:
osl_unmapMappedFile; osl_unmapMappedFile;
osl_identicalDirectoryItem;
} UDK_3.10; } UDK_3.10;
PRIVATE_1.0 { PRIVATE_1.0 {
...@@ -647,7 +648,6 @@ PRIVATE_textenc.1 { # LibreOffice 3.6 ...@@ -647,7 +648,6 @@ PRIVATE_textenc.1 { # LibreOffice 3.6
PRIVATE_file.1 { # LibreOffice 3.6 PRIVATE_file.1 { # LibreOffice 3.6
global: global:
osl_identicalDirectoryItem;
osl_getFileOSHandle; osl_getFileOSHandle;
}; };
......
...@@ -146,7 +146,7 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStr ...@@ -146,7 +146,7 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStr
for( size_t i = 0; i < rLockList.size(); ++i ) for( size_t i = 0; i < rLockList.size(); ++i )
{ {
pLock = rLockList[ i ]; pLock = rLockList[ i ];
if( osl_identicalDirectoryItem( aItem._pData, pLock->m_aItem._pData) ) if( aItem.isIdenticalTo( pLock->m_aItem ) )
{ {
sal_Bool bDenyByOptions = sal_False; sal_Bool bDenyByOptions = sal_False;
StreamMode nLockMode = pLock->m_pStream->GetStreamMode(); StreamMode nLockMode = pLock->m_pStream->GetStreamMode();
......
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