diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-06-20 03:29:50 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-06-20 03:29:50 +0000 |
commit | b88a51db8e0c83b0d74fe5a68ed38e0c9a7d00ed (patch) | |
tree | 271a374e69cc81e6cc71b6af09bb571e23944f33 /sal | |
parent | 5028bf5b6ce95eaa2a6c5cb3a43342702cb1692e (diff) |
INTEGRATION: CWS warnings01 (1.8.66); FILE MERGED
2005/09/23 01:28:58 sb 1.8.66.2: RESYNC: (1.8-1.9); FILE MERGED
2005/08/30 17:03:17 sb 1.8.66.1: #i53898# Made code warning-free.
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/source/logfile.cxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/sal/rtl/source/logfile.cxx b/sal/rtl/source/logfile.cxx index f456a92aff3c..35c3422f6bd6 100644 --- a/sal/rtl/source/logfile.cxx +++ b/sal/rtl/source/logfile.cxx @@ -4,9 +4,9 @@ * * $RCSfile: logfile.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: rt $ $Date: 2005-09-08 16:02:22 $ + * last change: $Author: hr $ $Date: 2006-06-20 04:29:50 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -105,6 +105,10 @@ LoggerGuard::~LoggerGuard() } } +// The destructor of this static LoggerGuard is "activated" by the assignment to +// g_buffer in init(): +LoggerGuard loggerGuard; + Mutex & getLogMutex() { static Mutex *pMutex = 0; @@ -123,7 +127,11 @@ Mutex & getLogMutex() OUString getFileUrl( const OUString &name ) { OUString aRet; - OSL_VERIFY( osl_getFileURLFromSystemPath( name.pData, &aRet.pData ) == osl_File_E_None ); + if ( osl_getFileURLFromSystemPath( name.pData, &aRet.pData ) + != osl_File_E_None ) + { + OSL_ASSERT( false ); + } OUString aWorkingDirectory; osl_getProcessWorkingDir( &(aWorkingDirectory.pData) ); @@ -170,12 +178,8 @@ void init() { if( osl_File_E_None == e ) { TimeValue aCurrentTime; - //Allocing a g_buffer implies the need for a LoggerGuard, this - //method is already double-locked, so no need for rtl::Static - static LoggerGuard guard; g_buffer = ( sal_Char * ) rtl_allocateMemory( g_BUFFERSIZE ); sal_Int64 nConverted = 0; - sal_Int64 nWritten = 0; if (osl_getSystemTime (&aCurrentTime)) { nConverted = (sal_Int64 ) sprintf ( @@ -185,14 +189,19 @@ void init() { aCurrentTime.Seconds + 1e-9 * aCurrentTime.Nanosec, osl_getGlobalTimer()); - sal_Int64 nWritten; if( nConverted > 0 ) + { + sal_Int64 nWritten; osl_writeFile( g_aFile, g_buffer, nConverted , (sal_uInt64 *)&nWritten ); + } } nConverted = sprintf (g_buffer, "Process id is %lu\n", aProcessId); if( nConverted ) + { + sal_Int64 nWritten; osl_writeFile( g_aFile, g_buffer, nConverted, (sal_uInt64 *)&nWritten ); + } } else { |