summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-08-24 11:06:12 +0300
committerTor Lillqvist <tml@iki.fi>2013-08-24 12:26:02 +0300
commit5275de82b04331e38923f1e8429d46091884f6e2 (patch)
tree8ddb4eb156497ea076cfc8330615791d7e7dac1e /sal
parenteb0a6c576c7e1bf804ac46ac0a6d0e0ad834fa68 (diff)
Cleanup some weird or inconsistent indentaion and bin some pointless comments
Sometimes one just can't resist. Change-Id: I3550f30cc206e2efe361a669b4f8e740d9c3c339
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_misc.cxx128
-rw-r--r--sal/osl/unx/file_path_helper.cxx183
-rw-r--r--sal/osl/unx/file_path_helper.h372
-rw-r--r--sal/osl/unx/file_stat.cxx19
-rw-r--r--sal/osl/unx/file_url.cxx74
-rw-r--r--sal/osl/unx/file_url.h16
-rw-r--r--sal/osl/unx/nlsupport.c10
-rw-r--r--sal/osl/unx/osxlocale.cxx4
-rw-r--r--sal/osl/unx/profile.c114
-rw-r--r--sal/osl/unx/uunxapi.cxx109
-rw-r--r--sal/osl/unx/uunxapi.h70
-rw-r--r--sal/osl/unx/uunxapi.hxx43
12 files changed, 400 insertions, 742 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index b2df4ff860c5..b262d84185df 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 67d8d2d8fc89..ce1b47b62c90 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 28a96c173533..bf084ba4e18c 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 e6e6cc5b444b..85331ba164f0 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 6026660635db..d3e23c4563ea 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 176ccea21314..9c97d3799c2e 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 ff5216a1f7c0..f504b9e0b0e3 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 87b34c153b69..8b7c4b5bed44 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 acfd91c6a7c6..a1de729ec3a7 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 7d62eee86f2a..83c321fccca0 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 f6bc1f2c2d6e..286c48230f7d 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 0419ebe31b71..f5fc477d3d1b 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_ */