diff options
author | Povilas Kanapickas <povilas.kanapickas@gmail.com> | 2010-10-18 16:25:37 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-10-18 16:25:47 +0100 |
commit | c189268e0ab3ec33c02c5dbabfd31b37e0b1f5ab (patch) | |
tree | 1a67096d0b39a58883f5eaabd041f187ae33b5f3 | |
parent | 17a52bb6a8d830b99605b0ecad84e50cac452a28 (diff) |
remove non-compiled code
36 files changed, 6 insertions, 3159 deletions
diff --git a/sal/inc/sal/main.h b/sal/inc/sal/main.h index b4be493cd863..51b66ad3eea6 100644 --- a/sal/inc/sal/main.h +++ b/sal/inc/sal/main.h @@ -71,14 +71,6 @@ int SAL_CALL main(int argc, char ** argv) \ /* Sorry but this is neccessary cause HINSTANCE is a typedef that differs (C++ causes an error) */ -#if 0 - -#ifndef _WINDOWS_ -#include <windows.h> -#endif - -#else /* Simulated what windows.h does */ - #ifndef WINAPI # define WINAPI __stdcall #endif @@ -95,7 +87,7 @@ int SAL_CALL main(int argc, char ** argv) \ DECLARE_HANDLE(HINSTANCE); #endif -#endif + #define SAL_WIN_WinMain \ int WINAPI WinMain( HINSTANCE _hinst, HINSTANCE _dummy, char* _cmdline, int _nshow ) \ diff --git a/sal/inc/systools/win32/snprintf.h b/sal/inc/systools/win32/snprintf.h index 79441f032fee..57afcc24937d 100644 --- a/sal/inc/systools/win32/snprintf.h +++ b/sal/inc/systools/win32/snprintf.h @@ -17,27 +17,18 @@ /* Define needed types if they are not yet defined */ -#if 0 -# ifndef _INC_STDARG -# include <stdarg.h> -# endif -#else + # ifndef _VA_LIST_DEFINED typedef char * va_list; # define _VA_LIST_DEFINED # endif -#endif -#if 0 -# ifndef _INC_WCHAR -# include <wchar.h> -# endif -#else + # ifndef _WCHAR_T_DEFINED typedef unsigned short wchar_t; # define _WCHAR_T_DEFINED # endif -#endif + #ifndef _SNPRINTF_DLLIMPORT #define _SNPRINTF_DLLIMPORT __declspec( dllimport ) @@ -65,13 +56,6 @@ _SNPRINTF_DLLIMPORT int __cdecl snwprintf( wchar_t *buffer, size_t count, const _SNPRINTF_DLLIMPORT int __cdecl snprintf( char *buffer, size_t count, const char *format, ... ); /* Conflict with STL_port inline implementation */ -#if 0 -/* UNICODE version */ -_SNPRINTF_DLLIMPORT int __cdecl vsnwprintf( wchar_t *buffer, size_t count, const wchar_t *format, va_list ap ); - -/* SBCS and MBCS version */ -_SNPRINTF_DLLIMPORT int __cdecl vsnprintf( char *buffer, size_t count, const char *format, va_list ap ); -#endif #ifdef __cplusplus } 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. */ diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index f9fde3f1c528..276ee03626c6 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -719,59 +719,6 @@ inline ::rtl::OUString getCurrentPID( void ); namespace osl_FileBase { -#if 0 //~ this function has been deprecated - //--------------------------------------------------------------------- - // testing the method - // static inline RC getCanonicalName( const ::rtl::OUString& ustrRequestedURL, ::rtl::OUString& ustrValidURL ) - // - // The illegal characters are ;+=[]',\"*\\<>/?:|. - // because getCanonicalName method is not implemented yet and will be deprecated in the future, this test is not necessary. - //--------------------------------------------------------------------- - - class getCanonicalName:public CppUnit::TestFixture - { - - public: - ::osl::FileBase::RC nError; - - void getCanonicalName_001( ) - { - ::rtl::OUString aUStr_ValidURL; - nError = ::osl::FileBase::getCanonicalName( aCanURL1, aUStr_ValidURL ); - - CPPUNIT_ASSERT_MESSAGE("test for getCanonicalName function: check valid and unused file name", - ( osl::FileBase::E_None == nError ) && aUStr_ValidURL.equalsIgnoreAsciiCase( aCanURL1 ) ); - } - - void getCanonicalName_002( ) - { - ::rtl::OUString aUStr_ValidURL; - - createTestFile( aCanURL1 ); - nError = ::osl::FileBase::getCanonicalName( aCanURL1, aUStr_ValidURL ); - deleteTestFile( aCanURL1 ); - - CPPUNIT_ASSERT_MESSAGE( " test for getCanonicalName function: an existed file name, should different from the request, it did not passed(W32)(UNX)", - ( osl::FileBase::E_None == nError ) && aUStr_ValidURL.equalsIgnoreAsciiCase( aCanURL1 ) ); - } - - void getCanonicalName_003( ) - { - ::rtl::OUString aUStr_ValidURL; - nError = ::osl::FileBase::getCanonicalName ( aCanURL2, aUStr_ValidURL ); - - CPPUNIT_ASSERT_MESSAGE( " test for getCanonicalName function: invalid file name, should different from the request, it did not passed(W32)(UNX)", - ( osl::FileBase::E_None == nError ) && aUStr_ValidURL.equalsIgnoreAsciiCase( aCanURL2 ) ); - } - - CPPUNIT_TEST_SUITE( getCanonicalName ); - CPPUNIT_TEST( getCanonicalName_001 ); - CPPUNIT_TEST( getCanonicalName_002 ); - CPPUNIT_TEST( getCanonicalName_003 ); - CPPUNIT_TEST_SUITE_END( ); - };// class getCanonicalName -#endif - //--------------------------------------------------------------------- // testing the method // static inline RC getAbsoluteFileURL( const ::rtl::OUString& ustrBaseDirectoryURL, @@ -818,161 +765,6 @@ namespace osl_FileBase }; //class getAbsoluteFileURL -/* use coding format as same as getSystemPathFromFileURL - // initialization - void setUp( ) - { - sal_Char pResultURL1[] = "/relative/file1"; - sal_Char pResultURL2[] = "/relative/file2"; - sal_Char pResultURL3[] = "/file3"; - sal_Char pResultURL4[] = "/file4"; - sal_Char pResultURL5[] = "/canonical.name"; - sal_Char pResultURL6[] = "/relative/"; - aResultURL1 = aUserDirectoryURL.concat( rtl::OUString::createFromAscii( pResultURL1 ) ); - aResultURL2 = aUserDirectoryURL.concat( rtl::OUString::createFromAscii( pResultURL2 ) ); - aResultURL3 = aUserDirectoryURL.concat( rtl::OUString::createFromAscii( pResultURL3 ) ); - aResultURL4 = aUserDirectoryURL.concat( rtl::OUString::createFromAscii( pResultURL4 ) ); - aResultURL5 = aUserDirectoryURL.concat( rtl::OUString::createFromAscii( pResultURL5 ) ); - aResultURL6 = aUserDirectoryURL.concat( rtl::OUString::createFromAscii( pResultURL6 ) ); - } - - void tearDown( ) - { - } - - // test code - void getAbsoluteFileURL_001( ) - { - ::rtl::OUString aUStr_AbsURL; - - ::osl::FileBase::RC nError11 = aFileBase.getAbsoluteFileURL( aUserDirectoryURL, aRelURL1, aUStr_AbsURL ); - ::rtl::OUString suError = ::rtl::OUString::createFromAscii("test for getAbsoluteFileURL(' "); - suError += aUserDirectoryURL; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aRelURL1; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aUStr_AbsURL; - suError += outputError( aUStr_AbsURL, aResultURL1, "' ),"); - - sal_Bool nError12 = aUStr_AbsURL.equals( aResultURL1 ); - ::osl::FileBase::RC nError21 = aFileBase.getAbsoluteFileURL( aUserDirectoryURL, aRelURL2, aUStr_AbsURL ); - sal_Bool nError22 = aUStr_AbsURL.equals( aResultURL2 ); - ::osl::FileBase::RC nError31 = aFileBase.getAbsoluteFileURL( aUserDirectoryURL, aRelURL3, aUStr_AbsURL ); - sal_Bool nError32 = aUStr_AbsURL.equals( aResultURL3 ); - ::osl::FileBase::RC nError41 = aFileBase.getAbsoluteFileURL( aUserDirectoryURL, aRelURL4, aUStr_AbsURL ); - sal_Bool nError42 = aUStr_AbsURL.equals( aResultURL4 ); - ::osl::FileBase::RC nError61 = aFileBase.getAbsoluteFileURL( aUserDirectoryURL, aRelURL6, aUStr_AbsURL ); - sal_Bool nError62 = aUStr_AbsURL.equals( aResultURL6 ); - printFileName( aUStr_AbsURL ); - printFileName( aResultURL6 ); - - CPPUNIT_ASSERT_MESSAGE("test for getAbsoluteFileURL function: valid file name with valid directory", - ( ::osl::FileBase::E_None == nError11 ) && ( sal_True == nError12 ) && - ( ::osl::FileBase::E_None == nError21 ) && ( sal_True == nError22 ) && - ( ::osl::FileBase::E_None == nError31 ) && ( sal_True == nError32 ) && - ( ::osl::FileBase::E_None == nError41 ) && ( sal_True == nError42 ) && - ( ::osl::FileBase::E_None == nError61 ) && ( sal_True == nError62 ) ); - } - - -#if ( defined UNX ) || ( defined OS2 ) //Link is not defined in Windows - void getAbsoluteFileURL_002( ) - { - ::rtl::OUString aUStr_AbsURL, aUStr_LnkFileSys( aTempDirectorySys ), aUStr_SrcFileSys( aTempDirectorySys ); - ( ( aUStr_LnkFileSys += aSlashURL ) += getCurrentPID( ) ) += ::rtl::OUString::createFromAscii("/link.file"); - ( ( aUStr_SrcFileSys += aSlashURL ) += getCurrentPID( ) ) += ::rtl::OUString::createFromAscii("/canonical.name"); - - rtl::OString strLinkFileName, strSrcFileName; - strLinkFileName = OUStringToOString( aUStr_LnkFileSys, RTL_TEXTENCODING_ASCII_US ); - strSrcFileName = OUStringToOString( aUStr_SrcFileSys, RTL_TEXTENCODING_ASCII_US ); - - createTestFile( aCanURL1 ); - sal_Int32 fd = symlink( strSrcFileName.getStr(), strLinkFileName.getStr() ); - CPPUNIT_ASSERT( fd == 0 ); - - nError = aFileBase.getAbsoluteFileURL( aUserDirectoryURL, aLnkURL1, aUStr_AbsURL ); - bOk = aUStr_AbsURL.equals( aResultURL5 ); - - ::rtl::OUString suError = ::rtl::OUString::createFromAscii("test for getAbsoluteFileURL(' "); - suError += aUserDirectoryURL; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aLnkURL1; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aUStr_AbsURL; - suError += outputError( aUStr_AbsURL, aResultURL5, "' ),"); - //printFileName(suError); - - deleteTestFile( aCanURL1 ); - fd = remove( strLinkFileName.getStr() ); - CPPUNIT_ASSERT( fd == 0 ); - - CPPUNIT_ASSERT_MESSAGE("test for getAbsoluteFileURL function: URL contain link( Solaris version )", - ( ::osl::FileBase::E_None == nError ) && ( sal_True == bOk ) ); - } -#else //Windows version - void getAbsoluteFileURL_002( ) - { - CPPUNIT_ASSERT_MESSAGE("test for getAbsoluteFileURL function: URL contain link( Windows version )", - 1 ); - } -#endif - - void getAbsoluteFileURL_003( ) - { -// LLA: may be a wrong test, aTmpName1 not a real URL -#if 0 - ::rtl::OUString aUStr_AbsURL; - - nError = aFileBase.getAbsoluteFileURL( aTmpName1, aRelURL1, aUStr_AbsURL ); //base dir invalid error - ::rtl::OUString suError = ::rtl::OUString::createFromAscii("test for getAbsoluteFileURL('"); - suError += aTmpName1; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aRelURL1; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aUStr_AbsURL; - suError += ::rtl::OUString::createFromAscii("' ),Parameter is invalid. it ignore the invalid base in Windows, did not pass in (W32), the reason maybe caused by the similar bug with getSystemPathFromFileURL() "); - - CPPUNIT_ASSERT_MESSAGE( suError, ( ::osl::FileBase::E_INVAL == nError ) ); -#endif - } - - //use ".." in relartive path, the BasePath must exist on the file system - void getAbsoluteFileURL_004( ) - { - //create two level directories under $Temp/PID/ - ::rtl::OUString aUStrUpBase = aUserDirectoryURL + ::rtl::OUString::createFromAscii("/test1"); - createTestDirectory( aUStrUpBase ); - ::rtl::OUString aUStrBase = aUserDirectoryURL + ::rtl::OUString::createFromAscii("/test1/dir1"); - createTestDirectory( aUStrBase ); - - ::rtl::OUString aUStrRelar = ::rtl::OUString::createFromAscii("../../mytestfile"); - ::rtl::OUString aUStr_AbsURL; - ::rtl::OUString aResultURL6 = aUserDirectoryURL + ::rtl::OUString::createFromAscii("/mytestfile"); - - nError = aFileBase.getAbsoluteFileURL( aUStrBase, aUStrRelar, aUStr_AbsURL ); - bOk = aUStr_AbsURL.equals( aResultURL6 ); - ::rtl::OUString suError = ::rtl::OUString::createFromAscii("test for getAbsoluteFileURL('"); - suError += aUStrBase; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aUStrRelar; - suError += ::rtl::OUString::createFromAscii("', '"); - suError += aUStr_AbsURL; - suError += outputError( aUStr_AbsURL, aResultURL6, "' ), did not pass on Win32 "); - - deleteTestDirectory( aUStrBase ); - deleteTestDirectory( aUStrUpBase ); - - CPPUNIT_ASSERT_MESSAGE( suError, ( ::osl::FileBase::E_None == nError ) && ( sal_True == bOk ) ); - } - - CPPUNIT_TEST_SUITE( getAbsoluteFileURL ); - CPPUNIT_TEST( getAbsoluteFileURL_001 ); - CPPUNIT_TEST( getAbsoluteFileURL_002 ); - CPPUNIT_TEST( getAbsoluteFileURL_003 ); - CPPUNIT_TEST( getAbsoluteFileURL_004 ); - CPPUNIT_TEST_SUITE_END( ); - };// class getAbsoluteFileURL*/ - void getAbsoluteFileURL::check_getAbsoluteFileURL( rtl::OUString const& _suBaseURL, rtl::OString const& _sRelativeURL, ::osl::FileBase::RC _nAssumeError, rtl::OUString const& _suAssumeResultStr ) { rtl::OUString suRelativeURL = rtl::OStringToOUString(_sRelativeURL, RTL_TEXTENCODING_UTF8); @@ -1427,26 +1219,6 @@ namespace osl_FileBase checkWNTBehaviour_getSystemPathFromFileURL(sURL, osl::FileBase::E_INVAL, ""); } -#if 0 - void SystemPath_FileURL::getSystemPathFromFileURL_003( ) - { -// LLA: ??? -//!! seams to be, that the directories do not pass together - ::rtl::OUString aUStr; - ::rtl::OUString aRelativeURL = ::rtl::OUString::createFromAscii("../../relartive/file3"); - ::rtl::OUString aResultURL ( aSysPath4 ); - ::osl::FileBase::RC nError = osl::FileBase::getSystemPathFromFileURL( aRelativeURL, aUStr ); - - sal_Bool bOk = compareFileName( aUStr, aResultURL ); - - ::rtl::OUString suError = ::rtl::OUString::createFromAscii("test for getSystemPathFromFileURL("); - suError += aRelativeURL; - suError += ::rtl::OUString::createFromAscii(") function:use a relative file URL, did not pass in(W32), it did not specified in method declaration of relative path issue, "); - suError += outputError(aUStr, aResultURL); - CPPUNIT_ASSERT_MESSAGE( suError, ( osl::FileBase::E_None == nError ) && ( sal_True == bOk ) ); - } -#endif - //normal legal case void SystemPath_FileURL::getSystemPathFromFileURL_004( ) { @@ -1772,9 +1544,6 @@ namespace osl_FileBase };// class createTempFile // ----------------------------------------------------------------------------- -#if 0 //~ this function has been deprecated. - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_FileBase::getCanonicalName, "osl_FileBase" ); -#endif CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_FileBase::getAbsoluteFileURL, "osl_FileBase" ); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_FileBase::SystemPath_FileURL, "osl_FileBase" ); // CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_FileBase::getFileURLFromSystemPath, "osl_FileBase" ); @@ -1785,135 +1554,6 @@ namespace osl_FileBase //------------------------------------------------------------------------ -// Beginning of the test cases for VolumeDevice class -//------------------------------------------------------------------------ - -#if 0 //~ this Class has been deprecated -namespace osl_VolumeDevice -{ - - //--------------------------------------------------------------------- - // testing the method - // VolumeDevice() : _aHandle( NULL ) - //--------------------------------------------------------------------- - class ctors : public CppUnit::TestFixture - { - ::osl::VolumeDevice aVolumeDevice; - ::rtl::OUString aUStr; - ::osl::FileBase::RC nError1, nError2; - - public: - // initialization - void setUp( ) - { - } - - void tearDown( ) - { - } - - // test code. - void ctors_001( ) - { - ::osl::VolumeDevice aVolumeDevice1; - - CPPUNIT_ASSERT_MESSAGE( "test for ctors function: Constructor for VolumeDevice with no args.", - ( osl::FileBase::E_None != aVolumeDevice1.automount( ) ) && - ( osl::FileBase::E_None != aVolumeDevice1.unmount( ) ) && - ( aNullURL.equals( aVolumeDevice1.getMountPath( ) ) ) ); - } - - void ctors_002( ) - { - ::osl::VolumeInfo aVolumeInfo( VolumeInfoMask_Attributes ); - nError1 = ::osl::Directory::getVolumeInfo( aRootURL, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - - ::osl::VolumeDevice aVolumeDevice1( aVolumeInfo.getDeviceHandle( ) ); - sal_Bool bOk = compareFileName( aNullURL, aVolumeDevice1.getMountPath( ) ); - CPPUNIT_ASSERT_MESSAGE( "test for ctors function: Copy constructor for VolumeDevice, the copied VolumeDevice should have a mount path file:///, but it returned an empty OUString, it also may be the error from getDeviceHandle(), it did not pass in (UNX), (W32).", - sal_False == bOk ); - } - - void ctors_003( ) - { - ::osl::VolumeInfo aVolumeInfo( VolumeInfoMask_Attributes ); - nError1 = ::osl::Directory::getVolumeInfo( aRootURL, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - - ::osl::VolumeDevice aVolumeDevice1 = aVolumeInfo.getDeviceHandle( ); - sal_Bool bOk = compareFileName( aNullURL, aVolumeDevice1.getMountPath( ) ); - CPPUNIT_ASSERT_MESSAGE( "test for ctors function: Assigned operator for VolumeDevice, the assigned VolumeDevice should have a mount path file:///, but it returned an empty OUString, it also may be the error from getDeviceHandle(),it did not pass in (UNX), (W32).", - sal_False == bOk ); - } - - CPPUNIT_TEST_SUITE( ctors ); - CPPUNIT_TEST( ctors_001 ); - CPPUNIT_TEST( ctors_002 ); - CPPUNIT_TEST( ctors_003 ); - CPPUNIT_TEST_SUITE_END( ); - };// class ctors - - - //--------------------------------------------------------------------- - // testing the method - // inline RC automount() - //--------------------------------------------------------------------- - class automount : public CppUnit::TestFixture - { - ::osl::VolumeDevice aVolumeDevice; - ::rtl::OUString aUStr; - ::osl::FileBase::RC nError1, nError2; - - public: - // initialization - void setUp( ) - { - } - - void tearDown( ) - { - - } - - // test code. - void automount_001( ) - { - ::osl::VolumeDevice aVolumeDevice1; - nError1 = aVolumeDevice1.automount( ); - - CPPUNIT_ASSERT_MESSAGE( "test for automount function: invalid parameter.", - ( osl::FileBase::E_INVAL == nError1 ) ); - } - - void automount_002( ) - { - ::osl::VolumeInfo aVolumeInfo( VolumeInfoMask_Attributes ); - nError1 = ::osl::Directory::getVolumeInfo( aVolURL2, aVolumeInfo ); - CPPUNIT_ASSERT( osl::FileBase::E_None == nError1 ); - - ::osl::VolumeDevice aVolumeDevice1( aVolumeInfo.getDeviceHandle( ) ); - nError1 = aVolumeDevice1.unmount( ); - nError1 = aVolumeDevice1.automount( ); - CPPUNIT_ASSERT_MESSAGE( "test for automount function: this test is not implemented yet, it did not pass in (UNX), (W32).", - ( osl::FileBase::E_None == nError1 ) ); - } - - CPPUNIT_TEST_SUITE( automount ); - CPPUNIT_TEST( automount_001 ); - CPPUNIT_TEST( automount_002 ); - CPPUNIT_TEST_SUITE_END( ); - };// class automount - - - // ----------------------------------------------------------------------------- - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeDevice::ctors, "osl_VolumeDevice" ); - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_VolumeDevice::automount, "osl_VolumeDevice" ); -}// namespace osl_VolumeDevice -#endif - - -//------------------------------------------------------------------------ // Beginning of the test cases for VolumeInfo class //------------------------------------------------------------------------ namespace osl_VolumeInfo @@ -3189,56 +2829,6 @@ namespace osl_FileStatus void getFileType_003( ) { -#if 0 -// LLA: this have to be discussed. - ::osl::FileStatus rFileStatus( FileStatusMask_Type ); - nError1 = m_aVolumeItem.getFileStatus( rFileStatus ); - CPPUNIT_ASSERT( ::osl::FileBase::E_None == nError1 ); - - if (rFileStatus.isValid(FileStatusMask_Type)) - { - osl::FileStatus::Type eType = rFileStatus.getFileType( ); - - CPPUNIT_ASSERT_MESSAGE( "test for getFileType function: Volume, it seems the volume part of the field is not implemented, it did not pass in (W32)(UNX).", - ( eType == ::osl::FileStatus::Volume ) ); - } -#endif - } - - - void getFileType_004( ) - { -#if ( defined UNX ) || ( defined OS2 ) //Fifo creation is differ in Windows - - //create a fifo in $ROOT/tmp/tmpdir, get its DirectoryItem. - rtl::OString strFifoSys; - strFifoSys = OUStringToOString( aFifoSys, RTL_TEXTENCODING_ASCII_US ); - ::rtl::OUString aFifoURL; - - int fd = mkfifo( strFifoSys.getStr(), O_RDWR | O_CREAT ); - CPPUNIT_ASSERT_MESSAGE("mkfifo failed!", fd == 0 ); - ::osl::FileBase::getFileURLFromSystemPath( aFifoSys, aFifoURL ); - - nError1 = ::osl::DirectoryItem::get( aFifoURL, m_aFifoItem ); - CPPUNIT_ASSERT_MESSAGE("get item failed!", ::osl::FileBase::E_None == nError1 ); - - //check for File type - ::osl::FileStatus rFileStatus( FileStatusMask_Type ); - nError1 = m_aFifoItem.getFileStatus( rFileStatus ); - CPPUNIT_ASSERT_MESSAGE("get Status failed!", ::osl::FileBase::E_None == nError1 ); - - //delete fifo - nError1 = ::osl::File::remove( aFifoURL ); - CPPUNIT_ASSERT_MESSAGE("remove file failed!", ::osl::FileBase::E_None == nError1 ); - - if (rFileStatus.isValid(FileStatusMask_Type)) - { - osl::FileStatus::Type eType = rFileStatus.getFileType( ); - - CPPUNIT_ASSERT_MESSAGE( "test for getFileType function: Fifo, Solaris version ", - ( eType == ::osl::FileStatus::Fifo ) ); - } -#endif } /* diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx index b660b3c33548..d4c802401450 100644 --- a/sal/qa/osl/mutex/osl_Mutex.cxx +++ b/sal/qa/osl/mutex/osl_Mutex.cxx @@ -513,15 +513,6 @@ namespace osl_Mutex // how about release twice? void release_002() { -// LLA: is this a real test? -#if 0 - Mutex aMutex; - sal_Bool bRes1 = aMutex.release( ); - sal_Bool bRes2 = aMutex.release( ); - - CPPUNIT_ASSERT_MESSAGE( "release Mutex: mutex should not be released without aquire, should not release twice. although the behaviour is still under discussion, this test is passed on (LINUX), not passed on (SOLARIS)&(WINDOWS)", - bRes1 == sal_False && bRes2 == sal_False ); -#endif } CPPUNIT_TEST_SUITE( release ); diff --git a/sal/qa/osl/socket/osl_AcceptorSocket.cxx b/sal/qa/osl/socket/osl_AcceptorSocket.cxx index 2ffe3a88eb3d..dd2b3789bf1c 100644 --- a/sal/qa/osl/socket/osl_AcceptorSocket.cxx +++ b/sal/qa/osl/socket/osl_AcceptorSocket.cxx @@ -158,47 +158,6 @@ namespace osl_AcceptorSocket }; // class ctors -#if 0 /* OBSOLETE */ - class operator_assign : public CppUnit::TestFixture - { - public: - - void assign_001() - { -#if defined(LINUX) - ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - ::osl::AcceptorSocket asSocketAssign( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - asSocket.setOption( osl_Socket_OptionReuseAddr, 1); - ::osl::SocketAddr saSocketAddr( rtl::OUString::createFromAscii("127.0.0.1"), IP_PORT_MYPORT4 ); - asSocket.bind( saSocketAddr ); - - AcceptorThread myAcceptorThread( asSocketAssign, rtl::OUString::createFromAscii("127.0.0.1") ); - myAcceptorThread.create(); - - thread_sleep( 1 ); - //when accepting, assign another socket to the socket, the thread will not be closed, so is blocking - asSocketAssign = asSocket; - - t_print("#asSocketAssign port number is %d\n", asSocketAssign.getLocalPort() ); - - asSocketAssign.shutdown(); - myAcceptorThread.join(); - - CPPUNIT_ASSERT_MESSAGE( "test for close when is accepting: the socket will quit accepting status.", - myAcceptorThread.isOK() == sal_True ); - - -#endif /* LINUX */ - } - - - CPPUNIT_TEST_SUITE( operator_assign ); - CPPUNIT_TEST( assign_001 ); - CPPUNIT_TEST_SUITE_END(); - - }; // class operator_assign -#endif /* OBSOLETE */ - /** testing the method: inline sal_Bool SAL_CALL listen(sal_Int32 MaxPendingConnections= -1); inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection); diff --git a/sal/qa/osl/socket/osl_Socket.cxx b/sal/qa/osl/socket/osl_Socket.cxx index 8af8cd43a05f..57d6e0c3f297 100644 --- a/sal/qa/osl/socket/osl_Socket.cxx +++ b/sal/qa/osl/socket/osl_Socket.cxx @@ -767,16 +767,7 @@ namespace osl_SocketAddr void ctors_copy_no_001() { -#if 0 - ::osl::SocketAddr saSocketAddr( aHostName1, IP_PORT_HTTP1 ); - oslSocketAddr psaOSLSocketAddr = saSocketAddr.getHandle( ); - - ::osl::SocketAddr saSocketAddrCopy( psaOSLSocketAddr, SAL_NO_COPY ); - saSocketAddrCopy.setPort( IP_PORT_HTTP2 ); - CPPUNIT_ASSERT_MESSAGE("test for SocketAddr no copy constructor function: do a no copy constructor on a given SocketAddr instance, modify the new instance's port, check the original one.", - saSocketAddr.getPort( ) == IP_PORT_HTTP2 ); -#endif ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( aHostName1, IP_PORT_HTTP1 ); CPPUNIT_ASSERT_MESSAGE("check for new SocketAddr", pSocketAddr != NULL); @@ -3366,47 +3357,6 @@ namespace osl_AcceptorSocket }; // class ctors -#if 0 - class operator_assign : public CppUnit::TestFixture - { - public: - - void assign_001() - { -#if defined(LINUX) - ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - ::osl::AcceptorSocket asSocketAssign( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - asSocket.setOption( osl_Socket_OptionReuseAddr, 1); - ::osl::SocketAddr saSocketAddr( aHostIp1, IP_PORT_MYPORT4 ); - asSocket.bind( saSocketAddr ); - - AcceptorThread myAcceptorThread( asSocketAssign, aHostIp1 ); - myAcceptorThread.create(); - - thread_sleep( 1 ); - //when accepting, assign another socket to the socket, the thread will not be closed, so is blocking - asSocketAssign = asSocket; - - t_print("#asSocketAssign port number is %d\n", asSocketAssign.getLocalPort() ); - - asSocketAssign.shutdown(); - myAcceptorThread.join(); - - CPPUNIT_ASSERT_MESSAGE( "test for close when is accepting: the socket will quit accepting status.", - myAcceptorThread.isOK() == sal_True ); - - -#endif /* LINUX */ - } - - - CPPUNIT_TEST_SUITE( operator_assign ); - CPPUNIT_TEST( assign_001 ); - CPPUNIT_TEST_SUITE_END(); - - }; // class operator_assign -#endif - /** testing the method: inline sal_Bool SAL_CALL listen(sal_Int32 MaxPendingConnections= -1); inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection); diff --git a/sal/qa/osl/socket/osl_SocketAddr.cxx b/sal/qa/osl/socket/osl_SocketAddr.cxx index e3c98bdff385..953d43548e6c 100644 --- a/sal/qa/osl/socket/osl_SocketAddr.cxx +++ b/sal/qa/osl/socket/osl_SocketAddr.cxx @@ -139,16 +139,6 @@ namespace osl_SocketAddr void ctors_copy_no_001() { -#if 0 - ::osl::SocketAddr saSocketAddr( rtl::OUString::createFromAscii("localhost"), IP_PORT_HTTP1 ); - oslSocketAddr psaOSLSocketAddr = saSocketAddr.getHandle( ); - - ::osl::SocketAddr saSocketAddrCopy( psaOSLSocketAddr, SAL_NO_COPY ); - saSocketAddrCopy.setPort( IP_PORT_HTTP2 ); - - CPPUNIT_ASSERT_MESSAGE("test for SocketAddr no copy constructor function: do a no copy constructor on a given SocketAddr instance, modify the new instance's port, check the original one.", - saSocketAddr.getPort( ) == IP_PORT_HTTP2 ); -#endif ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString::createFromAscii("localhost"), IP_PORT_HTTP1 ); CPPUNIT_ASSERT_MESSAGE("check for new SocketAddr", pSocketAddr != NULL); diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c index 1a74c7e36cae..0e7b174aa055 100644 --- a/sal/rtl/source/alloc_arena.c +++ b/sal/rtl/source/alloc_arena.c @@ -353,21 +353,6 @@ rtl_arena_hash_rescale ( old_size, new_size ); -#if 0 /* DBG */ - int i; - for (i = 0; i < arena->m_hash_size; i++) - { - sal_Size k = 0; rtl_arena_segment_type ** segpp = &(arena->m_hash_table[i]); - while (*segpp) - { - k += 1; - segpp = &((*segpp)->m_fnext); - } - fprintf(stdout, "%d, ", k); - } - fprintf(stdout, "\n"); -#endif /* DBG */ - arena->m_hash_table = new_table; arena->m_hash_size = new_size; arena->m_hash_shift = highbit(arena->m_hash_size) - 1; diff --git a/sal/textenc/tencinfo.c b/sal/textenc/tencinfo.c index 0c51a98206e5..65713c7b1af1 100644 --- a/sal/textenc/tencinfo.c +++ b/sal/textenc/tencinfo.c @@ -212,166 +212,6 @@ rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromWindowsCharset( sal_uInt8 nWinC /* ----------------------------------------------------------------------- */ -#if 0 - -rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromMacTextEncoding( sal_uInt32 nMacTextEncoding ) -{ - rtl_TextEncoding eTextEncoding; - - switch ( nMacTextEncoding ) - { - case 0: eTextEncoding = RTL_TEXTENCODING_APPLE_ROMAN; break; - case 1: eTextEncoding = RTL_TEXTENCODING_APPLE_JAPANESE; break; - case 2: eTextEncoding = RTL_TEXTENCODING_APPLE_CHINTRAD; break; - case 3: eTextEncoding = RTL_TEXTENCODING_APPLE_KOREAN; break; - case 4: eTextEncoding = RTL_TEXTENCODING_APPLE_ARABIC; break; - case 5: eTextEncoding = RTL_TEXTENCODING_APPLE_HEBREW; break; - case 6: eTextEncoding = RTL_TEXTENCODING_APPLE_GREEK; break; - case 7: eTextEncoding = RTL_TEXTENCODING_APPLE_CYRILLIC; break; - /* RIGHT-TO-LEFT SYMBOLS = 8 ??? */ - case 9: eTextEncoding = RTL_TEXTENCODING_APPLE_DEVANAGARI; break; - case 10: eTextEncoding = RTL_TEXTENCODING_APPLE_GURMUKHI; break; - case 11: eTextEncoding = RTL_TEXTENCODING_APPLE_GUJARATI; break; - /* MacOriya = 12 */ - /* MacBengali = 13 */ - /* MacTamil = 14 */ - /* MacTelugu = 15 */ - /* MacKannada = 16 */ - /* MacMalayalam = 17 */ - /* MacSinhalese = 18 */ - /* MacBurmese = 19 */ - /* MacKhmer = 20 */ - case 21: eTextEncoding = RTL_TEXTENCODING_APPLE_THAI; break; - /* MacLaotian = 22 */ - /* MacGeorgian = 23 */ - /* MacArmenian = 24 */ - case 25: eTextEncoding = RTL_TEXTENCODING_APPLE_CHINSIMP; break; - /* MacTibetan = 26 */ - /* MacMongolian = 27 */ - /* MacEthiopic = 28 */ - case 29: eTextEncoding = RTL_TEXTENCODING_APPLE_CENTEURO; break; /* MacCentralEurRoman */ - /* MacVietnamese = 30 */ - /* MacExtArabic = 31 */ - case 32: eTextEncoding = RTL_TEXTENCODING_SYMBOL; break; - case 33: eTextEncoding = RTL_TEXTENCODING_SYMBOL; break; /* MacSymbol */ - case 34: eTextEncoding = RTL_TEXTENCODING_SYMBOL; break; /* MacDingbats */ - case 35: eTextEncoding = RTL_TEXTENCODING_APPLE_TURKISH; break; /* MacTurkish */ - case 36: eTextEncoding = RTL_TEXTENCODING_APPLE_CROATIAN; break; /* MacCroatian */ - case 37: eTextEncoding = RTL_TEXTENCODING_APPLE_ICELAND; break; /* MacIcelandic */ - case 38: eTextEncoding = RTL_TEXTENCODING_APPLE_ROMANIAN; break; /* MacRomanian */ - /* MacCeltic = 39 */ - /* MacGaelic = 40 */ - /* Beginning in Mac OS 8.5, the set of Mac OS script codes has been */ - /* extended for some Mac OS components to include Unicode. Some of */ - /* these components have only 7 bits available for script code, so */ - /* kTextEncodingUnicodeDefault cannot be used to indicate Unicode. */ - /* Instead, the following meta-value is used to indicate Unicode */ - /* handled as a special Mac OS script code; TEC handles this value */ - /* like kTextEncodingUnicodeDefault. */ - /* The following use script code 4, smArabic */ - case 0x08C: eTextEncoding = RTL_TEXTENCODING_APPLE_FARSI; break; /* MacFarsi */ - /* The following use script code 7, smCyrillic */ - case 0x098: eTextEncoding = RTL_TEXTENCODING_APPLE_UKRAINIAN; break; /* MacUkrainian */ - /* The following use script code 28, smEthiopic */ - /* MacInuit = 0xEC */ - /* The following use script code 32, smUninterp */ - case 0x0FC: eTextEncoding = RTL_TEXTENCODING_SYMBOL; break; /* MacVT100 - VT100/102 font */ - /* Special Mac OS encodings */ - /* MacHFS = 0xFF */ /* metavalue. */ - /* Unicode & ISO UCS encodings begin at 0x100 */ - case 0x100: eTextEncoding = RTL_TEXTENCODING_UNICODE; break; /* UnicodeDefault */ - case 0x101: eTextEncoding = RTL_TEXTENCODING_UNICODE; break; /* UnicodeV1_1 / ISO10646_1993 */ - case 0x103: eTextEncoding = RTL_TEXTENCODING_UNICODE; break; /* UnicodeV2_1 - new location for Korean Hangul / UnicodeV2_1 */ - /* ISO 8-bit and 7-bit encodings begin at 0x200 */ - case 0x201: eTextEncoding = RTL_TEXTENCODING_ISO_8859_1; break; /* ISOLatin1 - ISO 8859-1 */ - case 0x202: eTextEncoding = RTL_TEXTENCODING_ISO_8859_2; break; /* ISOLatin2 - ISO 8859-2 */ - case 0x203: eTextEncoding = RTL_TEXTENCODING_ISO_8859_3; break; /* ISOLatin3 - ISO 8859-3 */ - case 0x204: eTextEncoding = RTL_TEXTENCODING_ISO_8859_4; break; /* ISOLatin4 - ISO 8859-4 */ - case 0x205: eTextEncoding = RTL_TEXTENCODING_ISO_8859_5; break; /* ISOLatinCyrillic - ISO 8859-5 */ - case 0x206: eTextEncoding = RTL_TEXTENCODING_ISO_8859_6; break; /* ISOLatinArabic - ISO 8859-6, = ASMO 708, =DOS CP 708 */ - case 0x207: eTextEncoding = RTL_TEXTENCODING_ISO_8859_7; break; /* ISOLatinGreek - ISO 8859-7 */ - case 0x208: eTextEncoding = RTL_TEXTENCODING_ISO_8859_8; break; /* ISOLatinHebrew - ISO 8859-8 */ - case 0x209: eTextEncoding = RTL_TEXTENCODING_ISO_8859_9; break; /* ISOLatin5 - ISO 8859-9 */ - /* MS-DOS & Windows encodings begin at 0x400 */ - case 0x400: eTextEncoding = RTL_TEXTENCODING_IBM_437; break; /* DOSLatinUS - code page 437 */ - case 0x405: eTextEncoding = RTL_TEXTENCODING_IBM_737; break; /* DOSGreek - code page 737 (formerly 437G) */ - case 0x406: eTextEncoding = RTL_TEXTENCODING_IBM_775; break; /* DOSBalticRim - code page 775 */ - case 0x410: eTextEncoding = RTL_TEXTENCODING_IBM_850; break; /* DOSLatin1 - code page 850, "Multilingual" */ -/* !!! case 0x411: eTextEncoding = RTL_TEXTENCODING_IBM_851; break; */ /* DOSGreek1 - code page 851 */ - case 0x412: eTextEncoding = RTL_TEXTENCODING_IBM_852; break; /* DOSLatin2 - code page 852, Slavic */ - case 0x413: eTextEncoding = RTL_TEXTENCODING_IBM_855; break; /* DOSCyrillic - code page 855, IBM Cyrillic */ - case 0x414: eTextEncoding = RTL_TEXTENCODING_IBM_857; break; /* DOSTurkish - code page 857, IBM Turkish */ - case 0x415: eTextEncoding = RTL_TEXTENCODING_IBM_860; break; /* DOSPortuguese - code page 860 */ - case 0x416: eTextEncoding = RTL_TEXTENCODING_IBM_861; break; /* DOSIcelandic - code page 861 */ - case 0x417: eTextEncoding = RTL_TEXTENCODING_IBM_862; break; /* DOSHebrew - code page 862 */ - case 0x418: eTextEncoding = RTL_TEXTENCODING_IBM_863; break; /* DOSCanadianFrench - code page 863 */ - case 0x419: eTextEncoding = RTL_TEXTENCODING_IBM_864; break; /* DOSArabic - code page 864 */ - case 0x41A: eTextEncoding = RTL_TEXTENCODING_IBM_865; break; /* DOSNordic - code page 865 */ - case 0x41B: eTextEncoding = RTL_TEXTENCODING_IBM_866; break; /* DOSRussian - code page 866 */ - case 0x41C: eTextEncoding = RTL_TEXTENCODING_IBM_869; break; /* DOSGreek2 - code page 869, IBM Modern Greek */ - case 0x41D: eTextEncoding = RTL_TEXTENCODING_MS_874; break; /* DOSThai - code page 874, also for Windows */ - case 0x420: eTextEncoding = RTL_TEXTENCODING_MS_932; break; /* DOSJapanese - code page 932, also for Windows */ - case 0x421: eTextEncoding = RTL_TEXTENCODING_MS_936; break; /* DOSChineseSimplif - code page 936, also for Windows */ - case 0x422: eTextEncoding = RTL_TEXTENCODING_MS_949; break; /* DOSKorean - code page 949, also for Windows;Unified Hangul */ - case 0x423: eTextEncoding = RTL_TEXTENCODING_MS_950; break; /* DOSChineseTrad - code page 950, also for Windows */ - case 0x500: eTextEncoding = RTL_TEXTENCODING_MS_1252; break; /* WindowsLatin1 / WindowsANSI - code page 1252 */ - case 0x501: eTextEncoding = RTL_TEXTENCODING_MS_1250; break; /* WindowsLatin2 - code page 1250, Central Europe */ - case 0x502: eTextEncoding = RTL_TEXTENCODING_MS_1251; break; /* WindowsCyrillic - code page 1251, Slavic Cyrillic */ - case 0x503: eTextEncoding = RTL_TEXTENCODING_MS_1253; break; /* WindowsGreek - code page 1253 */ - case 0x504: eTextEncoding = RTL_TEXTENCODING_MS_1254; break; /* WindowsLatin5 - code page 1254, Turkish */ - case 0x505: eTextEncoding = RTL_TEXTENCODING_MS_1255; break; /* WindowsHebrew - code page 1255 */ - case 0x506: eTextEncoding = RTL_TEXTENCODING_MS_1256; break; /* WindowsArabic - code page 1256 */ - case 0x507: eTextEncoding = RTL_TEXTENCODING_MS_1257; break; /* WindowsBalticRim - code page 1257 */ - case 0x508: eTextEncoding = RTL_TEXTENCODING_MS_1258; break; /* WindowsVietnamese - code page 1258 */ - case 0x510: eTextEncoding = RTL_TEXTENCODING_MS_1361; break; /* WindowsKoreanJohab - code page 1361, for Windows NT */ - /* Various national standards begin at 0x600 */ - case 0x600: eTextEncoding = RTL_TEXTENCODING_ASCII_US; break; /* US_ASCII */ - case 0x620: eTextEncoding = RTL_TEXTENCODING_JIS_X_0201; break; /* JIS_X0201_76 */ - case 0x621: eTextEncoding = RTL_TEXTENCODING_JIS_X_0208; break; /* JIS_X0208_83 */ - case 0x622: eTextEncoding = RTL_TEXTENCODING_JIS_X_0208; break; /* JIS_X0208_90 */ - case 0x623: eTextEncoding = RTL_TEXTENCODING_JIS_X_0212; break; /* JIS_X0212_90 */ - /* !!! JIS_C6226_78 = 0x624 */ - /* !!! GB_2312_80 = 0x630 */ - /* !!! GBK_95 = 0x631 */ /* annex to GB 13000-93; for Windows 95 */ -// case 0x640: eTextEncoding = RTL_TEXTENCODING_KSC_5601_1987; break; /* KSC_5601_87 */ /* same as KSC 5601-92 without Johab annex */ -// case 0x641: eTextEncoding = RTL_TEXTENCODING_KSC_5601_1992; break; /* KSC 5601-92 Johab annex */ - /* !!! CNS_11643_92_P1 = 0x651 */ /* CNS 11643-1992 plane 1 */ - /* !!! CNS_11643_92_P2 = 0x652 */ /* CNS 11643-1992 plane 2 */ - /* !!! CNS_11643_92_P3 = 0x653 */ /* CNS 11643-1992 plane 3 (11643-1986 plane 14) */ - /* ISO 2022 collections begin at 0x800 */ - case 0x820: eTextEncoding = RTL_TEXTENCODING_ISO_2022_JP; break; /* ISO_2022_JP */ - case 0x821: eTextEncoding = RTL_TEXTENCODING_ISO_2022_JP; break; /* ISO_2022_JP_2 */ - case 0x830: eTextEncoding = RTL_TEXTENCODING_ISO_2022_CN; break; /* ISO_2022_CN */ - case 0x831: eTextEncoding = RTL_TEXTENCODING_ISO_2022_CN; break; /* ISO_2022_CN_EXT */ - /* !!! ISO_2022_KR = 0x840 */ - /* EUC collections begin at 0x900 */ - case 0x920: eTextEncoding = RTL_TEXTENCODING_EUC_JP; break; /* EUC_JP - ISO 646,1-byte Katakana,JIS 208,JIS 212 */ - case 0x930: eTextEncoding = RTL_TEXTENCODING_EUC_CN; break; /* EUC_CN - ISO 646, GB 2312-80 */ - case 0x931: eTextEncoding = RTL_TEXTENCODING_EUC_TW; break; /* EUC_TW - ISO 646, CNS 11643-1992 Planes 1-16 */ - case 0x940: eTextEncoding = RTL_TEXTENCODING_EUC_KR; break; /* EUC_KR - ISO 646, KS C 5601-1987 */ - /* Miscellaneous standards begin at 0xA00 */ - case 0xA01: eTextEncoding = RTL_TEXTENCODING_SHIFT_JIS; break; /* ShiftJIS - plain Shift-JIS */ - case 0xA02: eTextEncoding = RTL_TEXTENCODING_KOI8_R; break; /* KOI8_R - Russian Internet standard */ - case 0xA03: eTextEncoding = RTL_TEXTENCODING_BIG5; break; /* Big5 - Big-5 */ - /* !!! MacRomanLatin1 = 0xA04 */ /* Mac OS Roman permuted to align with 8859-1 */ - /* !!! HZ_GB_2312 = 0xA05 */ /* HZ (RFC 1842, for Chinese mail & news) */ - /* Other platform encodings */ - /* !!! NextStepLatin = 0xB01 */ /* NextStep encoding */ - /* EBCDIC & IBM host encodings begin at 0xC00 */ - /* !!! EBCDIC_US = 0xC01 */ /* basic EBCDIC-US */ - /* !!! EBCDIC_CP037 = 0xC02 */ /* code page 037, extended EBCDIC-US Latin1 */ - /* Special value */ - /* MultiRun = 0xFFF */ /* Multiple encoded text, external run info */ - default: eTextEncoding = RTL_TEXTENCODING_DONTKNOW; break; - }; - - return eTextEncoding; -} - -#endif - -/* ----------------------------------------------------------------------- */ - rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromUnixCharset( const sal_Char* pUnixCharset ) { /* See <ftp://ftp.x.org/pub/DOCS/registry>, section 14 ("Font Charset diff --git a/sal/workben/t_readline.c b/sal/workben/t_readline.c index 9cbc7d39cf20..b82dc7cea8b6 100644 --- a/sal/workben/t_readline.c +++ b/sal/workben/t_readline.c @@ -40,11 +40,6 @@ int main (int argc, char ** argv) result = osl_readLine (hFile, &pBuffer); if (result != osl_File_E_None) break; -#if 0 - if (pBuffer->elements[0] == 0) - /* @@@ cannot distinguish empty line from EOF @@@ */ - break; -#endif for (i = 0, n = pBuffer->nElements; i < n; i++) printf ("%c", (char)(pBuffer->elements[i])); printf("\n"); diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 689a39564af6..db85ce0eff13 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -724,31 +724,6 @@ OStoreDirectoryPageObject::scope ( return page::SCOPE_UNREACHABLE; } -#if 0 /* NYI */ -/* - * chunk (external data page). - */ -inode::ChunkDescriptor OStoreDirectoryPageObject::chunk (sal_uInt32 nOffset) -{ - // @@@ INSUFFICIENT: NEED SCOPE AS WELL @@@ - sal_uInt32 nCapacity = m_rPage.capacity(); - if (nOffset < nCapacity) - // Internal scope (inode page). - return inode::ChunkDescriptor (nOffset, nCapacity); - else - // External scope (data page). - return inode::ChunkDescriptor (nOffset - nCapacity, data::capacity(m_rPage.m_aDescr)); - - inode::ChunkScope eScope = m_rPage.scope(nOffset); - if (eScope == inode::SCOPE_INTERNAL) - // Inode page (internal scope). - return inode::ChunkDescriptor (nOffset, m_rPage.capacity()); - else - // Data page (external scope). - return inode::ChunkDescriptor (nOffset - m_rPage.capacity(), data::capacity(m_rPage.m_aDescr)); -} -#endif /* NYI */ - /* * read (external data page). */ diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index ef88986d0f65..b91528a615df 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -164,71 +164,6 @@ storeError OStorePageManager::find_lookup ( * remove_Impl (possibly down from root). * Internal: Precond: initialized, writeable, exclusive access. */ -#if 0 /* EXP */ -storeError OStorePageManager::remove_Impl (entry & rEntry) -{ - // Find Node and Index. - OStoreBTreeNodeObject aNode; - sal_uInt16 nIndex = 0; - eErrCode = m_aRoot.find_lookup (aNode, nIndex, entry::CompareGreater(rEntry), *this); - - // @@@ - - PageHolderObject< page > xPage (aNode.get()); - page & rPage = (*xPage); - - // Check current page index. - sal_uInt16 i = rPage.find (rEntry), n = rPage.usageCount(); - if (!(i < n)) - { - // Path to entry not exists (Must not happen(?)). - return store_E_NotExists; - } - - // Compare entry. - entry::CompareResult result = rEntry.compare (rPage.m_pData[i]); - - for (; result == entry::COMPARE_GREATER && xPage->depth() > 0; ) - { - // Check next node address. - sal_uInt32 const nAddr = rPage.m_pData[i].m_aLink.location(); - if (nAddr == STORE_PAGE_NULL) - { - // Path to entry not exists (Must not happen(?)). - return store_E_NotExists; - } - - // Load next node page. - eErrCode = loadObjectAt (aNode, nAddr); - - PageHolderObject< page > xNext (aNode.get()); - xNext.swap (xPage); - } - - aNode.remove (nIndex, rEntry, *this); - - - do - { - // Load next node page. - eErrCode = loadObjectAt (aNode, nAddr); - - page const & rPage = (*xPage); - - // Check current page index. - sal_uInt16 i = rPage.find (rEntry), n = rPage.usageCount(); - if (!(i < n)) - { - // Path to entry not exists (Must not happen(?)). - return store_E_NotExists; - } - - // Compare entry. - result = rEntry.compare (rPage.m_pData[i]); - - } while (result == entry::COMPATE_GREATER); -} -#endif /* EXP */ storeError OStorePageManager::remove_Impl (entry & rEntry) { diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 58bcebad70b8..508748c3b285 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -125,22 +125,6 @@ void OStoreBTreeNodeData::remove (sal_uInt16 i) } } -#if 0 /* NYI */ -/* - * merge (with right page). - */ -void OStoreBTreeNodeData::merge (const self& rPageR) -{ - sal_uInt16 const n = usageCount(); - sal_uInt16 const m = rPageR.usageCount(); - if ((n + m) <= capacityCount()) - { - memcpy (&(m_pData[n]), &(rPageR.m_pData[0]), m * sizeof(T)); - usageCount (n + m); - } -} -#endif - /* * split (left half copied from right half of left page). */ @@ -281,25 +265,6 @@ storeError OStoreBTreeNodeObject::remove ( } else { -#if 0 /* NYI */ - // Check for right sibling. - sal_uInt16 const nIndexR = nIndexL + 1; - if (nIndexR < rPage.usageCount()) - { - // Load right link node. - self aNodeR; - eErrCode = rBIOS.loadObjectAt (aNodeR, rPage.m_pData[nIndexR].m_aLink.location()); - if (eErrCode == store_E_None) - { - if (rPageL.queryMerge (rPageR)) - { - rPageL.merge (rPageR); - - eErrCode = rBIOS.free (rPageR.location()); - } - } - } -#endif /* NYI */ // Relink. rPage.m_pData[nIndexL].m_aKey = xPageL->m_pData[0].m_aKey; diff --git a/store/source/stortree.hxx b/store/source/stortree.hxx index 63443e098e46..7b9c302b5643 100644 --- a/store/source/stortree.hxx +++ b/store/source/stortree.hxx @@ -222,12 +222,6 @@ struct OStoreBTreeNodeData : public store::OStorePageData void insert (sal_uInt16 i, const T& t); void remove (sal_uInt16 i); -#if 0 /* NYI */ - /** merge (with right page). - */ - void merge (const self& rPageR); -#endif - /** split (left half copied from right half of left page). */ void split (const self& rPageL); diff --git a/store/workben/t_base.cxx b/store/workben/t_base.cxx index b6f286444a01..6a96b7c15bb1 100644 --- a/store/workben/t_base.cxx +++ b/store/workben/t_base.cxx @@ -183,15 +183,6 @@ static void __store_string_newFromUnicode_WithLength ( OUSTRING_TO_OSTRING_CVTFLAGS); } -#if 0 /* UNSUSED */ -static void __store_string_newFromUnicode ( - rtl_String **newString, const rtl_uString *value) -{ - __store_string_newFromUnicode_WithLength ( - newString, value->buffer, value->length); -} -#endif /* UNUSED */ - static void __store_string_newFromUnicode ( rtl_String **newString, const sal_Unicode *value) { diff --git a/store/workben/t_file.cxx b/store/workben/t_file.cxx index ab14b4b1111c..6357e7b8a5a6 100644 --- a/store/workben/t_file.cxx +++ b/store/workben/t_file.cxx @@ -63,28 +63,6 @@ int SAL_CALL main (int argc, char **argv) argv[1], rtl_str_getLength(argv[1]), osl_getThreadTextEncoding()); -#if 0 /* EXP */ - oslFileError result; - rtl::OUString aPath; - - result = osl_getFileURLFromSystemPath(aFilename.pData, &(aPath.pData)); - if (result != osl_File_E_None) - { - // not SystemPath, assume FileUrl. - aPath = aFilename; - } - if (rtl_ustr_ascii_shortenedCompare_WithLength(aPath.pData->buffer, aPath.pData->length, "file://", 7) != 0) - { - // not FileUrl, assume relative path. - rtl::OUString aBase; - (void) osl_getProcessWorkingDir (&(aBase.pData)); - - // absolute FileUrl. - (void) osl_getAbsoluteFileURL(aBase.pData, aPath.pData, &(aPath.pData)); - } - aFilename = aPath; -#endif /* EXP */ - eErrCode = FileLockBytes_createInstance ( xLockBytes, aFilename.pData, store_AccessReadWrite); if (eErrCode != store_E_None) diff --git a/store/workben/t_leak.cxx b/store/workben/t_leak.cxx index 0ec6240fb7e4..32033268d618 100644 --- a/store/workben/t_leak.cxx +++ b/store/workben/t_leak.cxx @@ -12,10 +12,6 @@ { rtl_Locale * pLocale = 0; osl_getProcessLocale (&pLocale); -#if 0 - rtl_TextEncoding te = osl_getThreadTextEncoding(); - (void) te; -#endif return 0; } diff --git a/store/workben/t_page.cxx b/store/workben/t_page.cxx index 8efdf333d5f1..33ca80ea81a9 100644 --- a/store/workben/t_page.cxx +++ b/store/workben/t_page.cxx @@ -127,12 +127,6 @@ SharedCount::Allocator::~Allocator() /*======================================================================*/ -#if 0 /* OLD */ - -typedef store::OStorePageData PageData; - -#else /* NEW */ - #if defined(OSL_BIGENDIAN) #define STORE_DWORD(dword) OSL_SWAPDWORD((dword)) #else @@ -210,8 +204,6 @@ struct PageData } }; -#endif /* NEW */ - class IPageAllocator { public: @@ -708,75 +700,6 @@ public: }; /*======================================================================*/ -#if 0 /* NYI */ -BIOS::load (PageObject & rPage, sal_uInt32 nOffset) -{ - result = m_xCache->readPageAt (rPage.get(), nOffset); - if (result == NotExists) - { - result = m_xLockBytes->readPageAt (rPage.get(), nOffset); - if (result != None) - return result; - - result = rPage.verify(); - if (result != None) - return result; - - result = m_xCache->writePageAt (rPage.get(), nOffset); - } - return result; -} -BIOS::save (PageObject & rPage, sal_uInt32 nOffset) -{ - rPage.guard(); - result = m_xLockBytes->writePageAt (rPage.get(), nOffset); - if (result != None) - return result; - - return m_xCache->writePageAt (rPage.get(), nOffset); -} -BIOS::init (rxLockBytes, eAccessMode, nPageSize) -{ - SuperPage super; - if (eAccessMode == store_AccessCreate) - { - sal_uInt16 pagesize = nPageSize; - if ((STORE_MINIMUM_PAGESIZE > pagesize) || (pagesize > STORE_MAXIMUM_PAGESIZE)) - return store_E_InvalidParameter; - - pagesize = ((pagesize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); - rxLockBytes->init (pagesize); - - super = allocator->construct<SuperPage>(); - super->guard(); - - rxLockBytes->writeAt (0, super, super->size()); - - } - if (eAccessMode != store_AccessCreate) - { - rxLockBytes->readAt (0, &super, super::theSize); - - super.verify(); - } - if (eErrCode != store_E_NotExists) - - -} -#endif /* NYI */ -/*======================================================================*/ - -#if 0 /* NYI */ -class PageCache -{ - std::set<const sal_uInt32, PageObject> m_pages; -public: - storeError readPageAt (PageObject & rPage, sal_uInt32 nOffset); - storeError writePageAt (PageObject const & rPage, sal_uInt32 nOffset); -}; -#endif /* NYI */ - -/*======================================================================*/ class IPageAllocator; class IPageAccess @@ -1226,15 +1149,6 @@ storeError MemoryPageAccess::writePageAt_Impl (PageHolder const & rPage, sal_uIn if (!(pagedata != 0)) return store_E_InvalidParameter; -#if 0 /* NYI */ - sal_uInt16 const bytes = pagedata->size(); // Descr.m_nSize; - OSL_ASSERT(bytes >= PageData::thePageSize); - - offset = rPage.location(); // Descr.m_nAddr; - OSL_ASSERT(nOffset == offset); - - OSL_PRECOND(offset % bytes == 0, "Unaligned page write."); -#endif /* NYI */ return pokeAt (nOffset, pagedata, pagedata->size()); } storeError MemoryPageAccess::peekAt_Impl (sal_uInt32 nOffset, void * pBuffer, sal_uInt32 nBytes) @@ -1375,106 +1289,6 @@ void MappedPageAccess::unmapFile (sal_uInt8 * pData, sal_uInt32 nSize) (void) osl_unmapFile (pData, nSize); } -#if 0 /* NYI */ -storeError MemoryPageAccess_createInstance ( - rtl::Reference< IPageAccess > & rxPageAccess, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize -) -{ - rxPageAccess = new MemoryPageAccess(); - if (!rxPageAccess.is()) - return store_E_OutOfMemory; - - return rxPageAccess->initialize (eAccessMode, nPageSize); -} - -storeError FilePageAccess_createInstance ( - rtl::Reference< IPageAccess > & rxPageAccess, - rtl_uString * pFilename, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize -) -{ - // Acquire file handle. - ResourceHolder<FileHandle> xFile; - result = xFile.get().initialize (pFilename, MODE_TO_NATIVE(eAccessMode)); - if (result != osl_File_E_None) - return ERROR_FROM_NATIVE(result); - - if (eAccessMode == store_AccessReadOnly) - { - ResourceHolder<FileMapping> xMapping; - result = xMapping.get().initialize (xFile.get()); - if (result == osl_File_E_None) - { - const sal_uInt32 nSize = sal::static_int_cast<sal_uInt32>(xMapping.get().m_uSize); - rxPageAccess = new MappedPageAccess (xMapping.get().m_pAddr, nSize); - if (!rxPageAccess.is()) - return store_E_OutOfMemory; - (void) xMapping.release(); - } - } - if (!rxPageAccess.is()) - { - rxPageAccess = new FilePageAccess (xFile.get()); - if (!rxPageAccess.is()) - return store_E_OutOfMemory; - (void) xFile.release(); - } - return rxPageAccess->initialize (eAccessMode, nPageSize); -} -#endif /* NYI */ - -/*======================================================================== - * - * test... - * - *======================================================================*/ -#if 0 /* NYI */ - -struct IDataBlock -{ - virtual sal_uInt16 singleCount() const = 0; - virtual sal_uInt32 singleLink (sal_uInt16 nIndex) const = 0; - virtual void singleLink (sal_uInt16 nIndex, sal_uInt32 nAddr) = 0; - - virtual storeError get() = 0; - virtual storeError put() = 0; - virtual storeError truncate() = 0; -}; - -struct InodePageData : public PageData -{ - virtual INameBlock & getNameBlock() = 0; - virtual IDataBlock & getDataBlock() = 0; -}; - -template< class page_data_type > -page_data_type * query (PageData *, page_data_type *); - -template<> InodePageDataV2* -query (PageData & rData, InodePageDataV2 *) -{ - if (rData.isKindOf(InodePageDataV2::m_nTypeId)) - return static_cast<InodePageDataV2*>(&rData); - return 0; -} - -class InodePageObject : public PageObject -{ -public: - static InodePageObject createInstance (PageData & rData) - { - if (query(&rData, static_cast<InodePageDataV2*>(0))) - return InodePageObjectV2 (static_cast<InodePageDataV2&>(rData)); - else if (query(&rData, static_cast<InodePageDataV1*>(0))) - return InodePageObjectV1 (static_cast<InodePageDataV1&>(rData)); - } -}; - -#endif /* NYI */ - /*======================================================================== * * main. @@ -1483,33 +1297,6 @@ public: #include <stdio.h> -#if 0 /* EXP */ -class Interface -{ -public: - virtual void deallocate(void *) /* = 0 */; -}; - -class Implementation : public Interface -{ - SharedCount m_count; - -public: - Implementation() : Interface() { printf("Ctor(%p)\n", this); } - ~Implementation() { printf("Dtor(%p)\n", this); } - - Implementation (Implementation const & rhs) : Interface(), m_count (rhs.m_count) { printf("CopyCtor(%p)\n", this); } - - virtual void deallocate(void *) {} -}; - -Interface Interface_createInstance() -{ - Implementation aInst; - return aInst; -} -#endif /* EXP */ - int SAL_CALL main (int argc, char ** argv) { OSL_PRECOND(argc >= 1, "t_page: error: insufficient number of arguments."); @@ -1534,12 +1321,6 @@ int SAL_CALL main (int argc, char ** argv) TestClient aClient; aClient.dwim (aBIOS); } -#if 0 /* EXP */ - { - Interface aIfc1 (Interface_createInstance()); - Interface aIfc2 (aIfc1); - } -#endif /* EXP */ if (argc > 1) { diff --git a/store/workben/t_store.cxx b/store/workben/t_store.cxx index 53b01955fbc2..9f4e83931e52 100644 --- a/store/workben/t_store.cxx +++ b/store/workben/t_store.cxx @@ -500,23 +500,6 @@ int SAL_CALL main (int argc, char **argv) "t_store::main(): store_createDirectory() failed"); if (eErrCode == store_E_None) { -#if 0 /* NYI */ - // Rename directory. - eErrCode = aFile.rename ( - aPath, "demostor-1.dir/", - aPath, "Renamed demostor-1.dir"); - OSL_POSTCOND( - ((eErrCode == store_E_None ) || - (eErrCode == store_E_AlreadyExists) ), - "t_store::main(): store_rename() failed"); - - eErrCode = aFile.rename ( - aPath, "Renamed demostor-1.dir/", - aPath, "demostor-1.dir"); - OSL_POSTCOND( - (eErrCode == store_E_None), - "t_store::main(): store_rename() failed"); -#endif /* NYI */ } } diff --git a/xml2cmp/source/xcd/main.cxx b/xml2cmp/source/xcd/main.cxx index 5e92bbe558dc..a09c0f78a842 100644 --- a/xml2cmp/source/xcd/main.cxx +++ b/xml2cmp/source/xcd/main.cxx @@ -172,72 +172,6 @@ Create_TypeInfo( const char * o_sOutputFile, Put2StdOut_TypeInfo(i_rData); else Put2File_TypeInfo(o_sOutputFile,i_rData); - -#if 0 - std::ofstream aOut(o_sOutputFile, std::ios::out -#if defined(WNT) || defined(OS2) - | std::ios::binary -#endif - ); - if ( !aOut ) - { - std::cerr << "Error: " << o_sOutputFile << " could not be created." << std::endl; - return; - } - - Heap aTypesHeap(12); - Simstr sLibPrefix = i_rData.ModuleName(); - - // Gather types: - List< const MultipleTextElement * > aTypes; - i_rData.Get_Types(aTypes); - - for ( unsigned t = 0; t < aTypes.size(); ++t ) - { - unsigned i_max = aTypes[t]->Size(); - for ( unsigned i = 0; i < i_max; ++i ) - { - aTypesHeap.InsertValue( aTypes[t]->Data(i), "" ); - } // end for - } - - // Write types: - WriteStr( aOut, sLibPrefix ); - WriteStr( aOut, "_XML2CMPTYPES= "); - - HeapItem * pLastHeapTop = 0; - for ( HeapItem * pHeapTop = aTypesHeap.ReleaseTop(); pHeapTop != 0; pHeapTop = aTypesHeap.ReleaseTop() ) - { - if (pLastHeapTop != 0) - { - if ( 0 == strcmp(pHeapTop->Key(), pLastHeapTop->Key()) ) - continue; - delete pLastHeapTop; - } - pLastHeapTop = pHeapTop; - - WriteStr( aOut, "\t\\\n\t\t" ); - - const char * sEnd = strchr( pHeapTop->Key(), ' ' ); - if (sEnd != 0) - { - const char * sQuali = strrchr( pHeapTop->Key(), ' ' )+1; - WriteStr( aOut, sQuali ); - WriteStr( aOut, "." ); - aOut.write( pHeapTop->Key(), sEnd - pHeapTop->Key() ); - } - else - WriteStr( aOut, pHeapTop->Key() ); - } // end for - - if (pLastHeapTop != 0) - { - delete pLastHeapTop; - pLastHeapTop = 0; - } - - aOut.close(); -#endif // 0 } void diff --git a/xml2cmp/source/xcd/xmltree.cxx b/xml2cmp/source/xcd/xmltree.cxx index 1503c09d2ff8..6c823a1d8054 100644 --- a/xml2cmp/source/xcd/xmltree.cxx +++ b/xml2cmp/source/xcd/xmltree.cxx @@ -248,41 +248,5 @@ Create_CompDescrOptional_Element( MultipleTextElement * & o_rTypes, } -#if 0 - -const TextElement * -ModuleDescription::ServiceDependencies() const -{ - const unsigned nEarliestPossibleServiceDependenciesIndexInModules = 1; - - for ( unsigned i = nEarliestPossibleServiceDependenciesIndexInModules; - i < Children().size(); - ++i ) - { - if ( strcmp(Children()[i]->Name(), C_sServiceDependency) == 0 ) - return Children()[i]; - } - return 0; -} - -const TextElement & -ComponentDescription::SupportedServices() const -{ - return *Children()[C_nSupportedServicesIndex]; -} - -const TextElement * -ComponentDescription::ServiceDependencies() const -{ - for ( unsigned i = C_nEarliestPossibleServiceDependenciesIndex; i < Children().size(); ++i ) - { - if ( strcmp(Children()[i]->Name(),C_sServiceDependency) == 0) - return Children()[i]; - } - return 0; -} - -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |