logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@houston.rr.com
Subject RE: VC5 and logger
Date Thu, 01 Jul 2004 18:02:09 GMT
The end of this message contains a patch file that allowed me to build the CVS version of log4cxx
using Visual C++ 97 in the IDE.  The changes to make to 0.9.7 are nearly identical.

The first step (not represented in the patch) is to change "Format Version 6.0" to "Format
Version 5.0" in all the *.dsw and *.dsp files in the msvc directory.  If permanently changed
to "5.0", I think that VC6 will just prompt to upgrade when first loaded.

The second step (again not in the patch) is to change config_msvc.h to comment out HAVE_XML
and HAVE_MS_XML.   VC5 doesn't like building with MSXML.

The following issues were encountered:

The use of "#if _MSC_VER == 1200" to guard Interlocked* methods.  I just changed these to
"#if _MSC_DEV <= 1200" which causes the VC6 forms to be used for VC6 and all earlier version.

dateformat.cpp: VC5 would generate an internal compiler error when trying to evaluate:

string = string + char* + string;

I expanded these to:

string = string;
string += char*;
string += string;


logger.cpp: VC5 would complain that a control path did not return a value even though an exception
was thrown.  I added a unreachable return statement (which might result in a compile warning
or error) with another compiler.

optionconverter.cpp: Included "log4cxx/appenderskeleton.h" to avoid a problem expanding ObjPtrT<Appender>

include/log4cxx/nt/nteventlogappender.h

VC5 complained about the HKEY typedef.  The wtypes.h provided with VC 5 - 7.1 all define HKEY
as a void* or a void RPC_FAR*.


Index: condition.cpp
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/src/condition.cpp,v
retrieving revision 1.6
diff -u -r1.6 condition.cpp
--- condition.cpp	13 May 2004 21:14:38 -0000	1.6
+++ condition.cpp	1 Jul 2004 17:34:40 -0000
@@ -69,7 +69,7 @@
 	// updated by another thread.
 
 	// if (waiters != 0) (atomic comparison)
-#	if _MSC_VER == 1200	// MSDEV 6
+#	if _MSC_VER <= 1200	// MSDEV 6 or earlier
 	if ((long)InterlockedCompareExchange((void**)&waiters, 0, 0) != 0)
 #	else
 	if ((long)InterlockedCompareExchange(&waiters, 0, 0) != 0)
@@ -86,7 +86,7 @@
 	::pthread_cond_wait(&condition, &mutex.mutex);
 #elif defined(HAVE_MS_THREAD)
 
-#if _MSC_VER == 1200	// MSDEV 6
+#if _MSC_VER <= 1200	// MSDEV 6 or earlier
 	::InterlockedIncrement((long *)&waiters);
 #else
 	::InterlockedIncrement(&waiters);
@@ -98,7 +98,7 @@
 		throw ConditionException();
 	}
 
-#if _MSC_VER == 1200	// MSDEV 6
+#if _MSC_VER <= 1200	// MSDEV 6 or earlier
 	long oldWaiters = ::InterlockedDecrement((long*)&waiters);
 #else
 	long oldWaiters = ::InterlockedDecrement(&waiters);
Index: dateformat.cpp
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/src/dateformat.cpp,v
retrieving revision 1.11
diff -u -r1.11 dateformat.cpp
--- dateformat.cpp	13 May 2004 21:07:55 -0000	1.11
+++ dateformat.cpp	1 Jul 2004 17:34:40 -0000
@@ -34,8 +34,9 @@
 	size_t pos = this->dateFormat.find(_T("%Q"));
 	if (pos != String::npos)
 	{
-		this->dateFormat = this->dateFormat.substr(0, pos) +
-			_T("%") + this->dateFormat.substr(pos);
+		this->dateFormat = this->dateFormat.substr(0, pos);
+		this->dateFormat += _T("%");
+		this->dateFormat += this->dateFormat.substr(pos);
 	}
 }
 
@@ -45,8 +46,9 @@
 	size_t pos = this->dateFormat.find(_T("%Q"));
 	if (pos != String::npos)
 	{
-		this->dateFormat = this->dateFormat.substr(0, pos) +
-			_T("%") + this->dateFormat.substr(pos);
+		this->dateFormat = this->dateFormat.substr(0, pos);
+		this->dateFormat += _T("%");
+		this->dateFormat += this->dateFormat.substr(pos);
 	}
 }
 
Index: logger.cpp
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/src/logger.cpp,v
retrieving revision 1.13
diff -u -r1.13 logger.cpp
--- logger.cpp	22 Apr 2004 21:21:33 -0000	1.13
+++ logger.cpp	1 Jul 2004 17:34:40 -0000
@@ -193,6 +193,7 @@
 	}
 
 	throw RuntimeException(_T("level is null for logger") + name);
+	return this->level;
 }
 
 LoggerRepositoryPtr Logger::getLoggerRepository() const
Index: optionconverter.cpp
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/src/optionconverter.cpp,v
retrieving revision 1.14
diff -u -r1.14 optionconverter.cpp
--- optionconverter.cpp	24 Apr 2004 07:51:58 -0000	1.14
+++ optionconverter.cpp	1 Jul 2004 17:34:41 -0000
@@ -16,6 +16,7 @@
  
 #include <log4cxx/spi/loggerfactory.h>
 #include <log4cxx/spi/loggerrepository.h>
+#include <log4cxx/appenderskeleton.h>
 #include <log4cxx/helpers/optionconverter.h>
 #include <algorithm>
 #include <ctype.h>
Index: thread.cpp
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/src/thread.cpp,v
retrieving revision 1.12
diff -u -r1.12 thread.cpp
--- thread.cpp	13 May 2004 21:14:38 -0000	1.12
+++ thread.cpp	1 Jul 2004 17:34:41 -0000
@@ -205,7 +205,7 @@
 	sparc_atomic_add_32(val, 1);
 	return *val;
 #elif defined(HAVE_MS_THREAD)
-#if _MSC_VER == 1200	// MSDEV 6
+#if _MSC_VER <= 1200	// MSDEV 6 or earlier
 	return ::InterlockedIncrement((long *)val);
 #else
 	return ::InterlockedIncrement(val);
@@ -231,7 +231,7 @@
 	sparc_atomic_add_32(val, -1);
 	return *val;
 #elif defined(HAVE_MS_THREAD)
-#if _MSC_VER == 1200	// MSDEV 6
+#if _MSC_VER <= 1200	// MSDEV 6 or earlier
 	return ::InterlockedDecrement((long *)val);Index: log4cxx/nt/nteventlogappender.h
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/include/log4cxx/nt/nteventlogappender.h,v
retrieving revision 1.10
diff -u -r1.10 nteventlogappender.h
--- log4cxx/nt/nteventlogappender.h	24 Apr 2004 06:55:02 -0000	1.10
+++ log4cxx/nt/nteventlogappender.h	1 Jul 2004 17:35:21 -0000
@@ -22,7 +22,7 @@
 typedef void * HANDLE;
 struct HKEY__; 
 struct _SID;
-typedef struct HKEY__ *HKEY;
+typedef void *HKEY;
 typedef struct _SID SID;
 
 namespace log4cxx













Mime
View raw message