This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new 8f88de3 Fixed mixed style (space/tabs) in indentation
8f88de3 is described below
commit 8f88de384b4e01798d3b45fd5c9f9347b017c7ca
Author: mseidel <[email protected]>
AuthorDate: Thu Aug 26 22:11:03 2021 +0200
Fixed mixed style (space/tabs) in indentation
(cherry picked from commit 9664d1e0736bd476d60a744c560a8594e973e313)
---
main/sal/osl/unx/backtrace.c | 26 +--
main/sal/osl/unx/conditn.c | 315 ++++++++++++++-------------
main/sal/osl/unx/file_stat.cxx | 476 ++++++++++++++++++++---------------------
main/sal/osl/unx/module.c | 179 ++++++++--------
4 files changed, 497 insertions(+), 499 deletions(-)
diff --git a/main/sal/osl/unx/backtrace.c b/main/sal/osl/unx/backtrace.c
index 65e6238..aecb7c2 100644
--- a/main/sal/osl/unx/backtrace.c
+++ b/main/sal/osl/unx/backtrace.c
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,18 +7,20 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
+
+
#include "sal/types.h"
@@ -55,7 +57,7 @@
#else
-#error Unknown Solaris target platform.
+#error Unknown Solaris target platform.
#endif /* defined SPARC or INTEL */
@@ -296,22 +298,22 @@ void backtrace_symbols_fd( void **buffer, int size, int
fd )
typedef unsigned ptrdiff_t;
-/* glib backtrace is only available on MacOsX 10.5 or higher
+/* glib backtrace is only available on MacOsX 10.5 or higher
so we do it on our own */
int backtrace( void **buffer, int max_frames )
{
- void **frame = (void **)__builtin_frame_address(0);
- void **bp = ( void **)(*frame);
- void *ip = frame[1];
- int i;
+ void **frame = (void **)__builtin_frame_address(0);
+ void **bp = ( void **)(*frame);
+ void *ip = frame[1];
+ int i;
for ( i = 0; bp && ip && i < max_frames; i++ )
{
*(buffer++) = ip;
- ip = bp[1];
- bp = (void**)(bp[0]);
+ ip = bp[1];
+ bp = (void**)(bp[0]);
}
return i;
diff --git a/main/sal/osl/unx/conditn.c b/main/sal/osl/unx/conditn.c
index 163bdff..9a34c85 100644
--- a/main/sal/osl/unx/conditn.c
+++ b/main/sal/osl/unx/conditn.c
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,21 +7,20 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
#include "system.h"
#include <sal/types.h>
@@ -43,9 +42,9 @@ typedef struct _oslConditionImpl
/*****************************************************************************/
oslCondition SAL_CALL osl_createCondition()
{
- oslConditionImpl* pCond;
- int nRet=0;
-
+ oslConditionImpl* pCond;
+ int nRet=0;
+
pCond = (oslConditionImpl*) malloc(sizeof(oslConditionImpl));
OSL_ASSERT(pCond);
@@ -54,35 +53,35 @@ oslCondition SAL_CALL osl_createCondition()
{
return 0;
}
-
+
pCond->m_State = sal_False;
/* init condition variable with default attr. (PTHREAD_PROCESS_PRIVAT)
*/
- nRet = pthread_cond_init(&pCond->m_Condition, PTHREAD_CONDATTR_DEFAULT);
+ nRet = pthread_cond_init(&pCond->m_Condition, PTHREAD_CONDATTR_DEFAULT);
if ( nRet != 0 )
{
- OSL_TRACE("osl_createCondition : condition init failed. Errno: %d;
'%s'\n",
- nRet, strerror(nRet));
+ OSL_TRACE("osl_createCondition : condition init failed. Errno:
%d; '%s'\n",
+ nRet, strerror(nRet));
- free(pCond);
+ free(pCond);
return 0;
}
- nRet = pthread_mutex_init(&pCond->m_Lock, PTHREAD_MUTEXATTR_DEFAULT);
+ nRet = pthread_mutex_init(&pCond->m_Lock, PTHREAD_MUTEXATTR_DEFAULT);
if ( nRet != 0 )
{
- OSL_TRACE("osl_createCondition : mutex init failed. Errno: %d;
%s\n",
- nRet, strerror(nRet));
-
- nRet = pthread_cond_destroy(&pCond->m_Condition);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_createCondition : destroy condition failed. Errno:
%d; '%s'\n",
- nRet, strerror(nRet));
- }
-
- free(pCond);
- pCond = NULL;
+ OSL_TRACE("osl_createCondition : mutex init failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
+
+ nRet = pthread_cond_destroy(&pCond->m_Condition);
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_createCondition : destroy condition
failed. Errno: %d; '%s'\n",
+ nRet, strerror(nRet));
+ }
+
+ free(pCond);
+ pCond = NULL;
}
return (oslCondition)pCond;
@@ -93,30 +92,30 @@ oslCondition SAL_CALL osl_createCondition()
/*****************************************************************************/
void SAL_CALL osl_destroyCondition(oslCondition Condition)
{
- oslConditionImpl* pCond;
- int nRet = 0;
-
+ oslConditionImpl* pCond;
+ int nRet = 0;
+
if ( Condition )
{
- pCond = (oslConditionImpl*)Condition;
+ pCond = (oslConditionImpl*)Condition;
- nRet = pthread_cond_destroy(&pCond->m_Condition);
+ nRet = pthread_cond_destroy(&pCond->m_Condition);
if ( nRet != 0 )
- {
- OSL_TRACE("osl_destroyCondition : destroy condition failed. Errno:
%d; '%s'\n",
- nRet, strerror(nRet));
- }
- nRet = pthread_mutex_destroy(&pCond->m_Lock);
+ {
+ OSL_TRACE("osl_destroyCondition : destroy condition
failed. Errno: %d; '%s'\n",
+ nRet, strerror(nRet));
+ }
+ nRet = pthread_mutex_destroy(&pCond->m_Lock);
if ( nRet != 0 )
- {
- OSL_TRACE("osl_destroyCondition : destroy mutex failed. Errno: %d;
'%s'\n",
- nRet, strerror(nRet));
- }
+ {
+ OSL_TRACE("osl_destroyCondition : destroy mutex failed.
Errno: %d; '%s'\n",
+ nRet, strerror(nRet));
+ }
free(Condition);
}
-
- return;
+
+ return;
}
/*****************************************************************************/
@@ -124,44 +123,44 @@ void SAL_CALL osl_destroyCondition(oslCondition Condition)
/*****************************************************************************/
sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
{
- oslConditionImpl* pCond;
- int nRet=0;
-
- OSL_ASSERT(Condition);
- pCond = (oslConditionImpl*)Condition;
-
- if ( pCond == NULL )
- {
- return sal_False;
- }
-
- nRet = pthread_mutex_lock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_setCondition : mutex lock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- return sal_False;
- }
-
- pCond->m_State = sal_True;
- nRet = pthread_cond_broadcast(&pCond->m_Condition);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_setCondition : condition broadcast failed. Errno: %d;
%s\n",
- nRet, strerror(nRet));
- (void)pthread_mutex_unlock(&pCond->m_Lock);
- return sal_False;
- }
-
- nRet = pthread_mutex_unlock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_setCondition : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- return sal_False;
- }
-
- return sal_True;
+ oslConditionImpl* pCond;
+ int nRet=0;
+
+ OSL_ASSERT(Condition);
+ pCond = (oslConditionImpl*)Condition;
+
+ if ( pCond == NULL )
+ {
+ return sal_False;
+ }
+
+ nRet = pthread_mutex_lock(&pCond->m_Lock);
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_setCondition : mutex lock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
+ return sal_False;
+ }
+
+ pCond->m_State = sal_True;
+ nRet = pthread_cond_broadcast(&pCond->m_Condition);
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_setCondition : condition broadcast failed.
Errno: %d; %s\n",
+ nRet, strerror(nRet));
+ (void)pthread_mutex_unlock(&pCond->m_Lock);
+ return sal_False;
+ }
+
+ nRet = pthread_mutex_unlock(&pCond->m_Lock);
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_setCondition : mutex unlock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
+ return sal_False;
+ }
+
+ return sal_True;
}
@@ -171,8 +170,8 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
{
oslConditionImpl* pCond;
- int nRet=0;
-
+ int nRet=0;
+
OSL_ASSERT(Condition);
pCond = (oslConditionImpl*)Condition;
@@ -182,24 +181,24 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition
Condition)
return sal_False;
}
- nRet = pthread_mutex_lock(&pCond->m_Lock);
+ nRet = pthread_mutex_lock(&pCond->m_Lock);
if ( nRet != 0 )
{
- OSL_TRACE("osl_resetCondition : mutex lock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
+ OSL_TRACE("osl_resetCondition : mutex lock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
return sal_False;
}
pCond->m_State = sal_False;
- nRet = pthread_mutex_unlock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_resetCondition : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- return sal_False;
- }
-
+ nRet = pthread_mutex_unlock(&pCond->m_Lock);
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_resetCondition : mutex unlock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
+ return sal_False;
+ }
+
return sal_True;
}
@@ -209,7 +208,7 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const
TimeValue* pTimeout)
{
oslConditionImpl* pCond;
- int nRet=0;
+ int nRet=0;
oslConditionResult Result = osl_cond_result_ok;
OSL_ASSERT(Condition);
@@ -217,93 +216,93 @@ oslConditionResult SAL_CALL
osl_waitCondition(oslCondition Condition, const Time
if ( pCond == NULL )
{
- return osl_cond_result_error;
+ return osl_cond_result_error;
}
- nRet = pthread_mutex_lock(&pCond->m_Lock);
+ nRet = pthread_mutex_lock(&pCond->m_Lock);
if ( nRet != 0 )
{
- OSL_TRACE("osl_waitCondition : mutex lock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
+ OSL_TRACE("osl_waitCondition : mutex lock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
return osl_cond_result_error;
}
- if ( pTimeout )
- {
- if ( ! pCond->m_State )
- {
+ if ( pTimeout )
+ {
+ if ( ! pCond->m_State )
+ {
int ret;
- struct timeval tp;
+ struct timeval tp;
struct timespec to;
-
+
gettimeofday(&tp, NULL);
SET_TIMESPEC( to, tp.tv_sec + pTimeout->Seconds,
tp.tv_usec * 1000 +
pTimeout->Nanosec );
- /* spurious wake up prevention */
- do
- {
- ret = pthread_cond_timedwait(&pCond->m_Condition,
&pCond->m_Lock, &to);
+ /* spurious wake up prevention */
+ do
+ {
+ ret =
pthread_cond_timedwait(&pCond->m_Condition, &pCond->m_Lock, &to);
if ( ret != 0 )
{
if ( ret == ETIME || ret == ETIMEDOUT )
{
Result =
osl_cond_result_timeout;
- nRet = pthread_mutex_unlock(&pCond->m_Lock);
- if (nRet != 0)
- {
- OSL_TRACE("osl_waitCondition : mutex unlock
failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
-
+ nRet =
pthread_mutex_unlock(&pCond->m_Lock);
+ if (nRet != 0)
+ {
+
OSL_TRACE("osl_waitCondition : mutex unlock failed. Errno: %d; %s\n",
+ nRet,
strerror(nRet));
+ }
+
return Result;
}
else if ( ret != EINTR )
{
Result = osl_cond_result_error;
- nRet = pthread_mutex_unlock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_waitCondition : mutex unlock
failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
+ nRet =
pthread_mutex_unlock(&pCond->m_Lock);
+ if ( nRet != 0 )
+ {
+
OSL_TRACE("osl_waitCondition : mutex unlock failed. Errno: %d; %s\n",
+ nRet,
strerror(nRet));
+ }
return Result;
}
-/* OSL_TRACE("EINTR\n");*/
+/* OSL_TRACE("EINTR\n");*/
}
- }
- while ( !pCond->m_State );
+ }
+ while ( !pCond->m_State );
}
}
- else
- {
- while ( !pCond->m_State )
- {
- nRet = pthread_cond_wait(&pCond->m_Condition, &pCond->m_Lock);
+ else
+ {
+ while ( !pCond->m_State )
+ {
+ nRet = pthread_cond_wait(&pCond->m_Condition,
&pCond->m_Lock);
if ( nRet != 0 )
{
- OSL_TRACE("osl_waitCondition : condition wait failed. Errno:
%d; %s\n",
- nRet, strerror(nRet));
+ OSL_TRACE("osl_waitCondition : condition wait
failed. Errno: %d; %s\n",
+ nRet, strerror(nRet));
Result = osl_cond_result_error;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_waitCondition : mutex unlock failed. Errno:
%d; %s\n",
- nRet, strerror(nRet));
- }
-
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_waitCondition : mutex
unlock failed. Errno: %d; %s\n",
+ nRet, strerror(nRet));
+ }
+
return Result;
}
}
- }
+ }
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_waitCondition : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_waitCondition : mutex unlock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
+ }
return Result;
}
@@ -315,8 +314,8 @@ sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition)
{
sal_Bool State;
oslConditionImpl* pCond;
- int nRet=0;
-
+ int nRet=0;
+
OSL_ASSERT(Condition);
pCond = (oslConditionImpl*)Condition;
@@ -324,24 +323,22 @@ sal_Bool SAL_CALL osl_checkCondition(oslCondition
Condition)
{
return sal_False;
}
-
+
nRet = pthread_mutex_lock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_checkCondition : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
-
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_checkCondition : mutex unlock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
+ }
+
State = pCond->m_State;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_checkCondition : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
+ if ( nRet != 0 )
+ {
+ OSL_TRACE("osl_checkCondition : mutex unlock failed. Errno: %d;
%s\n",
+ nRet, strerror(nRet));
+ }
return State;
}
-
-
diff --git a/main/sal/osl/unx/file_stat.cxx b/main/sal/osl/unx/file_stat.cxx
index c56ff7d..106b741 100644
--- a/main/sal/osl/unx/file_stat.cxx
+++ b/main/sal/osl/unx/file_stat.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -45,59 +45,59 @@ namespace /* private */
inline void set_file_type(const struct stat& file_stat, oslFileStatus*
pStat)
{
/* links to directories state also to be a directory */
- if (S_ISLNK(file_stat.st_mode))
- pStat->eType = osl_File_Type_Link;
- else if (S_ISDIR(file_stat.st_mode))
- pStat->eType = osl_File_Type_Directory;
- else if (S_ISREG(file_stat.st_mode))
- pStat->eType = osl_File_Type_Regular;
- else if (S_ISFIFO(file_stat.st_mode))
- pStat->eType = osl_File_Type_Fifo;
- else if (S_ISSOCK(file_stat.st_mode))
- pStat->eType = osl_File_Type_Socket;
- else if (S_ISCHR(file_stat.st_mode) || S_ISBLK(file_stat.st_mode))
- pStat->eType = osl_File_Type_Special;
- else
- pStat->eType = osl_File_Type_Unknown;
-
- pStat->uValidFields |= osl_FileStatus_Mask_Type;
+ if (S_ISLNK(file_stat.st_mode))
+ pStat->eType = osl_File_Type_Link;
+ else if (S_ISDIR(file_stat.st_mode))
+ pStat->eType = osl_File_Type_Directory;
+ else if (S_ISREG(file_stat.st_mode))
+ pStat->eType = osl_File_Type_Regular;
+ else if (S_ISFIFO(file_stat.st_mode))
+ pStat->eType = osl_File_Type_Fifo;
+ else if (S_ISSOCK(file_stat.st_mode))
+ pStat->eType = osl_File_Type_Socket;
+ else if (S_ISCHR(file_stat.st_mode) ||
S_ISBLK(file_stat.st_mode))
+ pStat->eType = osl_File_Type_Special;
+ else
+ pStat->eType = osl_File_Type_Unknown;
+
+ pStat->uValidFields |= osl_FileStatus_Mask_Type;
}
-
+
inline void set_file_access_mask(const struct stat& file_stat,
oslFileStatus* pStat)
{
- // user permissions
- if (S_IRUSR & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_OwnRead;
+ // user permissions
+ if (S_IRUSR & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_OwnRead;
- if (S_IWUSR & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_OwnWrite;
+ if (S_IWUSR & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_OwnWrite;
- if (S_IXUSR & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_OwnExe;
+ if (S_IXUSR & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_OwnExe;
- // group permissions
- if (S_IRGRP & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_GrpRead;
+ // group permissions
+ if (S_IRGRP & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_GrpRead;
- if (S_IWGRP & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_GrpWrite;
+ if (S_IWGRP & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_GrpWrite;
- if (S_IXGRP & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_GrpExe;
+ if (S_IXGRP & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_GrpExe;
- // others permissions
- if (S_IROTH & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_OthRead;
+ // others permissions
+ if (S_IROTH & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_OthRead;
- if (S_IWOTH & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_OthWrite;
+ if (S_IWOTH & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_OthWrite;
+
+ if (S_IXOTH & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_OthExe;
- if (S_IXOTH & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_OthExe;
-
pStat->uValidFields |= osl_FileStatus_Mask_Attributes;
}
-
+
inline void set_file_access_rights(const struct stat& file_stat, int
S_IR, int S_IW, int S_IX, oslFileStatus* pStat)
{
/* we cannot really map osl_File_Attribute_ReadOnly to
@@ -108,29 +108,29 @@ namespace /* private */
to read because that's better than to give them incorrect
one.
*/
pStat->uValidFields |= osl_FileStatus_Mask_Attributes;
-
- if ((0 == (S_IW & file_stat.st_mode)) && (S_IR & file_stat.st_mode))
+
+ if ((0 == (S_IW & file_stat.st_mode)) && (S_IR &
file_stat.st_mode))
pStat->uAttributes |= osl_File_Attribute_ReadOnly;
- if (S_IX & file_stat.st_mode)
- pStat->uAttributes |= osl_File_Attribute_Executable;
+ if (S_IX & file_stat.st_mode)
+ pStat->uAttributes |= osl_File_Attribute_Executable;
}
-
+
/* a process may belong to up to NGROUPS_MAX groups, so when
checking group access rights, we have to check all belonging
groups */
inline bool is_in_process_grouplist(const gid_t file_group)
{
// check primary process group
-
+
if (getgid() == file_group)
return true;
-
+
// check supplementary process groups
-
+
gid_t grplist[NGROUPS_MAX];
int grp_number = getgroups(NGROUPS_MAX, grplist);
-
+
for (int i = 0; i < grp_number; i++)
{
if (grplist[i] == file_group)
@@ -138,17 +138,17 @@ namespace /* private */
}
return false;
}
-
+
/* Currently we are determining the file access right based
on the real user ID not the effective user ID!
We don't use access(...) because access follows links which
may cause performance problems see #97133.
*/
inline void set_file_access_rights(const struct stat& file_stat,
oslFileStatus* pStat)
- {
+ {
if (getuid() == file_stat.st_uid)
{
- set_file_access_rights(file_stat, S_IRUSR, S_IWUSR,
S_IXUSR, pStat);
+ set_file_access_rights(file_stat, S_IRUSR, S_IWUSR,
S_IXUSR, pStat);
}
else if (is_in_process_grouplist(file_stat.st_gid))
{
@@ -156,55 +156,55 @@ namespace /* private */
}
else
{
- set_file_access_rights(file_stat, S_IROTH, S_IWOTH,
S_IXOTH, pStat);
- }
+ set_file_access_rights(file_stat, S_IROTH, S_IWOTH,
S_IXOTH, pStat);
+ }
}
-
+
inline void set_file_hidden_status(const rtl::OUString& file_path,
oslFileStatus* pStat)
{
- pStat->uAttributes =
osl::systemPathIsHiddenFileOrDirectoryEntry(file_path) ?
osl_File_Attribute_Hidden : 0;
- pStat->uValidFields |= osl_FileStatus_Mask_Attributes;
+ pStat->uAttributes =
osl::systemPathIsHiddenFileOrDirectoryEntry(file_path) ?
osl_File_Attribute_Hidden : 0;
+ pStat->uValidFields |= osl_FileStatus_Mask_Attributes;
}
-
+
/* the set_file_access_rights must be called after
set_file_hidden_status(...) and
set_file_access_mask(...) because of the hack in
set_file_access_rights(...) */
inline void set_file_attributes(
const rtl::OUString& file_path, const struct stat& file_stat,
const sal_uInt32 uFieldMask, oslFileStatus* pStat)
{
- set_file_hidden_status(file_path, pStat);
- set_file_access_mask(file_stat, pStat);
-
+ set_file_hidden_status(file_path, pStat);
+ set_file_access_mask(file_stat, pStat);
+
// we set the file access rights only on demand
- // because it's potentially expensive
- if (uFieldMask & osl_FileStatus_Mask_Attributes)
- set_file_access_rights(file_stat, pStat);
+ // because it's potentially expensive
+ if (uFieldMask & osl_FileStatus_Mask_Attributes)
+ set_file_access_rights(file_stat, pStat);
}
-
+
inline void set_file_access_time(const struct stat& file_stat,
oslFileStatus* pStat)
{
pStat->aAccessTime.Seconds = file_stat.st_atime;
- pStat->aAccessTime.Nanosec = 0;
- pStat->uValidFields |= osl_FileStatus_Mask_AccessTime;
+ pStat->aAccessTime.Nanosec = 0;
+ pStat->uValidFields |= osl_FileStatus_Mask_AccessTime;
}
-
+
inline void set_file_modify_time(const struct stat& file_stat,
oslFileStatus* pStat)
{
- pStat->aModifyTime.Seconds = file_stat.st_mtime;
- pStat->aModifyTime.Nanosec = 0;
- pStat->uValidFields |= osl_FileStatus_Mask_ModifyTime;
+ pStat->aModifyTime.Seconds = file_stat.st_mtime;
+ pStat->aModifyTime.Nanosec = 0;
+ pStat->uValidFields |= osl_FileStatus_Mask_ModifyTime;
}
-
+
inline void set_file_size(const struct stat& file_stat, oslFileStatus*
pStat)
{
if (S_ISREG(file_stat.st_mode))
- {
- pStat->uFileSize = file_stat.st_size;
- pStat->uValidFields |= osl_FileStatus_Mask_FileSize;
- }
+ {
+ pStat->uFileSize = file_stat.st_size;
+ pStat->uValidFields |= osl_FileStatus_Mask_FileSize;
+ }
}
-
- /* we only need to call stat or lstat if one of the
- following flags is set */
+
+ /* we only need to call stat or lstat if one of the
+ following flags is set */
inline bool is_stat_call_necessary(sal_uInt32 field_mask, oslFileType
file_type = osl_File_Type_Unknown)
{
return (
@@ -215,54 +215,54 @@ namespace /* private */
(field_mask & osl_FileStatus_Mask_ModifyTime) ||
(field_mask & osl_FileStatus_Mask_FileSize) ||
(field_mask &
osl_FileStatus_Mask_LinkTargetURL) ||
- (field_mask & osl_FileStatus_Mask_Validate));
+ (field_mask & osl_FileStatus_Mask_Validate));
}
-
+
inline oslFileError set_link_target_url(const rtl::OUString& file_path,
oslFileStatus* pStat)
{
- rtl::OUString link_target;
+ rtl::OUString link_target;
if (!osl::realpath(file_path, link_target))
return oslTranslateFileError(OSL_FET_ERROR, errno);
oslFileError osl_error =
osl_getFileURLFromSystemPath(link_target.pData, &pStat->ustrLinkTargetURL);
if (osl_error != osl_File_E_None)
return osl_error;
-
- pStat->uValidFields |= osl_FileStatus_Mask_LinkTargetURL;
- return osl_File_E_None;
+
+ pStat->uValidFields |= osl_FileStatus_Mask_LinkTargetURL;
+ return osl_File_E_None;
}
-
+
inline oslFileError setup_osl_getFileStatus(
DirectoryItem_Impl * pImpl, oslFileStatus* pStat,
rtl::OUString& file_path)
- {
- if ((NULL == pImpl) || (NULL == pStat))
- return osl_File_E_INVAL;
-
+ {
+ if ((NULL == pImpl) || (NULL == pStat))
+ return osl_File_E_INVAL;
+
file_path = rtl::OUString(pImpl->m_ustrFilePath);
OSL_ASSERT(file_path.getLength() > 0);
if (file_path.getLength() <= 0)
return osl_File_E_INVAL;
-
- pStat->uValidFields = 0;
- return osl_File_E_None;
+
+ pStat->uValidFields = 0;
+ return osl_File_E_None;
}
-
+
} // end namespace private
/****************************************************************************
- * osl_getFileStatus
+ * osl_getFileStatus
****************************************************************************/
oslFileError SAL_CALL osl_getFileStatus(oslDirectoryItem Item, oslFileStatus*
pStat, sal_uInt32 uFieldMask)
-{
+{
DirectoryItem_Impl * pImpl = static_cast< DirectoryItem_Impl* >(Item);
- rtl::OUString file_path;
- oslFileError osl_error = setup_osl_getFileStatus(pImpl, pStat,
file_path);
+ rtl::OUString file_path;
+ oslFileError osl_error = setup_osl_getFileStatus(pImpl, pStat,
file_path);
if (osl_File_E_None != osl_error)
return osl_error;
-
+
#if defined(__GNUC__) && (__GNUC__ < 3)
struct ::stat file_stat;
#else
@@ -271,218 +271,218 @@ oslFileError SAL_CALL
osl_getFileStatus(oslDirectoryItem Item, oslFileStatus* pS
bool bStatNeeded = is_stat_call_necessary(uFieldMask,
pImpl->getFileType());
if (bStatNeeded && (0 != osl::lstat(file_path, file_stat)))
- return oslTranslateFileError(OSL_FET_ERROR, errno);
-
+ return oslTranslateFileError(OSL_FET_ERROR, errno);
+
if (bStatNeeded)
{
- // we set all these attributes because it's cheap
+ // we set all these attributes because it's cheap
set_file_type(file_stat, pStat);
set_file_access_time(file_stat, pStat);
set_file_modify_time(file_stat, pStat);
- set_file_size(file_stat, pStat);
+ set_file_size(file_stat, pStat);
set_file_attributes(file_path, file_stat, uFieldMask, pStat);
-
- // file exists semantic of osl_FileStatus_Mask_Validate
- if ((uFieldMask & osl_FileStatus_Mask_LinkTargetURL) &&
S_ISLNK(file_stat.st_mode))
+
+ // file exists semantic of osl_FileStatus_Mask_Validate
+ if ((uFieldMask & osl_FileStatus_Mask_LinkTargetURL) &&
S_ISLNK(file_stat.st_mode))
{
osl_error = set_link_target_url(file_path, pStat);
- if (osl_error != osl_File_E_None)
+ if (osl_error != osl_File_E_None)
return osl_error;
}
- }
+ }
#ifdef _DIRENT_HAVE_D_TYPE
- else if (uFieldMask & osl_FileStatus_Mask_Type)
- {
+ else if (uFieldMask & osl_FileStatus_Mask_Type)
+ {
pStat->eType = pImpl->getFileType();
pStat->uValidFields |= osl_FileStatus_Mask_Type;
}
#endif /* _DIRENT_HAVE_D_TYPE */
-
- if (uFieldMask & osl_FileStatus_Mask_FileURL)
- {
- if ((osl_error = osl_getFileURLFromSystemPath(file_path.pData,
&pStat->ustrFileURL)) != osl_File_E_None)
+
+ if (uFieldMask & osl_FileStatus_Mask_FileURL)
+ {
+ if ((osl_error = osl_getFileURLFromSystemPath(file_path.pData,
&pStat->ustrFileURL)) != osl_File_E_None)
return osl_error;
-
- pStat->uValidFields |= osl_FileStatus_Mask_FileURL;
- }
-
- if (uFieldMask & osl_FileStatus_Mask_FileName)
- {
+
+ pStat->uValidFields |= osl_FileStatus_Mask_FileURL;
+ }
+
+ if (uFieldMask & osl_FileStatus_Mask_FileName)
+ {
osl_systemPathGetFileNameOrLastDirectoryPart(file_path.pData,
&pStat->ustrFileName);
pStat->uValidFields |= osl_FileStatus_Mask_FileName;
- }
- return osl_File_E_None;
+ }
+ return osl_File_E_None;
}
/****************************************************************************/
-/* osl_setFileAttributes */
+/* osl_setFileAttributes */
/****************************************************************************/
static oslFileError osl_psz_setFileAttributes( const sal_Char* pszFilePath,
sal_uInt64 uAttributes )
{
oslFileError osl_error = osl_File_E_None;
- mode_t nNewMode = 0;
+ mode_t nNewMode = 0;
OSL_ENSURE(!(osl_File_Attribute_Hidden & uAttributes),
"osl_File_Attribute_Hidden doesn't work under Unix");
- if (uAttributes & osl_File_Attribute_OwnRead)
- nNewMode |= S_IRUSR;
+ if (uAttributes & osl_File_Attribute_OwnRead)
+ nNewMode |= S_IRUSR;
- if (uAttributes & osl_File_Attribute_OwnWrite)
- nNewMode|=S_IWUSR;
+ if (uAttributes & osl_File_Attribute_OwnWrite)
+ nNewMode|=S_IWUSR;
- if (uAttributes & osl_File_Attribute_OwnExe)
- nNewMode|=S_IXUSR;
+ if (uAttributes & osl_File_Attribute_OwnExe)
+ nNewMode|=S_IXUSR;
- if (uAttributes & osl_File_Attribute_GrpRead)
- nNewMode|=S_IRGRP;
+ if (uAttributes & osl_File_Attribute_GrpRead)
+ nNewMode|=S_IRGRP;
- if (uAttributes & osl_File_Attribute_GrpWrite)
- nNewMode|=S_IWGRP;
+ if (uAttributes & osl_File_Attribute_GrpWrite)
+ nNewMode|=S_IWGRP;
- if (uAttributes & osl_File_Attribute_GrpExe)
- nNewMode|=S_IXGRP;
+ if (uAttributes & osl_File_Attribute_GrpExe)
+ nNewMode|=S_IXGRP;
- if (uAttributes & osl_File_Attribute_OthRead)
- nNewMode|=S_IROTH;
+ if (uAttributes & osl_File_Attribute_OthRead)
+ nNewMode|=S_IROTH;
- if (uAttributes & osl_File_Attribute_OthWrite)
- nNewMode|=S_IWOTH;
+ if (uAttributes & osl_File_Attribute_OthWrite)
+ nNewMode|=S_IWOTH;
- if (uAttributes & osl_File_Attribute_OthExe)
- nNewMode|=S_IXOTH;
+ if (uAttributes & osl_File_Attribute_OthExe)
+ nNewMode|=S_IXOTH;
- if (chmod(pszFilePath, nNewMode) < 0)
- osl_error = oslTranslateFileError(OSL_FET_ERROR, errno);
+ if (chmod(pszFilePath, nNewMode) < 0)
+ osl_error = oslTranslateFileError(OSL_FET_ERROR, errno);
- return osl_error;
+ return osl_error;
}
oslFileError SAL_CALL osl_setFileAttributes( rtl_uString* ustrFileURL,
sal_uInt64 uAttributes )
{
- char path[PATH_MAX];
- oslFileError eRet;
+ char path[PATH_MAX];
+ oslFileError eRet;
- OSL_ASSERT( ustrFileURL );
+ OSL_ASSERT( ustrFileURL );
- /* convert file url to system path */
- eRet = FileURLToPath( path, PATH_MAX, ustrFileURL );
- if( eRet != osl_File_E_None )
- return eRet;
+ /* convert file url to system path */
+ eRet = FileURLToPath( path, PATH_MAX, ustrFileURL );
+ if( eRet != osl_File_E_None )
+ return eRet;
#ifdef MACOSX
- if ( macxp_resolveAlias( path, PATH_MAX ) != 0 )
- return oslTranslateFileError( OSL_FET_ERROR, errno );
+ if ( macxp_resolveAlias( path, PATH_MAX ) != 0 )
+ return oslTranslateFileError( OSL_FET_ERROR, errno );
#endif/* MACOSX */
- return osl_psz_setFileAttributes( path, uAttributes );
+ return osl_psz_setFileAttributes( path, uAttributes );
}
/****************************************************************************/
-/* osl_setFileTime */
+/* osl_setFileTime */
/****************************************************************************/
static oslFileError osl_psz_setFileTime (
- const sal_Char* pszFilePath,
- const TimeValue* /*pCreationTime*/,
- const TimeValue* pLastAccessTime,
- const TimeValue* pLastWriteTime )
+ const sal_Char* pszFilePath,
+ const TimeValue* /*pCreationTime*/,
+ const TimeValue* pLastAccessTime,
+ const TimeValue* pLastWriteTime )
{
- int nRet=0;
- struct utimbuf aTimeBuffer;
- struct stat aFileStat;
+ int nRet=0;
+ struct utimbuf aTimeBuffer;
+ struct stat aFileStat;
#ifdef DEBUG_OSL_FILE
- struct tm* pTM=0;
+ struct tm* pTM=0;
#endif
- nRet = lstat(pszFilePath,&aFileStat);
+ nRet = lstat(pszFilePath,&aFileStat);
- if ( nRet < 0 )
- {
- nRet=errno;
- return oslTranslateFileError(OSL_FET_ERROR, nRet);
- }
+ if ( nRet < 0 )
+ {
+ nRet=errno;
+ return oslTranslateFileError(OSL_FET_ERROR, nRet);
+ }
#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"File Times are (in localtime):\n");
- pTM=localtime(&aFileStat.st_ctime);
- fprintf(stderr,"CreationTime is '%s'\n",asctime(pTM));
- pTM=localtime(&aFileStat.st_atime);
- fprintf(stderr,"AccessTime is '%s'\n",asctime(pTM));
- pTM=localtime(&aFileStat.st_mtime);
- fprintf(stderr,"Modification is '%s'\n",asctime(pTM));
-
- fprintf(stderr,"File Times are (in UTC):\n");
- fprintf(stderr,"CreationTime is '%s'\n",ctime(&aFileStat.st_ctime));
- fprintf(stderr,"AccessTime is '%s'\n",ctime(&aTimeBuffer.actime));
- fprintf(stderr,"Modification is '%s'\n",ctime(&aTimeBuffer.modtime));
+ fprintf(stderr,"File Times are (in localtime):\n");
+ pTM=localtime(&aFileStat.st_ctime);
+ fprintf(stderr,"CreationTime is '%s'\n",asctime(pTM));
+ pTM=localtime(&aFileStat.st_atime);
+ fprintf(stderr,"AccessTime is '%s'\n",asctime(pTM));
+ pTM=localtime(&aFileStat.st_mtime);
+ fprintf(stderr,"Modification is '%s'\n",asctime(pTM));
+
+ fprintf(stderr,"File Times are (in UTC):\n");
+ fprintf(stderr,"CreationTime is '%s'\n",ctime(&aFileStat.st_ctime));
+ fprintf(stderr,"AccessTime is '%s'\n",ctime(&aTimeBuffer.actime));
+ fprintf(stderr,"Modification is '%s'\n",ctime(&aTimeBuffer.modtime));
#endif
- if ( pLastAccessTime != 0 )
- {
- aTimeBuffer.actime=pLastAccessTime->Seconds;
- }
- else
- {
- aTimeBuffer.actime=aFileStat.st_atime;
- }
-
- if ( pLastWriteTime != 0 )
- {
- aTimeBuffer.modtime=pLastWriteTime->Seconds;
- }
- else
- {
- aTimeBuffer.modtime=aFileStat.st_mtime;
- }
-
- /* mfe: Creation time not used here! */
+ if ( pLastAccessTime != 0 )
+ {
+ aTimeBuffer.actime=pLastAccessTime->Seconds;
+ }
+ else
+ {
+ aTimeBuffer.actime=aFileStat.st_atime;
+ }
+
+ if ( pLastWriteTime != 0 )
+ {
+ aTimeBuffer.modtime=pLastWriteTime->Seconds;
+ }
+ else
+ {
+ aTimeBuffer.modtime=aFileStat.st_mtime;
+ }
+
+ /* mfe: Creation time not used here! */
#ifdef DEBUG_OSL_FILE
- fprintf(stderr,"File Times are (in localtime):\n");
- pTM=localtime(&aFileStat.st_ctime);
- fprintf(stderr,"CreationTime now '%s'\n",asctime(pTM));
- pTM=localtime(&aTimeBuffer.actime);
- fprintf(stderr,"AccessTime now '%s'\n",asctime(pTM));
- pTM=localtime(&aTimeBuffer.modtime);
- fprintf(stderr,"Modification now '%s'\n",asctime(pTM));
-
- fprintf(stderr,"File Times are (in UTC):\n");
- fprintf(stderr,"CreationTime now '%s'\n",ctime(&aFileStat.st_ctime));
- fprintf(stderr,"AccessTime now '%s'\n",ctime(&aTimeBuffer.actime));
- fprintf(stderr,"Modification now '%s'\n",ctime(&aTimeBuffer.modtime));
+ fprintf(stderr,"File Times are (in localtime):\n");
+ pTM=localtime(&aFileStat.st_ctime);
+ fprintf(stderr,"CreationTime now '%s'\n",asctime(pTM));
+ pTM=localtime(&aTimeBuffer.actime);
+ fprintf(stderr,"AccessTime now '%s'\n",asctime(pTM));
+ pTM=localtime(&aTimeBuffer.modtime);
+ fprintf(stderr,"Modification now '%s'\n",asctime(pTM));
+
+ fprintf(stderr,"File Times are (in UTC):\n");
+ fprintf(stderr,"CreationTime now '%s'\n",ctime(&aFileStat.st_ctime));
+ fprintf(stderr,"AccessTime now '%s'\n",ctime(&aTimeBuffer.actime));
+ fprintf(stderr,"Modification now '%s'\n",ctime(&aTimeBuffer.modtime));
#endif
- nRet=utime(pszFilePath,&aTimeBuffer);
- if ( nRet < 0 )
- {
- nRet=errno;
- return oslTranslateFileError(OSL_FET_ERROR, nRet);
- }
+ nRet=utime(pszFilePath,&aTimeBuffer);
+ if ( nRet < 0 )
+ {
+ nRet=errno;
+ return oslTranslateFileError(OSL_FET_ERROR, nRet);
+ }
- return osl_File_E_None;
+ return osl_File_E_None;
}
oslFileError SAL_CALL osl_setFileTime (
- rtl_uString* ustrFileURL,
- const TimeValue* pCreationTime,
- const TimeValue* pLastAccessTime,
- const TimeValue* pLastWriteTime )
+ rtl_uString* ustrFileURL,
+ const TimeValue* pCreationTime,
+ const TimeValue* pLastAccessTime,
+ const TimeValue* pLastWriteTime )
{
- char path[PATH_MAX];
- oslFileError eRet;
+ char path[PATH_MAX];
+ oslFileError eRet;
- OSL_ASSERT( ustrFileURL );
+ OSL_ASSERT( ustrFileURL );
- /* convert file url to system path */
- eRet = FileURLToPath( path, PATH_MAX, ustrFileURL );
- if( eRet != osl_File_E_None )
- return eRet;
+ /* convert file url to system path */
+ eRet = FileURLToPath( path, PATH_MAX, ustrFileURL );
+ if( eRet != osl_File_E_None )
+ return eRet;
#ifdef MACOSX
- if ( macxp_resolveAlias( path, PATH_MAX ) != 0 )
- return oslTranslateFileError( OSL_FET_ERROR, errno );
+ if ( macxp_resolveAlias( path, PATH_MAX ) != 0 )
+ return oslTranslateFileError( OSL_FET_ERROR, errno );
#endif/* MACOSX */
- return osl_psz_setFileTime( path, pCreationTime, pLastAccessTime,
pLastWriteTime );
+ return osl_psz_setFileTime( path, pCreationTime, pLastAccessTime,
pLastWriteTime );
}
diff --git a/main/sal/osl/unx/module.c b/main/sal/osl/unx/module.c
index d115121..da808e2 100644
--- a/main/sal/osl/unx/module.c
+++ b/main/sal/osl/unx/module.c
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -43,25 +43,25 @@ extern int UnicodeToText(char *, size_t, const sal_Unicode
*, sal_Int32);
oslModule SAL_CALL osl_loadModule(rtl_uString *ustrModuleName, sal_Int32
nRtldMode)
{
- oslModule pModule=0;
- rtl_uString* ustrTmp = NULL;
+ oslModule pModule=0;
+ rtl_uString* ustrTmp = NULL;
- OSL_ENSURE(ustrModuleName,"osl_loadModule : string is not valid");
+ OSL_ENSURE(ustrModuleName,"osl_loadModule : string is not valid");
- /* ensure ustrTmp hold valid string */
- if (osl_File_E_None != osl_getSystemPathFromFileURL(ustrModuleName,
&ustrTmp))
- rtl_uString_assign(&ustrTmp, ustrModuleName);
+ /* ensure ustrTmp holds valid string */
+ if (osl_File_E_None != osl_getSystemPathFromFileURL(ustrModuleName,
&ustrTmp))
+ rtl_uString_assign(&ustrTmp, ustrModuleName);
- if (ustrTmp)
- {
- char buffer[PATH_MAX];
+ if (ustrTmp)
+ {
+ char buffer[PATH_MAX];
- if (UnicodeToText(buffer, PATH_MAX, ustrTmp->buffer, ustrTmp->length))
- pModule = osl_loadAsciiModule(buffer, nRtldMode);
- rtl_uString_release(ustrTmp);
- }
+ if (UnicodeToText(buffer, PATH_MAX, ustrTmp->buffer,
ustrTmp->length))
+ pModule = osl_loadAsciiModule(buffer, nRtldMode);
+ rtl_uString_release(ustrTmp);
+ }
- return pModule;
+ return pModule;
}
/*****************************************************************************/
@@ -70,15 +70,15 @@ oslModule SAL_CALL osl_loadModule(rtl_uString
*ustrModuleName, sal_Int32 nRtldMo
oslModule SAL_CALL osl_loadAsciiModule(const sal_Char *pszModuleName,
sal_Int32 nRtldMode)
{
- OSL_ASSERT(
- (nRtldMode & SAL_LOADMODULE_LAZY) == 0 ||
- (nRtldMode & SAL_LOADMODULE_NOW) == 0); /* only either LAZY or NOW */
+ OSL_ASSERT(
+ (nRtldMode & SAL_LOADMODULE_LAZY) == 0 ||
+ (nRtldMode & SAL_LOADMODULE_NOW) == 0); /* only either LAZY or
NOW */
if (pszModuleName)
{
#ifndef NO_DL_FUNCTIONS
- int rtld_mode =
- ((nRtldMode & SAL_LOADMODULE_NOW) ? RTLD_NOW : RTLD_LAZY) |
- ((nRtldMode & SAL_LOADMODULE_GLOBAL) ? RTLD_GLOBAL : RTLD_LOCAL);
+ int rtld_mode =
+ ((nRtldMode & SAL_LOADMODULE_NOW) ? RTLD_NOW :
RTLD_LAZY) |
+ ((nRtldMode & SAL_LOADMODULE_GLOBAL) ? RTLD_GLOBAL :
RTLD_LOCAL);
void* pLib = dlopen(pszModuleName, rtld_mode);
#if OSL_DEBUG_LEVEL > 1
@@ -88,9 +88,9 @@ oslModule SAL_CALL osl_loadAsciiModule(const sal_Char
*pszModuleName, sal_Int32
return ((oslModule)(pLib));
-#else /* NO_DL_FUNCTIONS */
+#else /* NO_DL_FUNCTIONS */
printf("No DL Functions\n");
-#endif /* NO_DL_FUNCTIONS */
+#endif /* NO_DL_FUNCTIONS */
}
return NULL;
}
@@ -99,12 +99,12 @@ oslModule SAL_CALL osl_loadAsciiModule(const sal_Char
*pszModuleName, sal_Int32
/* osl_getModuleHandle */
/*****************************************************************************/
-sal_Bool SAL_CALL
+sal_Bool SAL_CALL
osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult)
{
- (void) pModuleName; /* avoid warning about unused parameter */
- *pResult = (oslModule) RTLD_DEFAULT;
- return sal_True;
+ (void) pModuleName; /* avoid warning about unused parameter */
+ *pResult = (oslModule) RTLD_DEFAULT;
+ return sal_True;
}
/*****************************************************************************/
@@ -115,15 +115,15 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
if (hModule)
{
#ifndef NO_DL_FUNCTIONS
- int nRet = dlclose(hModule);
-
+ int nRet = dlclose(hModule);
+
#if OSL_DEBUG_LEVEL > 1
- if (nRet != 0)
- {
+ if (nRet != 0)
+ {
fprintf(stderr, "error: osl_unloadModule failed with
%s\n", dlerror());
- }
+ }
#else
- (void) nRet;
+ (void) nRet;
#endif /* if OSL_DEBUG_LEVEL */
#endif /* ifndef NO_DL_FUNCTIONS */
@@ -133,60 +133,60 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
/*****************************************************************************/
/* osl_getSymbol */
/*****************************************************************************/
-void* SAL_CALL
+void* SAL_CALL
osl_getSymbol(oslModule Module, rtl_uString* pSymbolName)
{
- return (void *) osl_getFunctionSymbol(Module, pSymbolName);
+ return (void *) osl_getFunctionSymbol(Module, pSymbolName);
}
/*****************************************************************************/
/* osl_getAsciiFunctionSymbol */
/*****************************************************************************/
-oslGenericFunction SAL_CALL
+oslGenericFunction SAL_CALL
osl_getAsciiFunctionSymbol(oslModule Module, const sal_Char *pSymbol)
{
- void *fcnAddr = NULL;
-
+ void *fcnAddr = NULL;
+
#ifndef NO_DL_FUNCTIONS
- if (pSymbol)
+ if (pSymbol)
{
- fcnAddr = dlsym(Module, pSymbol);
-
- if (!fcnAddr)
- OSL_TRACE("error: osl_getAsciiFunctionSymbol failed with %s\n",
dlerror());
+ fcnAddr = dlsym(Module, pSymbol);
+
+ if (!fcnAddr)
+ OSL_TRACE("error: osl_getAsciiFunctionSymbol failed
with %s\n", dlerror());
}
#endif
- return (oslGenericFunction) fcnAddr;
+ return (oslGenericFunction) fcnAddr;
}
/*****************************************************************************/
/* osl_getFunctionSymbol */
/*****************************************************************************/
-oslGenericFunction SAL_CALL
+oslGenericFunction SAL_CALL
osl_getFunctionSymbol(oslModule module, rtl_uString *puFunctionSymbolName)
{
- oslGenericFunction pSymbol = NULL;
-
- if( puFunctionSymbolName )
- {
- rtl_String* pSymbolName = NULL;
-
- rtl_uString2String( &pSymbolName,
- rtl_uString_getStr(puFunctionSymbolName),
- rtl_uString_getLength(puFunctionSymbolName),
- RTL_TEXTENCODING_UTF8,
- OUSTRING_TO_OSTRING_CVTFLAGS );
-
- if( pSymbolName != NULL )
- {
- pSymbol = osl_getAsciiFunctionSymbol(module,
rtl_string_getStr(pSymbolName));
- rtl_string_release(pSymbolName);
- }
- }
-
- return pSymbol;
+ oslGenericFunction pSymbol = NULL;
+
+ if( puFunctionSymbolName )
+ {
+ rtl_String* pSymbolName = NULL;
+
+ rtl_uString2String( &pSymbolName,
+ rtl_uString_getStr(puFunctionSymbolName),
+ rtl_uString_getLength(puFunctionSymbolName),
+ RTL_TEXTENCODING_UTF8,
+ OUSTRING_TO_OSTRING_CVTFLAGS );
+
+ if( pSymbolName != NULL )
+ {
+ pSymbol = osl_getAsciiFunctionSymbol(module,
rtl_string_getStr(pSymbolName));
+ rtl_string_release(pSymbolName);
+ }
+ }
+
+ return pSymbol;
}
/*****************************************************************************/
@@ -201,28 +201,28 @@ sal_Bool SAL_CALL osl_getModuleURLFromAddress(void *
addr, rtl_uString ** ppLibr
{
rtl_uString * workDir = NULL;
osl_getProcessWorkingDir(&workDir);
- if (workDir)
- {
+ if (workDir)
+ {
#if OSL_DEBUG_LEVEL > 1
- OSL_TRACE("module.c::osl_getModuleURLFromAddress - %s\n",
dl_info.dli_fname);
+ OSL_TRACE("module.c::osl_getModuleURLFromAddress -
%s\n", dl_info.dli_fname);
#endif
- rtl_string2UString(ppLibraryUrl,
- dl_info.dli_fname,
- strlen(dl_info.dli_fname),
- osl_getThreadTextEncoding(),
- OSTRING_TO_OUSTRING_CVTFLAGS);
-
- OSL_ASSERT(*ppLibraryUrl != NULL);
- osl_getFileURLFromSystemPath(*ppLibraryUrl, ppLibraryUrl);
- osl_getAbsoluteFileURL(workDir, *ppLibraryUrl, ppLibraryUrl);
-
- rtl_uString_release(workDir);
- result = sal_True;
- }
- else
- {
- result = sal_False;
- }
+ rtl_string2UString(ppLibraryUrl,
+ dl_info.dli_fname,
+
strlen(dl_info.dli_fname),
+
osl_getThreadTextEncoding(),
+
OSTRING_TO_OUSTRING_CVTFLAGS);
+
+ OSL_ASSERT(*ppLibraryUrl != NULL);
+ osl_getFileURLFromSystemPath(*ppLibraryUrl,
ppLibraryUrl);
+ osl_getAbsoluteFileURL(workDir, *ppLibraryUrl,
ppLibraryUrl);
+
+ rtl_uString_release(workDir);
+ result = sal_True;
+ }
+ else
+ {
+ result = sal_False;
+ }
}
return result;
}
@@ -232,6 +232,5 @@ sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr,
rtl_uString ** ppLibr
/*****************************************************************************/
sal_Bool SAL_CALL osl_getModuleURLFromFunctionAddress(oslGenericFunction addr,
rtl_uString ** ppLibraryUrl)
{
- return osl_getModuleURLFromAddress((void*)addr, ppLibraryUrl);
+ return osl_getModuleURLFromAddress((void*)addr, ppLibraryUrl);
}
-