diff options
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/os2/debug.c | 6 | ||||
-rw-r--r-- | sal/osl/os2/file.cxx | 211 | ||||
-rw-r--r-- | sal/osl/os2/file_url.cxx | 615 | ||||
-rw-r--r-- | sal/osl/os2/helpers/debug.h | 11 | ||||
-rw-r--r-- | sal/osl/os2/helpers/setup.h | 8 | ||||
-rw-r--r-- | sal/osl/os2/libutil.c | 52 | ||||
-rw-r--r-- | sal/osl/os2/makefile.mk | 1 | ||||
-rw-r--r-- | sal/osl/os2/process.c | 21 | ||||
-rw-r--r-- | sal/osl/os2/profile.c | 526 | ||||
-rw-r--r-- | sal/osl/os2/socket.c | 251 | ||||
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 10 | ||||
-rw-r--r-- | sal/osl/unx/socket.c | 186 | ||||
-rw-r--r-- | sal/osl/w32/file_url.cxx | 7 | ||||
-rw-r--r-- | sal/osl/w32/profile.cxx | 5 | ||||
-rw-r--r-- | sal/osl/w32/socket.cxx | 19 |
15 files changed, 2 insertions, 1927 deletions
diff --git a/sal/osl/os2/debug.c b/sal/osl/os2/debug.c index f2d0f915f375..bfa2a9ee0469 100644 --- a/sal/osl/os2/debug.c +++ b/sal/osl/os2/debug.c @@ -2090,14 +2090,12 @@ VOID dbgPrintStack(FILE *LogFile, // in: text log file to write to if (!fExceptionAddress) { LastEbp = Ebp; -#if 0 - Ebp = (PUSHORT) MAKEULONG(Bp, Sp); -#else // Inserted by Kim Rasmussen 26/06 1996 to allow big stacks + if (f32bit) Ebp = (PUSHORT) *(PULONG) LastEbp; else Ebp = (PUSHORT) MAKEULONG((*Ebp), Sp); -#endif + if (f32bit) { dbgPrintVariables(LogFile, (ULONG) Ebp); diff --git a/sal/osl/os2/file.cxx b/sal/osl/os2/file.cxx index f6e41a78fee6..7430f0a4c3b7 100644 --- a/sal/osl/os2/file.cxx +++ b/sal/osl/os2/file.cxx @@ -480,14 +480,6 @@ oslFileError SAL_CALL osl_closeDirectory( oslDirectory Directory ) case DIRECTORYTYPE_LOCALROOT: err = osl_File_E_None; break; -#if 0 - case DIRECTORYTYPE_NETROOT: - { - DWORD err = WNetCloseEnum(pDirImpl->hDirectory); - eError = (err == NO_ERROR) ? osl_File_E_None : MapError(err); - } - break; -#endif default: OSL_ENSURE( 0, "Invalid directory type" ); break; @@ -2575,209 +2567,6 @@ static oslFileError osl_psz_setFileTime( const sal_Char* pszFilePath, } -/***************************************** - * osl_psz_removeFile - ****************************************/ -#if 0 -static oslFileError osl_psz_removeFile( const sal_Char* pszPath ) -{ - int nRet=0; - struct stat aStat; - - nRet = stat(pszPath,&aStat); - if ( nRet < 0 ) - { - nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); - } - - if ( S_ISDIR(aStat.st_mode) ) - { - return osl_File_E_ISDIR; - } - - nRet = unlink(pszPath); - if ( nRet < 0 ) - { - nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); - } - - return osl_File_E_None; -} -#endif - -/***************************************** - * osl_psz_createDirectory - ****************************************/ -#if 0 -static oslFileError osl_psz_createDirectory( const sal_Char* pszPath ) -{ - int nRet=0; - int mode = S_IRWXU | S_IRWXG | S_IRWXO; - - nRet = mkdir(pszPath,mode); - - if ( nRet < 0 ) - { - nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); - } - - return osl_File_E_None; -} -#endif -/***************************************** - * osl_psz_removeDirectory - ****************************************/ -#if 0 -static oslFileError osl_psz_removeDirectory( const sal_Char* pszPath ) -{ - int nRet=0; - - nRet = rmdir(pszPath); - - if ( nRet < 0 ) - { - nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); - } - - return osl_File_E_None; -} -#endif -/***************************************** - * oslDoMoveFile - ****************************************/ -#if 0 -static oslFileError oslDoMoveFile( const sal_Char* pszPath, const sal_Char* pszDestPath) -{ - oslFileError tErr=osl_File_E_invalidError; - - tErr = osl_psz_moveFile(pszPath,pszDestPath); - if ( tErr == osl_File_E_None ) - { - return tErr; - } - - if ( tErr != osl_File_E_XDEV ) - { - return tErr; - } - - tErr=osl_psz_copyFile(pszPath,pszDestPath); - - if ( tErr != osl_File_E_None ) - { - oslFileError tErrRemove; - tErrRemove=osl_psz_removeFile(pszDestPath); - return tErr; - } - - tErr=osl_psz_removeFile(pszPath); - - return tErr; -} -#endif -/***************************************** - * osl_psz_moveFile - ****************************************/ -#if 0 -static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* pszDestPath) -{ - - int nRet = 0; - - nRet = rename(pszPath,pszDestPath); - - if ( nRet < 0 ) - { - nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); - } - - return osl_File_E_None; -} -#endif -/***************************************** - * osl_psz_copyFile - ****************************************/ -#if 0 -static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* pszDestPath ) -{ - time_t nAcTime=0; - time_t nModTime=0; - uid_t nUID=0; - gid_t nGID=0; - int nRet=0; - mode_t nMode=0; - struct stat aFileStat; - oslFileError tErr=osl_File_E_invalidError; - size_t nSourceSize=0; - int DestFileExists=1; - - /* mfe: does the source file really exists? */ - nRet = lstat(pszPath,&aFileStat); - - if ( nRet < 0 ) - { - nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); - } - - /* mfe: we do only copy files here! */ - if ( S_ISDIR(aFileStat.st_mode) ) - { - return osl_File_E_ISDIR; - } - - nSourceSize=(size_t)aFileStat.st_size; - nMode=aFileStat.st_mode; - nAcTime=aFileStat.st_atime; - nModTime=aFileStat.st_mtime; - nUID=aFileStat.st_uid; - nGID=aFileStat.st_gid; - - nRet = stat(pszDestPath,&aFileStat); - if ( nRet < 0 ) - { - nRet=errno; - - if ( nRet == ENOENT ) - { - DestFileExists=0; - } -/* return oslTranslateFileError(nRet);*/ - } - - /* mfe: the destination file must not be a directory! */ - if ( nRet == 0 && S_ISDIR(aFileStat.st_mode) ) - { - return osl_File_E_ISDIR; - } - else - { - /* mfe: file does not exists or is no dir */ - } - - tErr = oslDoCopy(pszPath,pszDestPath,nMode,nSourceSize,DestFileExists); - - if ( tErr != osl_File_E_None ) - { - return tErr; - } - - /* - * mfe: ignore return code - * since only the success of the copy is - * important - */ - oslChangeFileModes(pszDestPath,nMode,nAcTime,nModTime,nUID,nGID); - - return tErr; -} -#endif - /****************************************************************************** * * Utility Functions diff --git a/sal/osl/os2/file_url.cxx b/sal/osl/os2/file_url.cxx index 57508bd44687..395cfea13e41 100644 --- a/sal/osl/os2/file_url.cxx +++ b/sal/osl/os2/file_url.cxx @@ -346,14 +346,7 @@ DWORD WINAPI IsValidFilePath(LPCTSTR lpszPath, LPCTSTR *lppError, DWORD dwFlags) if ( !lpComponent ) { -#if 0 - /* We only have a Server specification what is invalid */ - - lpComponent = lpszPath; - fValid = FALSE; -#else dwPathType |= PATHTYPE_IS_SERVER; -#endif } else { @@ -653,118 +646,6 @@ oslFileError SAL_CALL _osl_getFileURLFromSystemPath( rtl_uString* strPath, rtl_u oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath, rtl_uString **pustrFileURL ) { return _osl_getFileURLFromSystemPath( ustrSystemPath, pustrFileURL ); -#if 0 - static const sal_Unicode pDoubleSlash[2] = { '/', '/' }; - - rtl_uString *pTmp = NULL; - sal_Int32 nIndex; - - if( 0 == ustrSystemPath->length ) - return osl_File_E_INVAL; - - /* YD convert '\' to '/' */ - rtl_ustr_replaceChar( ustrSystemPath->buffer, '\\', '/' ); - - /* temporary hack: if already file url, return ustrSystemPath */ - if( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( ustrSystemPath->buffer, ustrSystemPath->length,"file:", 5 ) ) - { - /* - if( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( ustrSystemPath->buffer, ustrSystemPath->length,"file://", 7 ) ) - { - OSL_ENSURE( 0, "osl_getFileURLFromSystemPath: input is already file URL" ); - rtl_uString_assign( pustrFileURL, ustrSystemPath ); - } - else - { - rtl_uString *pTmp2 = NULL; - - OSL_ENSURE( 0, "osl_getFileURLFromSystemPath: input is wrong file URL" ); - rtl_uString_newFromStr_WithLength( pustrFileURL, ustrSystemPath->buffer + 5, ustrSystemPath->length - 5 ); - rtl_uString_newFromAscii( &pTmp2, "file://" ); - rtl_uString_newConcat( pustrFileURL, *pustrFileURL, pTmp2 ); - rtl_uString_release( pTmp2 ); - } - return osl_File_E_None; - */ - return osl_File_E_INVAL; - } - - - /* check if system path starts with ~ or ~user and replace it with the appropriate home dir */ - if( (sal_Unicode) '~' == ustrSystemPath->buffer[0] ) - { - /* check if another user is specified */ - if( ( 1 == ustrSystemPath->length ) || ( (sal_Unicode)'/' == ustrSystemPath->buffer[1] ) ) - { - /* osl_getHomeDir returns file URL */ - osl_getHomeDir( osl_getCurrentSecurity(), &pTmp ); - - /* remove "file://" prefix */ - rtl_uString_newFromStr_WithLength( &pTmp, pTmp->buffer + 7, pTmp->length - 7 ); - - /* replace '~' in original string */ - rtl_uString_newReplaceStrAt( &pTmp, ustrSystemPath, 0, 1, pTmp ); - } - - else - { - /* FIXME: replace ~user with users home directory */ - return osl_File_E_INVAL; - } - } - - /* check if initial string contains double instances of '/' */ - nIndex = rtl_ustr_indexOfStr_WithLength( ustrSystemPath->buffer, ustrSystemPath->length, pDoubleSlash, 2 ); - if( -1 != nIndex ) - { - sal_Int32 nSrcIndex; - sal_Int32 nDeleted = 0; - - /* if pTmp is not already allocated, copy ustrSystemPath for modification */ - if( NULL == pTmp ) - rtl_uString_newFromString( &pTmp, ustrSystemPath ); - - /* adapt index to pTmp */ - nIndex += pTmp->length - ustrSystemPath->length; - - /* remove all occurances of '//' */ - for( nSrcIndex = nIndex + 1; nSrcIndex < pTmp->length; nSrcIndex++ ) - { - if( ((sal_Unicode) '/' == pTmp->buffer[nSrcIndex]) && ((sal_Unicode) '/' == pTmp->buffer[nIndex]) ) - nDeleted++; - else - pTmp->buffer[++nIndex] = pTmp->buffer[nSrcIndex]; - } - - /* adjust length member */ - pTmp->length -= nDeleted; - } - - if( NULL == pTmp ) - rtl_uString_assign( &pTmp, ustrSystemPath ); - - /* temporary check for top 5 wrong usage strings (which are valid but unlikly filenames) */ - /* - OSL_ASSERT( !findWrongUsage( pTmp->buffer, pTmp->length ) ); - */ - - /* file URLs must be URI encoded */ - rtl_uriEncode( pTmp, uriCharClass, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8, pustrFileURL ); - - rtl_uString_release( pTmp ); - - /* absolute urls should start with 'file://' */ - if( (sal_Unicode)'/' == (*pustrFileURL)->buffer[0] ) - { - rtl_uString *pProtocol = NULL; - - rtl_uString_newFromAscii( &pProtocol, "file://" ); - rtl_uString_newConcat( pustrFileURL, pProtocol, *pustrFileURL ); - rtl_uString_release( pProtocol ); - } - - return osl_File_E_None; -#endif } //############################################# @@ -869,140 +750,6 @@ oslFileError SAL_CALL _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uS oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath ) { return _osl_getSystemPathFromFileURL( ustrFileURL, pustrSystemPath, sal_True ); -#if 0 - sal_Int32 nIndex = 0; - rtl_uString * pTmp = NULL; - - sal_Unicode encodedSlash[3] = { '%', '2', 'F' }; - - /* temporary hack: if already system path, return ustrFileURL */ - /* - if( (sal_Unicode) '/' == ustrFileURL->buffer[0] ) - { - OSL_ENSURE( 0, "osl_getSystemPathFromFileURL: input is already system path" ); - rtl_uString_assign( pustrSystemPath, ustrFileURL ); - return osl_File_E_None; - } - */ - - /* a valid file url may not start with '/' */ - if( ( 0 == ustrFileURL->length ) || ( (sal_Unicode) '/' == ustrFileURL->buffer[0] ) ) - { - return osl_File_E_INVAL; - } - - /* search for encoded slashes (%2F) and decode every single token if we find one */ - if( -1 != rtl_ustr_indexOfStr_WithLength( ustrFileURL->buffer, ustrFileURL->length, encodedSlash, 3 ) ) - { - rtl_uString * ustrPathToken = NULL; - sal_Int32 nOffset = 7; - - do - { - nOffset += nIndex; - - /* break url down in '/' devided tokens tokens */ - nIndex = rtl_ustr_indexOfChar_WithLength( ustrFileURL->buffer + nOffset, ustrFileURL->length - nOffset, (sal_Unicode) '/' ); - - /* copy token to new string */ - rtl_uString_newFromStr_WithLength( &ustrPathToken, ustrFileURL->buffer + nOffset, - -1 == nIndex ? ustrFileURL->length - nOffset : nIndex++ ); - - /* decode token */ - rtl_uriDecode( ustrPathToken, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8, &pTmp ); - - /* the result should not contain any '/' */ - if( -1 != rtl_ustr_indexOfChar_WithLength( pTmp->buffer, pTmp->length, (sal_Unicode) '/' ) ) - { - rtl_uString_release( pTmp ); - rtl_uString_release( ustrPathToken ); - - return osl_File_E_INVAL; - } - - } while( -1 != nIndex ); - - /* release temporary string and restore index variable */ - rtl_uString_release( ustrPathToken ); - nIndex = 0; - } - - /* protocol and server should not be encoded, so decode the whole string */ - rtl_uriDecode( ustrFileURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8, &pTmp ); - - /* check if file protocol specified */ - /* FIXME: use rtl_ustr_ascii_shortenedCompareIgnoreCase_WithLength when available */ - if( 7 <= pTmp->length ) - { - rtl_uString * pProtocol = NULL; - rtl_uString_newFromStr_WithLength( &pProtocol, pTmp->buffer, 7 ); - - /* protocol is case insensitive */ - rtl_ustr_toAsciiLowerCase_WithLength( pProtocol->buffer, pProtocol->length ); - - if( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pProtocol->buffer, pProtocol->length,"file://", 7 ) ) - nIndex = 7; - - rtl_uString_release( pProtocol ); - } - - /* skip "localhost" or "127.0.0.1" if "file://" is specified */ - /* FIXME: use rtl_ustr_ascii_shortenedCompareIgnoreCase_WithLength when available */ - if( nIndex && ( 10 <= pTmp->length - nIndex ) ) - { - rtl_uString * pServer = NULL; - rtl_uString_newFromStr_WithLength( &pServer, pTmp->buffer + nIndex, 10 ); - - /* server is case insensitive */ - rtl_ustr_toAsciiLowerCase_WithLength( pServer->buffer, pServer->length ); - - if( ( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pServer->buffer, pServer->length,"localhost/", 10 ) ) || - ( 0 == rtl_ustr_ascii_shortenedCompare_WithLength( pServer->buffer, pServer->length,"127.0.0.1/", 10 ) ) ) - { - /* don't exclude the '/' */ - nIndex += 9; - } - - rtl_uString_release( pServer ); - } - - if( nIndex ) - rtl_uString_newFromStr_WithLength( &pTmp, pTmp->buffer + nIndex, pTmp->length - nIndex ); - - /* check if system path starts with ~ or ~user and replace it with the appropriate home dir */ - if( (sal_Unicode) '~' == pTmp->buffer[0] ) - { - /* check if another user is specified */ - if( ( 1 == pTmp->length ) || ( (sal_Unicode)'/' == pTmp->buffer[1] ) ) - { - rtl_uString *pTmp2 = NULL; - - /* osl_getHomeDir returns file URL */ - osl_getHomeDir( osl_getCurrentSecurity(), &pTmp2 ); - - /* remove "file://" prefix */ - rtl_uString_newFromStr_WithLength( &pTmp2, pTmp2->buffer + 7, pTmp2->length - 7 ); - - /* replace '~' in original string */ - rtl_uString_newReplaceStrAt( &pTmp, pTmp, 0, 1, pTmp2 ); - rtl_uString_release( pTmp2 ); - } - - else - { - /* FIXME: replace ~user with users home directory */ - return osl_File_E_INVAL; - } - } - - /* temporary check for top 5 wrong usage strings (which are valid but unlikly filenames) */ - /* - OSL_ASSERT( !findWrongUsage( pTmp->buffer, pTmp->length ) ); - */ - - *pustrSystemPath = pTmp; - return osl_File_E_None; -#endif // 0 } @@ -1016,336 +763,8 @@ oslFileError osl_getSystemPathFromFileURL_Ex( rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath, sal_Bool bAllowRelative) { return _osl_getSystemPathFromFileURL( ustrFileURL, pustrSystemPath, bAllowRelative); -#if 0 - rtl_uString* temp = 0; - oslFileError osl_error = osl_getSystemPathFromFileURL(ustrFileURL, &temp); - - if (osl_File_E_None == osl_error) - { - if (bAllowRelative - || (UNICHAR_SLASH == temp->buffer[0]) - || (UNICHAR_COLON == temp->buffer[1] && UNICHAR_SLASH == temp->buffer[2])) - { - *pustrSystemPath = temp; - } - else - { - rtl_uString_release(temp); - osl_error = osl_File_E_INVAL; - } - } - - return osl_error; -#endif } -namespace /* private */ -{ - -#if 0 // YD - - /****************************************************** - * Helper function, return a pinter to the final '\0' - * of a string - ******************************************************/ - - sal_Unicode* ustrtoend(sal_Unicode* pStr) - { - return (pStr + rtl_ustr_getLength(pStr)); - } - - /********************************************* - - ********************************************/ - sal_Unicode* ustrcpy(const sal_Unicode* s, sal_Unicode* d) - { - const sal_Unicode* sc = s; - sal_Unicode* dc = d; - - while ((*dc++ = *sc++)) - /**/; - - return d; - } - - /********************************************* - - ********************************************/ - - sal_Unicode* ustrncpy(const sal_Unicode* s, sal_Unicode* d, unsigned int n) - { - const sal_Unicode* sc = s; - sal_Unicode* dc = d; - unsigned int i = n; - - while (i--) - *dc++ = *sc++; - - if (n) - *dc = 0; - - return d; - } - - /********************************************* - - ********************************************/ - - sal_Unicode* ustrchrcat(const sal_Unicode chr, sal_Unicode* d) - { - sal_Unicode* p = ustrtoend(d); - *p++ = chr; - *p = 0; - return d; - } - - /********************************************* - - ********************************************/ - - sal_Unicode* ustrcat(const sal_Unicode* s, sal_Unicode* d) - { - sal_Unicode* dc = ustrtoend(d); - ustrcpy(s, dc); - return d; - } - - /****************************************************** - * - ******************************************************/ - - bool _islastchr(sal_Unicode* pStr, sal_Unicode Chr) - { - sal_Unicode* p = ustrtoend(pStr); - if (p > pStr) - p--; - return (*p == Chr); - } - - /****************************************************** - * Ensure that the given string has the specified last - * character if necessary append it - ******************************************************/ - - sal_Unicode* _strensurelast(sal_Unicode* pStr, sal_Unicode Chr) - { - if (!_islastchr(pStr, Chr)) - ustrchrcat(Chr, pStr); - return pStr; - } - - /****************************************************** - * Remove the last part of a path, a path that has - * only a '/' or no '/' at all will be returned - * unmodified - ******************************************************/ - - sal_Unicode* _rmlastpathtoken(sal_Unicode* aPath) - { - /* we always may skip -2 because we - may at least stand on a '/' but - either there is no other character - before this '/' or it's another - character than the '/' - */ - sal_Unicode* p = ustrtoend(aPath) - 2; - - // move back to the next path separator - // or to the start of the string - while ((p > aPath) && (*p != UNICHAR_SLASH)) - p--; - - if (p >= aPath) - { - if (UNICHAR_SLASH == *p) - { - p++; - *p = '\0'; - } - else - { - *p = '\0'; - } - } - - return aPath; - } - - /****************************************************** - * - ******************************************************/ - - oslFileError _osl_resolvepath( - /*inout*/ sal_Unicode* path, - /*inout*/ sal_Unicode* current_pos, - /*in */ sal_Unicode* sentinel, - /*inout*/ bool* failed) - { - oslFileError ferr = osl_File_E_None; - - if (!*failed) - { - char unresolved_path[PATH_MAX]; - if (!UnicodeToText(unresolved_path, sizeof(unresolved_path), path, rtl_ustr_getLength(path))) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); - - char resolved_path[PATH_MAX]; - if (realpath(unresolved_path, resolved_path)) - { - if (!TextToUnicode(resolved_path, strlen(resolved_path), path, PATH_MAX)) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); - - current_pos = ustrtoend(path) - 1; - } - else - { - if (EACCES == errno || ENOTDIR == errno || ENOENT == errno) - *failed = true; - else - ferr = oslTranslateFileError(OSL_FET_ERROR, errno); - } - } - - return ferr; - } - - /****************************************************** - * Works even with non existing paths. The resulting - * path must not exceed PATH_MAX else - * osl_File_E_NAMETOOLONG is the result - ******************************************************/ - - oslFileError osl_getAbsoluteFileURL_impl_(const rtl::OUString& unresolved_path, rtl::OUString& resolved_path) - { - // the given unresolved path must not exceed PATH_MAX - if (unresolved_path.getLength() >= (PATH_MAX - 2)) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); - - sal_Unicode path_resolved_so_far[PATH_MAX]; - const sal_Unicode* punresolved = unresolved_path.getStr(); - sal_Unicode* presolvedsf = path_resolved_so_far; - - // reserve space for leading '/' and trailing '\0' - // do not exceed this limit - sal_Unicode* sentinel = path_resolved_so_far + PATH_MAX - 2; - - // if realpath fails with error ENOTDIR, EACCES or ENOENT - // we will not call it again, because _osl_realpath should also - // work with non existing directories etc. - bool realpath_failed = false; - oslFileError ferr; - - path_resolved_so_far[0] = '\0'; - - while (*punresolved != '\0') - { - // ignore '/.' , skip one part back when '/..' - - if ((UNICHAR_DOT == *punresolved) && (UNICHAR_SLASH == *presolvedsf)) - { - if ('\0' == *(punresolved + 1)) - { - punresolved++; - continue; - } - else if (UNICHAR_SLASH == *(punresolved + 1)) - { - punresolved += 2; - continue; - } - else if ((UNICHAR_DOT == *(punresolved + 1)) && ('\0' == *(punresolved + 2) || (UNICHAR_SLASH == *(punresolved + 2)))) - { - _rmlastpathtoken(path_resolved_so_far); - - presolvedsf = ustrtoend(path_resolved_so_far) - 1; - - if (UNICHAR_SLASH == *(punresolved + 2)) - punresolved += 3; - else - punresolved += 2; - - continue; - } - else // a file or directory name may start with '.' - { - if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); - - ustrchrcat(*punresolved++, path_resolved_so_far); - - if ('\0' == *punresolved && !realpath_failed) - { - ferr = _osl_resolvepath( - path_resolved_so_far, - presolvedsf, - sentinel, - &realpath_failed); - - if (osl_File_E_None != ferr) - return ferr; - } - } - } - else if (UNICHAR_SLASH == *punresolved) - { - if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); - - ustrchrcat(*punresolved++, path_resolved_so_far); - - if (!realpath_failed) - { - ferr = _osl_resolvepath( - path_resolved_so_far, - presolvedsf, - sentinel, - &realpath_failed); - - if (osl_File_E_None != ferr) - return ferr; - - if (!_islastchr(path_resolved_so_far, UNICHAR_SLASH)) - { - if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); - - ustrchrcat(UNICHAR_SLASH, path_resolved_so_far); - } - } - } - else // any other character - { - if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); - - ustrchrcat(*punresolved++, path_resolved_so_far); - - if ('\0' == *punresolved && !realpath_failed) - { - ferr = _osl_resolvepath( - path_resolved_so_far, - presolvedsf, - sentinel, - &realpath_failed); - - if (osl_File_E_None != ferr) - return ferr; - } - } - } - - sal_Int32 len = rtl_ustr_getLength(path_resolved_so_far); - - OSL_ASSERT(len < PATH_MAX); - - resolved_path = rtl::OUString(path_resolved_so_far, len); - - return osl_File_E_None; - } - -#endif // 0 // YD - -} // end namespace private #if OSL_DEBUG_LEVEL > 0 @@ -1455,40 +874,6 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr rtl_uString_release( ustrRelSysPath ); return eError; -#if 0 - FileBase::RC rc; - rtl::OUString unresolved_path; - - rc = FileBase::getSystemPathFromFileURL(rtl::OUString(ustrRelativeURL), unresolved_path); - - if(FileBase::E_None != rc) - return oslFileError(rc); - - if (systemPathIsRelativePath(unresolved_path)) - { - rtl::OUString base_path; - rc = (FileBase::RC) osl_getSystemPathFromFileURL_Ex(ustrBaseDirURL, &base_path.pData, sal_False); - - if (FileBase::E_None != rc) - return oslFileError(rc); - - rtl::OUString abs_path; - systemPathMakeAbsolutePath(base_path, unresolved_path, abs_path); - - unresolved_path = abs_path; - } - - rtl::OUString resolved_path; - rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path); - - if (FileBase::E_None == rc) - { - rc = (FileBase::RC) osl_getFileURLFromSystemPath(resolved_path.pData, pustrAbsoluteURL); - OSL_ASSERT(FileBase::E_None == rc); - } - - return oslFileError(rc); -#endif // 0 } diff --git a/sal/osl/os2/helpers/debug.h b/sal/osl/os2/helpers/debug.h index 83edca5db676..f5cc2a59b094 100644 --- a/sal/osl/os2/helpers/debug.h +++ b/sal/osl/os2/helpers/debug.h @@ -326,17 +326,6 @@ BYTE name_len; // Length of name (wich follows) }; - #if 0 - // Linenumbers header - struct linhead_rec - { - BYTE id; // 0x95 for flat mem, 32 bit progs - USHORT length; // Record length - USHORT base_group; // Base group - USHORT base_segment; // Base segment - }; - #endif - // First linenumber record struct linfirst_rec { diff --git a/sal/osl/os2/helpers/setup.h b/sal/osl/os2/helpers/setup.h index b9c6e50f0111..716db473bd53 100644 --- a/sal/osl/os2/helpers/setup.h +++ b/sal/osl/os2/helpers/setup.h @@ -58,14 +58,6 @@ typedef unsigned short APIRET16; typedef unsigned long APIRET32; -#if 0 -//YD do not use with gcc 3.3.5 - #define _System - #define APIENTRY - // with VAC++, this defines _System linkage, which - // EMX doesn't have, or does it?!? -#endif // 0 - #endif // the following is a VAC++-specific macro, which doesn't exist diff --git a/sal/osl/os2/libutil.c b/sal/osl/os2/libutil.c deleted file mode 100644 index e0f94a8b3235..000000000000 --- a/sal/osl/os2/libutil.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if 0 // YD - -#include <windows.h> - -static BOOL g_bInit = FALSE; -static DWORD g_dwPlatformId = VER_PLATFORM_WIN32_WINDOWS; - -DWORD GetPlatformId() -{ - - if (!g_bInit) - { - OSVERSIONINFO aInfo; - - aInfo.dwOSVersionInfoSize = sizeof(aInfo); - if (GetVersionEx(&aInfo)) - g_dwPlatformId = aInfo.dwPlatformId; - - g_bInit = TRUE; - } - - return g_dwPlatformId; -} - -#endif // 0 diff --git a/sal/osl/os2/makefile.mk b/sal/osl/os2/makefile.mk index c9bfd3f96771..d677866945a1 100644 --- a/sal/osl/os2/makefile.mk +++ b/sal/osl/os2/makefile.mk @@ -82,7 +82,6 @@ SLOFILES= $(SLO)$/conditn.obj \ OBJFILES= $(OBJ)$/conditn.obj \ $(OBJ)$/diagnose.obj \ - $(OBJ)$/libutil.obj \ $(OBJ)$/semaphor.obj \ $(OBJ)$/interlck.obj \ $(OBJ)$/nlsupport.obj\ diff --git a/sal/osl/os2/process.c b/sal/osl/os2/process.c index cdc26b63963a..8c645222aa50 100644 --- a/sal/osl/os2/process.c +++ b/sal/osl/os2/process.c @@ -141,27 +141,6 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( char szImagePath[PATH_MAX] = ""; char szWorkDir[PATH_MAX] = ""; -#if 0 - if (Options & osl_Process_SEARCHPATH) - { - const rtl::OUString PATH1; - OUString PATH (RTL_CONSTASCII_USTRINGPARAM("PATH")); - - rtl_uString * pSearchPath = 0; - osl_getEnvironment (PATH.pData, &pSearchPath); - if (pSearchPath) - { - rtl_uString * pSearchResult = 0; - osl_searchPath (ustrImageName, pSearchPath, &pSearchResult); - if (pSearchResult) - { - rtl_uString_assign (ustrImageName, pSearchResult); - rtl_uString_release (pSearchResult); - } - rtl_uString_release (pSearchPath); - } - } -#endif if ( ustrImageName && ustrImageName->length ) { diff --git a/sal/osl/os2/profile.c b/sal/osl/os2/profile.c index 38901fedb3d4..ac2e2b67daa1 100644 --- a/sal/osl/os2/profile.c +++ b/sal/osl/os2/profile.c @@ -873,224 +873,6 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff return (n); } -#if 0 // YD -sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName) -{ - sal_Bool bFailed; - sal_Char File[_MAX_PATH]; - sal_Char Path[_MAX_PATH]; - sal_uInt32 nFileLen; - sal_uInt32 nPathLen = 0; - - rtl_uString * strTmp = NULL; - oslFileError nError; - - /* build file name */ - if (strName && strName->length) - { - if(strName->length >= _MAX_PATH) - return sal_False; - - strcpy(File, (char*)strName->buffer); - nFileLen = strName->length; - - if (rtl_ustr_indexOfChar( File, L'.' ) == -1) - { - if (nFileLen + strlen(STR_INI_EXTENSION) >= _MAX_PATH) - return sal_False; - - /* add default extension */ - strcpy(File + nFileLen, STR_INI_EXTENSION); - nFileLen += strlen(STR_INI_EXTENSION); - } - } - else - { - rtl_uString *strProgName = NULL; - sal_Unicode *pProgName; - sal_Int32 nOffset = 0; - sal_Int32 nLen; - sal_Int32 nPos; - - if (osl_getExecutableFile(&strProgName) != osl_Process_E_None) - return sal_False; - - /* remove path and extension from filename */ - pProgName = strProgName->buffer; - nLen = strProgName->length ; - - if ((nPos = rtl_ustr_lastIndexOfChar( pProgName, L'/' )) != -1) - nOffset = nPos + 1; - else if ((nPos = rtl_ustr_lastIndexOfChar( pProgName, L':' )) != -1) - nOffset = nPos + 1; - - if ((nPos = rtl_ustr_lastIndexOfChar( pProgName, L'.' )) != -1 ) - nLen -= 4; - - if ((nFileLen = nLen - nOffset) >= _MAX_PATH) - return sal_False; - - strncpy(File, pProgName + nOffset, nFileLen); - - if (nFileLen + strlen(STR_INI_EXTENSION) >= _MAX_PATH) - return sal_False; - - /* add default extension */ - strcpy(File + nFileLen, STR_INI_EXTENSION); - nFileLen += strlen(STR_INI_EXTENSION); - - rtl_uString_release( strProgName ); - } - - if (File[0] == 0) - return sal_False; - - /* build directory path */ - if (strPath && strPath->length) - { - sal_Unicode *pPath = rtl_uString_getStr(strPath); - sal_Int32 nLen = rtl_uString_getLength(strPath); - - if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METAHOME) , STR_INI_METAHOME) == 0) && - ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METAHOME)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAHOME)] == '/'))) - { - rtl_uString * strHome = NULL; - oslSecurity security = osl_getCurrentSecurity(); - - bFailed = ! osl_getHomeDir(security, &strHome); - osl_freeSecurityHandle(security); - - if (bFailed) return (sal_False); - - if (strHome->length >= _MAX_PATH) - return sal_False; - - strcpy( Path, strHome->buffer); - nPathLen = strHome->length; - - if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METAHOME)) - { - pPath += RTL_CONSTASCII_LENGTH(STR_INI_METAHOME); - nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METAHOME); - - if (nLen + nPathLen >= _MAX_PATH) - return sal_False; - - strcpy(Path + nPathLen, pPath); - nPathLen += nLen; - } - - rtl_uString_release(strHome); - } - - else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METACFG), STR_INI_METACFG) == 0) && - ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METACFG)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METACFG)] == '/'))) - { - rtl_uString * strConfig = NULL; - oslSecurity security = osl_getCurrentSecurity(); - - bFailed = ! osl_getConfigDir(security, &strConfig); - osl_freeSecurityHandle(security); - - if (bFailed) return (sal_False); - - if (strConfig->length >= _MAX_PATH) - return sal_False; - - strcpy( Path, strConfig->buffer); - nPathLen = strConfig->length; - - if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METACFG)) - { - pPath += RTL_CONSTASCII_LENGTH(STR_INI_METACFG); - nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METACFG); - - if (nLen + nPathLen >= _MAX_PATH) - return sal_False; - - strcpy(Path + nPathLen, pPath); - nPathLen += nLen; - } - - rtl_uString_release(strConfig); - } - - else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METASYS), STR_INI_METASYS) == 0) && - ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METASYS)] == '/'))) - { - if (((nPathLen = GetWindowsDirectoryW(Path, _MAX_PATH)) == 0) || (nPathLen >= _MAX_PATH)) - return (sal_False); - - if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) - { - pPath += RTL_CONSTASCII_LENGTH(STR_INI_METASYS); - nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METASYS); - - if (nLen + nPathLen >= MAX_PATH) - return sal_False; - - strcpy(Path + nPathLen, pPath); - nPathLen += nLen; - } - } - - else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METAINS), STR_INI_METAINS) == 0) && - ((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METAINS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAINS)] == '/') || - (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAINS)] == '"') ) ) - { - if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), File, Path)) - return (sal_False); - - nPathLen = strlen(Path); - } - - else if(nLen < MAX_PATH) - { - strcpy(Path, pPath); - nPathLen = strlen(Path); - } - else - return sal_False; - } - else - { - rtl_uString * strConfigDir = NULL; - oslSecurity security = osl_getCurrentSecurity(); - - bFailed = ! osl_getConfigDir(security, &strConfigDir); - osl_freeSecurityHandle(security); - - if (bFailed) return (sal_False); - if (strConfigDir->length >= MAX_PATH) - return sal_False; - - strcpy(Path, strConfigDir->buffer); - nPathLen = strConfigDir->length; - } - - if (nPathLen && (Path[nPathLen - 1] != L'/') && (Path[nPathLen - 1] != L'\\')) - { - Path[nPathLen++] = L'\\'; - Path[nPathLen] = 0; - } - - if (nPathLen + nFileLen >= MAX_PATH) - return sal_False; - - /* append file name */ - strcpy(Path + nPathLen, File); - nPathLen += nFileLen; - - /* copy filename */ - rtl_uString_newFromStr_WithLength(&strTmp, Path, nPathLen); - nError = osl_getFileURLFromSystemPath(strTmp, strProfileName); - rtl_uString_release(strTmp); - - return nError == osl_File_E_None; -} -#endif // 0 // YD - - /*****************************************************************************/ /* Static Module Functions */ /*****************************************************************************/ @@ -1983,311 +1765,3 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) #endif return (sal_True); } - -#if 0 // YD -static sal_Bool lookupProfile(const sal_Char *pszPath, const sal_Char *pszFile, sal_Char *pPath) -{ - sal_Char *pChr, *pStr; - sal_Char Path[_MAX_PATH] = ""; - sal_Char Product[132] = ""; - sal_Char Buffer[1024]; - - if (*pszPath == '"') - { - int i = 0; - - pszPath++; - - while ((*pszPath != '"') && (*pszPath != '\0')) - Product[i++] = *pszPath++; - - Product[i] = '\0'; - - if (*pszPath == '"') - pszPath++; - - if ( (*pszPath == '/') || (*pszPath == '\\') ) - { - pszPath++; - } - } - else - { - /* if we have not product identfication, do a special handling for soffice.ini */ - if (stricmp(SVERSION_PROFILE, pszFile) == 0) - { - sal_Char Profile[_MAX_PATH]; - sal_Char Dir[_MAX_PATH]; - oslProfile hProfile; - - /* open sversion.ini in the system directory, and try to locate the entry - with the highest version for StarOffice */ - if ((osl_getProfileName(SVERSION_FALLBACK, SVERSION_NAME, Profile, sizeof(Profile))) && - (hProfile = osl_openProfile(Profile, osl_Profile_READLOCK))) - { - osl_getProfileSectionEntries(hProfile, SVERSION_SECTION, - Buffer, sizeof(Buffer)); - - for (pChr = Buffer; *pChr != '\0'; pChr += strlen(pChr) + 1) - { - if ((strnicmp(pChr, SVERSION_SOFFICE, sizeof(SVERSION_SOFFICE) - 1) == 0) && - (stricmp(Product, pChr) < 0)) - { - osl_readProfileString(hProfile, SVERSION_SECTION, pChr, - Dir, sizeof(Dir), ""); - - /* check for existence of path */ - if (access(Dir, 0) >= 0) - strcpy(Product, pChr); - } - } - - osl_closeProfile(hProfile); - } - - /* open sversion.ini in the users directory, and try to locate the entry - with the highest version for StarOffice */ - if ((strcmp(SVERSION_LOCATION, SVERSION_FALLBACK) != 0) && - (osl_getProfileName(SVERSION_LOCATION, SVERSION_NAME, Profile, sizeof(Profile))) && - (hProfile = osl_openProfile(Profile, osl_Profile_READLOCK))) - { - osl_getProfileSectionEntries(hProfile, SVERSION_SECTION, - Buffer, sizeof(Buffer)); - - for (pChr = Buffer; *pChr != '\0'; pChr += strlen(pChr) + 1) - { - if ((strnicmp(pChr, SVERSION_SOFFICE, sizeof(SVERSION_SOFFICE) - 1) == 0) && - (stricmp(Product, pChr) < 0)) - { - osl_readProfileString(hProfile, SVERSION_SECTION, pChr, - Dir, sizeof(Dir), ""); - - /* check for existence of path */ - if (access(Dir, 0) >= 0) - strcpy(Product, pChr); - } - } - - osl_closeProfile(hProfile); - } - - /* remove any trailing build number */ - if ((pChr = strrchr(Product, '/')) != NULL) - *pChr = '\0'; - } - } - - - /* if we have an userid option eg. "-userid:rh[/usr/home/rh/staroffice]", - this will supercede all other locations */ - if (osl_getCommandArgs(Buffer, sizeof(Buffer)) == osl_Process_E_None) - { - sal_Char *pStart, *pEnd; - - for (pChr = Buffer; *pChr != '\0'; pChr += strlen(pChr) + 1) - if (((*pChr == '-') || (*pChr == '+')) && - (strnicmp(pChr + 1, SVERSION_OPTION, sizeof(SVERSION_OPTION) - 1) == 0)) - { - if (((pStart = strchr(pChr + sizeof(SVERSION_OPTION), '[')) != NULL) && - ((pEnd = strchr(pStart + 1, ']')) != NULL)) - { - strncpy(Path, pStart + 1, pEnd - (pStart + 1)); - Path[pEnd - (pStart + 1)] = '\0'; - - /* build full path */ - if ((Path[strlen(Path) - 1] != '/') && (Path[strlen(Path) - 1] != '\\')) - { - strcat(Path, "\\"); - } - - pChr =&Path[strlen(Path)]; - if ( strlen(pszPath) <= 0 ) - { - strcat(Path,SVERSION_USER); - - if ( access(Path, 0) < 0 ) - { - *pChr='\0'; - } - } - else - { - strcat(Path, pszPath); - } - - break; - } - } - } - - if (strlen(Path) <= 0) - { - /* try to find the file in the directory of the executbale */ - if (osl_getExecutableFile(Path, sizeof(Path)) != osl_Process_E_None) - return (sal_False); - - /* seperate path from filename */ - if ((pChr = strrchr(Path, '\\')) == NULL) - if ((pChr = strrchr(Path, ':')) == NULL) - return (sal_False); - else - *pChr = '\0'; - else - *pChr = '\0'; - - /* if we have no product identification use the executable file name */ - if (strlen(Product) <= 0) - { - strcpy(Product, pChr + 1); - - /* remove extension */ - if ((pChr = strrchr(Product, '.')) != NULL) - *pChr = '\0'; - } - - /* remember last subdir */ - pStr = strrchr(Path, '\\'); - - strcat(Path, "\\"); - - if ( strlen(pszPath) <= 0 ) - { - strcat(Path, pszPath); - } - else - { - strcat(Path,pszPath); - } - - /* if file not exists, remove any specified subdirectories - like "bin" or "program" */ - if (((access(Path, 0) < 0) && (pStr != NULL)) || (strlen(pszPath) <= 0)) - { - static sal_Char *SubDirs[] = SVERSION_DIRS; - - int i = 0; - - for (i = 0; i < SAL_N_ELEMENTS(SubDirs); i++) - if (strnicmp(pStr + 1, SubDirs[i], strlen(SubDirs[i])) == 0) - { - if ( strlen(pszPath) <= 0) - { - strcpy(pStr + 1,SVERSION_USER); - if ( access(Path, 0) < 0 ) - { - *(pStr+1)='\0'; - } - } - else - { - strcpy(pStr + 1, pszPath); - } - - break; - } - } - - pChr = &Path[strlen(Path)]; - if ((Path[strlen(Path) - 1] != '/') && (Path[strlen(Path) - 1] != '\\')) - strcat(Path, "\\"); - strcat(Path, pszFile); - - if ((access(Path, 0) < 0) && (strlen(Product) > 0)) - { - sal_Char Profile[_MAX_PATH]; - oslProfile hProfile; - - /* remove appended filename */ - *pChr = '\0'; - - /* open sversion.ini in the system directory, and try to locate the entry - with the highest version for StarOffice */ - if ((osl_getProfileName(SVERSION_LOCATION, SVERSION_NAME, Profile, sizeof(Profile))) && - (hProfile = osl_openProfile(Profile, osl_Profile_READLOCK))) - { - pChr = &Product[strlen(Product)]; - - /* append build number */ - strcat(Product, "/"); - strcat(Product, BUILD_STR(SUPD)); - - osl_readProfileString(hProfile, SVERSION_SECTION, Product, - Buffer, sizeof(Buffer), ""); - - /* if not found, try it without build number */ - if (strlen(Buffer) <= 0) - { - *pChr = '\0'; - - osl_readProfileString(hProfile, SVERSION_SECTION, Product, - Buffer, sizeof(Buffer), ""); - - osl_closeProfile(hProfile); - - /* if not found, try the fallback */ - if ((strlen(Buffer) <= 0) && (strcmp(SVERSION_LOCATION, SVERSION_FALLBACK) != 0)) - { - if ((osl_getProfileName(SVERSION_FALLBACK, SVERSION_NAME, Profile, sizeof(Profile))) && - (hProfile = osl_openProfile(Profile, osl_Profile_READLOCK))) - { - /* prepare build number */ - *pChr = '/'; - - osl_readProfileString(hProfile, SVERSION_SECTION, Product, - Buffer, sizeof(Buffer), ""); - - /* if not found, try it without build number */ - if (strlen(Buffer) <= 0) - { - *pChr = '\0'; - - osl_readProfileString(hProfile, SVERSION_SECTION, Product, - Buffer, sizeof(Buffer), ""); - } - - osl_closeProfile(hProfile); - } - } - } - else - osl_closeProfile(hProfile); - - if (strlen(Buffer) > 0) - { - strcpy(Path, Buffer); - - /* build full path */ - if ((Path[strlen(Path) - 1] != '/') && (Path[strlen(Path) - 1] != '\\')) - { - if ((*pszPath != '/') && (*pszPath != '\\')) - strcat(Path, "\\"); - } - - pChr=&Path[strlen(pszPath)]; - if ( strlen(pszPath) > 0 ) - { - strcat(Path, pszPath); - } - else - { - strcat(Path,SVERSION_USER); - if ( access(Path, 0) < 0 ) - { - *pChr='\0'; - } - } - } - } - } - else - /* remove appended filename */ - *pChr = '\0'; - } - - strcpy(pPath, Path); - - return (sal_True); -} - -#endif // 0 // YD - diff --git a/sal/osl/os2/socket.c b/sal/osl/os2/socket.c index 6c171016f798..2e4ebeb65953 100644 --- a/sal/osl/os2/socket.c +++ b/sal/osl/os2/socket.c @@ -464,21 +464,6 @@ void SAL_CALL osl_psz_getLastSocketErrorDescription ( static sal_uInt32 g_nSocketImpl = 0; static sal_uInt32 g_nSocketAddr = 0; -/* sorry, must be implemented otherwise */ -#if 0 -struct LeakWarning -{ - ~LeakWarning() - { - if( g_nSocketImpl ) - OSL_TRACE( "sal_socket: %d socket instances leak\n" , g_nSocketImpl ); - if( g_nSocketAddr ) - OSL_TRACE( "sal_socket: %d socket address instances leak\n" , g_nSocketAddr ); - } -}; -LeakWarning socketWarning; -#endif - #endif /* OSL_DEBUG_LEVEL */ @@ -818,53 +803,6 @@ static sal_Bool _osl_getDomainName (sal_Char *buffer, sal_Int32 bufsiz) result = sal_False; -#if 0 // YD 17/04/06 libc panic for fork() from thread!=1 - - if (pipe (p) == 0) - { - pid_t pid; - int nStatus; - - pid = fork(); - if (pid == 0) - { - char *argv[] = - { - "/bin/domainname", - NULL - }; - - close (p[0]); - dup2 (p[1], 1); - close (p[1]); - - execv ("/bin/domainname", argv); - // arriving here means exec failed - _exit(-1); - } - else if (pid > 0) - { - sal_Int32 k = 0, n = bufsiz; - - close (p[1]); - if ((k = read (p[0], buffer, n - 1)) > 0) - { - buffer[k] = 0; - if (buffer[k - 1] == '\n') - buffer[k - 1] = 0; - result = sal_True; - } - close (p[0]); - waitpid (pid, &nStatus, 0); - } - else - { - close (p[0]); - close (p[1]); - } - } -#endif // 0 - return (result); } @@ -876,9 +814,6 @@ static sal_Char* _osl_getFullQualifiedDomainName (const sal_Char *pHostName) static sal_Char *pDomainName = NULL; sal_Char *pFullQualifiedName; -#if 0 /* OBSOLETE */ - FILE *pPipeToDomainnameExe; -#endif /* OBSOLETE */ /* get a '\0' terminated domainname */ @@ -910,72 +845,6 @@ static sal_Char* _osl_getFullQualifiedDomainName (const sal_Char *pHostName) } #endif /* NEW */ -#if 0 /* OBSOLETE */ -#ifdef SCO - - /* call 'domainname > /usr/tmp/some-tmp-file', since - popen read pclose do block or core-dump, - (even the pipe-stuff that comes with pthreads) */ - if (nLengthOfDomainName == 0) - { - sal_Char tmp_name[ L_tmpnam ]; - FILE *tmp_file; - sal_Char domain_call [ L_tmpnam + 16 ] = "domainname > "; - - tmp_name[0] = '\0'; - - tmpnam ( tmp_name ); - strcat ( domain_call, tmp_name ); - if ( (system ( domain_call ) == 0) - && ((tmp_file = fopen( tmp_name, "r" )) != NULL ) ) - { - sal_Char pDomainNameBuffer[ DOMAINNAME_LENGTH ]; - - pDomainNameBuffer[0] = '\0'; - - if ( fgets ( pDomainNameBuffer, DOMAINNAME_LENGTH, tmp_file ) ) - { - pDomainName = strdup( pDomainNameBuffer ); - nLengthOfDomainName = strlen( pDomainName ); - if ( ( nLengthOfDomainName > 0 ) - && ( pDomainName[ nLengthOfDomainName - 1] == '\n' ) ) - pDomainName[ --nLengthOfDomainName ] = '\0'; - } - fclose ( tmp_file ); - } - unlink( tmp_name ); - } - -#else /* !SCO */ - - /* read the domainname from pipe to the program domainname */ - if ( (nLengthOfDomainName == 0) - && (pPipeToDomainnameExe = popen( "domainname", "r")) ) - { - sal_Char c; - sal_Char pDomainNameBuffer[ DOMAINNAME_LENGTH ]; - sal_Char *pDomainNamePointer; - - pDomainNameBuffer[0] = '\0'; - - pDomainNamePointer = pDomainNameBuffer; - while ( ((c = getc( pPipeToDomainnameExe )) != EOF) - && (nLengthOfDomainName < (DOMAINNAME_LENGTH - 1)) ) - { - if (! isspace(c)) - { - nLengthOfDomainName++ ; - *pDomainNamePointer++ = (sal_Char)c; - } - } - *pDomainNamePointer = '\0'; - pDomainName = strdup( pDomainNameBuffer ); - - pclose( pPipeToDomainnameExe ); - } - -#endif /* !SCO */ -#endif /* OBSOLETE */ /* compose hostname and domainname */ nLengthOfHostName = strlen( pHostName ); @@ -1100,25 +969,6 @@ static oslHostAddr _osl_hostentToHostAddr (const struct hostent *he) strcpy(cn, he->h_name); -#if 0 // YD 17/04/06 win32 doesn't it. - if (_osl_isFullQualifiedDomainName(he->h_name)) - { - cn= (sal_Char *)malloc(strlen (he->h_name) + 1); - OSL_ASSERT(cn); - if (cn == NULL) - return ((oslHostAddr)NULL); - - strcpy(cn, he->h_name); - } - else - { - cn =_osl_getFullQualifiedDomainName (he->h_name); - OSL_ASSERT(cn); - if (cn == NULL) - return ((oslHostAddr)NULL); - } -#endif - pSockAddr = __osl_createSocketAddr(); OSL_ASSERT(pSockAddr); if (pSockAddr == NULL) @@ -1424,43 +1274,7 @@ oslSocketResult SAL_CALL osl_psz_getLocalHostname ( if (Addr && (pStr = osl_psz_getHostnameOfHostAddr(Addr)) != NULL) { -#if 0 /* OBSOLETE */ - sal_Char* pChr; -#endif /* OBSOLETE */ strcpy(LocalHostname, pStr); - -#if 0 /* OBSOLETE */ - /* already done by _osl_getFullQualifiedDomainName() with - much better heuristics, so this may be contraproductive */ - - /* no FQDN, last try append domain name */ - if ((pChr = strchr(LocalHostname, '.')) == NULL) - { - FILE *fp; - - pChr = &LocalHostname[strlen(LocalHostname)]; - - if ( (fp = popen("domainname", "r")) != 0 ) - { - int c; - - *pChr++ = '.'; - - while ((c = getc(fp)) != EOF) - { - if (! isspace(c)) - *pChr++ = (sal_Char)c; - } - - *pChr = '\0'; - - fclose(fp); - } - else - LocalHostname[0] = '\0'; - } -#endif /* OBSOLETE */ - } if (Addr) osl_destroyHostAddr(Addr); @@ -1720,71 +1534,6 @@ oslSocketResult SAL_CALL osl_psz_getDottedInetAddrOfSocketAddr(oslSocketAddr pAd return osl_Socket_Error; } -#if 0 /* OBSOLETE */ -/*****************************************************************************/ -/* osl_getIpxNetNumber */ -/*****************************************************************************/ -oslSocketResult SAL_CALL osl_getIpxNetNumber(oslSocketAddr Addr, - oslSocketIpxNetNumber NetNumber) - -{ - struct sockaddr_ipx* pAddr; - - pAddr= (struct sockaddr_ipx*)Addr; - - OSL_ASSERT(pAddr); - - if (pAddr && (pAddr->sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyIpx))) - { - memcpy(NetNumber, pAddr->sa_netnum, sizeof(NetNumber)); - - return osl_Socket_Ok; - } - else - return osl_Socket_Error; -} - - -/*****************************************************************************/ -/* osl_getIpxNodeNumber */ -/*****************************************************************************/ -oslSocketResult SAL_CALL osl_getIpxNodeNumber(oslSocketAddr Addr, - oslSocketIpxNodeNumber NodeNumber) - -{ - struct sockaddr_ipx* pAddr; - - pAddr= (struct sockaddr_ipx*)Addr; - - OSL_ASSERT(pAddr); - - if (pAddr && (pAddr->sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyIpx))) - { - memcpy(NodeNumber, pAddr->sa_nodenum, sizeof(NodeNumber)); - - return osl_Socket_Ok; - } - else - return osl_Socket_Error; -} - - -/*****************************************************************************/ -/* osl_getIpxSocketNumber */ -/*****************************************************************************/ -sal_Int32 SAL_CALL osl_getIpxSocketNumber(oslSocketAddr Addr) -{ - struct sockaddr_ipx* pAddr= (struct sockaddr_ipx*)Addr; - OSL_ASSERT(pAddr); - - if (pAddr && (pAddr->sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyIpx))) - return pAddr->sa_socket; - else - return OSL_INVALID_IPX_SOCKET_NO; -} - -#endif /* OBSOLETE */ - /*****************************************************************************/ /* osl_createSocket */ /*****************************************************************************/ diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 57c37b705d62..961e29775b86 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -71,16 +71,6 @@ typedef struct DIR* pDirStruct; } oslDirectoryImpl; -#if 0 -/* FIXME: reintroducing this may save some extra bytes per Item */ -typedef struct -{ - rtl_uString* ustrFileName; /* holds native file name */ - rtl_uString* ustrDirPath; /* holds native dir path */ - sal_uInt32 RefCount; -} oslDirectoryItemImpl; -#endif - DirectoryItem_Impl::DirectoryItem_Impl( rtl_uString * ustrFilePath, unsigned char DType) : m_RefCount (1), diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index a47567167721..759a1267054b 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -465,19 +465,6 @@ static sal_uInt32 g_nSocketImpl = 0; static sal_uInt32 g_nSocketAddr = 0; /* sorry, must be implemented otherwise */ -#if 0 -struct LeakWarning -{ - ~LeakWarning() - { - if( g_nSocketImpl ) - OSL_TRACE( "sal_socket: %d socket instances leak\n" , g_nSocketImpl ); - if( g_nSocketAddr ) - OSL_TRACE( "sal_socket: %d socket address instances leak\n" , g_nSocketAddr ); - } -}; -LeakWarning socketWarning; -#endif #endif /* OSL_DEBUG_LEVEL */ @@ -871,9 +858,6 @@ static sal_Char* _osl_getFullQualifiedDomainName (const sal_Char *pHostName) static sal_Char *pDomainName = NULL; sal_Char *pFullQualifiedName; -#if 0 /* OBSOLETE */ - FILE *pPipeToDomainnameExe; -#endif /* OBSOLETE */ /* get a '\0' terminated domainname */ @@ -890,7 +874,6 @@ static sal_Char* _osl_getFullQualifiedDomainName (const sal_Char *pHostName) } } -#if 1 /* NEW */ if (nLengthOfDomainName == 0) { sal_Char pDomainNameBuffer[ DOMAINNAME_LENGTH ]; @@ -904,74 +887,6 @@ static sal_Char* _osl_getFullQualifiedDomainName (const sal_Char *pHostName) } } -#endif /* NEW */ -#if 0 /* OBSOLETE */ -#ifdef SCO - - /* call 'domainname > /usr/tmp/some-tmp-file', since - popen read pclose do block or core-dump, - (even the pipe-stuff that comes with pthreads) */ - if (nLengthOfDomainName == 0) - { - sal_Char tmp_name[ L_tmpnam ]; - FILE *tmp_file; - sal_Char domain_call [ L_tmpnam + 16 ] = "domainname > "; - - tmp_name[0] = '\0'; - - tmpnam ( tmp_name ); - strcat ( domain_call, tmp_name ); - if ( (system ( domain_call ) == 0) - && ((tmp_file = fopen( tmp_name, "r" )) != NULL ) ) - { - sal_Char pDomainNameBuffer[ DOMAINNAME_LENGTH ]; - - pDomainNameBuffer[0] = '\0'; - - if ( fgets ( pDomainNameBuffer, DOMAINNAME_LENGTH, tmp_file ) ) - { - pDomainName = strdup( pDomainNameBuffer ); - nLengthOfDomainName = strlen( pDomainName ); - if ( ( nLengthOfDomainName > 0 ) - && ( pDomainName[ nLengthOfDomainName - 1] == '\n' ) ) - pDomainName[ --nLengthOfDomainName ] = '\0'; - } - fclose ( tmp_file ); - } - unlink( tmp_name ); - } - -#else /* !SCO */ - - /* read the domainname from pipe to the program domainname */ - if ( (nLengthOfDomainName == 0) - && (pPipeToDomainnameExe = popen( "domainname", "r")) ) - { - sal_Char c; - sal_Char pDomainNameBuffer[ DOMAINNAME_LENGTH ]; - sal_Char *pDomainNamePointer; - - pDomainNameBuffer[0] = '\0'; - - pDomainNamePointer = pDomainNameBuffer; - while ( ((c = getc( pPipeToDomainnameExe )) != EOF) - && (nLengthOfDomainName < (DOMAINNAME_LENGTH - 1)) ) - { - if (! isspace(c)) - { - nLengthOfDomainName++ ; - *pDomainNamePointer++ = (sal_Char)c; - } - } - *pDomainNamePointer = '\0'; - pDomainName = strdup( pDomainNameBuffer ); - - pclose( pPipeToDomainnameExe ); - } - -#endif /* !SCO */ -#endif /* OBSOLETE */ - /* compose hostname and domainname */ nLengthOfHostName = strlen( pHostName ); pFullQualifiedName = (sal_Char*) malloc( (nLengthOfHostName + 1 @@ -1409,43 +1324,7 @@ oslSocketResult SAL_CALL osl_psz_getLocalHostname ( if ((pStr = osl_psz_getHostnameOfHostAddr(Addr)) != NULL) { -#if 0 /* OBSOLETE */ - sal_Char* pChr; -#endif /* OBSOLETE */ strcpy(LocalHostname, pStr); - -#if 0 /* OBSOLETE */ - /* already done by _osl_getFullQualifiedDomainName() with - much better heuristics, so this may be contraproductive */ - - /* no FQDN, last try append domain name */ - if ((pChr = strchr(LocalHostname, '.')) == NULL) - { - FILE *fp; - - pChr = &LocalHostname[strlen(LocalHostname)]; - - if ( (fp = popen("domainname", "r")) != 0 ) - { - int c; - - *pChr++ = '.'; - - while ((c = getc(fp)) != EOF) - { - if (! isspace(c)) - *pChr++ = (sal_Char)c; - } - - *pChr = '\0'; - - fclose(fp); - } - else - LocalHostname[0] = '\0'; - } -#endif /* OBSOLETE */ - } osl_destroyHostAddr(Addr); } @@ -1704,71 +1583,6 @@ oslSocketResult SAL_CALL osl_psz_getDottedInetAddrOfSocketAddr(oslSocketAddr pAd return osl_Socket_Error; } -#if 0 /* OBSOLETE */ -/*****************************************************************************/ -/* osl_getIpxNetNumber */ -/*****************************************************************************/ -oslSocketResult SAL_CALL osl_getIpxNetNumber(oslSocketAddr Addr, - oslSocketIpxNetNumber NetNumber) - -{ - struct sockaddr_ipx* pAddr; - - pAddr= (struct sockaddr_ipx*)Addr; - - OSL_ASSERT(pAddr); - - if (pAddr && (pAddr->sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyIpx))) - { - memcpy(NetNumber, pAddr->sa_netnum, sizeof(NetNumber)); - - return osl_Socket_Ok; - } - else - return osl_Socket_Error; -} - - -/*****************************************************************************/ -/* osl_getIpxNodeNumber */ -/*****************************************************************************/ -oslSocketResult SAL_CALL osl_getIpxNodeNumber(oslSocketAddr Addr, - oslSocketIpxNodeNumber NodeNumber) - -{ - struct sockaddr_ipx* pAddr; - - pAddr= (struct sockaddr_ipx*)Addr; - - OSL_ASSERT(pAddr); - - if (pAddr && (pAddr->sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyIpx))) - { - memcpy(NodeNumber, pAddr->sa_nodenum, sizeof(NodeNumber)); - - return osl_Socket_Ok; - } - else - return osl_Socket_Error; -} - - -/*****************************************************************************/ -/* osl_getIpxSocketNumber */ -/*****************************************************************************/ -sal_Int32 SAL_CALL osl_getIpxSocketNumber(oslSocketAddr Addr) -{ - struct sockaddr_ipx* pAddr= (struct sockaddr_ipx*)Addr; - OSL_ASSERT(pAddr); - - if (pAddr && (pAddr->sa_family == FAMILY_TO_NATIVE(osl_Socket_FamilyIpx))) - return pAddr->sa_socket; - else - return OSL_INVALID_IPX_SOCKET_NO; -} - -#endif /* OBSOLETE */ - /*****************************************************************************/ /* osl_createSocket */ /*****************************************************************************/ diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index 0b1f825624ce..fb837821cfe0 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -303,14 +303,7 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u if ( !lpComponent ) { - #if 0 - /* We only have a Server specification what is invalid */ - - lpComponent = lpszPath; - fValid = FALSE; - #else dwPathType |= PATHTYPE_IS_SERVER; - #endif } else { diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx index 9e73212c22d5..fe536001a0f6 100644 --- a/sal/osl/w32/profile.cxx +++ b/sal/osl/w32/profile.cxx @@ -1275,11 +1275,6 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi if (! bWriteable) { -#if 0 -//#ifdef DEBUG_OSL_PROFILE - OSL_TRACE("opening '%s' read only\n",pszFilename); -#endif - pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx index 8f8cffd19ebc..6e0027e3e06f 100644 --- a/sal/osl/w32/socket.cxx +++ b/sal/osl/w32/socket.cxx @@ -290,25 +290,6 @@ static oslSocketError osl_SocketErrorFromNative(int nativeType) /*****************************************************************************/ static oslSocketDialupImpl *pDialupImpl = NULL; -#if 0 /* INTERNAL DEBUG ONLY */ -BOOL WINAPI __osl_autodial_Impl (DWORD dwFlags, DWORD dwReserved) -{ - return 0; -} - -BOOL WINAPI __osl_autodialHangup_Impl (DWORD dwReserved) -{ - return 1; -} - -BOOL WINAPI __osl_getConnectedState_Impl (LPDWORD lpdwFlags, DWORD dwReserved) -{ - if (lpdwFlags) - *lpdwFlags = 0; - return 0; -} -#endif /* INTERNAL DEBUG ONLY */ - /* * __osl_createSocketDialupImpl. */ |