[Libreoffice-commits] core.git: 7 commits - framework/source sal/osl sfx2/source
Tor Lillqvist
tml at iki.fi
Sat Aug 24 02:27:09 PDT 2013
framework/source/services/autorecovery.cxx | 2
sal/osl/unx/file_misc.cxx | 136 ----------
sal/osl/unx/file_path_helper.cxx | 183 ++++----------
sal/osl/unx/file_path_helper.h | 372 ++++++++++++++---------------
sal/osl/unx/file_stat.cxx | 19 -
sal/osl/unx/file_url.cxx | 176 ++-----------
sal/osl/unx/file_url.h | 21 -
sal/osl/unx/nlsupport.c | 10
sal/osl/unx/osxlocale.cxx | 4
sal/osl/unx/profile.c | 114 +++-----
sal/osl/unx/tempfile.c | 2
sal/osl/unx/uunxapi.cxx | 109 +++-----
sal/osl/unx/uunxapi.h | 70 ++---
sal/osl/unx/uunxapi.hxx | 43 ---
sfx2/source/doc/docfile.cxx | 29 ++
15 files changed, 460 insertions(+), 830 deletions(-)
New commits:
commit 4bea3627327d2faba580701062160ea7892cd384
Author: Tor Lillqvist <tml at iki.fi>
Date: Sat Aug 24 12:11:06 2013 +0300
A slash is a slash, a dot is a dot
Bin pointless abstraction.
Change-Id: I193842dff5a86f58f53827712e2f16f6bdd83c3d
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 2adbe60..1400216 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -59,10 +59,6 @@
using namespace osl;
-const sal_Unicode UNICHAR_SLASH = ((sal_Unicode)'/');
-const sal_Unicode UNICHAR_COLON = ((sal_Unicode)':');
-const sal_Unicode UNICHAR_DOT = ((sal_Unicode)'.');
-
/* a slightly modified version of Pchar in rtl/source/uri.c */
const sal_Bool uriCharClass[128] =
{
@@ -93,7 +89,7 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
sal_Unicode protocolDelimiter[3] = { ':', '/', '/' };
/* a valid file url may not start with '/' */
- if( ( 0 == ustrFileURL->length ) || ( (sal_Unicode) '/' == ustrFileURL->buffer[0] ) )
+ if( ( 0 == ustrFileURL->length ) || ( '/' == ustrFileURL->buffer[0] ) )
{
return osl_File_E_INVAL;
}
@@ -120,7 +116,7 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
nOffset += nIndex;
/* break url down in '/' divided tokens tokens */
- nIndex = rtl_ustr_indexOfChar_WithLength( ustrFileURL->buffer + nOffset, ustrFileURL->length - nOffset, (sal_Unicode) '/' );
+ nIndex = rtl_ustr_indexOfChar_WithLength( ustrFileURL->buffer + nOffset, ustrFileURL->length - nOffset, '/' );
/* copy token to new string */
rtl_uString_newFromStr_WithLength( &ustrPathToken, ustrFileURL->buffer + nOffset,
@@ -130,7 +126,7 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
rtl_uriDecode( ustrPathToken, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8, &pTmp );
/* the result should not contain any '/' */
- if( -1 != rtl_ustr_indexOfChar_WithLength( pTmp->buffer, pTmp->length, (sal_Unicode) '/' ) )
+ if( -1 != rtl_ustr_indexOfChar_WithLength( pTmp->buffer, pTmp->length, '/' ) )
{
rtl_uString_release( pTmp );
rtl_uString_release( ustrPathToken );
@@ -188,10 +184,10 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
rtl_uString_newFromStr_WithLength( &pTmp, pTmp->buffer + nIndex, pTmp->length - nIndex );
/* check if system path starts with ~ or ~user and replace it with the appropriate home dir */
- if( (sal_Unicode) '~' == pTmp->buffer[0] )
+ if( '~' == pTmp->buffer[0] )
{
/* check if another user is specified */
- if( ( 1 == pTmp->length ) || ( (sal_Unicode)'/' == pTmp->buffer[1] ) )
+ if( ( 1 == pTmp->length ) || ( '/' == pTmp->buffer[1] ) )
{
rtl_uString *pTmp2 = NULL;
@@ -257,10 +253,10 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
/* check if system path starts with ~ or ~user and replace it with the appropriate home dir */
- if( (sal_Unicode) '~' == ustrSystemPath->buffer[0] )
+ if( '~' == ustrSystemPath->buffer[0] )
{
/* check if another user is specified */
- if( ( 1 == ustrSystemPath->length ) || ( (sal_Unicode)'/' == ustrSystemPath->buffer[1] ) )
+ if( ( 1 == ustrSystemPath->length ) || ( '/' == ustrSystemPath->buffer[1] ) )
{
/* osl_getHomeDir returns file URL */
oslSecurity pSecurity = osl_getCurrentSecurity();
@@ -298,7 +294,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
/* remove all occurrences of '//' */
for( nSrcIndex = nIndex + 1; nSrcIndex < pTmp->length; nSrcIndex++ )
{
- if( ((sal_Unicode) '/' == pTmp->buffer[nSrcIndex]) && ((sal_Unicode) '/' == pTmp->buffer[nIndex]) )
+ if( ('/' == pTmp->buffer[nSrcIndex]) && ('/' == pTmp->buffer[nIndex]) )
nDeleted++;
else
pTmp->buffer[++nIndex] = pTmp->buffer[nSrcIndex];
@@ -317,7 +313,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
rtl_uString_release( pTmp );
/* absolute urls should start with 'file://' */
- if( (sal_Unicode)'/' == (*pustrFileURL)->buffer[0] )
+ if( '/' == (*pustrFileURL)->buffer[0] )
{
rtl_uString *pProtocol = NULL;
@@ -340,7 +336,7 @@ oslFileError osl_getSystemPathFromFileURL_Ex(
if (osl_File_E_None == osl_error)
{
- if (UNICHAR_SLASH == temp->buffer[0])
+ if ('/' == temp->buffer[0])
{
*pustrSystemPath = temp;
}
@@ -409,12 +405,12 @@ namespace
// move back to the next path separator
// or to the start of the string
- while ((p > aPath) && (*p != UNICHAR_SLASH))
+ while ((p > aPath) && (*p != '/'))
p--;
if (p >= aPath)
{
- if (UNICHAR_SLASH == *p)
+ if ('/' == *p)
{
p++;
*p = '\0';
@@ -495,25 +491,25 @@ namespace
{
// ignore '/.' , skip one part back when '/..'
- if ((UNICHAR_DOT == *punresolved) && (UNICHAR_SLASH == *presolvedsf))
+ if (('.' == *punresolved) && ('/' == *presolvedsf))
{
if ('\0' == *(punresolved + 1))
{
punresolved++;
continue;
}
- else if (UNICHAR_SLASH == *(punresolved + 1))
+ else if ('/' == *(punresolved + 1))
{
punresolved += 2;
continue;
}
- else if ((UNICHAR_DOT == *(punresolved + 1)) && ('\0' == *(punresolved + 2) || (UNICHAR_SLASH == *(punresolved + 2))))
+ else if (('.' == *(punresolved + 1)) && ('\0' == *(punresolved + 2) || ('/' == *(punresolved + 2))))
{
_rmlastpathtoken(path_resolved_so_far);
presolvedsf = ustrtoend(path_resolved_so_far) - 1;
- if (UNICHAR_SLASH == *(punresolved + 2))
+ if ('/' == *(punresolved + 2))
punresolved += 3;
else
punresolved += 2;
@@ -538,7 +534,7 @@ namespace
}
}
}
- else if (UNICHAR_SLASH == *punresolved)
+ else if ('/' == *punresolved)
{
if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel)
return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG);
@@ -554,12 +550,12 @@ namespace
if (osl_File_E_None != ferr)
return ferr;
- if (!_islastchr(path_resolved_so_far, UNICHAR_SLASH))
+ if (!_islastchr(path_resolved_so_far, '/'))
{
if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel)
return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG);
- ustrchrcat(UNICHAR_SLASH, path_resolved_so_far);
+ ustrchrcat('/', path_resolved_so_far);
}
}
}
@@ -640,7 +636,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
// SAL_ALLOW_LINKOO_SYMLINKS environment variable:
// for linkoo to work, we need to let the symlinks to the libraries untouched
rtl::OUString base;
- sal_Int32 last_slash = unresolved_path.lastIndexOf( UNICHAR_SLASH );
+ sal_Int32 last_slash = unresolved_path.lastIndexOf( '/' );
if (last_slash >= 0 && last_slash + 1 < unresolved_path.getLength()
&& ! ( last_slash + 2 == unresolved_path.getLength() && unresolved_path.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("."), last_slash + 1) )
@@ -654,7 +650,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
if (!base.isEmpty())
{
- resolved_path += rtl::OUString( UNICHAR_SLASH );
+ resolved_path += "/";
resolved_path += base;
}
}
commit 9ba13c4a02555668392166d401d54c4695b10593
Author: Tor Lillqvist <tml at iki.fi>
Date: Sat Aug 24 12:01:07 2013 +0300
Bin "temporary hack" code that has been commented-out since 2002
Change-Id: If228820b35927d24a1ae2e19c184767a447f829b
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 539732e..2adbe60 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -92,16 +92,6 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
sal_Unicode encodedSlash[3] = { '%', '2', 'F' };
sal_Unicode protocolDelimiter[3] = { ':', '/', '/' };
- /* temporary hack: if already system path, return ustrFileURL */
- /*
- if( (sal_Unicode) '/' == ustrFileURL->buffer[0] )
- {
- OSL_FAIL( "osl_getSystemPathFromFileURL: input is already system path" );
- rtl_uString_assign( pustrSystemPath, ustrFileURL );
- return osl_File_E_None;
- }
- */
-
/* a valid file url may not start with '/' */
if( ( 0 == ustrFileURL->length ) || ( (sal_Unicode) '/' == ustrFileURL->buffer[0] ) )
{
commit 4cebcbedfe56a869e54a61f7023275dd6b426ca4
Author: Tor Lillqvist <tml at iki.fi>
Date: Sat Aug 24 11:53:39 2013 +0300
Simplify osl_getSystemPathFromFileURL_Ex()
It was always called with the bAllowRelative parameter as false
anyway.
Change-Id: I6c4bf739e3f8c1d52dbe8af5df13e97dc9be96e5
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index b262d84..0ee3a66 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -145,7 +145,7 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
return osl_File_E_INVAL;
/* convert file URL to system path */
- eRet = osl_getSystemPathFromFileURL_Ex(ustrDirectoryURL, &ustrSystemPath, sal_False);
+ eRet = osl_getSystemPathFromFileURL_Ex(ustrDirectoryURL, &ustrSystemPath);
if( osl_File_E_None != eRet )
return eRet;
@@ -355,7 +355,7 @@ oslFileError SAL_CALL osl_getDirectoryItem( rtl_uString* ustrFileURL, oslDirecto
if ((0 == ustrFileURL) || (0 == ustrFileURL->length) || (0 == pItem))
return osl_File_E_INVAL;
- osl_error = osl_getSystemPathFromFileURL_Ex(ustrFileURL, &ustrSystemPath, sal_False);
+ osl_error = osl_getSystemPathFromFileURL_Ex(ustrFileURL, &ustrSystemPath);
if (osl_File_E_None != osl_error)
return osl_error;
@@ -541,8 +541,7 @@ oslFileError SAL_CALL osl_createDirectoryPath(
return osl_File_E_INVAL;
rtl::OUString sys_path;
- oslFileError osl_error = osl_getSystemPathFromFileURL_Ex(
- aDirectoryUrl, &sys_path.pData, sal_False);
+ oslFileError osl_error = osl_getSystemPathFromFileURL_Ex(aDirectoryUrl, &sys_path.pData);
if (osl_error != osl_File_E_None)
return osl_error;
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index b55251f..539732e 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -339,21 +339,18 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
return osl_File_E_None;
}
-/****************************************************************************
- * osl_getSystemPathFromFileURL_Ex - helper function
- * clients may specify if they want to accept relative
- * URLs or not
- ****************************************************************************/
-
+/*
+ * relative URLs are not accepted
+ */
oslFileError osl_getSystemPathFromFileURL_Ex(
- rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath, sal_Bool bAllowRelative)
+ rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath)
{
rtl_uString* temp = 0;
oslFileError osl_error = osl_getSystemPathFromFileURL(ustrFileURL, &temp);
if (osl_File_E_None == osl_error)
{
- if (bAllowRelative || (UNICHAR_SLASH == temp->buffer[0]))
+ if (UNICHAR_SLASH == temp->buffer[0])
{
*pustrSystemPath = temp;
}
@@ -629,7 +626,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
if (systemPathIsRelativePath(unresolved_path))
{
rtl::OUString base_path;
- rc = (FileBase::RC) osl_getSystemPathFromFileURL_Ex(ustrBaseDirURL, &base_path.pData, sal_False);
+ rc = (FileBase::RC) osl_getSystemPathFromFileURL_Ex(ustrBaseDirURL, &base_path.pData);
if (FileBase::E_None != rc)
return oslFileError(rc);
diff --git a/sal/osl/unx/file_url.h b/sal/osl/unx/file_url.h
index 9c97d37..4f418b2 100644
--- a/sal/osl/unx/file_url.h
+++ b/sal/osl/unx/file_url.h
@@ -27,10 +27,7 @@ extern "C"
{
#endif
-#define FURL_ALLOW_RELATIVE sal_True
-#define FURL_DENY_RELATIVE sal_False
-
-oslFileError osl_getSystemPathFromFileURL_Ex(rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath, sal_Bool bAllowRelative);
+oslFileError osl_getSystemPathFromFileURL_Ex(rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath);
oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileURL);
diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c
index 3d60477..b36054e 100644
--- a/sal/osl/unx/tempfile.c
+++ b/sal/osl/unx/tempfile.c
@@ -120,7 +120,7 @@ static oslFileError osl_setup_base_directory_impl_(
if (osl_File_E_None == error)
{
- error = osl_getSystemPathFromFileURL_Ex(dir_url, &dir, FURL_DENY_RELATIVE);
+ error = osl_getSystemPathFromFileURL_Ex(dir_url, &dir);
rtl_uString_release(dir_url);
}
commit 3e8c8728967bab1aca1892b55af1497ceccaf67b
Author: Tor Lillqvist <tml at iki.fi>
Date: Sat Aug 24 11:43:09 2013 +0300
Remove function that has been commented-out since 2000
Change-Id: I18ed3ba6f1567ec40f3a87d988863680c55f665b
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index d3e23c4..b55251f 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -76,29 +76,6 @@ const sal_Bool uriCharClass[128] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 /* pqrstuvwxyz{|}~ */
};
-
-/* check for top wrong usage strings */
-/*
-static sal_Bool findWrongUsage( const sal_Unicode *path, sal_Int32 len )
-{
- rtl_uString *pTmp = NULL;
- sal_Bool bRet;
-
- rtl_uString_newFromStr_WithLength( &pTmp, path, len );
-
- rtl_ustr_toAsciiLowerCase_WithLength( pTmp->buffer, pTmp->length );
-
- bRet = ( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pTmp->buffer, pTmp->length, "ftp://", 6 ) ) ||
- ( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pTmp->buffer, pTmp->length, "http://", 7 ) ) ||
- ( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pTmp->buffer, pTmp->length, "vnd.sun.star", 12 ) ) ||
- ( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pTmp->buffer, pTmp->length, "private:", 8 ) ) ||
- ( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pTmp->buffer, pTmp->length, "slot:", 5) );
-
- rtl_uString_release( pTmp );
- return bRet;
-}
-*/
-
oslFileError SAL_CALL osl_getCanonicalName( rtl_uString* ustrFileURL, rtl_uString** pustrValidURL )
{
OSL_FAIL("osl_getCanonicalName not implemented");
@@ -248,11 +225,6 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
}
}
- /* temporary check for top 5 wrong usage strings (which are valid but unlikly filenames) */
- /*
- OSL_ASSERT( !findWrongUsage( pTmp->buffer, pTmp->length ) );
- */
-
rtl_uString_assign ( pustrSystemPath, pTmp );
rtl_uString_release ( pTmp );
return osl_File_E_None;
@@ -349,11 +321,6 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
if( NULL == pTmp )
rtl_uString_assign( &pTmp, ustrSystemPath );
- /* temporary check for top 5 wrong usage strings (which are valid but unlikly filenames) */
- /*
- OSL_ASSERT( !findWrongUsage( pTmp->buffer, pTmp->length ) );
- */
-
/* file URLs must be URI encoded */
rtl_uriEncode( pTmp, uriCharClass, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8, pustrFileURL );
commit 5275de82b04331e38923f1e8429d46091884f6e2
Author: Tor Lillqvist <tml at iki.fi>
Date: Sat Aug 24 11:06:12 2013 +0300
Cleanup some weird or inconsistent indentaion and bin some pointless comments
Sometimes one just can't resist.
Change-Id: I3550f30cc206e2efe361a669b4f8e740d9c3c339
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index b2df4ff..b262d84 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -50,17 +50,12 @@
#endif
/************************************************************************
- * ToDo
+ * TODO
*
* - Fix: check for corresponding struct sizes in exported functions
* - check size/use of oslDirectory
* - check size/use of oslDirectoryItem
***********************************************************************/
-/******************************************************************************
- *
- * Data Type Definition
- *
- ******************************************************************************/
typedef struct
{
@@ -136,19 +131,9 @@ oslFileType DirectoryItem_Impl::getFileType() const
return osl_File_Type_Unknown;
}
-/******************************************************************************
- *
- * C-String Function Declarations
- *
- *****************************************************************************/
-
static oslFileError osl_psz_createDirectory(const sal_Char* pszPath);
static oslFileError osl_psz_removeDirectory(const sal_Char* pszPath);
-/*******************************************************************
- * osl_openDirectory
- ******************************************************************/
-
oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirectory* pDirectory)
{
rtl_uString* ustrSystemPath = NULL;
@@ -240,10 +225,6 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
return oslTranslateFileError(OSL_FET_ERROR, errno);
}
-/****************************************************************************/
-/* osl_closeDirectory */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_closeDirectory( oslDirectory Directory )
{
oslDirectoryImpl* pDirImpl = (oslDirectoryImpl*) Directory;
@@ -298,10 +279,6 @@ static struct dirent* osl_readdir_impl_(DIR* pdir, sal_Bool bFilterLocalAndParen
return pdirent;
}
-/****************************************************************************
- * osl_getNextDirectoryItem
- ***************************************************************************/
-
oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory Directory, oslDirectoryItem* pItem, SAL_UNUSED_PARAMETER sal_uInt32 /*uHint*/)
{
oslDirectoryImpl* pDirImpl = (oslDirectoryImpl*)Directory;
@@ -369,10 +346,6 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory Directory, oslDirect
return osl_File_E_None;
}
-/****************************************************************************/
-/* osl_getDirectoryItem */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_getDirectoryItem( rtl_uString* ustrFileURL, oslDirectoryItem* pItem )
{
rtl_uString* ustrSystemPath = NULL;
@@ -401,11 +374,6 @@ oslFileError SAL_CALL osl_getDirectoryItem( rtl_uString* ustrFileURL, oslDirecto
return osl_error;
}
-
-/****************************************************************************/
-/* osl_acquireDirectoryItem */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_acquireDirectoryItem( oslDirectoryItem Item )
{
DirectoryItem_Impl * pImpl = static_cast< DirectoryItem_Impl* >(Item);
@@ -416,10 +384,6 @@ oslFileError SAL_CALL osl_acquireDirectoryItem( oslDirectoryItem Item )
return osl_File_E_None;
}
-/****************************************************************************/
-/* osl_releaseDirectoryItem */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item )
{
DirectoryItem_Impl * pImpl = static_cast< DirectoryItem_Impl* >(Item);
@@ -430,10 +394,6 @@ oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item )
return osl_File_E_None;
}
-/****************************************************************************/
-/* osl_createDirectory */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_createDirectory( rtl_uString* ustrDirectoryURL )
{
char path[PATH_MAX];
@@ -454,10 +414,6 @@ oslFileError SAL_CALL osl_createDirectory( rtl_uString* ustrDirectoryURL )
return osl_psz_createDirectory( path );
}
-/****************************************************************************/
-/* osl_removeDirectory */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_removeDirectory( rtl_uString* ustrDirectoryURL )
{
char path[PATH_MAX];
@@ -478,10 +434,6 @@ oslFileError SAL_CALL osl_removeDirectory( rtl_uString* ustrDirectoryURL )
return osl_psz_removeDirectory( path );
}
-/*****************************************
- * osl_psz_createDirectory
- ****************************************/
-
static oslFileError osl_psz_createDirectory( const sal_Char* pszPath )
{
int nRet=0;
@@ -498,10 +450,6 @@ static oslFileError osl_psz_createDirectory( const sal_Char* pszPath )
return osl_File_E_None;
}
-/*****************************************
- * osl_psz_removeDirectory
- ****************************************/
-
static oslFileError osl_psz_removeDirectory( const sal_Char* pszPath )
{
int nRet=0;
@@ -517,10 +465,6 @@ static oslFileError osl_psz_removeDirectory( const sal_Char* pszPath )
return osl_File_E_None;
}
-/****************************************************************************/
-/* osl_createDirectoryPath */
-/****************************************************************************/
-
static int path_make_parent(sal_Unicode* path)
{
int i = rtl_ustr_lastIndexOfChar(path, '/');
@@ -610,33 +554,16 @@ oslFileError SAL_CALL osl_createDirectoryPath(
return create_dir_recursively_(sys_path.pData->buffer, aDirectoryCreationCallbackFunc, pData);
}
-/******************************************************************************
- *
- * C-String Function Declarations
- *
- *****************************************************************************/
-
static oslFileError osl_psz_removeFile(const sal_Char* pszPath);
static oslFileError osl_psz_copyFile(const sal_Char* pszPath, const sal_Char* pszDestPath);
static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* pszDestPath);
-
-/******************************************************************************
- *
- * Static Module Utility Function Declarations
- *
- *****************************************************************************/
-
static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName, mode_t nMode, size_t nSourceSize, int DestFileExists);
static oslFileError oslChangeFileModes(const sal_Char* pszFileName, mode_t nMode, time_t nAcTime, time_t nModTime, uid_t nUID, gid_t nGID);
static int oslDoCopyLink(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName);
static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName, size_t nSourceSize, mode_t mode);
static oslFileError oslDoMoveFile(const sal_Char* pszPath, const sal_Char* pszDestPath);
-/****************************************************************************/
-/* osl_moveFile */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_moveFile( rtl_uString* ustrFileURL, rtl_uString* ustrDestURL )
{
char srcPath[PATH_MAX];
@@ -664,10 +591,6 @@ oslFileError SAL_CALL osl_moveFile( rtl_uString* ustrFileURL, rtl_uString* ustrD
return oslDoMoveFile( srcPath, destPath );
}
-/****************************************************************************/
-/* osl_copyFile */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_copyFile( rtl_uString* ustrFileURL, rtl_uString* ustrDestURL )
{
char srcPath[PATH_MAX];
@@ -695,10 +618,6 @@ oslFileError SAL_CALL osl_copyFile( rtl_uString* ustrFileURL, rtl_uString* ustrD
return osl_psz_copyFile( srcPath, destPath );
}
-/****************************************************************************/
-/* osl_removeFile */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_removeFile( rtl_uString* ustrFileURL )
{
char path[PATH_MAX];
@@ -719,16 +638,6 @@ oslFileError SAL_CALL osl_removeFile( rtl_uString* ustrFileURL )
return osl_psz_removeFile( path );
}
-/******************************************************************************
- *
- * Utility Functions
- *
- *****************************************************************************/
-
-/*****************************************
- * oslDoMoveFile
- ****************************************/
-
static oslFileError oslDoMoveFile( const sal_Char* pszPath, const sal_Char* pszDestPath)
{
oslFileError tErr = osl_psz_moveFile(pszPath,pszDestPath);
@@ -755,9 +664,6 @@ static oslFileError oslDoMoveFile( const sal_Char* pszPath, const sal_Char* pszD
return tErr;
}
-/*****************************************
- * osl_psz_removeFile
- ****************************************/
static oslFileError osl_psz_removeFile( const sal_Char* pszPath )
{
int nRet=0;
@@ -785,13 +691,8 @@ static oslFileError osl_psz_removeFile( const sal_Char* pszPath )
return osl_File_E_None;
}
-/*****************************************
- * osl_psz_moveFile
- ****************************************/
-
static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* pszDestPath)
{
-
int nRet = 0;
nRet = rename(pszPath,pszDestPath);
@@ -805,10 +706,6 @@ static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* ps
return osl_File_E_None;
}
-/*****************************************
- * osl_psz_copyFile
- ****************************************/
-
static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* pszDestPath )
{
time_t nAcTime=0;
@@ -882,17 +779,6 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p
return tErr;
}
-
-/******************************************************************************
- *
- * Utility Functions
- *
- *****************************************************************************/
-
-/*****************************************
- * oslDoCopy
- ****************************************/
-
#define TMP_DEST_FILE_EXTENSION ".osl-tmp"
static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName, mode_t nMode, size_t nSourceSize, int DestFileExists)
@@ -956,10 +842,6 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
return osl_File_E_None;
}
-/*****************************************
- * oslChangeFileModes
- ****************************************/
-
static oslFileError oslChangeFileModes( const sal_Char* pszFileName, mode_t nMode, time_t nAcTime, time_t nModTime, uid_t nUID, gid_t nGID)
{
int nRet=0;
@@ -998,10 +880,6 @@ static oslFileError oslChangeFileModes( const sal_Char* pszFileName, mode_t nMod
return osl_File_E_None;
}
-/*****************************************
- * oslDoCopyLink
- ****************************************/
-
static int oslDoCopyLink(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName)
{
int nRet=0;
@@ -1033,10 +911,6 @@ static int oslDoCopyLink(const sal_Char* pszSourceFileName, const sal_Char* pszD
return 0;
}
-/*****************************************
- * oslDoCopyFile
- ****************************************/
-
static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName, size_t nSourceSize, mode_t mode)
{
oslFileHandle SourceFileFH=0;
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx
index 67d8d2d..ce1b47b 100644
--- a/sal/osl/unx/file_path_helper.cxx
+++ b/sal/osl/unx/file_path_helper.cxx
@@ -17,40 +17,29 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "file_path_helper.h"
+#include "file_path_helper.hxx"
+#include "uunxapi.hxx"
- /*******************************************
- Includes
- ******************************************/
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
- #include "file_path_helper.h"
- #include "file_path_helper.hxx"
- #include "uunxapi.hxx"
+const sal_Unicode FPH_CHAR_PATH_SEPARATOR = (sal_Unicode)'/';
+const sal_Unicode FPH_CHAR_DOT = (sal_Unicode)'.';
+const sal_Unicode FPH_CHAR_COLON = (sal_Unicode)':';
- #include <osl/diagnose.h>
- #include <rtl/ustring.hxx>
+inline const rtl::OUString FPH_PATH_SEPARATOR()
+{ return rtl::OUString(FPH_CHAR_PATH_SEPARATOR); }
- /*******************************************
- Constants
- ******************************************/
+inline const rtl::OUString FPH_LOCAL_DIR_ENTRY()
+{ return rtl::OUString(FPH_CHAR_DOT); }
- const sal_Unicode FPH_CHAR_PATH_SEPARATOR = (sal_Unicode)'/';
- const sal_Unicode FPH_CHAR_DOT = (sal_Unicode)'.';
- const sal_Unicode FPH_CHAR_COLON = (sal_Unicode)':';
+inline const rtl::OUString FPH_PARENT_DIR_ENTRY()
+{ return rtl::OUString(".."); }
- inline const rtl::OUString FPH_PATH_SEPARATOR()
- { return rtl::OUString(FPH_CHAR_PATH_SEPARATOR); }
- inline const rtl::OUString FPH_LOCAL_DIR_ENTRY()
- { return rtl::OUString(FPH_CHAR_DOT); }
- inline const rtl::OUString FPH_PARENT_DIR_ENTRY()
- { return rtl::OUString(".."); }
-
- /*******************************************
- * osl_systemPathRemoveSeparator
- ******************************************/
-
- void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* pustrPath)
- {
- OSL_PRECOND(0 != pustrPath, "osl_systemPathRemoveSeparator: Invalid parameter");
+void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* pustrPath)
+{
+ OSL_PRECOND(0 != pustrPath, "osl_systemPathRemoveSeparator: Invalid parameter");
if (0 != pustrPath)
{
// maybe there are more than one separator at end
@@ -65,48 +54,36 @@
(pustrPath->length > 1 && pustrPath->buffer[pustrPath->length - 1] != FPH_CHAR_PATH_SEPARATOR), \
"osl_systemPathRemoveSeparator: Post condition failed");
}
- }
-
- /*******************************************
- osl_systemPathEnsureSeparator
- ******************************************/
-
- void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath)
- {
- OSL_PRECOND((0 != ppustrPath) && (0 != *ppustrPath), "osl_systemPathEnsureSeparator: Invalid parameter");
- if ((0 != ppustrPath) && (0 != *ppustrPath))
- {
- rtl::OUString path(*ppustrPath);
- sal_Int32 lp = path.getLength();
- sal_Int32 i = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
-
- if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0))
- {
- path += FPH_PATH_SEPARATOR();
- rtl_uString_assign(ppustrPath, path.pData);
- }
-
- OSL_POSTCOND(path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR) == (path.getLength() - 1), \
- "osl_systemPathEnsureSeparator: Post condition failed");
- }
- }
-
- /*******************************************
- * osl_systemPathIsRelativePath
- ******************************************/
-
- sal_Bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath)
- {
- OSL_PRECOND(0 != pustrPath, "osl_systemPathIsRelativePath: Invalid parameter");
- return ((0 == pustrPath) || (0 == pustrPath->length) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR));
- }
-
- /******************************************
- osl_systemPathMakeAbsolutePath
- *****************************************/
-
- void SAL_CALL osl_systemPathMakeAbsolutePath(
- const rtl_uString* pustrBasePath,
+}
+
+void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath)
+{
+ OSL_PRECOND((0 != ppustrPath) && (0 != *ppustrPath), "osl_systemPathEnsureSeparator: Invalid parameter");
+ if ((0 != ppustrPath) && (0 != *ppustrPath))
+ {
+ rtl::OUString path(*ppustrPath);
+ sal_Int32 lp = path.getLength();
+ sal_Int32 i = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
+
+ if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0))
+ {
+ path += FPH_PATH_SEPARATOR();
+ rtl_uString_assign(ppustrPath, path.pData);
+ }
+
+ OSL_POSTCOND(path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR) == (path.getLength() - 1), \
+ "osl_systemPathEnsureSeparator: Post condition failed");
+ }
+}
+
+sal_Bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath)
+{
+ OSL_PRECOND(0 != pustrPath, "osl_systemPathIsRelativePath: Invalid parameter");
+ return ((0 == pustrPath) || (0 == pustrPath->length) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR));
+}
+
+void SAL_CALL osl_systemPathMakeAbsolutePath(
+ const rtl_uString* pustrBasePath,
const rtl_uString* pustrRelPath,
rtl_uString** ppustrAbsolutePath)
{
@@ -122,13 +99,8 @@
*ppustrAbsolutePath = base.pData;
}
-
- /*******************************************
- osl_systemPathGetFileOrLastDirectoryPart
- ******************************************/
-
- void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
- const rtl_uString* pustrPath,
+void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
+ const rtl_uString* pustrPath,
rtl_uString** ppustrFileNameOrLastDirPart)
{
OSL_PRECOND(pustrPath && ppustrFileNameOrLastDirPart, \
@@ -149,13 +121,8 @@
rtl_uString_assign(ppustrFileNameOrLastDirPart, last_part.pData);
}
-
- /********************************************
- osl_systemPathIsHiddenFileOrDirectoryEntry
- *********************************************/
-
- sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry(
- const rtl_uString* pustrPath)
+sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry(
+ const rtl_uString* pustrPath)
{
OSL_PRECOND(0 != pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter");
if ((0 == pustrPath) || (0 == pustrPath->length))
@@ -169,11 +136,6 @@
!osl_systemPathIsLocalOrParentDirectoryEntry(fdp.pData));
}
-
- /************************************************
- osl_systemPathIsLocalOrParentDirectoryEntry
- ************************************************/
-
sal_Bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry(
const rtl_uString* pustrPath)
{
@@ -183,10 +145,8 @@ sal_Bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry(
osl_systemPathGetFileNameOrLastDirectoryPart(pustrPath, &dirent.pData);
- return (
- (dirent == FPH_LOCAL_DIR_ENTRY()) ||
- (dirent == FPH_PARENT_DIR_ENTRY())
- );
+ return (dirent == FPH_LOCAL_DIR_ENTRY() ||
+ dirent == FPH_PARENT_DIR_ENTRY());
}
/***********************************************
@@ -198,13 +158,10 @@ class path_list_iterator
{
public:
- /******************************************
- constructor
-
- after construction get_current_item
- returns the first path in list, no need
- to call reset first
- *****************************************/
+ /* after construction get_current_item
+ returns the first path in list, no need
+ to call reset first
+ */
path_list_iterator(const rtl::OUString& path_list, sal_Unicode list_separator = FPH_CHAR_COLON) :
m_path_list(path_list),
m_end(m_path_list.getStr() + m_path_list.getLength() + 1),
@@ -213,18 +170,12 @@ public:
reset();
}
- /******************************************
- reset the iterator
- *****************************************/
void reset()
{
m_path_segment_begin = m_path_segment_end = m_path_list.getStr();
advance();
}
- /******************************************
- move the iterator to the next position
- *****************************************/
void next()
{
OSL_PRECOND(!done(), "path_list_iterator: Already done!");
@@ -233,17 +184,11 @@ public:
advance();
}
- /******************************************
- check if done
- *****************************************/
bool done() const
{
return (m_path_segment_end >= m_end);
}
- /******************************************
- return the current item
- *****************************************/
rtl::OUString get_current_item() const
{
return rtl::OUString(
@@ -252,11 +197,9 @@ public:
}
private:
-
- /******************************************
- move m_path_end to the next separator or
- to the edn of the string
- *****************************************/
+ /* move m_path_end to the next separator or
+ to the end of the string
+ */
void advance()
{
while (!done() && *m_path_segment_end && (*m_path_segment_end != m_separator))
@@ -291,12 +234,8 @@ private:
path_list_iterator& operator=(const path_list_iterator& other);
};
- /************************************************
- osl_searchPath
- ***********************************************/
-
sal_Bool SAL_CALL osl_searchPath(
- const rtl_uString* pustrFilePath,
+ const rtl_uString* pustrFilePath,
const rtl_uString* pustrSearchPathList,
rtl_uString** ppustrPathFound)
{
diff --git a/sal/osl/unx/file_path_helper.h b/sal/osl/unx/file_path_helper.h
index 28a96c1..bf084ba 100644
--- a/sal/osl/unx/file_path_helper.h
+++ b/sal/osl/unx/file_path_helper.h
@@ -17,218 +17,212 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
- #ifndef _OSL_FILE_PATH_HELPER_H_
- #define _OSL_FILE_PATH_HELPER_H_
-
- #include <sal/types.h>
- #include <rtl/ustring.h>
-
- #ifdef __cplusplus
- extern "C"
- {
- #endif
-
-
- /*******************************************
- osl_systemPathRemoveSeparator
- Removes the last separator from the
- given system path if any and if the path
- is not the root path '/'
-
- @param ppustrPath [inout] a system path
- if the path is not the root path
- and the last character is a
- path separator it will be cut off
- ppustrPath must not be NULL and
- must point to a valid rtl_uString
-
- @returns nothing
-
- ******************************************/
-
- void SAL_CALL osl_systemPathRemoveSeparator(
- /*inout*/ rtl_uString* pustrPath);
-
- /*******************************************
- osl_systemPathEnsureSeparator
- Adds a trailing path separator to the
- given system path if not already there
- and if the path is not the root path '/'
-
- @param pustrPath [inout] a system path
- if the path is not the root path
- '/' and has no trailing separator
- a separator will be added
- ppustrPath must not be NULL and
- must point to a valid rtl_uString
-
- @returns nothing
-
- ******************************************/
-
- void SAL_CALL osl_systemPathEnsureSeparator(
- /*inout*/ rtl_uString** ppustrPath);
-
- /*******************************************
- osl_systemPathIsRelativePath
- Returns true if the given path is a
- relative path and so starts not with '/'
-
- @param pustrPath [in] a system path
- pustrPath must not be NULL
-
- @returns sal_True if the given path
- doesn't start with a separator
- else sal_False will be returned
-
- ******************************************/
-
- sal_Bool SAL_CALL osl_systemPathIsRelativePath(
- const rtl_uString* pustrPath);
-
- /******************************************
- osl_systemPathMakeAbsolutePath
- Append a relative path to a base path
-
- @param pustrBasePath [in] a system
- path that will be considered as
- base path
- pustrBasePath must not be NULL
-
- @param pustrRelPath [in] a system path
- that will be considered as
- relative path
- pustrBasePath must not be NULL
-
- @param ppustrAbsolutePath [out] the
- resulting path which is a
- concatination of the base and
- the relative path
- if base path is empty the
- resulting absolute path is the
- relative path
- if relative path is empty the
- resulting absolute path is the
- base path
- if base and relative path are
- empty the resulting absolute
- path is also empty
- ppustrAbsolutePath must not be
- NULL and *ppustrAbsolutePath
- must be 0 or point to a valid
- rtl_uString
-
- *****************************************/
-
- void SAL_CALL osl_systemPathMakeAbsolutePath(
- const rtl_uString* pustrBasePath,
+#ifndef _OSL_FILE_PATH_HELPER_H_
+#define _OSL_FILE_PATH_HELPER_H_
+
+#include <sal/types.h>
+#include <rtl/ustring.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*******************************************
+ osl_systemPathRemoveSeparator
+ Removes the last separator from the
+ given system path if any and if the path
+ is not the root path '/'
+
+ @param ppustrPath [inout] a system path
+ if the path is not the root path
+ and the last character is a
+ path separator it will be cut off
+ ppustrPath must not be NULL and
+ must point to a valid rtl_uString
+
+ @returns nothing
+
+ ******************************************/
+
+void SAL_CALL osl_systemPathRemoveSeparator(
+ /*inout*/ rtl_uString* pustrPath);
+
+/*******************************************
+ osl_systemPathEnsureSeparator
+ Adds a trailing path separator to the
+ given system path if not already there
+ and if the path is not the root path '/'
+
+ @param pustrPath [inout] a system path
+ if the path is not the root path
+ '/' and has no trailing separator
+ a separator will be added
+ ppustrPath must not be NULL and
+ must point to a valid rtl_uString
+
+ @returns nothing
+
+ ******************************************/
+
+void SAL_CALL osl_systemPathEnsureSeparator(
+ rtl_uString** ppustrPath);
+
+/*******************************************
+ osl_systemPathIsRelativePath
+ Returns true if the given path is a
+ relative path and so starts not with '/'
+
+ @param pustrPath [in] a system path
+ pustrPath must not be NULL
+
+ @returns sal_True if the given path
+ doesn't start with a separator
+ else sal_False will be returned
+
+ ******************************************/
+
+sal_Bool SAL_CALL osl_systemPathIsRelativePath(
+ const rtl_uString* pustrPath);
+
+/******************************************
+ osl_systemPathMakeAbsolutePath
+ Append a relative path to a base path
+
+ @param pustrBasePath [in] a system
+ path that will be considered as
+ base path
+ pustrBasePath must not be NULL
+
+ @param pustrRelPath [in] a system path
+ that will be considered as
+ relative path
+ pustrBasePath must not be NULL
+
+ @param ppustrAbsolutePath [out] the
+ resulting path which is a
+ concatination of the base and
+ the relative path
+ if base path is empty the
+ resulting absolute path is the
+ relative path
+ if relative path is empty the
+ resulting absolute path is the
+ base path
+ if base and relative path are
+ empty the resulting absolute
+ path is also empty
+ ppustrAbsolutePath must not be
+ NULL and *ppustrAbsolutePath
+ must be 0 or point to a valid
+ rtl_uString
+
+ *****************************************/
+
+void SAL_CALL osl_systemPathMakeAbsolutePath(
+ const rtl_uString* pustrBasePath,
const rtl_uString* pustrRelPath,
rtl_uString** ppustrAbsolutePath);
- /*****************************************
- osl_systemPathGetFileOrLastDirectoryPart
- Returns the file or the directory part
- of the given path
-
- @param pustrPath [in] a system path,
- must not be NULL
-
- @param ppustrFileOrDirPart [out] on
- return receives the last part
- of the given directory or the
- file name
- if pustrPath is the root path
- '/' an empty string will be
- returned
- if pustrPath has a trailing
- '/' the last part before the
- '/' will be returned else
- the part after the last '/'
- will be returned
-
- @returns nothing
-
- ****************************************/
- void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
- const rtl_uString* pustrPath,
+/*****************************************
+ osl_systemPathGetFileOrLastDirectoryPart
+ Returns the file or the directory part
+ of the given path
+
+ @param pustrPath [in] a system path,
+ must not be NULL
+
+ @param ppustrFileOrDirPart [out] on
+ return receives the last part
+ of the given directory or the
+ file name
+ if pustrPath is the root path
+ '/' an empty string will be
+ returned
+ if pustrPath has a trailing
+ '/' the last part before the
+ '/' will be returned else
+ the part after the last '/'
+ will be returned
+
+ @returns nothing
+
+ ****************************************/
+
+void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
+ const rtl_uString* pustrPath,
rtl_uString** ppustrFileNameOrLastDirPart);
+/********************************************
+ osl_systemPathIsHiddenFileOrDirectoryEntry
+ Returns sal_True if the last part of
+ given system path is not '.' or '..'
+ alone and starts with a '.'
- /********************************************
- osl_systemPathIsHiddenFileOrDirectoryEntry
- Returns sal_True if the last part of
- given system path is not '.' or '..'
- alone and starts with a '.'
+ @param pustrPath [in] a system path,
+ must not be NULL
- @param pustrPath [in] a system path,
- must not be NULL
+ @returns sal_True if the last part of
+ the given system path starts
+ with '.' or sal_False the last
+ part is '.' or '..' alone or
+ doesn't start with a dot
- @returns sal_True if the last part of
- the given system path starts
- with '.' or sal_False the last
- part is '.' or '..' alone or
- doesn't start with a dot
+*********************************************/
- *********************************************/
+sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry(
+ const rtl_uString* pustrPath);
- sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry(
- const rtl_uString* pustrPath);
+/************************************************
+ osl_systemPathIsLocalOrParentDirectoryEntry
+ Returns sal_True if the last part of the given
+ system path is the local directory entry '.'
+ or the parent directory entry '..'
+ @param pustrPath [in] a system path,
+ must not be NULL
- /************************************************
- osl_systemPathIsLocalOrParentDirectoryEntry
- Returns sal_True if the last part of the given
- system path is the local directory entry '.'
- or the parent directory entry '..'
+ @returns sal_True if the last part of the
+ given system path is '.' or '..'
+ else sal_False
- @param pustrPath [in] a system path,
- must not be NULL
+************************************************/
- @returns sal_True if the last part of the
- given system path is '.' or '..'
- else sal_False
+sal_Bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry(
+ const rtl_uString* pustrPath);
- ************************************************/
+/************************************************
+ osl_searchPath
+ Searches for a file name or path name in all
+ directories specified by a given path list.
+ Symbolic links in the resulting path will not be
+ resolved, it's up to the caller to do this.
- sal_Bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry(
- const rtl_uString* pustrPath);
+ @param pustrFilePath [in] a file name or
+ directory name to search for, the name must
+ be provided as system path not as a file URL
+ @param pustrSearchPathList [in] a ':'
+ separated list of paths in which to search for
+ the file or directory name
- /************************************************
- osl_searchPath
- Searches for a file name or path name in all
- directories specified by a given path list.
- Symbolic links in the resulting path will not be
- resolved, it's up to the caller to do this.
+ @param ppustrPathFound [out] on success receives the
+ complete path of the file or directory found
+ as a system path
- @param pustrFilePath [in] a file name or
- directory name to search for, the name must
- be provided as system path not as a file URL
+ @returns sal_True if the specified file or
+ directory was found else sal_False
+ ***********************************************/
- @param pustrSearchPathList [in] a ':'
- separated list of paths in which to search for
- the file or directory name
-
- @ppustrPathFound [out] on success receives the
- complete path of the file or directory found
- as a system path
-
- @returns sal_True if the specified file or
- directory was found else sal_False
- ***********************************************/
-
- sal_Bool SAL_CALL osl_searchPath(
- const rtl_uString* pustrFilePath,
+sal_Bool SAL_CALL osl_searchPath(
+ const rtl_uString* pustrFilePath,
const rtl_uString* pustrSearchPathList,
rtl_uString** ppustrPathFound);
+#ifdef __cplusplus
+}
+#endif
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif /* #ifndef _OSL_PATH_HELPER_H_ */
-
+#endif /* #ifndef _OSL_PATH_HELPER_H_ */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx
index e6e6cc5..85331ba 100644
--- a/sal/osl/unx/file_stat.cxx
+++ b/sal/osl/unx/file_stat.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include "osl/file.h"
#include "osl/detail/file.h"
@@ -34,9 +33,8 @@
#include "file_url.h"
#include "uunxapi.hxx"
-namespace /* private */
+namespace
{
-
inline void set_file_type(const struct stat& file_stat, oslFileStatus* pStat)
{
/* links to directories state also to be a directory */
@@ -199,12 +197,7 @@ namespace /* private */
return osl_File_E_None;
}
-} // end namespace private
-
-
-/****************************************************************************
- * osl_getFileStatus
- ****************************************************************************/
+}
oslFileError SAL_CALL osl_getFileStatus(oslDirectoryItem Item, oslFileStatus* pStat, sal_uInt32 uFieldMask)
{
@@ -262,10 +255,6 @@ oslFileError SAL_CALL osl_getFileStatus(oslDirectoryItem Item, oslFileStatus* pS
return osl_File_E_None;
}
-/****************************************************************************/
-/* osl_setFileAttributes */
-/****************************************************************************/
-
static oslFileError osl_psz_setFileAttributes( const sal_Char* pszFilePath, sal_uInt64 uAttributes )
{
oslFileError osl_error = osl_File_E_None;
@@ -326,10 +315,6 @@ oslFileError SAL_CALL osl_setFileAttributes( rtl_uString* ustrFileURL, sal_uInt6
return osl_psz_setFileAttributes( path, uAttributes );
}
-/****************************************************************************/
-/* osl_setFileTime */
-/****************************************************************************/
-
static oslFileError osl_psz_setFileTime (
const sal_Char* pszFilePath,
const TimeValue* pLastAccessTime,
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 6026660..d3e23c4 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include "file_url.h"
#include "system.h"
@@ -57,34 +56,13 @@
so this code should be consolidated.
**************************************************/
-/************************************************************************
- * ToDo
- *
- * Fix osl_getCanonicalName
- *
- ***********************************************************************/
-
-
-/***************************************************
- * namespace directives
- **************************************************/
using namespace osl;
-/***************************************************
- * constants
- **************************************************/
-
const sal_Unicode UNICHAR_SLASH = ((sal_Unicode)'/');
const sal_Unicode UNICHAR_COLON = ((sal_Unicode)':');
const sal_Unicode UNICHAR_DOT = ((sal_Unicode)'.');
-/******************************************************************************
- *
- * Exported Module Functions
- *
- *****************************************************************************/
-
/* a slightly modified version of Pchar in rtl/source/uri.c */
const sal_Bool uriCharClass[128] =
{
@@ -121,10 +99,6 @@ static sal_Bool findWrongUsage( const sal_Unicode *path, sal_Int32 len )
}
*/
-/****************************************************************************/
-/* osl_getCanonicalName */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_getCanonicalName( rtl_uString* ustrFileURL, rtl_uString** pustrValidURL )
{
OSL_FAIL("osl_getCanonicalName not implemented");
@@ -133,10 +107,6 @@ oslFileError SAL_CALL osl_getCanonicalName( rtl_uString* ustrFileURL, rtl_uStrin
return osl_File_E_None;
}
-/****************************************************************************/
-/* osl_getSystemPathFromFileURL */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath )
{
sal_Int32 nIndex;
@@ -288,10 +258,6 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
return osl_File_E_None;
}
-/****************************************************************************/
-/* osl_getFileURLFromSystemPath */
-/****************************************************************************/
-
oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath, rtl_uString **pustrFileURL )
{
static const sal_Unicode pDoubleSlash[2] = { '/', '/' };
@@ -434,7 +400,7 @@ oslFileError osl_getSystemPathFromFileURL_Ex(
return osl_error;
}
-namespace /* private */
+namespace
{
/******************************************************
@@ -671,12 +637,7 @@ namespace /* private */
return osl_File_E_None;
}
-} // end namespace private
-
-
-/******************************************************
- * osl_getAbsoluteFileURL
- ******************************************************/
+}
oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* ustrRelativeURL, rtl_uString** pustrAbsoluteURL)
{
@@ -753,8 +714,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
return oslFileError(rc);
}
-
-namespace /* private */
+namespace
{
/*********************************************
@@ -806,12 +766,7 @@ namespace /* private */
return (search_path && osl::searchPath(file_path, rtl::OUString(search_path), result));
}
-} // end namespace private
-
-
-/****************************************************************************
- * osl_searchFileURL
- ***************************************************************************/
+}
oslFileError osl_searchFileURL(rtl_uString* ustrFilePath, rtl_uString* ustrSearchPath, rtl_uString** pustrURL)
{
@@ -849,11 +804,6 @@ oslFileError osl_searchFileURL(rtl_uString* ustrFilePath, rtl_uString* ustrSearc
return bfound ? osl_File_E_None : osl_File_E_NOENT;
}
-
-/****************************************************************************
- * FileURLToPath
- ***************************************************************************/
-
oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileURL)
{
rtl_uString* ustrSystemPath = NULL;
@@ -873,11 +823,7 @@ oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileUR
return osl_error;
}
-/*****************************************************************************
- * UnicodeToText
- ****************************************************************************/
-
-namespace /* private */
+namespace
{
class UnicodeToTextConverter_Impl
{
@@ -907,7 +853,7 @@ namespace /* private */
m_converter, 0, pSrcBuf, nSrcChars, pDstBuf, nDstBytes, nFlags, pInfo, pSrcCvtChars);
}
};
-} // end namespace private
+}
int UnicodeToText( char * buffer, size_t bufLen, const sal_Unicode * uniText, sal_Int32 uniTextLen )
{
@@ -929,11 +875,7 @@ int UnicodeToText( char * buffer, size_t bufLen, const sal_Unicode * uniText, sa
return nDestBytes;
}
-/*****************************************************************************
- * TextToUnicode
- ****************************************************************************/
-
-namespace /* private */
+namespace
{
class TextToUnicodeConverter_Impl
{
@@ -964,7 +906,7 @@ namespace /* private */
m_converter, 0, pSrcBuf, nSrcBytes, pDstBuf, nDstChars, nFlags, pInfo, pSrcCvtBytes);
}
};
-} // end namespace private
+}
int TextToUnicode(
const char* text,
diff --git a/sal/osl/unx/file_url.h b/sal/osl/unx/file_url.h
index 176ccea..9c97d37 100644
--- a/sal/osl/unx/file_url.h
+++ b/sal/osl/unx/file_url.h
@@ -27,31 +27,15 @@ extern "C"
{
#endif
-/**************************************************
- * osl_getSystemPathFromFileURL_Ex
- *************************************************/
-
#define FURL_ALLOW_RELATIVE sal_True
#define FURL_DENY_RELATIVE sal_False
oslFileError osl_getSystemPathFromFileURL_Ex(rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath, sal_Bool bAllowRelative);
-/**************************************************
- * FileURLToPath
- *************************************************/
-
oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileURL);
-/***************************************************
- * UnicodeToText
- **************************************************/
-
int UnicodeToText(char * buffer, size_t bufLen, const sal_Unicode * uniText, sal_Int32 uniTextLen);
-/***************************************************
- * TextToUniCode
- **************************************************/
-
int TextToUnicode(const char* text, size_t text_buffer_size, sal_Unicode* unic_text, sal_Int32 unic_text_buffer_size);
#ifdef __cplusplus
diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c
index ff5216a..f504b9e 100644
--- a/sal/osl/unx/nlsupport.c
+++ b/sal/osl/unx/nlsupport.c
@@ -26,8 +26,8 @@
defined(DRAGONFLY)
#include <pthread.h>
#if !defined(MACOSX) && !defined(IOS)
- #include <locale.h>
- #include <langinfo.h>
+#include <locale.h>
+#include <langinfo.h>
#else
#include <osl/module.h>
#include <osl/thread.h>
@@ -36,11 +36,6 @@
#include <string.h>
-/*****************************************************************************
- typedefs
- *****************************************************************************/
-
-
typedef struct {
const char *key;
const rtl_TextEncoding value;
@@ -963,5 +958,4 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
#endif /* ifdef LINUX || SOLARIS || MACOSX || NETBSD || AIX */
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/osxlocale.cxx b/sal/osl/unx/osxlocale.cxx
index 87b34c1..8b7c4b5 100644
--- a/sal/osl/unx/osxlocale.cxx
+++ b/sal/osl/unx/osxlocale.cxx
@@ -28,7 +28,7 @@
#include <CoreFoundation/CoreFoundation.h>
#include <postmac.h>
-namespace /* private */
+namespace
{
template <typename T>
class CFGuard
@@ -58,7 +58,7 @@ namespace /* private */
return CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, sref);
}
-} // namespace private
+}
/** Grab current locale from system.
*/
diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c
index acfd91c..a1de729 100644
--- a/sal/osl/unx/profile.c
+++ b/sal/osl/unx/profile.c
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include "system.h"
#include "readwrite_helper.h"
@@ -51,10 +50,6 @@
/*#define DEBUG_OSL_PROFILE*/
/*#define TRACE_OSL_PROFILE*/
-/*****************************************************************************/
-/* Data Type Definition */
-/*****************************************************************************/
-
typedef time_t osl_TStamp;
typedef enum _osl_TLockMode
@@ -90,9 +85,7 @@ typedef struct _osl_TProfileSection
} osl_TProfileSection;
-/*
- Profile-data structure hidden behind oslProfile:
-*/
+/* Profile-data structure hidden behind oslProfile: */
typedef struct _osl_TProfileImpl
{
sal_uInt32 m_Flags;
@@ -109,11 +102,6 @@ typedef struct _osl_TProfileImpl
sal_Bool m_bIsValid;
} osl_TProfileImpl;
-
-/*****************************************************************************/
-/* Static Module Function Declarations */
-/*****************************************************************************/
-
static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption ProfileFlags);
static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags);
static sal_Bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode);
@@ -150,9 +138,6 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o
/* implemented in file.c */
extern oslFileError FileURLToPath( char *, size_t, rtl_uString* );
-/*****************************************************************************/
-/* Exported Module Functions */
-/*****************************************************************************/
oslProfile SAL_CALL osl_openProfile(rtl_uString *ustrProfileName, oslProfileOption Options)
{
char profilePath[PATH_MAX] = "";
@@ -163,7 +148,6 @@ oslProfile SAL_CALL osl_openProfile(rtl_uString *ustrProfileName, oslProfileOpti
return osl_psz_openProfile( profilePath,Options );
}
-
static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, oslProfileOption Flags)
{
osl_TFile* pFile;
@@ -450,9 +434,11 @@ static sal_Bool writeProfileImpl(osl_TFile* pFile)
sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile,
- const sal_Char* pszSection, const sal_Char* pszEntry,
- sal_Char* pszString, sal_uInt32 MaxLen,
- const sal_Char* pszDefault)
+ const sal_Char* pszSection,
+ const sal_Char* pszEntry,
+ sal_Char* pszString,
+ sal_uInt32 MaxLen,
+ const sal_Char* pszDefault)
{
sal_uInt32 NoEntry;
sal_Char* pStr=0;
@@ -546,10 +532,10 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile,
return (sal_True);
}
-
sal_Bool SAL_CALL osl_readProfileBool(oslProfile Profile,
- const sal_Char* pszSection, const sal_Char* pszEntry,
- sal_Bool Default)
+ const sal_Char* pszSection,
+ const sal_Char* pszEntry,
+ sal_Bool Default)
{
sal_Char Line[32];
Line[0] = '\0';
@@ -578,11 +564,12 @@ sal_Bool SAL_CALL osl_readProfileBool(oslProfile Profile,
return (Default);
}
-
sal_uInt32 SAL_CALL osl_readProfileIdent(oslProfile Profile,
- const sal_Char* pszSection, const sal_Char* pszEntry,
- sal_uInt32 FirstId, const sal_Char* Strings[],
- sal_uInt32 Default)
+ const sal_Char* pszSection,
+ const sal_Char* pszEntry,
+ sal_uInt32 FirstId,
+ const sal_Char* Strings[],
+ sal_uInt32 Default)
{
sal_uInt32 i;
sal_Char Line[256];
@@ -613,8 +600,9 @@ sal_uInt32 SAL_CALL osl_readProfileIdent(oslProfile Profile,
}
sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
- const sal_Char* pszSection, const sal_Char* pszEntry,
- const sal_Char* pszString)
+ const sal_Char* pszSection,
+ const sal_Char* pszEntry,
+ const sal_Char* pszString)
{
sal_uInt32 i;
sal_Bool bRet = sal_False;
@@ -755,10 +743,10 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
return bRet;
}
-
sal_Bool SAL_CALL osl_writeProfileBool(oslProfile Profile,
- const sal_Char* pszSection, const sal_Char* pszEntry,
- sal_Bool Value)
+ const sal_Char* pszSection,
+ const sal_Char* pszEntry,
+ sal_Bool Value)
{
sal_Bool bRet=sal_False;
@@ -778,11 +766,12 @@ sal_Bool SAL_CALL osl_writeProfileBool(oslProfile Profile,
return bRet;
}
-
sal_Bool SAL_CALL osl_writeProfileIdent(oslProfile Profile,
- const sal_Char* pszSection, const sal_Char* pszEntry,
- sal_uInt32 FirstId, const sal_Char* Strings[],
- sal_uInt32 Value)
+ const sal_Char* pszSection,
+ const sal_Char* pszEntry,
+ sal_uInt32 FirstId,
+ const sal_Char* Strings[],
+ sal_uInt32 Value)
{
int i, n = 0;
sal_Bool bRet=sal_False;
@@ -805,9 +794,9 @@ sal_Bool SAL_CALL osl_writeProfileIdent(oslProfile Profile,
return bRet;
}
-
sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile,
- const sal_Char *pszSection, const sal_Char *pszEntry)
+ const sal_Char *pszSection,
+ const sal_Char *pszEntry)
{
sal_uInt32 NoEntry;
osl_TProfileSection* pSec;
@@ -890,9 +879,10 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile,
return bRet;
}
-
-sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_Char *pszSection,
- sal_Char* pszBuffer, sal_uInt32 MaxLen)
+sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile,
+ const sal_Char *pszSection,
+ sal_Char* pszBuffer,
+ sal_uInt32 MaxLen)
{
sal_uInt32 i, n = 0;
sal_uInt32 NoEntry;
@@ -995,7 +985,9 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C
return (n);
}
-sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuffer, sal_uInt32 MaxLen)
+sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile,
+ sal_Char* pszBuffer,
+ sal_uInt32 MaxLen)
{
sal_uInt32 i, n = 0;
osl_TProfileSection* pSec;
@@ -1087,10 +1079,6 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
return (n);
}
-/*****************************************************************************/
-/* Static Module Functions */
-/*****************************************************************************/
-
static osl_TStamp OslProfile_getFileStamp(osl_TFile* pFile)
{
struct stat status;
@@ -1170,12 +1158,12 @@ static sal_Bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode)
break;
}
-#ifndef MACOSX // not MAC OSX
+#ifndef MACOSX
if ( fcntl(pFile->m_Handle, F_SETLKW, &lock) == -1 )
#else
/* Mac OSX will return ENOTSUP for webdav drives so we should ignore it */
if ( fcntl(pFile->m_Handle, F_SETLKW, &lock) == -1 && errno != ENOTSUP )
-#endif /* MACOSX */
+#endif
{
OSL_TRACE("fcntl returned -1 (%s)",strerror(errno));
#ifdef TRACE_OSL_PROFILE
@@ -1471,8 +1459,6 @@ static sal_Bool OslProfile_putLine(osl_TFile* pFile, const sal_Char *pszLine)
return sal_True;
}
-/* platform specific end */
-
static sal_Char* stripBlanks(sal_Char* String, sal_uInt32* pLen)
{
if ( ( pLen != NULL ) && ( *pLen != 0 ) )
@@ -1650,8 +1636,10 @@ static void setEntry(osl_TProfileImpl* pProfile, osl_TProfileSection* pSection,
return;
}
-static sal_Bool addEntry(osl_TProfileImpl* pProfile, osl_TProfileSection *pSection,
- int Line, sal_Char* Entry, sal_uInt32 Len)
+static sal_Bool addEntry(osl_TProfileImpl* pProfile,
+ osl_TProfileSection *pSection,
+ int Line, sal_Char* Entry,
+ sal_uInt32 Len)
{
if (pSection != NULL)
{
@@ -1788,14 +1776,16 @@ static void removeSection(osl_TProfileImpl* pProfile, osl_TProfileSection *pSect
return;
}
-static osl_TProfileSection* findEntry(osl_TProfileImpl* pProfile, const sal_Char* Section,
- const sal_Char* Entry, sal_uInt32 *pNoEntry)
+static osl_TProfileSection* findEntry(osl_TProfileImpl* pProfile,
+ const sal_Char* Section,
+ const sal_Char* Entry,
+ sal_uInt32 *pNoEntry)
{
-static sal_uInt32 Sect = 0;
- sal_uInt32 i, n;
- sal_uInt32 Len;
- const sal_Char* pStr;
- osl_TProfileSection* pSec=0;
+ static sal_uInt32 Sect = 0;
+ sal_uInt32 i, n;
+ sal_uInt32 Len;
+ const sal_Char* pStr;
+ osl_TProfileSection* pSec=0;
Len = strlen(Section);
@@ -1842,8 +1832,8 @@ static sal_uInt32 Sect = 0;
static sal_Bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile)
{
sal_uInt32 i;
- sal_Char* pStr;
- sal_Char* pChar;
+ sal_Char* pStr;
+ sal_Char* pChar;
sal_Char* pLine;
sal_Char* bWasAdded = NULL;
@@ -1997,7 +1987,6 @@ static sal_Bool storeProfile(osl_TProfileImpl* pProfile, sal_Bool bCleanup)
return (sal_True);
}
-
static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile)
{
osl_TFile* pFile=0;
@@ -2058,7 +2047,6 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
return bRet;
}
-
static void osl_ProfileGenerateExtension(const sal_Char* pszFileName, const sal_Char* pszExtension, sal_Char* pszTmpName, int BufferMaxLen)
{
sal_Char* cursor = pszTmpName;
diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx
index 7d62eee..83c321f 100644
--- a/sal/osl/unx/uunxapi.cxx
+++ b/sal/osl/unx/uunxapi.cxx
@@ -17,49 +17,44 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
- #include "uunxapi.h"
- #include "system.h"
- #include <limits.h>
- #include <rtl/ustring.hxx>
- #include <osl/thread.h>
+#include "uunxapi.h"
+#include "system.h"
+#include <limits.h>
+#include <rtl/ustring.hxx>
+#include <osl/thread.h>
- #ifdef ANDROID
- #include <osl/detail/android-bootstrap.h>
- #endif
+#ifdef ANDROID
+#include <osl/detail/android-bootstrap.h>
+#endif
- //###########################
- inline rtl::OString OUStringToOString(const rtl_uString* s)
- {
- return rtl::OUStringToOString(
- rtl::OUString(const_cast<rtl_uString*>(s)),
- osl_getThreadTextEncoding());
- }
+inline rtl::OString OUStringToOString(const rtl_uString* s)
+{
+ return rtl::OUStringToOString(rtl::OUString(const_cast<rtl_uString*>(s)),
+ osl_getThreadTextEncoding());
+}
- //###########################
#ifdef MACOSX
/*
* Helper function for resolving Mac native alias files (not the same as unix alias files)
* and to return the resolved alias as rtl::OString
*/
- inline rtl::OString macxp_resolveAliasAndConvert(const rtl_uString* s)
- {
- rtl::OString p = OUStringToOString(s);
- sal_Char path[PATH_MAX];
- if (p.getLength() < PATH_MAX)
+inline rtl::OString macxp_resolveAliasAndConvert(const rtl_uString* s)
+{
+ rtl::OString p = OUStringToOString(s);
+ sal_Char path[PATH_MAX];
+ if (p.getLength() < PATH_MAX)
{
- strcpy(path, p.getStr());
- macxp_resolveAlias(path, PATH_MAX);
- p = rtl::OString(path);
+ strcpy(path, p.getStr());
+ macxp_resolveAlias(path, PATH_MAX);
+ p = rtl::OString(path);
}
- return p;
- }
+ return p;
+}
#endif /* MACOSX */
- //###########################
- //access_u
- int access_u(const rtl_uString* pustrPath, int mode)
- {
-#ifndef MACOSX // not MACOSX
+int access_u(const rtl_uString* pustrPath, int mode)
+{
+#ifndef MACOSX
rtl::OString fn = OUStringToOString(pustrPath);
#ifdef ANDROID
if (strncmp(fn.getStr(), "/assets", sizeof("/assets")-1) == 0 &&
@@ -81,13 +76,11 @@
#else
return access(macxp_resolveAliasAndConvert(pustrPath).getStr(), mode);
#endif
- }
+}
- //#########################
- //realpath_u
- sal_Bool realpath_u(const rtl_uString* pustrFileName, rtl_uString** ppustrResolvedName)
- {
-#ifndef MACOSX // not MACOSX
+sal_Bool realpath_u(const rtl_uString* pustrFileName, rtl_uString** ppustrResolvedName)
+{
+#ifndef MACOSX
rtl::OString fn = OUStringToOString(pustrFileName);
#ifdef ANDROID
if (strncmp(fn.getStr(), "/assets", sizeof("/assets")-1) == 0 &&
@@ -111,19 +104,16 @@
if (bRet)
{
- rtl::OUString resolved = rtl::OStringToOUString(
- rtl::OString(static_cast<sal_Char*>(rp)),
- osl_getThreadTextEncoding());
+ rtl::OUString resolved = rtl::OStringToOUString(rtl::OString(static_cast<sal_Char*>(rp)),
+ osl_getThreadTextEncoding());
rtl_uString_assign(ppustrResolvedName, resolved.pData);
}
return bRet;
- }
+}
- //#########################
- //stat_c
- int stat_c(const char* cpPath, struct stat* buf)
- {
+int stat_c(const char* cpPath, struct stat* buf)
+{
#ifdef ANDROID
if (strncmp(cpPath, "/assets", sizeof("/assets")-1) == 0 &&
(cpPath[sizeof("/assets")-1] == '\0' ||
@@ -131,12 +121,10 @@
return lo_apk_lstat(cpPath, buf);
#endif
return stat(cpPath, buf);
- }
+}
- //#########################
- //lstat_c
- int lstat_c(const char* cpPath, struct stat* buf)
- {
+int lstat_c(const char* cpPath, struct stat* buf)
+{
#ifdef ANDROID
if (strncmp(cpPath, "/assets", sizeof("/assets")-1) == 0 &&
(cpPath[sizeof("/assets")-1] == '\0' ||
@@ -144,26 +132,21 @@
return lo_apk_lstat(cpPath, buf);
#endif
return lstat(cpPath, buf);
- }
+}
- //#########################
- //lstat_u
- int lstat_u(const rtl_uString* pustrPath, struct stat* buf)
- {
-#ifndef MACOSX // not MACOSX
+int lstat_u(const rtl_uString* pustrPath, struct stat* buf)
+{
+#ifndef MACOSX
rtl::OString fn = OUStringToOString(pustrPath);
return lstat_c(fn.getStr(), buf);
#else
return lstat(macxp_resolveAliasAndConvert(pustrPath).getStr(), buf);
#endif
- }
+}
- //#########################
- // @see mkdir
- int mkdir_u(const rtl_uString* path, mode_t mode)
- {
+int mkdir_u(const rtl_uString* path, mode_t mode)
+{
return mkdir(OUStringToOString(path).getStr(), mode);
- }
-
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/uunxapi.h b/sal/osl/unx/uunxapi.h
index f6bc1f2..286c482 100644
--- a/sal/osl/unx/uunxapi.h
+++ b/sal/osl/unx/uunxapi.h
@@ -17,55 +17,49 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
- #ifndef _OSL_UUNXAPI_H_
- #define _OSL_UUNXAPI_H_
+#ifndef _OSL_UUNXAPI_H_
+#define _OSL_UUNXAPI_H_
- #include <unistd.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <rtl/ustring.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <rtl/ustring.h>
- #ifdef __cplusplus
- extern "C"
- {
- #endif
+#ifdef __cplusplus
+extern "C"
+{
+#endif
- /* @see access */
- int access_u(const rtl_uString* pustrPath, int mode);
+/* @see access */
+int access_u(const rtl_uString* pustrPath, int mode);
- /***********************************
- @descr
- The return value differs from the
- realpath function
+/***********************************
+ @descr
+ The return value differs from the
+ realpath function
- @returns sal_True on success else
- sal_False
+ @returns sal_True on success else
+ sal_False
- @see realpath
- **********************************/
- sal_Bool realpath_u(
- const rtl_uString* pustrFileName,
- rtl_uString** ppustrResolvedName);
+ @see realpath
+ **********************************/
+sal_Bool realpath_u(
+ const rtl_uString* pustrFileName,
+ rtl_uString** ppustrResolvedName);
- /* @see stat */
- int stat_c(const char *cpPath, struct stat* buf);
+int stat_c(const char *cpPath, struct stat* buf);
- /* @see lstat */
- int lstat_c(const char *cpPath, struct stat* buf);
+int lstat_c(const char *cpPath, struct stat* buf);
- /* @see lstat */
- int lstat_u(const rtl_uString* pustrPath, struct stat* buf);
+int lstat_u(const rtl_uString* pustrPath, struct stat* buf);
- /* @see mkdir */
- int mkdir_u(const rtl_uString* path, mode_t mode);
+int mkdir_u(const rtl_uString* path, mode_t mode);
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif /* _OSL_UUNXAPI_H_ */
+#ifdef __cplusplus
+}
+#endif
+#endif /* _OSL_UUNXAPI_H_ */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/uunxapi.hxx b/sal/osl/unx/uunxapi.hxx
index 0419ebe..f5fc477 100644
--- a/sal/osl/unx/uunxapi.hxx
+++ b/sal/osl/unx/uunxapi.hxx
@@ -26,17 +26,10 @@
namespace osl
{
-
- /***********************************
- osl::access
-
- @see access
- **********************************/
-
inline int access(const rtl::OUString& ustrPath, int mode)
- {
+ {
return access_u(ustrPath.pData, mode);
- }
+ }
/***********************************
osl::realpath
@@ -53,32 +46,20 @@ namespace osl
inline sal_Bool realpath(
const rtl::OUString& ustrFileName,
- rtl::OUString& ustrResolvedName)
+ rtl::OUString& ustrResolvedName)
{
return realpath_u(ustrFileName.pData, &ustrResolvedName.pData);
- }
-
+ }
- /***********************************
- osl::lstat
-
- @see lstat
- **********************************/
-
- inline int lstat(const rtl::OUString& ustrPath, struct stat& buf)
- {
- return lstat_u(ustrPath.pData, &buf);
- }
-
- /***********************************
- osl::mkdir
- @see mkdir
- **********************************/
- inline int mkdir(const rtl::OUString& aPath, mode_t aMode)
- {
- return mkdir_u(aPath.pData, aMode);
- }
+ inline int lstat(const rtl::OUString& ustrPath, struct stat& buf)
+ {
+ return lstat_u(ustrPath.pData, &buf);
+ }
+ inline int mkdir(const rtl::OUString& aPath, mode_t aMode)
+ {
+ return mkdir_u(aPath.pData, aMode);
+ }
} // end namespace osl
#endif /* _OSL_UUNXAPI_HXX_ */
commit eb0a6c576c7e1bf804ac46ac0a6d0e0ad834fa68
Author: Tor Lillqvist <tml at iki.fi>
Date: Sat Aug 24 10:59:09 2013 +0300
Bin line of code commented out since 2009
Change-Id: I89c2cf3c82617bada72053678a6fb6013bfbca13
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index cbfc52f..b2df4ff 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -853,7 +853,6 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p
{
DestFileExists=0;
}
-/* return oslTranslateFileError(nRet);*/
}
/* mfe: the destination file must not be a directory! */
commit 063b32804c58f663e42444f676af1a1e3a1cc2a8
Author: Tor Lillqvist <tml at iki.fi>
Date: Sat Aug 24 01:34:23 2013 +0300
Don't use lock files when sandboxed on OS X
We won't be allowed to create such files anyway.
Change-Id: Iaba652b9ae3f1d8c7cfeaae493e962d58ad1fb7f
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 653567d..619fbba 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2013,7 +2013,7 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible)
*/
void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo)
{
-#if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT
+#if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT || HAVE_FEATURE_MACOSX_SANDBOX
(void) rInfo;
#else
if ( rInfo.Document.is() )
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 8a93ef2..2034369 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -140,13 +140,21 @@ static const sal_Int8 LOCK_UI_TRY = 2;
bool IsSystemFileLockingUsed()
{
+#if HAVE_FEATURE_MACOSX_SANDBOX
+ return true;
+#else
return officecfg::Office::Common::Misc::UseDocumentSystemFileLocking::get();
+#endif
}
//----------------------------------------------------------------
bool IsOOoLockFileUsed()
{
+#if HAVE_FEATURE_MACOSX_SANDBOX
+ return false;
+#else
return officecfg::Office::Common::Misc::UseDocumentOOoLockFile::get();
+#endif
}
bool IsLockingUsed()
@@ -831,6 +839,21 @@ void SfxMedium::SetEncryptionDataToStorage_Impl()
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
+// FIXME: Hmm actually lock files should be used for sftp: documents
+// even if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT. Only the use of lock
+// files for *local* documents is unnecessary in that case. But
+// actually, the checks for sftp: here are just wishful thinking; I
+// don't this there is any support for actually editing documents
+// behind sftp: URLs anyway.
+//
+// Sure, there could perhaps be a 3rd-party extension that brings UCB
+// the potential to handle files behind sftp:. But there could also be
+// an extension that handles some arbitrary foobar: scheme *and* it
+// could be that lock files would be the correct thing to use for
+// foobar: documents, too. But the hardcoded test below won't know
+// that. Clearly the knowledge whether lock files should be used or
+// not for some URL scheme belongs in UCB, not here.
+
//------------------------------------------------------------------
sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock )
{
@@ -946,11 +969,15 @@ namespace
{
INetURLObject aUrl( rLogicName );
INetProtocol eProt = aUrl.GetProtocol();
+#if HAVE_FEATURE_MACOSX_SANDBOX
+ return eProt == INET_PROT_SFTP;
+#else
return eProt == INET_PROT_FILE || eProt == INET_PROT_SFTP;
+#endif
}
}
-#endif
+#endif // HAVE_FEATURE_MULTIUSER_ENVIRONMENT
// returns true if the document can be opened for editing ( even if it should be a copy )
// otherwise the document should be opened readonly
More information about the Libreoffice-commits
mailing list