carnold     2004/08/10 15:39:02

  Modified:    src      thread.cpp condition.cpp logger.cpp
                        nteventlogappender.cpp optionconverter.cpp
                        dateformat.cpp
               include/log4cxx/nt nteventlogappender.h
               include/log4cxx config_msvc.h.in
  Log:
  Issue: LOGCXX-8: VC5 or (VC6 + current SDK) compilation failure
  Submitted by: [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.13      +2 -2      logging-log4cxx/src/thread.cpp
  
  Index: thread.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/thread.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- thread.cpp        13 May 2004 21:14:38 -0000      1.12
  +++ thread.cpp        10 Aug 2004 22:39:00 -0000      1.13
  @@ -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);
  
  
  
  1.7       +3 -3      logging-log4cxx/src/condition.cpp
  
  Index: condition.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/condition.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- condition.cpp     13 May 2004 21:14:38 -0000      1.6
  +++ condition.cpp     10 Aug 2004 22:39:00 -0000      1.7
  @@ -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);
  
  
  
  1.14      +1 -0      logging-log4cxx/src/logger.cpp
  
  Index: logger.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/logger.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- logger.cpp        22 Apr 2004 21:21:33 -0000      1.13
  +++ logger.cpp        10 Aug 2004 22:39:01 -0000      1.14
  @@ -193,6 +193,7 @@
        }
   
        throw RuntimeException(_T("level is null for logger") + name);
  +     return this->level;
   }
   
   LoggerRepositoryPtr Logger::getLoggerRepository() const
  
  
  
  1.9       +9 -9      logging-log4cxx/src/nteventlogappender.cpp
  
  Index: nteventlogappender.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/nteventlogappender.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- nteventlogappender.cpp    3 Aug 2004 06:01:25 -0000       1.8
  +++ nteventlogappender.cpp    10 Aug 2004 22:39:01 -0000      1.9
  @@ -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"));
  
  
  
  1.15      +1 -0      logging-log4cxx/src/optionconverter.cpp
  
  Index: optionconverter.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/optionconverter.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- optionconverter.cpp       24 Apr 2004 07:51:58 -0000      1.14
  +++ optionconverter.cpp       10 Aug 2004 22:39:01 -0000      1.15
  @@ -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>
  
  
  
  1.12      +6 -4      logging-log4cxx/src/dateformat.cpp
  
  Index: dateformat.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/dateformat.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- dateformat.cpp    13 May 2004 21:07:55 -0000      1.11
  +++ dateformat.cpp    10 Aug 2004 22:39:01 -0000      1.12
  @@ -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);
        }
   }
   
  
  
  
  1.11      +11 -8     logging-log4cxx/include/log4cxx/nt/nteventlogappender.h
  
  Index: nteventlogappender.h
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/include/log4cxx/nt/nteventlogappender.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- nteventlogappender.h      24 Apr 2004 06:55:02 -0000      1.10
  +++ nteventlogappender.h      10 Aug 2004 22:39:01 -0000      1.11
  @@ -19,11 +19,6 @@
   
   #include <log4cxx/appenderskeleton.h>
   
  -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);
                        /*
  
  
  
  1.3       +12 -0     logging-log4cxx/include/log4cxx/config_msvc.h.in
  
  Index: config_msvc.h.in
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/include/log4cxx/config_msvc.h.in,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- config_msvc.h.in  3 Aug 2004 06:01:26 -0000       1.2
  +++ config_msvc.h.in  10 Aug 2004 22:39:01 -0000      1.3
  @@ -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
  
  
  

Reply via email to