[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h |
Date: |
Mon, 20 Aug 2007 16:21:04 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/08/20 16:21:04
Modified files:
. : ChangeLog
libbase : log.cpp log.h
Log message:
* libbase/log.{cpp,h}: print an error on stderr of the debug
log file
can not be opened for writing. Minor cleanups (including dox).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4045&r2=1.4046
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.cpp?cvsroot=gnash&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.h?cvsroot=gnash&r1=1.59&r2=1.60
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4045
retrieving revision 1.4046
diff -u -b -r1.4045 -r1.4046
--- ChangeLog 20 Aug 2007 15:15:28 -0000 1.4045
+++ ChangeLog 20 Aug 2007 16:21:03 -0000 1.4046
@@ -1,5 +1,10 @@
2007-08-20 Sandro Santilli <address@hidden>
+ * libbase/log.{cpp,h}: print an error on stderr of the debug log file
+ can not be opened for writing. Minor cleanups (including dox).
+
+2007-08-20 Sandro Santilli <address@hidden>
+
* server/vm/ExecutableCode.h (FunctionCode::markReachableResources):
Don't mark the function twice, and most importantly don't forget
to mark the target character !!
Index: libbase/log.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- libbase/log.cpp 20 Aug 2007 10:39:23 -0000 1.56
+++ libbase/log.cpp 20 Aug 2007 16:21:04 -0000 1.57
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: log.cpp,v 1.56 2007/08/20 10:39:23 strk Exp $ */
+/* $Id: log.cpp,v 1.57 2007/08/20 16:21:04 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -340,7 +340,9 @@
}
// Default constructor
-LogFile::LogFile (void): _state(OPEN),
+LogFile::LogFile (void)
+ :
+ _state(CLOSED),
_stamp(true),
_write(true),
_trace(false)
@@ -374,31 +376,35 @@
// TODO: expand ~ to getenv("HOME") !!
- _outstream.open (loadfile.c_str(), ios::out);
- _filespec = loadfile;
- _state = OPEN;
+ openLog(loadfile);
}
-LogFile::LogFile (const char *filespec): _stamp(true), _write(true)
+LogFile::LogFile (const char *filespec)
+ :
+ _state(CLOSED),
+ _stamp(true),
+ _write(true)
{
- if (_state == OPEN) {
- _outstream.close ();
- }
-
- _filespec = filespec;
- _outstream.open (filespec, ios::out);
- _state = OPEN;
+ openLog(filespec);
}
-/// \brief open the log file
bool
LogFile::openLog (const char *filespec)
{
+ boost::mutex::scoped_lock lock(_ioMutex);
if (_state == OPEN) {
_outstream.close ();
+ _state = CLOSED;
}
_outstream.open (filespec, ios::out);
+ if( ! _outstream ) {
+ // Can't use log_error here...
+ std::cerr << "ERROR: can't open debug log file " << filespec << " for
writing." << std::endl;
+ return false;
+ }
+
+ _filespec = filespec;
_state = OPEN;
// LogFile::outstream << "Opened " << filespec << endl;
@@ -406,7 +412,6 @@
return true;
}
-/// \brief close the log file
bool
LogFile::closeLog (void)
{
@@ -420,7 +425,6 @@
return true;
}
-/// \brief remove the log file
bool
LogFile::removeLog (void)
{
Index: libbase/log.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- libbase/log.h 1 Jul 2007 10:54:09 -0000 1.59
+++ libbase/log.h 20 Aug 2007 16:21:04 -0000 1.60
@@ -99,10 +99,30 @@
const char *getEntry(void);
+ /// Open the specified file to write logs on disk
+ //
+ /// Locks _ioMutex to prevent race conditions accessing _outstream
+ ///
+ /// @return true on success, false on failure
+ ///
+ bool openLog(const std::string& filespec)
+ {
+ return openLog(filespec.c_str());
+ }
+
+ /// See openLog(const std::string&)
bool openLog(const char *filespec);
+
+ /// Remove the log file
+ //
+ /// Does NOT lock _ioMutex (should it?)
+ ///
bool removeLog(void);
- // locks _ioMutex to prevent race conditions accessing _outstream
+ /// Close the log file
+ //
+ /// Locks _ioMutex to prevent race conditions accessing _outstream
+ ///
bool closeLog(void);
// accessors for the verbose level
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h,
Sandro Santilli <=