CWS-TOOLING: integrate CWS mav56
This commit is contained in:
@@ -161,6 +161,8 @@ public:
|
|||||||
|
|
||||||
static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed );
|
static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed );
|
||||||
static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
|
static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
|
||||||
|
|
||||||
|
static sal_Bool PathHasSegment( const ::rtl::OUString& aPath, const ::rtl::OUString& aSegment );
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -452,5 +452,36 @@ sal_Bool OStorageHelper::IsValidZipEntryFileName(
|
|||||||
return sal_True;
|
return sal_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
sal_Bool OStorageHelper::PathHasSegment( const ::rtl::OUString& aPath, const ::rtl::OUString& aSegment )
|
||||||
|
{
|
||||||
|
sal_Bool bResult = sal_False;
|
||||||
|
const sal_Int32 nPathLen = aPath.getLength();
|
||||||
|
const sal_Int32 nSegLen = aSegment.getLength();
|
||||||
|
|
||||||
|
if ( nSegLen && nPathLen >= nSegLen )
|
||||||
|
{
|
||||||
|
::rtl::OUString aEndSegment( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
|
||||||
|
aEndSegment += aSegment;
|
||||||
|
|
||||||
|
::rtl::OUString aInternalSegment( aEndSegment );
|
||||||
|
aInternalSegment += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
|
||||||
|
|
||||||
|
if ( aPath.indexOf( aInternalSegment ) >= 0 )
|
||||||
|
bResult = sal_True;
|
||||||
|
|
||||||
|
if ( !bResult && !aPath.compareTo( aSegment, nSegLen ) )
|
||||||
|
{
|
||||||
|
if ( nPathLen == nSegLen || aPath.getStr()[nSegLen] == (sal_Unicode)'/' )
|
||||||
|
bResult = sal_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !bResult && nPathLen > nSegLen && aPath.copy( nPathLen - nSegLen - 1, nSegLen + 1 ).equals( aEndSegment ) )
|
||||||
|
bResult = sal_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user