You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2007/12/21 07:51:13 UTC

svn commit: r606117 - in /logging/log4cxx/trunk: ./ src/dependencies/esmtp/ src/main/cpp/ src/main/include/log4cxx/helpers/

Author: carnold
Date: Thu Dec 20 22:51:09 2007
New Revision: 606117

URL: http://svn.apache.org/viewvc?rev=606117&view=rev
Log:
LOGCXX-85: MSVC 6 fixes

Modified:
    logging/log4cxx/trunk/build.xml
    logging/log4cxx/trunk/src/dependencies/esmtp/build.xml
    logging/log4cxx/trunk/src/main/cpp/hierarchy.cpp
    logging/log4cxx/trunk/src/main/cpp/logger.cpp
    logging/log4cxx/trunk/src/main/cpp/nteventlogappender.cpp
    logging/log4cxx/trunk/src/main/cpp/odbcappender.cpp
    logging/log4cxx/trunk/src/main/cpp/optionconverter.cpp
    logging/log4cxx/trunk/src/main/cpp/simpledateformat.cpp
    logging/log4cxx/trunk/src/main/cpp/transcoder.cpp
    logging/log4cxx/trunk/src/main/include/log4cxx/helpers/transcoder.h

Modified: logging/log4cxx/trunk/build.xml
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/build.xml?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/build.xml (original)
+++ logging/log4cxx/trunk/build.xml Thu Dec 20 22:51:09 2007
@@ -455,7 +455,6 @@
     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
        match="@HAS_SYSLOG@"
        replace="1"/>
-<<<<<<< .mine
     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
        match="@HAS_STD_LOCALE@"
        replace="1"/>
@@ -483,14 +482,6 @@
     <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
        match="@HAS_ODBC@"
        replace="0"/>
-=======
-    <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
-       match="@HAS_LIBESMTP@"
-       replace="0"/>
-    <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
-       match="@HAS_ODBC@"
-       replace="0"/>
->>>>>>> .r606088
 </target>
 
 <target name="build-apr" depends="init" unless="apr-available">

Modified: logging/log4cxx/trunk/src/dependencies/esmtp/build.xml
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/dependencies/esmtp/build.xml?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/dependencies/esmtp/build.xml (original)
+++ logging/log4cxx/trunk/src/dependencies/esmtp/build.xml Thu Dec 20 22:51:09 2007
@@ -30,6 +30,7 @@
 <property name="esmtp.version" value="1.0.4"/>
 <property name="esmtp.dir" location="${ant.file}/../../../../../libesmtp-${esmtp.version}"/>
 <property name="esmtp.include.dir" location="${esmtp.dir}"/>
+<property name="esmtp.win.include.dir" location="${ant.file}/../win32"/>
 <property name="build.dir" location="${user.dir}/target"/>
 <property name="src.dir" location="${esmtp.dir}"/>
 <property name="esmtp.lib.type" value="shared"/>
@@ -170,7 +171,16 @@
         outputfileproperty="esmtp.dll"
         debug="${debug}"
         projectsOnly="${projectsOnly}">
-        <fileset dir="${src.dir}" includes="*.c" excludes="getaddrinfo.c"/>
+        <fileset dir="${src.dir}">
+            <include name="*.c"/>
+            <exclude name="getaddrinfo.c"/>
+            <exclude name="gethostbyname.c" if="is-windows"/>
+            <exclude name="strdup.c" if="is-windows"/>
+            <exclude name="snprintf.c" if="is-windows"/>
+            <exclude name="auth-client.c" if="is-windows"/>
+            <!-- exclude name="siobuf.c" if="is-windows"/ -->
+        </fileset>
+        <includepath path="${esmtp.win.include.dir}" if="is-windows"/>
         <includepath path="${esmtp.include.dir}"/>
         <defineset define="HAVE_CONFIG_H"/>
         <defineset>

Modified: logging/log4cxx/trunk/src/main/cpp/hierarchy.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/hierarchy.cpp?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/hierarchy.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/hierarchy.cpp Thu Dec 20 22:51:09 2007
@@ -130,7 +130,7 @@
 }
 
 void Hierarchy::setThreshold(const LogString& levelStr) {
-        const LevelPtr& l = Level::toLevel(levelStr, 0);
+        LevelPtr l(Level::toLevelLS(levelStr, 0));
 
         if(l != 0)
         {

Modified: logging/log4cxx/trunk/src/main/cpp/logger.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/logger.cpp?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/logger.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/logger.cpp Thu Dec 20 22:51:09 2007
@@ -219,8 +219,8 @@
                 }
                 catch (MissingResourceException&)
                 {
-                        error(LOG4CXX_STR("No resource is associated with key \"") +
-                                key + LOG4CXX_STR("\"."));
+					logLS(Level::getError(), LOG4CXX_STR("No resource is associated with key \"") +
+						key + LOG4CXX_STR("\"."), LocationInfo::getLocationUnavailable());
 
                         return LogString();
                 }
@@ -478,8 +478,7 @@
 
 LoggerPtr Logger::getLogger(const std::string& name)
 {
-        LOG4CXX_DECODE_CHAR(lname, name);
-        return LogManager::getLogger(lname);
+        return LogManager::getLogger(name);
 }
 
 
@@ -494,10 +493,10 @@
         return LogManager::getRootLogger();
 }
 
-LoggerPtr Logger::getLogger(const LogString& name,
+LoggerPtr Logger::getLoggerLS(const LogString& name,
         const spi::LoggerFactoryPtr& factory)
 {
-        return LogManager::getLogger(name, factory);
+        return LogManager::getLoggerLS(name, factory);
 }
 
 void Logger::getName(std::string& rv) const {

Modified: logging/log4cxx/trunk/src/main/cpp/nteventlogappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/nteventlogappender.cpp?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/nteventlogappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/nteventlogappender.cpp Thu Dec 20 22:51:09 2007
@@ -354,7 +354,6 @@
         MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
         lpMsgBuf,
         MSGSIZE, NULL );
-    size_t msgLen = wcslen(lpMsgBuf);
 #else
     char* lpMsgBuf = (char*) p.palloc(MSGSIZE);
     DWORD dw = GetLastError();
@@ -367,14 +366,13 @@
         lpMsgBuf,
         MSGSIZE, NULL );
 
-    size_t msgLen = strlen(lpMsgBuf);
 #endif
 
     LogString msg(function);
     msg.append(LOG4CXX_STR(" failed with error "));
     StringHelper::toString((size_t) dw, p, msg);
     msg.append(LOG4CXX_STR(": "));
-    Transcoder::decode(lpMsgBuf, msgLen, msg);
+    Transcoder::decode(lpMsgBuf, msg);
 
     return msg;
 }

Modified: logging/log4cxx/trunk/src/main/cpp/odbcappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/odbcappender.cpp?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/odbcappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/odbcappender.cpp Thu Dec 20 22:51:09 2007
@@ -120,7 +120,8 @@
       ret = SQLAllocHandle( SQL_HANDLE_STMT, con, &stmt);
       if (ret < 0)
       {
-         throw SQLException( GetErrorMessage( SQL_HANDLE_DBC, con, "Failed to allocate sql handle.") );
+		 LOG4CXX_DECODE_CHAR(msg, GetErrorMessage( SQL_HANDLE_DBC, con, "Failed to allocate sql handle."));
+         throw SQLException( msg );
       }
 
       LOG4CXX_ENCODE_CHAR( strEncodedSql, sql );
@@ -128,7 +129,8 @@
 
      if (ret < 0)
       {
-         throw SQLException( GetErrorMessage( SQL_HANDLE_STMT, stmt, "Failed to execute sql statement.") );
+		 LOG4CXX_DECODE_CHAR(msg, GetErrorMessage( SQL_HANDLE_STMT, stmt, "Failed to execute sql statement."));
+         throw SQLException( msg );
       }
    }
    catch (SQLException& e)
@@ -195,7 +197,7 @@
       ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
       if (ret < 0)
       {
-        std::string strErr = GetErrorMessage(SQL_HANDLE_ENV, env, "Failed to allocate SQL handle.");
+         LOG4CXX_DECODE_CHAR(strErr, GetErrorMessage(SQL_HANDLE_ENV, env, "Failed to allocate SQL handle."));
          env = SQL_NULL_HENV;
          throw SQLException( strErr );
       }
@@ -203,7 +205,7 @@
       ret = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);
       if (ret < 0)
       {
-       std::string strErr = GetErrorMessage(SQL_HANDLE_ENV, env, "Failed to set odbc version.");
+         LOG4CXX_DECODE_CHAR(strErr, GetErrorMessage(SQL_HANDLE_ENV, env, "Failed to set odbc version."));
          SQLFreeHandle(SQL_HANDLE_ENV, env);
          env = SQL_NULL_HENV;
          throw SQLException( strErr );
@@ -215,7 +217,7 @@
       ret = SQLAllocHandle(SQL_HANDLE_DBC, env, &connection);
       if (ret < 0)
       {
-       std::string strErr = GetErrorMessage(SQL_HANDLE_DBC, connection, "Failed to allocate sql handle.");
+         LOG4CXX_DECODE_CHAR(strErr, GetErrorMessage(SQL_HANDLE_DBC, connection, "Failed to allocate sql handle."));
          connection = SQL_NULL_HDBC;
          throw SQLException( strErr );
       }
@@ -236,7 +238,7 @@
 
      if (ret < 0)
       {
-       std::string strErr = GetErrorMessage( SQL_HANDLE_DBC, connection, "Failed to connect to database.");
+         LOG4CXX_DECODE_CHAR(strErr, GetErrorMessage( SQL_HANDLE_DBC, connection, "Failed to connect to database."));
          SQLFreeHandle(SQL_HANDLE_DBC, connection);
          connection = SQL_NULL_HDBC;
          throw SQLException( strErr );

Modified: logging/log4cxx/trunk/src/main/cpp/optionconverter.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/optionconverter.cpp?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/optionconverter.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/optionconverter.cpp Thu Dec 20 22:51:09 2007
@@ -258,7 +258,7 @@
                          + value
                          +LOG4CXX_STR("]"));
                         // no class name specified : use standard Level class
-                        return Level::toLevel(value, defaultValue);
+                        return Level::toLevelLS(value, defaultValue);
                 }
         }
 
@@ -270,7 +270,7 @@
         // This is degenerate case but you never know.
         if (levelName.empty())
         {
-                return Level::toLevel(value, defaultValue);
+                return Level::toLevelLS(value, defaultValue);
         }
 
         try

Modified: logging/log4cxx/trunk/src/main/cpp/simpledateformat.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/simpledateformat.cpp?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/simpledateformat.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/simpledateformat.cpp Thu Dec 20 22:51:09 2007
@@ -39,12 +39,24 @@
 #endif
 
 
+#if !defined(_HAS)
+#define _HAS(locale, type) std::has_facet< type >(locale)
+#endif
+
+#if !defined(_USE)
+#define _USE(locale, type) std::use_facet < type >(locale)
+#define _PUT(facet,os, time, spec) facet.put(os, os, os.fill(), time, spec)
+#else
+#define _PUT(facet, os, time, spec) facet.put(os, os, time, spec)
+#endif
+
 namespace log4cxx
 {
   namespace helpers
   {
     namespace SimpleDateFormatImpl
     {
+    typedef void (*incrementFunction)(tm& time, apr_time_exp_t& apr_time);
 
     /**
      * Abstract inner class representing one format token
@@ -76,7 +88,6 @@
                               log4cxx::helpers::Pool& p) const = 0;
                               
     protected:
-           typedef static void (*incrementFunction)(tm& time, apr_time_exp_t& apr_time);
            
            static void incrementMonth(tm& time, apr_time_exp_t& aprtime) {
                time.tm_mon++;
@@ -107,24 +118,24 @@
 #if LOG4CXX_HAS_STD_LOCALE
                 if (locale != NULL) {
 #if LOG4CXX_WCHAR_T_API
-                    if (std::has_facet< std::time_put<wchar_t> >(*locale)) {
-                        const std::time_put<wchar_t>& facet = std::use_facet< std::time_put<wchar_t> >(*locale);
+                    if (_HAS(*locale, std::time_put<wchar_t>)) {
+                        const std::time_put<wchar_t>& facet = _USE(*locale, std::time_put<wchar_t>);
                         size_t start = 0;
                         std::wostringstream os;
                         for(; valueIter != values.end(); valueIter++) {
-                            facet.put(os, os, os.fill(), &time, (wchar_t) wspec);
+                            _PUT(facet, os, &time, (wchar_t) wspec);
                             Transcoder::decode(os.str().substr(start), *valueIter);
                             start = os.str().length();
                             (*inc)(time, aprtime);
                         }
                     } else 
 #endif
-                    if (std::has_facet< std::time_put<char> >(*locale)) {
-                        const std::time_put<char>& facet = std::use_facet< std::time_put<char> >(*locale);
+                    if (_HAS(*locale,  std::time_put<char>)) {
+                        const std::time_put<char>& facet = _USE(*locale, std::time_put<char> );
                         size_t start = 0;
                         std::ostringstream os;
                         for(; valueIter != values.end(); valueIter++) {
-                            facet.put(os, os, os.fill(), &time, spec);
+                            _PUT(facet, os, &time, spec);
                             Transcoder::decode(os.str().substr(start), *valueIter);
                             start = os.str().length();
                             (*inc)(time, aprtime);

Modified: logging/log4cxx/trunk/src/main/cpp/transcoder.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/transcoder.cpp?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/transcoder.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/transcoder.cpp Thu Dec 20 22:51:09 2007
@@ -71,7 +71,6 @@
 }
 
 void Transcoder::encodeUTF8(unsigned int sv, ByteBuffer& dst) {
-    assert(dst.remaining() >= 8);
     size_t bytes = encodeUTF8(sv, dst.current());
     dst.position(dst.position() + bytes);
 }
@@ -108,7 +107,6 @@
 }
 
 void Transcoder::encodeUTF16BE(unsigned int sv, ByteBuffer& dst) {
-    assert(dst.remaining() >= 4);
     size_t bytes = encodeUTF16BE(sv, dst.current());
     dst.position(dst.position() + bytes);
 }
@@ -133,7 +131,6 @@
 }
 
 void Transcoder::encodeUTF16LE(unsigned int sv, ByteBuffer& dst) {
-    assert(dst.remaining() >= 4);
     size_t bytes = encodeUTF16LE(sv, dst.current());
     dst.position(dst.position() + bytes);
 }
@@ -345,7 +342,7 @@
 
 
 
-#if LOG4CXX_WCHAR_T_API
+#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR_T
 void Transcoder::decode(const std::wstring& src, LogString& dst) {
 #if LOG4CXX_LOGCHAR_IS_WCHAR_T
   dst.append(src, len);

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/transcoder.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/transcoder.h?rev=606117&r1=606116&r2=606117&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/transcoder.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/transcoder.h Thu Dec 20 22:51:09 2007
@@ -88,7 +88,7 @@
 
 
 
-#if LOG4CXX_WCHAR_T_API
+#if LOG4CXX_WCHAR_T_API || LOG4CXX_LOGCHAR_IS_WCHAR_T
       static void decode(const std::wstring& src, LogString& dst);
       static void encode(const LogString& src, std::wstring& dst);
 
@@ -112,7 +112,7 @@
 #endif
 
 
-#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
+#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API || LOG4CXX_LOGCHAR_IS_UNICHAR
       static void decode(const std::basic_string<UniChar>& src, LogString& dst);
       static void encode(const LogString& src, std::basic_string<UniChar>& dst);