summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-02-02 17:12:56 +0100
committersb <sb@openoffice.org>2010-02-02 17:12:56 +0100
commitbc91905036de09b18285920f0dcd4ef74327d725 (patch)
tree2106e02502b7d56ac27c11f64c5719d3e18e7e1e /sal
parent24f0ca25dac7bd7209709538e1b09a7b17db062d (diff)
parenta06b295cb359d7430bd1360296bb1284ff9e003f (diff)
sb111: #i108461# merged in more cws/fwk137
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/file_dirvol.cxx35
-rw-r--r--sal/osl/w32/file_url.cxx15
2 files changed, 13 insertions, 37 deletions
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 22e2c7f2d5d9..dbab4864cb28 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -668,22 +668,7 @@ static DWORD create_dir_with_callback(
BOOL bCreated = FALSE;
- if ( rtl_uString_getLength( dir_path ) < MAX_PATH - 12 )
- {
- /* this is a normal short URL, ".." are acceptable here */
- bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL );
- }
- else
- {
- /* the long urls can not contain ".." while calling CreateDirectory, no idea why! */
- ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
- sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( dir_path ) ),
- aBuf,
- aBuf.getBufSizeInSymbols(),
- sal_False );
-
- bCreated = CreateDirectoryW( aBuf, NULL );
- }
+ bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL );
if ( bCreated )
{
@@ -783,23 +768,7 @@ oslFileError SAL_CALL osl_createDirectory(rtl_uString* strPath)
{
BOOL bCreated = FALSE;
- if ( rtl_uString_getLength( strSysPath ) < MAX_PATH - 12 )
- {
- /* this is a normal short URL, ".." are acceptable here */
- bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL );
- }
- else
- {
- /* the long urls can not contain ".." while calling CreateDirectory, no idea why! */
- ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
- sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( strSysPath ) ),
- aBuf,
- aBuf.getBufSizeInSymbols(),
- sal_False );
-
- bCreated = CreateDirectoryW( aBuf, NULL );
- }
-
+ bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL );
if ( !bCreated )
{
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index 34bcd8169fb3..45f8c726a93e 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -779,10 +779,17 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
}
else
{
- if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_SYSTEM_ROOT_PATH, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 )
+ ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
+ sal_uInt32 nNewLen = GetCaseCorrectPathName( pDecodedURL + nSkip,
+ aBuf,
+ aBuf.getBufSizeInSymbols(),
+ sal_False );
+
+ if ( nNewLen <= MAX_PATH - 12
+ || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_SYSTEM_ROOT_PATH, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 )
|| 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) )
{
- rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip );
+ rtl_uString_newFromStr_WithLength( &strTempPath, aBuf, nNewLen );
}
else if ( pDecodedURL[nSkip] == (sal_Unicode)'\\' && pDecodedURL[nSkip+1] == (sal_Unicode)'\\' )
{
@@ -790,7 +797,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
rtl_uString *strSuffix = NULL;
rtl_uString *strPrefix = NULL;
rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX_UNC, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1 );
- rtl_uString_newFromStr_WithLength( &strSuffix, pDecodedURL + nSkip + 2, nDecodedLen - nSkip - 2 );
+ rtl_uString_newFromStr_WithLength( &strSuffix, aBuf + 2, nNewLen - 2 );
rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );
@@ -802,7 +809,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
rtl_uString *strSuffix = NULL;
rtl_uString *strPrefix = NULL;
rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1 );
- rtl_uString_newFromStr_WithLength( &strSuffix, pDecodedURL + nSkip, nDecodedLen - nSkip );
+ rtl_uString_newFromStr_WithLength( &strSuffix, aBuf, nNewLen );
rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );