summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sal/osl/unx/module.c45
-rw-r--r--sal/osl/unx/process.c66
-rw-r--r--sal/osl/unx/profile.c105
3 files changed, 65 insertions, 151 deletions
diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c
index 7d39017bc..3f543f760 100644
--- a/sal/osl/unx/module.c
+++ b/sal/osl/unx/module.c
@@ -2,9 +2,9 @@
*
* $RCSfile: module.c,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: svesik $ $Date: 2001-04-26 14:53:29 $
+ * last change: $Author: obr $ $Date: 2001-05-11 19:20:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,6 +75,10 @@
#include <osl/thread.h>
#endif
+#ifndef _OSL_FILE_H_
+#include <osl/file.h>
+#endif
+
#include "system.h"
#if defined(DEBUG)
@@ -90,6 +94,9 @@ extern oslProcessError SAL_CALL osl_searchPath(const sal_Char* pszName, const sa
extern int _dlclose(void *handle);
#endif /* MACOSX */
+/* implemented in file.c */
+extern UnicodeToText( char *, size_t, const sal_Unicode *, sal_Int32 );
+
oslModule SAL_CALL osl_psz_loadModule(const sal_Char *pszModuleName, sal_Int32 nRtldMode);
void* SAL_CALL osl_psz_getSymbol(oslModule hModule, const sal_Char* pszSymbolName);
@@ -101,36 +108,30 @@ void* SAL_CALL osl_psz_getSymbol(oslModule hModule, const sal_Char* pszSymbolNam
oslModule SAL_CALL osl_loadModule(rtl_uString *ustrModuleName, sal_Int32 nRtldMode)
{
oslModule pModule=0;
+ rtl_uString* ustrTmp = NULL;
OSL_ENSURE(ustrModuleName,"osl_loadModule : string is not valid");
- if ( ustrModuleName != 0 )
+ /* ensure ustrTmp hold valid string */
+ if( osl_File_E_None != osl_getSystemPathFromFileURL( ustrModuleName, &ustrTmp ) )
+ rtl_uString_assign( &ustrTmp, ustrModuleName );
+
+ if( ustrTmp )
{
- rtl_String* strModuleName = 0;
- sal_Char* pszModuleName=0;
-
- rtl_uString2String( &strModuleName,
- rtl_uString_getStr(ustrModuleName),
- rtl_uString_getLength(ustrModuleName),
- osl_getThreadTextEncoding(),
- OUSTRING_TO_OSTRING_CVTFLAGS );
-
- pszModuleName=rtl_string_getStr(strModuleName);
-
-#if defined(DEBUG)
- fprintf(stderr,"osl_loadModule : lib to load : [%s]\n",pszModuleName);
-#endif
+ char *buffer[PATH_MAX];
- if ( strncmp(pszModuleName,"//./",4) == 0 )
- pszModuleName+=3;
-
- pModule = osl_psz_loadModule(pszModuleName,nRtldMode);
- rtl_string_release(strModuleName);
+ if( UnicodeToText( buffer, PATH_MAX, ustrTmp->buffer, ustrTmp->length ) )
+ pModule = osl_psz_loadModule( buffer, nRtldMode );
}
+
+ rtl_uString_release( ustrTmp );
return pModule;
}
+/*****************************************************************************/
+/* osl_psz_loadModule */
+/*****************************************************************************/
oslModule SAL_CALL osl_psz_loadModule(const sal_Char *pszModuleName, sal_Int32 nRtldMode)
{
diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c
index 78605af1d..36c5efbb6 100644
--- a/sal/osl/unx/process.c
+++ b/sal/osl/unx/process.c
@@ -2,9 +2,9 @@
*
* $RCSfile: process.c,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: mfe $ $Date: 2001-03-22 10:01:41 $
+ * last change: $Author: obr $ $Date: 2001-05-11 19:20:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -101,7 +101,8 @@
#define CONTROLLEN (sizeof(struct cmsghdr) + sizeof(int))
#endif
-
+/* implemented in file.c */
+extern oslFileError FileURLToPath( char *, size_t, rtl_uString* );
/******************************************************************************
*
@@ -386,33 +387,25 @@ static sal_Char *getCmdLine()
#endif
-oslProcessError SAL_CALL osl_getExecutableFile(rtl_uString **ustrFile)
+oslProcessError SAL_CALL osl_getExecutableFile( rtl_uString** pustrFile )
{
- sal_Char pszExecutable[PATH_MAX];
- sal_Char pszUncPath[PATH_MAX+5];
- oslProcessError Error;
+ char executablePath[PATH_MAX] = "";
+ oslProcessError eRet;
- pszExecutable[0] = '\0';
- pszUncPath[0] = '\0';
-
- Error=osl_psz_getExecutableFile(pszExecutable,sizeof(pszExecutable));
+ eRet = osl_psz_getExecutableFile( executablePath, PATH_MAX );
- if ( Error == osl_Process_E_None)
+ if ( eRet == osl_Process_E_None)
{
- strcpy(pszUncPath,"//.");
- strcat(pszUncPath,pszExecutable);
+ rtl_uString *ustrTmp = NULL;
+
+ rtl_string2UString( &ustrTmp, executablePath, strlen( executablePath ),
+ osl_getThreadTextEncoding(), OUSTRING_TO_OSTRING_CVTFLAGS );
+
+ osl_getFileURLFromSystemPath( ustrTmp, pustrFile );
+ rtl_uString_release( ustrTmp );
}
- /* fprintf(stderr,"Exec file is '%s'\n",pszUncPath);*/
-
- rtl_string2UString(
- ustrFile,
- pszUncPath,
- rtl_str_getLength( pszUncPath ),
- osl_getThreadTextEncoding(),
- OUSTRING_TO_OSTRING_CVTFLAGS );
-
- return Error;
+ return eRet;
}
@@ -967,26 +960,16 @@ oslProcessError SAL_CALL osl_executeProcess(rtl_uString *ustrImageName,
oslProcessError Error;
rtl_String* strImageName=0;
rtl_String* strWorkDir=0;
- sal_Char* pszImageName=0;
sal_Char* pszWorkDir=0;
sal_Char** pArguments=0;
sal_Char** pEnvironment=0;
unsigned int index;
+
+ char imagePath[PATH_MAX] = "";
-
- if ( ustrImageName != 0 && ustrImageName->buffer[0] != 0 )
+ if ( ustrImageName && ustrImageName->length )
{
- rtl_uString2String( &strImageName,
- rtl_uString_getStr(ustrImageName),
- rtl_uString_getLength(ustrImageName),
- osl_getThreadTextEncoding(),
- OUSTRING_TO_OSTRING_CVTFLAGS );
-
- pszImageName = rtl_string_getStr(strImageName);
- if ( strncmp(pszImageName,"//./",4) == 0 )
- {
- pszImageName+=3;
- }
+ FileURLToPath( imagePath, PATH_MAX, ustrImageName );
}
if ( ustrWorkDir != 0 && ustrWorkDir->buffer[0] != 0 )
@@ -1043,7 +1026,7 @@ oslProcessError SAL_CALL osl_executeProcess(rtl_uString *ustrImageName,
}
- Error = osl_psz_executeProcess(pszImageName,
+ Error = osl_psz_executeProcess(imagePath,
pArguments,
Options,
Security,
@@ -1076,11 +1059,6 @@ oslProcessError SAL_CALL osl_executeProcess(rtl_uString *ustrImageName,
free(pEnvironment);
}
- if ( strImageName != 0 )
- {
- rtl_string_release(strImageName);
- }
-
if ( strWorkDir != 0 )
{
rtl_string_release(strWorkDir);
diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c
index 5e05e7b93..a10f246b4 100644
--- a/sal/osl/unx/profile.c
+++ b/sal/osl/unx/profile.c
@@ -2,9 +2,9 @@
*
* $RCSfile: profile.c,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: mfe $ $Date: 2001-02-26 16:17:49 $
+ * last change: $Author: obr $ $Date: 2001-05-11 19:20:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -225,45 +225,20 @@ oslProcessError SAL_CALL osl_getCommandArgs(sal_Char* pszBuffer, sal_uInt32 Max)
static sal_Bool bGlobalSofficeFlag=sal_False;
+/* 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)
{
- oslProfile pProfile=0;
- rtl_String* strProfileName=0;
- sal_Char* pszProfileName=0;
-
+ char profilePath[PATH_MAX] = "";
if ( ustrProfileName != 0 && ustrProfileName->buffer[0] != 0 )
- {
-
- rtl_uString2String( &strProfileName,
- rtl_uString_getStr(ustrProfileName),
- rtl_uString_getLength(ustrProfileName),
- osl_getThreadTextEncoding(),
- OUSTRING_TO_OSTRING_CVTFLAGS );
- pszProfileName = rtl_string_getStr(strProfileName);
-
- if ( strncmp(pszProfileName,"//./",4) != 0 )
- {
- rtl_string_release(strProfileName);
- return 0;
- }
- pszProfileName+=3;
- }
-
+ FileURLToPath( profilePath, PATH_MAX, ustrProfileName );
- pProfile = osl_psz_openProfile(pszProfileName,Options);
-
- if ( strProfileName != 0 )
- {
- rtl_string_release(strProfileName);
- }
-
-
- return pProfile;
+ return osl_psz_openProfile( profilePath,Options );
}
@@ -1233,73 +1208,33 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
return (n);
}
-sal_Bool SAL_CALL osl_getProfileName(rtl_uString* ustrPath, rtl_uString* ustrName, rtl_uString** strProfileName)
+sal_Bool SAL_CALL osl_getProfileName(rtl_uString* ustrPath, rtl_uString* ustrName, rtl_uString** pustrProfileName)
{
sal_Bool bRet=sal_False;
- sal_Char pszBuffer[PATH_MAX];
- rtl_uString* strNativeName=0;
- rtl_String* strPath=0;
- rtl_String* strName=0;
- sal_Char* pszPath=0;
- sal_Char* pszName=0;
-
- pszBuffer[0] = '\0';
-
+ sal_Char buffer[PATH_MAX] = "";
+ rtl_uString* ustrTmp = NULL;
+ char path[PATH_MAX] = "";
+ char name[PATH_MAX] = "";
+
if ( ustrPath != 0 && ustrPath->buffer[0] != 0 )
{
- rtl_uString2String( &strPath,
- rtl_uString_getStr(ustrPath),
- rtl_uString_getLength(ustrPath),
- osl_getThreadTextEncoding(),
- OUSTRING_TO_OSTRING_CVTFLAGS );
- pszPath = rtl_string_getStr(strPath);
-
- /* Don't skip UNC prefix if metatag is used */
-
- if ( strncmp(pszPath,"//./",4) == 0 )
- {
- pszPath+=3;
- }
- else if ( strncmp(pszPath, "?", 1) != 0 )
- {
- rtl_string_release(strPath);
- return 0;
- }
+ FileURLToPath( path, PATH_MAX, ustrPath );
}
if ( ustrName != 0 && ustrName->buffer[0] != 0 )
{
- rtl_uString2String( &strName,
- rtl_uString_getStr(ustrName),
- rtl_uString_getLength(ustrName),
- osl_getThreadTextEncoding(),
- OUSTRING_TO_OSTRING_CVTFLAGS );
- pszName = rtl_string_getStr(strName);
+ FileURLToPath( name, PATH_MAX, ustrName );
}
+ bRet = osl_psz_getProfileName( path, name, buffer, PATH_MAX );
-
- bRet=osl_psz_getProfileName(pszPath,pszName,pszBuffer,sizeof(pszBuffer));
-
-
- if ( strPath != 0 )
+ if( bRet )
{
- rtl_string_release(strPath);
+ rtl_string2UString( &ustrTmp, buffer, strlen( buffer ), osl_getThreadTextEncoding(), OUSTRING_TO_OSTRING_CVTFLAGS );
+ osl_getFileURLFromSystemPath( ustrTmp, pustrProfileName );
+ rtl_uString_release( ustrTmp );
}
-
- if ( strName != 0 )
- {
- rtl_string_release(strName);
- }
-
- /* Convert result to UNC notation */
-
- rtl_string2UString( &strNativeName, pszBuffer, rtl_str_getLength( pszBuffer ), osl_getThreadTextEncoding(), OUSTRING_TO_OSTRING_CVTFLAGS );
-
- osl_normalizePath( strNativeName, strProfileName );
- rtl_uString_release( strNativeName );
-
return bRet;
}