From 4a56954e39111be53cac8dd82717f2d7a6a5b75e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 25 May 2011 08:53:31 +0100 Subject: add salhelper::LinkResolver --- svl/source/misc/lockfilecommon.cxx | 39 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'svl/source') diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index b39998dc57f4..c725a8a2d74a 100644 --- a/svl/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -56,6 +56,8 @@ #include +#include + #include using namespace ::com::sun::star; @@ -89,36 +91,19 @@ INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) if ( aDocURL.HasError() ) throw lang::IllegalArgumentException(); - ::rtl::OUString aURLToCheck = aDocURL.GetMainURL( INetURLObject::NO_DECODE ); - - sal_Bool bNeedsChecking = sal_True; - sal_Int32 nMaxLinkCount = 128; - sal_Int32 nCount = 0; + ::rtl::OUString aURLToCheck = aDocURL.GetMainURL(INetURLObject::NO_DECODE); - while( bNeedsChecking ) + // there is currently no UCB functionality to resolve the symbolic links; + // since the lock files are used only for local file systems the osl + // functionality is used directly + salhelper::LinkResolver aResolver(osl_FileStatus_Mask_FileName); + osl::FileBase::RC eStatus = aResolver.fetchFileStatus(aURLToCheck); + if (eStatus == osl::FileBase::E_None) + aURLToCheck = aResolver.m_aStatus.getFileURL(); + else if (eStatus == osl::FileBase::E_MULTIHOP) { - bNeedsChecking = sal_False; - // do not allow too deep links - if ( nCount++ >= nMaxLinkCount ) - throw io::IOException(); - - // there is currently no UCB functionality to resolve the symbolic links; - // since the lock files are used only for local file systems the osl functionality is used directly - - ::osl::FileStatus aStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_LinkTargetURL ); - ::osl::DirectoryItem aItem; - if ( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aURLToCheck, aItem ) - && aItem.is() && ::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) ) - { - if ( aStatus.isValid( osl_FileStatus_Mask_Type ) - && aStatus.isValid( osl_FileStatus_Mask_LinkTargetURL ) - && aStatus.getFileType() == ::osl::FileStatus::Link ) - { - aURLToCheck = aStatus.getLinkTargetURL(); - bNeedsChecking = sal_True; - } - } + throw io::IOException(); } return INetURLObject( aURLToCheck ); -- cgit From 5813da304964f69db2b97725fb15d817d552a9d7 Mon Sep 17 00:00:00 2001 From: Nigel Hawkins Date: Fri, 27 May 2011 17:30:47 +0100 Subject: Remove last traces of SvULongsSort. LGPLv3+/MPL. --- svl/source/memtools/svarray.cxx | 3 --- 1 file changed, 3 deletions(-) (limited to 'svl/source') diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index 2a0bf03a733e..5c553648124b 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -32,7 +32,6 @@ #define _SVARRAY_CXX #define _SVSTDARR_ULONGS -#define _SVSTDARR_ULONGSSORT #define _SVSTDARR_sal_uInt16S #define _SVSTDARR_STRINGS #define _SVSTDARR_STRINGSDTOR @@ -67,8 +66,6 @@ sal_uInt16 SvPtrarr::GetPos( const VoidPtr& aElement ) const SV_IMPL_VARARR( SvULongs, sal_uLong ) SV_IMPL_VARARR( SvUShorts, sal_uInt16 ) -SV_IMPL_VARARR_SORT( SvULongsSort, sal_uLong ) - SV_IMPL_PTRARR( SvStrings, StringPtr ) SV_IMPL_PTRARR( SvStringsDtor, StringPtr ) SV_IMPL_OP_PTRARR_SORT( SvStringsSort, StringPtr ) -- cgit From 61e112b8ac1d1fe822c7a2ae4fa75bab4c34e0a7 Mon Sep 17 00:00:00 2001 From: Nigel Hawkins Date: Fri, 27 May 2011 18:14:06 +0100 Subject: Remove last trace of SvXub_StrLensSort. LGPLv3+/MPL. --- svl/source/memtools/svarray.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'svl/source') diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index 5c553648124b..7d5984c6f6df 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -49,7 +49,6 @@ #define _SVSTDARR_BYTESTRINGSISORTDTOR #define _SVSTDARR_XUB_STRLEN -#define _SVSTDARR_XUB_STRLENSORT #include #include -- cgit