Index: include/log4cxx/config_msvc.h.in =================================================================== RCS file: /home/cvs/logging-log4cxx/include/log4cxx/config_msvc.h.in,v retrieving revision 1.2 diff -u -r1.2 config_msvc.h.in --- include/log4cxx/config_msvc.h.in 3 Aug 2004 06:01:26 -0000 1.2 +++ include/log4cxx/config_msvc.h.in 10 Aug 2004 22:27:45 -0000 @@ -43,4 +43,16 @@ #endif #endif +#if !defined(LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS) +#if defined(_MSC_VER) +#if _MSC_VER <= 1200 +#define LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS 1 +#else +#define LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS 0 +#endif +#else +#define LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS 0 +#endif +#endif + #define _WIN32_WINNT 0x0400 Index: include/log4cxx/nt/nteventlogappender.h =================================================================== RCS file: /home/cvs/logging-log4cxx/include/log4cxx/nt/nteventlogappender.h,v retrieving revision 1.10 diff -u -r1.10 nteventlogappender.h --- include/log4cxx/nt/nteventlogappender.h 24 Apr 2004 06:55:02 -0000 1.10 +++ include/log4cxx/nt/nteventlogappender.h 10 Aug 2004 22:27:45 -0000 @@ -19,11 +19,6 @@ #include -typedef void * HANDLE; -struct HKEY__; -struct _SID; -typedef struct HKEY__ *HKEY; -typedef struct _SID SID; namespace log4cxx { @@ -77,10 +72,18 @@ { return server; } protected: + // + // these typedef are proxies for the real Win32 definitions + // and need to be cast to the global definitions before + // use with a Win32 API call + typedef void* HKEY; + typedef void SID; + typedef void* HANDLE; + virtual void append(const spi::LoggingEventPtr& event); - HKEY regGetKey(const String& subkey, unsigned long *disposition); - void regSetString(HKEY hkey, const String& name, const String& value); - void regSetDword(HKEY hkey, const String& name, unsigned long value); + static HKEY regGetKey(const String& subkey, unsigned long *disposition); + static void regSetString(HKEY hkey, const String& name, const String& value); + static void regSetDword(HKEY hkey, const String& name, unsigned long value); unsigned short getEventType(const spi::LoggingEventPtr& event); unsigned short getEventCategory(const spi::LoggingEventPtr& event); /* Index: src/condition.cpp =================================================================== RCS file: /home/cvs/logging-log4cxx/src/condition.cpp,v retrieving revision 1.6 diff -u -r1.6 condition.cpp --- src/condition.cpp 13 May 2004 21:14:38 -0000 1.6 +++ src/condition.cpp 10 Aug 2004 22:27:45 -0000 @@ -69,7 +69,7 @@ // updated by another thread. // if (waiters != 0) (atomic comparison) -# if _MSC_VER == 1200 // MSDEV 6 +# if LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6 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 LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6 ::InterlockedIncrement((long *)&waiters); #else ::InterlockedIncrement(&waiters); @@ -98,7 +98,7 @@ throw ConditionException(); } -#if _MSC_VER == 1200 // MSDEV 6 +#if LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6 long oldWaiters = ::InterlockedDecrement((long*)&waiters); #else long oldWaiters = ::InterlockedDecrement(&waiters); Index: src/dateformat.cpp =================================================================== RCS file: /home/cvs/logging-log4cxx/src/dateformat.cpp,v retrieving revision 1.11 diff -u -r1.11 dateformat.cpp --- src/dateformat.cpp 13 May 2004 21:07:55 -0000 1.11 +++ src/dateformat.cpp 10 Aug 2004 22:27:45 -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: src/logger.cpp =================================================================== RCS file: /home/cvs/logging-log4cxx/src/logger.cpp,v retrieving revision 1.13 diff -u -r1.13 logger.cpp --- src/logger.cpp 22 Apr 2004 21:21:33 -0000 1.13 +++ src/logger.cpp 10 Aug 2004 22:27:45 -0000 @@ -193,6 +193,7 @@ } throw RuntimeException(_T("level is null for logger") + name); + return this->level; } LoggerRepositoryPtr Logger::getLoggerRepository() const Index: src/nteventlogappender.cpp =================================================================== RCS file: /home/cvs/logging-log4cxx/src/nteventlogappender.cpp,v retrieving revision 1.8 diff -u -r1.8 nteventlogappender.cpp --- src/nteventlogappender.cpp 3 Aug 2004 06:01:25 -0000 1.8 +++ src/nteventlogappender.cpp 10 Aug 2004 22:27:45 -0000 @@ -113,7 +113,7 @@ if (pCurrentUserSID != NULL) { - CCtUserSIDHelper::FreeSid(pCurrentUserSID); + CCtUserSIDHelper::FreeSid((::SID*) pCurrentUserSID); pCurrentUserSID = NULL; } } @@ -154,7 +154,7 @@ close(); // current user security identifier - CCtUserSIDHelper::GetCurrentUserSID(&pCurrentUserSID); + CCtUserSIDHelper::GetCurrentUserSID((::SID**) &pCurrentUserSID); addRegistryInfo(); @@ -192,10 +192,10 @@ } } -HKEY NTEventLogAppender::regGetKey(const String& subkey, DWORD *disposition) +NTEventLogAppender::HKEY NTEventLogAppender::regGetKey(const String& subkey, DWORD *disposition) { - HKEY hkey = 0; - RegCreateKeyEx(HKEY_LOCAL_MACHINE, subkey.c_str(), 0, NULL, + ::HKEY hkey = 0; + RegCreateKeyEx((::HKEY) HKEY_LOCAL_MACHINE, subkey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hkey, disposition); return hkey; @@ -203,12 +203,12 @@ void NTEventLogAppender::regSetString(HKEY hkey, const String& name, const String& value) { - RegSetValueEx(hkey, name.c_str(), 0, REG_SZ, (LPBYTE)value.c_str(), value.length()*sizeof(wchar_t)); + RegSetValueEx((::HKEY) hkey, name.c_str(), 0, REG_SZ, (LPBYTE)value.c_str(), value.length()*sizeof(wchar_t)); } void NTEventLogAppender::regSetDword(HKEY hkey, const String& name, DWORD value) { - RegSetValueEx(hkey, name.c_str(), 0, REG_DWORD, (LPBYTE)&value, sizeof(DWORD)); + RegSetValueEx((::HKEY) hkey, name.c_str(), 0, REG_DWORD, (LPBYTE)&value, sizeof(DWORD)); } /* @@ -217,11 +217,11 @@ void NTEventLogAppender::addRegistryInfo() { DWORD disposition; - HKEY hkey = 0; + ::HKEY hkey = 0; String subkey = _T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\") + log + _T("\\") + source; - hkey = regGetKey(subkey, &disposition); + hkey = (::HKEY) regGetKey(subkey, &disposition); if (disposition == REG_CREATED_NEW_KEY) { regSetString(hkey, _T("EventMessageFile"), _T("NTEventLogAppender.dll")); Index: src/optionconverter.cpp =================================================================== RCS file: /home/cvs/logging-log4cxx/src/optionconverter.cpp,v retrieving revision 1.14 diff -u -r1.14 optionconverter.cpp --- src/optionconverter.cpp 24 Apr 2004 07:51:58 -0000 1.14 +++ src/optionconverter.cpp 10 Aug 2004 22:27:46 -0000 @@ -16,6 +16,7 @@ #include #include +#include #include #include #include Index: src/thread.cpp =================================================================== RCS file: /home/cvs/logging-log4cxx/src/thread.cpp,v retrieving revision 1.12 diff -u -r1.12 thread.cpp --- src/thread.cpp 13 May 2004 21:14:38 -0000 1.12 +++ src/thread.cpp 10 Aug 2004 22:27:46 -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 LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6 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 LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6 return ::InterlockedDecrement((long *)val); #else return ::InterlockedDecrement(val);