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 03:52:42 UTC
svn commit: r606089 [1/6] - in /logging/log4cxx/trunk: ./ src/examples/cpp/
src/main/cpp/ src/main/include/log4cxx/ src/main/include/log4cxx/db/
src/main/include/log4cxx/filter/ src/main/include/log4cxx/helpers/
src/main/include/log4cxx/net/ src/main/i...
Author: carnold
Date: Thu Dec 20 18:52:29 2007
New Revision: 606089
URL: http://svn.apache.org/viewvc?rev=606089&view=rev
Log:
LOGCXX-85: Support for Mac's CFString and UniChar
Removed:
logging/log4cxx/trunk/src/main/cpp/unicodehelper.cpp
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/unicodehelper.h
logging/log4cxx/trunk/src/test/cpp/helpers/unicodehelpertestcase.cpp
Modified:
logging/log4cxx/trunk/INSTALL
logging/log4cxx/trunk/build.xml
logging/log4cxx/trunk/configure.in
logging/log4cxx/trunk/src/examples/cpp/console.cpp
logging/log4cxx/trunk/src/main/cpp/Makefile.am
logging/log4cxx/trunk/src/main/cpp/appenderskeleton.cpp
logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp
logging/log4cxx/trunk/src/main/cpp/bytebuffer.cpp
logging/log4cxx/trunk/src/main/cpp/cacheddateformat.cpp
logging/log4cxx/trunk/src/main/cpp/charsetdecoder.cpp
logging/log4cxx/trunk/src/main/cpp/charsetencoder.cpp
logging/log4cxx/trunk/src/main/cpp/class.cpp
logging/log4cxx/trunk/src/main/cpp/cyclicbuffer.cpp
logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp
logging/log4cxx/trunk/src/main/cpp/datelayout.cpp
logging/log4cxx/trunk/src/main/cpp/datepatternconverter.cpp
logging/log4cxx/trunk/src/main/cpp/defaultconfigurator.cpp
logging/log4cxx/trunk/src/main/cpp/domconfigurator.cpp
logging/log4cxx/trunk/src/main/cpp/exception.cpp
logging/log4cxx/trunk/src/main/cpp/file.cpp
logging/log4cxx/trunk/src/main/cpp/fileappender.cpp
logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp
logging/log4cxx/trunk/src/main/cpp/fixedwindowrollingpolicy.cpp
logging/log4cxx/trunk/src/main/cpp/formattinginfo.cpp
logging/log4cxx/trunk/src/main/cpp/fulllocationpatternconverter.cpp
logging/log4cxx/trunk/src/main/cpp/hierarchy.cpp
logging/log4cxx/trunk/src/main/cpp/htmllayout.cpp
logging/log4cxx/trunk/src/main/cpp/inetaddress.cpp
logging/log4cxx/trunk/src/main/cpp/inputstreamreader.cpp
logging/log4cxx/trunk/src/main/cpp/integerpatternconverter.cpp
logging/log4cxx/trunk/src/main/cpp/level.cpp
logging/log4cxx/trunk/src/main/cpp/levelmatchfilter.cpp
logging/log4cxx/trunk/src/main/cpp/linelocationpatternconverter.cpp
logging/log4cxx/trunk/src/main/cpp/literalpatternconverter.cpp
logging/log4cxx/trunk/src/main/cpp/logger.cpp
logging/log4cxx/trunk/src/main/cpp/loglog.cpp
logging/log4cxx/trunk/src/main/cpp/logmanager.cpp
logging/log4cxx/trunk/src/main/cpp/logstream.cpp
logging/log4cxx/trunk/src/main/cpp/mdc.cpp
logging/log4cxx/trunk/src/main/cpp/messagebuffer.cpp
logging/log4cxx/trunk/src/main/cpp/nameabbreviator.cpp
logging/log4cxx/trunk/src/main/cpp/ndc.cpp
logging/log4cxx/trunk/src/main/cpp/nteventlogappender.cpp
logging/log4cxx/trunk/src/main/cpp/objectptr.cpp
logging/log4cxx/trunk/src/main/cpp/obsoleterollingfileappender.cpp
logging/log4cxx/trunk/src/main/cpp/odbcappender.cpp
logging/log4cxx/trunk/src/main/cpp/optionconverter.cpp
logging/log4cxx/trunk/src/main/cpp/outputdebugstringappender.cpp
logging/log4cxx/trunk/src/main/cpp/outputstreamwriter.cpp
logging/log4cxx/trunk/src/main/cpp/patternparser.cpp
logging/log4cxx/trunk/src/main/cpp/properties.cpp
logging/log4cxx/trunk/src/main/cpp/propertiespatternconverter.cpp
logging/log4cxx/trunk/src/main/cpp/propertyconfigurator.cpp
logging/log4cxx/trunk/src/main/cpp/propertysetter.cpp
logging/log4cxx/trunk/src/main/cpp/relativetimedateformat.cpp
logging/log4cxx/trunk/src/main/cpp/relativetimepatternconverter.cpp
logging/log4cxx/trunk/src/main/cpp/rollingfileappender.cpp
logging/log4cxx/trunk/src/main/cpp/simpledateformat.cpp
logging/log4cxx/trunk/src/main/cpp/smtpappender.cpp
logging/log4cxx/trunk/src/main/cpp/socketimpl.cpp
logging/log4cxx/trunk/src/main/cpp/strftimedateformat.cpp
logging/log4cxx/trunk/src/main/cpp/stringhelper.cpp
logging/log4cxx/trunk/src/main/cpp/syslogappender.cpp
logging/log4cxx/trunk/src/main/cpp/system.cpp
logging/log4cxx/trunk/src/main/cpp/systemerrwriter.cpp
logging/log4cxx/trunk/src/main/cpp/systemoutwriter.cpp
logging/log4cxx/trunk/src/main/cpp/telnetappender.cpp
logging/log4cxx/trunk/src/main/cpp/timebasedrollingpolicy.cpp
logging/log4cxx/trunk/src/main/cpp/timezone.cpp
logging/log4cxx/trunk/src/main/cpp/transcoder.cpp
logging/log4cxx/trunk/src/main/cpp/transform.cpp
logging/log4cxx/trunk/src/main/cpp/ttcclayout.cpp
logging/log4cxx/trunk/src/main/cpp/writerappender.cpp
logging/log4cxx/trunk/src/main/cpp/xmllayout.cpp
logging/log4cxx/trunk/src/main/include/log4cxx/db/odbcappender.h
logging/log4cxx/trunk/src/main/include/log4cxx/file.h
logging/log4cxx/trunk/src/main/include/log4cxx/filter/levelmatchfilter.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/cacheddateformat.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/charsetdecoder.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/charsetencoder.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/class.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/exception.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/inetaddress.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/loglog.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/messagebuffer.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/object.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/optionconverter.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/simpledateformat.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/stringhelper.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/systemerrwriter.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/systemoutwriter.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/transcoder.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/xml.h
logging/log4cxx/trunk/src/main/include/log4cxx/level.h
logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.h.in
logging/log4cxx/trunk/src/main/include/log4cxx/log4cxx.hw
logging/log4cxx/trunk/src/main/include/log4cxx/logger.h
logging/log4cxx/trunk/src/main/include/log4cxx/logmanager.h
logging/log4cxx/trunk/src/main/include/log4cxx/logstring.h
logging/log4cxx/trunk/src/main/include/log4cxx/mdc.h
logging/log4cxx/trunk/src/main/include/log4cxx/ndc.h
logging/log4cxx/trunk/src/main/include/log4cxx/net/smtpappender.h
logging/log4cxx/trunk/src/main/include/log4cxx/private/log4cxx_private.h.in
logging/log4cxx/trunk/src/main/include/log4cxx/private/log4cxx_private.hw
logging/log4cxx/trunk/src/main/include/log4cxx/stream.h
logging/log4cxx/trunk/src/main/include/log4cxx/xml/domconfigurator.h
logging/log4cxx/trunk/src/performance/cpp/main.cpp
logging/log4cxx/trunk/src/test/cpp/Makefile.am
logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/customlogger/xlogger.cpp
logging/log4cxx/trunk/src/test/cpp/customlogger/xloggertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/encodingtest.cpp
logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/cacheddateformattestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/charsetdecodertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/datetimedateformattestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/optionconvertertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/stringhelpertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/transcodertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/insertwide.h
logging/log4cxx/trunk/src/test/cpp/leveltestcase.cpp
logging/log4cxx/trunk/src/test/cpp/main.cpp
logging/log4cxx/trunk/src/test/cpp/minimumtestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/socketservertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/pattern/patternparsertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/patternlayouttest.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/timebasedrollingtest.cpp
logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp
logging/log4cxx/trunk/src/test/cpp/testchar.h
logging/log4cxx/trunk/src/test/cpp/util/compare.cpp
logging/log4cxx/trunk/src/test/cpp/util/compare.h
logging/log4cxx/trunk/src/test/cpp/varia/levelmatchfiltertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/varia/levelrangefiltertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/xml/customleveltestcase.cpp
logging/log4cxx/trunk/src/test/cpp/xml/xlevel.cpp
logging/log4cxx/trunk/src/test/cpp/xml/xlevel.h
Modified: logging/log4cxx/trunk/INSTALL
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/INSTALL?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/INSTALL (original)
+++ logging/log4cxx/trunk/INSTALL Thu Dec 20 18:52:29 2007
@@ -226,7 +226,10 @@
--with-aprutil: Specify non-default location for apr-util.
--enable-cppunit=no: Disable building CppUnit unit tests.
--enable-wchar_t: Enable wchar_t API methods.
---with-logchar= utf-8 | wchar_t: Specify internal character type.
+--enable-unichar: Enable UniChar API methods, UniChar is an unsigned short containing UTF-16.
+--enable-cfstring: Enable CFString API methods, CFString is Mac OS/X CoreFoundation's string.
+--with-logchar= utf-8 | wchar_t | unichar: Specify internal character type.
+--with-charset = utf-8 | iso-8859-1 | usascii | ebcdic | auto: Specified fixed encoding.
SMTP support (SMTPAppender) can be disabled through option --with-SMTP
Modified: logging/log4cxx/trunk/build.xml
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/build.xml?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/build.xml (original)
+++ logging/log4cxx/trunk/build.xml Thu Dec 20 18:52:29 2007
@@ -133,7 +133,7 @@
-Daprutil.dir=PATH
-Dhas.wchar_t=[0|1] (default=1)
-Dhas.wcout=[0|1] (default=1)
--Dlogchar=[utf-8|wchar_t|cfstring] (default=wchar_t)
+-Dlogchar=[utf-8|wchar_t|unichar] (default=utf-8 on Unix, wchar_t on Windows)
</echo>
</target>
@@ -417,10 +417,10 @@
</condition>
<property name="logchar_is_utf8" value="0"/>
- <condition property="logchar_is_cfstring" value="1">
- <equals arg1="${logchar_type}" arg2="cfstring"/>
+ <condition property="logchar_is_unichar" value="1">
+ <equals arg1="${logchar_type}" arg2="unichar"/>
</condition>
- <property name="logchar_is_cfstring" value="0"/>
+ <property name="logchar_is_unichar" value="0"/>
<condition property="logchar_is_wchar" value="1">
<equals arg1="${logchar_type}" arg2="wchar_t"/>
@@ -428,8 +428,8 @@
<property name="logchar_is_wchar" value="0"/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
- match="@LOGCHAR_IS_CFSTRING@"
- replace="${logchar_is_cfstring}"/>
+ match="@LOGCHAR_IS_UNICHAR@"
+ replace="${logchar_is_unichar}"/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
match="@LOGCHAR_IS_UTF8@"
@@ -440,25 +440,57 @@
replace="${logchar_is_wchar}"/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
- match="@HAS_WCHAR_T@"
+ match="@WCHAR_T_API@"
replace="${has.wchar_t}"/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
- match="@HAS_STD_WCOUT@"
- replace="${has.wcout}"/>
+ match="@UNICHAR_API@"
+ replace="0"/>
+
+ <replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
+ match="@CFSTRING_API@"
+ replace="0"/>
+
- <!-- The MS Windows template for log4cxx_private.h contains a hard coded
- "0" for LOG4CXX_HAVE_SYSLOG. Therefore the following replacement
- only applies to the UNIX template. -->
<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"/>
+ <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
+ match="@HAS_MBSRTOWCS@"
+ replace="1"/>
+ <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
+ match="@HAS_WCSTOMBS@"
+ replace="1"/>
+ <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
+ match="@CHARSET_UTF8@"
+ replace="0"/>
+ <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
+ match="@CHARSET_ISO88591@"
+ replace="0"/>
+ <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
+ match="@CHARSET_USASCII@"
+ replace="0"/>
+ <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
+ match="@CHARSET_EBCDIC@"
+ 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"/>
+=======
<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/configure.in
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/configure.in?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/configure.in (original)
+++ logging/log4cxx/trunk/configure.in Thu Dec 20 18:52:29 2007
@@ -157,7 +157,6 @@
# Checks header files
# ----------------------------------------------------------------------------
-AC_CHECK_HEADERS(unistd.h io.h alloca.h)
APR_FIND_APR( , , 1, 1)
if test "$apr_found" = "no"; then
AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.)
@@ -181,7 +180,22 @@
# Checks local idioms
# ----------------------------------------------------------------------------
-AC_CHECK_FUNCS(swprintf)
+# for local syslog() function for SyslogAppender
+AC_CHECK_FUNCS(mbsrtowcs, [have_mbsrtowcs=yes], [have_mbsrtowcs=no])
+if test "$have_mbsrtowcs" = "yes"
+then
+ AC_SUBST(HAS_MBSRTOWCS, 1)
+else
+ AC_SUBST(HAS_MBSRTOWCS, 0)
+fi
+
+AC_CHECK_FUNCS(wcstombs, [have_wcstombs=yes], [have_wcstombs=no])
+if test "$have_wcstombs" = "yes"
+then
+ AC_SUBST(HAS_WCSTOMBS, 1)
+else
+ AC_SUBST(HAS_WCSTOMBS, 0)
+fi
# for local syslog() function for SyslogAppender
AC_CHECK_FUNCS(syslog, [have_syslog=yes], [have_syslog=no])
@@ -192,6 +206,27 @@
AC_SUBST(HAS_SYSLOG, 0)
fi
+AC_CHECK_HEADER([locale],have_locale=yes,have_locale=no)
+if test "$have_locale" = "yes"
+then
+ AC_SUBST(HAS_STD_LOCALE, 1)
+else
+ AC_SUBST(HAS_STD_LOCALE, 0)
+fi
+
+AC_MSG_CHECKING([for wchar_t])
+AC_COMPILE_IFELSE(AC_LANG_SOURCE([[
+ #include <string>
+ std::wstring w;]]), [have_wchar_t=yes], [have_wchar_t=no])
+AC_MSG_RESULT($have_wchar_t)
+if test "$have_wchar_t" = "yes"
+then
+ AC_SUBST(HAS_WCHAR_T, 1)
+else
+ AC_SUBST(HAS_WCHAR_T, 0)
+fi
+
+
# Checks for libraries
# ----------------------------------------------------------------------------
@@ -241,8 +276,6 @@
AC_SUBST(LIBS_ODBC)
AC_SUBST(CPPFLAGS_ODBC)
-#for System
-AC_CHECK_FUNCS(gettimeofday ftime setenv mbsnrtowcs wcsnrtombs)
#for SMTPAppender
AC_MSG_CHECKING(for SMTP support)
@@ -270,32 +303,140 @@
;;
esac
-#for wchar_t
+#for char api
+AC_ARG_ENABLE(char,
+ AC_HELP_STRING(--enable-char,
+ [enable char API (yes)]))
+if test "x$enable_char" = xno; then
+ have_char_api=no
+else
+ have_char_api=yes
+fi
+
+if test "$have_char_api" = "yes"
+then
+ AC_SUBST(CHAR_API, 1)
+else
+ AC_SUBST(CHAR_API, 0)
+fi
+
+#for wchar_t api
AC_ARG_ENABLE(wchar_t,
AC_HELP_STRING(--enable-wchar_t,
- [enable wchar_t interfaces (auto)]))
+ [enable wchar_t API (yes if wchar_t available)]))
if test "x$enable_wchar_t" = xno; then
- have_wchar_t=no
+ have_wchar_t_api=no
else
- AC_MSG_CHECKING([for wchar_t])
+ if test "$have_wchar_t" = "yes"
+ then
+ have_wchar_t_api=yes
+ else
+ have_wchar_t_api=no
+ fi
+fi
+
+if test "$have_wchar_t_api" = "yes"
+then
+ AC_SUBST(WCHAR_T_API, 1)
+else
+ AC_SUBST(WCHAR_T_API, 0)
+fi
+
+#for unichar api
+AC_ARG_ENABLE(unichar,
+ AC_HELP_STRING(--enable-unichar,
+ [enable unichar API (no)]))
+if test "x$enable_unichar" = "yes"
+then
+ AC_SUBST(UNICHAR_API, 1)
+else
+ AC_SUBST(UNICHAR_API, 0)
+fi
+
+#for cfstring api
+AC_ARG_ENABLE(cfstring,
+ AC_HELP_STRING(--enable-cfstring,
+ [enable cfstring API (no)]))
+if test "x$enable_cfstring" = xyes; then
+ AC_MSG_CHECKING([for cfstring])
+ CPPFLAGS="$CPPFLAGS -framework CoreFoundation"
AC_COMPILE_IFELSE(AC_LANG_SOURCE([[
- #include <string>
- std::wstring w;]]), [have_wchar_t=yes], [have_wchar_t=no])
- AC_MSG_RESULT($have_wchar_t)
+ #include <CoreFoundation/CFString.h>
+ CFStringRef x = CFSTR("Hello");]]), [have_cfstring_api=yes], [have_cfstring_api=no])
+ AC_MSG_RESULT($have_cfstring_api)
+else
+ have_cfstring_api=no
fi
-if test "$have_wchar_t" = "yes"
+if test "$have_cfstring_api" = "yes"
then
- AC_SUBST(HAS_WCHAR_T, 1)
+ AC_SUBST(CFSTRING_API, 1)
else
- AC_SUBST(HAS_WCHAR_T, 0)
+ AC_SUBST(CFSTRING_API, 0)
fi
+#determine charset type
+AC_MSG_CHECKING([charset type])
+AC_ARG_WITH(charset,
+ AC_HELP_STRING(--with-charset=TYPE, [locale charset.
+ Accepted TYPE variants: auto, utf-8, iso-8859-1, usascii, ebcdic (default=auto)]),
+ [ac_with_charset=$withval],
+ [ac_with_charset=auto])
+
+case "$ac_with_charset" in
+ utf-8)
+ AC_MSG_RESULT(utf-8)
+ AC_SUBST(CHARSET_UTF8, 1)
+ AC_SUBST(CHARSET_ISO88591, 0)
+ AC_SUBST(CHARSET_USASCII, 0)
+ AC_SUBST(CHARSET_EBCDIC, 0)
+ ;;
+
+ iso-8859-1)
+ AC_MSG_RESULT(iso-8859-1)
+ AC_SUBST(CHARSET_UTF8, 0)
+ AC_SUBST(CHARSET_ISO88591, 1)
+ AC_SUBST(CHARSET_USASCII, 0)
+ AC_SUBST(CHARSET_EBCDIC, 0)
+ ;;
+
+ usascii)
+ AC_MSG_RESULT(usascii)
+ AC_SUBST(CHARSET_UTF8, 0)
+ AC_SUBST(CHARSET_ISO88591, 0)
+ AC_SUBST(CHARSET_USASCII, 1)
+ AC_SUBST(CHARSET_EBCDIC, 0)
+ ;;
+
+ ebcdic)
+ AC_MSG_RESULT(usascii)
+ AC_SUBST(CHARSET_UTF8, 0)
+ AC_SUBST(CHARSET_ISO88591, 0)
+ AC_SUBST(CHARSET_USASCII, 0)
+ AC_SUBST(CHARSET_EBCDIC, 1)
+ ;;
+
+ auto)
+ AC_MSG_RESULT(auto)
+ AC_SUBST(CHARSET_UTF8, 0)
+ AC_SUBST(CHARSET_ISO88591, 0)
+ AC_SUBST(CHARSET_USASCII, 0)
+ AC_SUBST(CHARSET_EBCDIC, 0)
+ ;;
+
+ *)
+ AC_MSG_RESULT(???)
+ AC_MSG_ERROR(Invalid charset type: $ac_with_charset)
+ ;;
+esac
+
+
+
#determine logchar type
AC_MSG_CHECKING([logchar type])
AC_ARG_WITH(logchar,
AC_HELP_STRING(--with-logchar=TYPE, [type for logchar.
- Accepted TYPE variants: utf-8, wchar_t, cfstring (default=utf-8)]),
+ Accepted TYPE variants: utf-8, wchar_t, unichar (default=utf-8)]),
[ac_with_logchar=$withval],
[ac_with_logchar=utf-8])
@@ -304,21 +445,21 @@
AC_MSG_RESULT(utf-8)
AC_SUBST(LOGCHAR_IS_UTF8, 1)
AC_SUBST(LOGCHAR_IS_WCHAR, 0)
- AC_SUBST(LOGCHAR_IS_CFSTRING, 0)
+ AC_SUBST(LOGCHAR_IS_UNICHAR, 0)
;;
wchar_t)
AC_MSG_RESULT(wchar_t)
AC_SUBST(LOGCHAR_IS_UTF8, 0)
AC_SUBST(LOGCHAR_IS_WCHAR, 1)
- AC_SUBST(LOGCHAR_IS_CFSTRING, 0)
+ AC_SUBST(LOGCHAR_IS_UNICHAR, 0)
;;
- cfstring)
- AC_MSG_RESULT(cfstring)
+ unichar)
+ AC_MSG_RESULT(unichar)
AC_SUBST(LOGCHAR_IS_UTF8, 0)
AC_SUBST(LOGCHAR_IS_WCHAR, 0)
- AC_SUBST(LOGCHAR_IS_CFSTRING, 1)
+ AC_SUBST(LOGCHAR_IS_UNICHAR, 1)
;;
*)
@@ -327,19 +468,6 @@
;;
esac
-#for wide streams
-AC_MSG_CHECKING(for wcout)
-AC_COMPILE_IFELSE(AC_LANG_SOURCE([[
- #include <iostream>
- int main() { std::wcout << L"Hello"; } ]]), [have_wcout=yes], [have_wcout=no])
-AC_MSG_RESULT($have_wcout)
-
-if test "$have_wcout" = "yes"
-then
- AC_SUBST(HAS_STD_WCOUT, 1)
-else
- AC_SUBST(HAS_STD_WCOUT, 0)
-fi
# Create files
Modified: logging/log4cxx/trunk/src/examples/cpp/console.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/examples/cpp/console.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/examples/cpp/console.cpp (original)
+++ logging/log4cxx/trunk/src/examples/cpp/console.cpp Thu Dec 20 18:52:29 2007
@@ -63,10 +63,10 @@
if (strcmp("-err", argv[i]) == 0) {
err = true;
} else if (strcmp("puts", argv[i]) == 0) {
- fputs("Hello, fputs\n", err ? stderr : stdout);
-#if LOG4CXX_HAS_WCHAR_T
+ fputs("Hello, fputs\n", err ? stderr : stdout);
+#if LOG4CXX_WCHAR_T_API
} else if (strcmp("putws", argv[i]) == 0) {
- fputws(L"Hello, fputws\n", err ? stderr : stdout);
+ fputws(L"Hello, fputws\n", err ? stderr : stdout);
#endif
} else if (strcmp("cout", argv[i]) == 0) {
if (err) {
@@ -97,11 +97,11 @@
configured = true;
}
log4cxx::Logger::getRootLogger()->info("Hello, log4cxx");
-#if LOG4CXX_HAS_WCHAR_T
+#if LOG4CXX_WCHAR_T_API
} else if (strcmp("wide", argv[i]) == 0) {
fwide(err ? stderr : stdout, 1);
} else if (strcmp("byte", argv[i]) == 0) {
- fwide(err ? stderr : stdout, -1);
+ fwide(err ? stderr : stdout, -1);
#endif
} else {
fputs("Unrecognized option: ", stderr);
Modified: logging/log4cxx/trunk/src/main/cpp/Makefile.am
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/Makefile.am?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/Makefile.am (original)
+++ logging/log4cxx/trunk/src/main/cpp/Makefile.am Thu Dec 20 18:52:29 2007
@@ -161,7 +161,6 @@
triggeringpolicy.cpp \
transcoder.cpp \
ttcclayout.cpp \
- unicodehelper.cpp \
writer.cpp \
writerappender.cpp \
xmllayout.cpp\
Modified: logging/log4cxx/trunk/src/main/cpp/appenderskeleton.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/appenderskeleton.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/appenderskeleton.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/appenderskeleton.cpp Thu Dec 20 18:52:29 2007
@@ -159,7 +159,7 @@
if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("THRESHOLD"), LOG4CXX_STR("threshold")))
{
- setThreshold(Level::toLevel(value));
+ setThreshold(Level::toLevelLS(value));
}
}
Modified: logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp Thu Dec 20 18:52:29 2007
@@ -236,7 +236,7 @@
void AsyncAppender::setBufferSize(int size)
{
if (size < 0) {
- throw IllegalArgumentException("size argument must be non-negative");
+ throw IllegalArgumentException(LOG4CXX_STR("size argument must be non-negative"));
}
synchronized sync(bufferMutex);
bufferSize = (size < 1) ? 1 : size;
@@ -285,7 +285,7 @@
msg.append(LOG4CXX_STR(" messages due to a full event buffer including: "));
msg.append(maxEvent->getMessage());
return new LoggingEvent(
- Logger::getLogger(maxEvent->getLoggerName()),
+ Logger::getLoggerLS(maxEvent->getLoggerName()),
maxEvent->getLevel(),
msg,
LocationInfo::getLocationUnavailable());
Modified: logging/log4cxx/trunk/src/main/cpp/bytebuffer.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/bytebuffer.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/bytebuffer.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/bytebuffer.cpp Thu Dec 20 18:52:29 2007
@@ -50,7 +50,7 @@
void ByteBuffer::limit(size_t newLimit) {
if (newLimit > cap) {
- throw IllegalArgumentException("newLimit");
+ throw IllegalArgumentException(LOG4CXX_STR("newLimit"));
}
lim = newLimit;
}
Modified: logging/log4cxx/trunk/src/main/cpp/cacheddateformat.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/cacheddateformat.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/cacheddateformat.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/cacheddateformat.cpp Thu Dec 20 18:52:29 2007
@@ -37,24 +37,24 @@
* will not be recognized and duplicate requests
* will use the cache.
*/
-const logchar* const CachedDateFormat::digits = LOG4CXX_STR("0123456789");
+const logchar CachedDateFormat::digits[] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0 };
/**
* Expected representation of first magic number.
*/
-const logchar* const CachedDateFormat::magicString1 = LOG4CXX_STR("654");
+const logchar CachedDateFormat::magicString1[] = { 0x36, 0x35, 0x34, 0 };
/**
* Expected representation of second magic number.
*/
-const logchar* const CachedDateFormat::magicString2 = LOG4CXX_STR("987");
+const logchar CachedDateFormat::magicString2[] = { 0x39, 0x38, 0x37, 0};
/**
* Expected representation of 0 milliseconds.
*/
-const logchar* const CachedDateFormat::zeroString = LOG4CXX_STR("000");
+const logchar CachedDateFormat::zeroString[] = { 0x30, 0x30, 0x30, 0 };
#undef min
@@ -71,14 +71,14 @@
formatter(dateFormat),
millisecondStart(0),
slotBegin(std::numeric_limits<log4cxx_time_t>::min()),
- cache(50, LOG4CXX_STR(' ')),
+ cache(50, 0x20),
expiration(expiration1),
previousTime(std::numeric_limits<log4cxx_time_t>::min()) {
if (dateFormat == NULL) {
- throw IllegalArgumentException("dateFormat cannot be null");
+ throw IllegalArgumentException(LOG4CXX_STR("dateFormat cannot be null"));
}
if (expiration1 < 0) {
- throw IllegalArgumentException("expiration must be non-negative");
+ throw IllegalArgumentException(LOG4CXX_STR("expiration must be non-negative"));
}
}
@@ -125,7 +125,8 @@
if (formatted[i] != plusMagic[i]) {
//
// determine the expected digits for the base time
- LogString formattedMillis(LOG4CXX_STR("ABC"));
+ const logchar abc[] = { 0x41, 0x42, 0x43, 0 };
+ LogString formattedMillis(abc);
millisecondFormat(millis, formattedMillis, 0);
LogString plusZero;
@@ -270,16 +271,18 @@
// (for example, "HH:mm:ss,SSS SSS"), then set the expiration to
// one millisecond which should only perform duplicate request caching.
//
- size_t firstS = pattern.find(LOG4CXX_STR('S'));
+ const logchar S = 0x53;
+ const logchar SSS[] = { 0x53, 0x53, 0x53, 0 };
+ size_t firstS = pattern.find(S);
size_t len = pattern.length();
//
// if there are no S's or
// three that start with the first S and no fourth S in the string
//
if (firstS == LogString::npos ||
- (len >= firstS + 3 && pattern.compare(firstS, 3, LOG4CXX_STR("SSS")) == 0
+ (len >= firstS + 3 && pattern.compare(firstS, 3, SSS) == 0
&& (len == firstS + 3 ||
- pattern.find(LOG4CXX_STR('S'), firstS + 3) == LogString::npos))) {
+ pattern.find(S, firstS + 3) == LogString::npos))) {
return 1000000;
}
return 1000;
Modified: logging/log4cxx/trunk/src/main/cpp/charsetdecoder.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/charsetdecoder.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/charsetdecoder.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/charsetdecoder.cpp Thu Dec 20 18:52:29 2007
@@ -18,7 +18,6 @@
#include <log4cxx/helpers/charsetdecoder.h>
#include <log4cxx/helpers/bytebuffer.h>
#include <log4cxx/helpers/exception.h>
-#include <log4cxx/helpers/unicodehelper.h>
#include <log4cxx/helpers/mutex.h>
#include <log4cxx/helpers/synchronized.h>
#include <log4cxx/helpers/pool.h>
@@ -30,7 +29,7 @@
#include <locale.h>
#include <apr_portable.h>
#include <log4cxx/helpers/stringhelper.h>
-
+#include <log4cxx/helpers/transcoder.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -55,22 +54,20 @@
* Creates a new instance.
* @param frompage name of source encoding.
*/
- APRCharsetDecoder(const char* frompage) : pool(), mutex(pool) {
- if (frompage == APR_LOCALE_CHARSET) {
- throw IllegalArgumentException("APRCharsetDecoder does not support APR_LOCALE_CHARSET.");
- }
- if (frompage == APR_DEFAULT_CHARSET) {
- throw IllegalArgumentException("APRCharsetDecoder does not support APR_DEFAULT_CHARSET.");
- }
+ APRCharsetDecoder(const LogString& frompage) : pool(), mutex(pool) {
#if LOG4CXX_LOGCHAR_IS_WCHAR
const char* topage = "WCHAR_T";
#endif
#if LOG4CXX_LOGCHAR_IS_UTF8
const char* topage = "UTF-8";
#endif
+#if LOG4CXX_LOGCHAR_IS_UNICHAR
+ const char* topage = "UTF-16";
+#endif
+ std::string fpage(Transcoder::encodeCharsetName(frompage));
apr_status_t stat = apr_xlate_open(&convset,
topage,
- frompage,
+ fpage.c_str(),
(apr_pool_t*) pool.getAPRPool());
if (stat != APR_SUCCESS) {
throw IllegalArgumentException(frompage);
@@ -128,7 +125,7 @@
#endif
-#if LOG4CXX_LOGCHAR_IS_WCHAR && !defined(_WIN32_WCE)
+#if LOG4CXX_LOGCHAR_IS_WCHAR && LOG4CXX_HAS_MBSRTOWCS
/**
* Converts from the default multi-byte string to
* LogString using mbstowcs.
@@ -232,9 +229,7 @@
#if LOG4CXX_LOGCHAR_IS_UTF8
typedef TrivialCharsetDecoder UTF8CharsetDecoder;
-#endif
-
-#if LOG4CXX_LOGCHAR_IS_WCHAR
+#else
/**
* Converts from UTF-8 to std::wstring
*
@@ -251,28 +246,24 @@
private:
virtual log4cxx_status_t decode(ByteBuffer& in,
LogString& out) {
- log4cxx_status_t stat = APR_SUCCESS;
if (in.remaining() > 0) {
- wchar_t buf[2];
-
- const char* src = in.current();
- const char* srcEnd = in.data() + in.limit();
- while(src < srcEnd) {
- unsigned int sv = UnicodeHelper::decodeUTF8(src, srcEnd);
- if (sv == 0xFFFF) {
- stat = APR_BADARG;
- break;
- }
- int wchars = UnicodeHelper::encode(sv, buf);
- out.append(buf, wchars);
+ std::string tmp(in.current(), in.remaining());
+ std::string::const_iterator iter = tmp.begin();
+ while(iter != tmp.end()) {
+ unsigned int sv = Transcoder::decode(tmp, iter);
+ if (sv == 0xFFFF) {
+ size_t offset = iter - tmp.begin();
+ in.position(in.position() + offset);
+ return APR_BADARG;
+ } else {
+ Transcoder::encode(sv, out);
+ }
}
- in.position(src - in.data());
+ in.position(in.limit());
}
- return stat;
+ return APR_SUCCESS;
}
-
-
private:
UTF8CharsetDecoder(const UTF8CharsetDecoder&);
UTF8CharsetDecoder& operator=(const UTF8CharsetDecoder&);
@@ -295,20 +286,17 @@
private:
virtual log4cxx_status_t decode(ByteBuffer& in,
LogString& out) {
- log4cxx_status_t stat = APR_SUCCESS;
if (in.remaining() > 0) {
- logchar buf[8];
const unsigned char* src = (unsigned char*) in.current();
const unsigned char* srcEnd = src + in.remaining();
while(src < srcEnd) {
unsigned int sv = *(src++);
- int logchars = UnicodeHelper::encode(sv, buf);
- out.append(buf, logchars);
+ Transcoder::encode(sv, out);
}
in.position(in.limit());
}
- return stat;
+ return APR_SUCCESS;
}
@@ -338,7 +326,6 @@
LogString& out) {
log4cxx_status_t stat = APR_SUCCESS;
if (in.remaining() > 0) {
- logchar buf[8];
const unsigned char* src = (unsigned char*) in.current();
const unsigned char* srcEnd = src + in.remaining();
@@ -346,8 +333,7 @@
unsigned char sv = *src;
if (sv < 0x80) {
src++;
- int logchars = UnicodeHelper::encode(sv, buf);
- out.append(buf, logchars);
+ Transcoder::encode(sv, out);
} else {
stat = APR_BADARG;
break;
@@ -377,13 +363,15 @@
}
virtual log4cxx_status_t decode(ByteBuffer& in,
LogString& out) {
- //
- // assuming that all default locales are US-ASCII based (sorry no EBCDIC for now)
- // scan byte array for any non US-ASCII
const char* p = in.current();
size_t i = in.position();
- for (; i < in.limit(); i++, p++) {
- if (*((unsigned char*) p) > 127) {
+#if !LOG4CXX_CHARSET_EBCDIC
+ for (; i < in.limit() && ((unsigned int) *p) < 0x80; i++, p++) {
+ out.append(1, *p);
+ }
+ in.position(i);
+#endif
+ if (i < in.limit()) {
Pool subpool;
const char* enc = apr_os_locale_encoding((apr_pool_t*) subpool.getAPRPool());
{
@@ -396,28 +384,16 @@
} else if (encoding != enc) {
encoding = enc;
try {
- decoder = getDecoder(encoding);
+ LogString e;
+ Transcoder::decode(encoding, e);
+ decoder = getDecoder(e);
} catch (IllegalArgumentException& ex) {
decoder = new USASCIICharsetDecoder();
}
}
}
return decoder->decode(in, out);
- }
}
- //
- // Straight US-ASCII, append bytes as characters.
- //
-#if LOG4CXX_LOGCHAR_IS_UTF8
- out.append(in.current(), in.remaining());
-#else
- p = in.current();
- i = in.position();
- for (; i < in.limit(); i++, p++) {
- out.append(1, *p);
- }
-#endif
- in.position(in.limit());
return APR_SUCCESS;
}
private:
@@ -427,66 +403,6 @@
std::string encoding;
};
-#if LOG4CXX_LOGCHAR_IS_UTF8 && LOG4CXX_HAS_WCHAR_T && (defined(_WIN32) || defined(__STDC_ISO_10646__) || defined(__APPLE__))
- /**
- * Decoder to convert array of wchar_t to UTF-8 bytes.
- *
- */
- class WideToUTF8CharsetDecoder : public CharsetDecoder
- {
- public:
- WideToUTF8CharsetDecoder() {
- }
-
- virtual ~WideToUTF8CharsetDecoder() {
- }
-
-#if defined(_WIN32)
- unsigned int decodeWide(const wchar_t*& src, const wchar_t* srcEnd) {
- unsigned int sv = *(src++);
- if (sv < 0xDC00 || sv >= 0xDC00) {
- return sv;
- }
- if (src < srcEnd) {
- unsigned short ls = *(src++);
- unsigned char w = (unsigned char) ((sv >> 6) & 0x0F);
- return ((w + 1) << 16) + ((sv & 0x3F) << 10) + (ls & 0x3FF);
- }
- return 0xFFFF;
- }
-#endif
-
-
-
- virtual log4cxx_status_t decode(ByteBuffer& in,
- LogString& out) {
- const wchar_t* src = (const wchar_t*) (in.data() + in.position());
- const wchar_t* srcEnd = (const wchar_t*) (in.data() + in.limit());
- out.reserve(out.length() + in.remaining()/sizeof(wchar_t));
- char utf8[8];
- while(src < srcEnd) {
-#if defined(__STDC_ISO_10646__) || defined(__APPLE__)
- unsigned int sv = *(src++);
-#else
- unsigned int sv = decodeWide(src, srcEnd);
-#endif
- if (sv == 0xFFFF) {
- return APR_BADARG;
- }
- int bytes = UnicodeHelper::encodeUTF8(sv, utf8);
- out.append(utf8, bytes);
- }
- in.position(((const char*) src) - in.data());
- return APR_SUCCESS;
- }
-
-
-
- private:
- WideToUTF8CharsetDecoder(const WideToUTF8CharsetDecoder&);
- WideToUTF8CharsetDecoder& operator=(const WideToUTF8CharsetDecoder&);
- };
-#endif
} // namespace helpers
@@ -502,13 +418,13 @@
}
CharsetDecoder* CharsetDecoder::createDefaultDecoder() {
-#if LOG4CXX_LOCALE_ENCODING_UTF8
+#if LOG4CXX_CHARSET_UTF8
return new UTF8CharsetDecoder();
-#elif LOG4CXX_LOCALE_ENCODING_ISO_8859_1 || defined(_WIN32_WCE)
+#elif LOG4CXX_CHARSET_ISO88591 || defined(_WIN32_WCE)
return new ISOLatinCharsetDecoder();
-#elif LOG4CXX_LOCALE_ENCODING_US_ASCII
+#elif LOG4CXX_CHARSET_USASCII
return new USASCIICharsetDecoder();
-#elif LOG4CXX_LOGCHAR_IS_WCHAR
+#elif LOG4CXX_LOGCHAR_IS_WCHAR && LOG4CXX_HAS_MBSRTOWCS
return new MbstowcsCharsetDecoder();
#else
return new LocaleCharsetDecoder();
@@ -546,22 +462,22 @@
}
-CharsetDecoderPtr CharsetDecoder::getDecoder(const std::string& charset) {
- if (StringHelper::equalsIgnoreCase(charset, "UTF-8", "utf-8") ||
- StringHelper::equalsIgnoreCase(charset, "UTF8", "utf8")) {
+CharsetDecoderPtr CharsetDecoder::getDecoder(const LogString& charset) {
+ if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-8"), LOG4CXX_STR("utf-8")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF8"), LOG4CXX_STR("utf8"))) {
return new UTF8CharsetDecoder();
- } else if (StringHelper::equalsIgnoreCase(charset, "C", "c") ||
- charset == "646" ||
- StringHelper::equalsIgnoreCase(charset, "US-ASCII", "us-ascii") ||
- StringHelper::equalsIgnoreCase(charset, "ISO646-US", "iso646-US") ||
- StringHelper::equalsIgnoreCase(charset, "ANSI_X3.4-1968", "ansi_x3.4-1968")) {
+ } else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("C"), LOG4CXX_STR("c")) ||
+ charset == LOG4CXX_STR("646") ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("US-ASCII"), LOG4CXX_STR("us-ascii")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO646-US"), LOG4CXX_STR("iso646-US")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ANSI_X3.4-1968"), LOG4CXX_STR("ansi_x3.4-1968"))) {
return new USASCIICharsetDecoder();
- } else if (StringHelper::equalsIgnoreCase(charset, "ISO-8859-1", "iso-8859-1") ||
- StringHelper::equalsIgnoreCase(charset, "ISO-LATIN-1", "iso-latin-1")) {
+ } else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-8859-1"), LOG4CXX_STR("iso-8859-1")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1"))) {
return new ISOLatinCharsetDecoder();
}
#if APR_HAS_XLATE || !defined(_WIN32)
- return new APRCharsetDecoder(charset.c_str());
+ return new APRCharsetDecoder(charset);
#else
throw IllegalArgumentException(charset);
#endif
@@ -569,40 +485,6 @@
-#if LOG4CXX_HAS_WCHAR_T
-CharsetDecoder* CharsetDecoder::createWideDecoder() {
-#if LOG4CXX_LOGCHAR_IS_WCHAR
- return new TrivialCharsetDecoder();
-#elif defined(_WIN32) || defined(__STDC_ISO_10646__) || defined(__APPLE__)
- return new WideToUTF8CharsetDecoder();
-#else
- return new APRCharsetDecoder("WCHAR_T");
-#endif
-}
-
-
-CharsetDecoderPtr CharsetDecoder::getWideDecoder() {
- static CharsetDecoderPtr decoder(createWideDecoder());
- //
- // if invoked after static variable destruction
- // (if logging is called in the destructor of a static object)
- // then create a new decoder.
- //
- if (decoder == 0) {
- return createWideDecoder();
- }
- return decoder;
-}
-CharsetDecoderPtr CharsetDecoder::getDecoder(const std::wstring& charset) {
- std::string cs(charset.size(), ' ');
- for(std::wstring::size_type i = 0;
- i < charset.length();
- i++) {
- cs[i] = (char) charset[i];
- }
- return getDecoder(cs);
-}
-#endif
Modified: logging/log4cxx/trunk/src/main/cpp/charsetencoder.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/charsetencoder.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/charsetencoder.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/charsetencoder.cpp Thu Dec 20 18:52:29 2007
@@ -20,7 +20,7 @@
#include <log4cxx/helpers/exception.h>
#include <apr_xlate.h>
#include <log4cxx/helpers/stringhelper.h>
-#include <log4cxx/helpers/unicodehelper.h>
+#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
#define LOG4CXX 1
#endif
@@ -46,21 +46,19 @@
class APRCharsetEncoder : public CharsetEncoder
{
public:
- APRCharsetEncoder(const char* topage) : pool(), mutex(pool) {
- if (topage == APR_LOCALE_CHARSET) {
- throw IllegalArgumentException("APRCharsetEncoder does not support APR_LOCALE_CHARSET.");
- }
- if (topage == APR_DEFAULT_CHARSET) {
- throw IllegalArgumentException("APRCharsetEncoder does not support APR_DEFAULT_CHARSET.");
- }
+ APRCharsetEncoder(const LogString& topage) : pool(), mutex(pool) {
#if LOG4CXX_LOGCHAR_IS_WCHAR
const char* frompage = "WCHAR_T";
#endif
#if LOG4CXX_LOGCHAR_IS_UTF8
const char* frompage = "UTF-8";
#endif
+#if LOG4CXX_LOGCHAR_IS_UNICHAR
+ const char* frompage = "UTF-16";
+#endif
+ std::string tpage(Transcoder::encodeCharsetName(topage));
apr_status_t stat = apr_xlate_open(&convset,
- topage,
+ tpage.c_str(),
frompage,
(apr_pool_t*) pool.getAPRPool());
if (stat != APR_SUCCESS) {
@@ -110,7 +108,7 @@
};
#endif
-#if LOG4CXX_LOGCHAR_IS_WCHAR
+#if LOG4CXX_LOGCHAR_IS_WCHAR && LOG4CXX_HAS_WCSTOMBS
/**
* A character encoder implemented using wcstombs.
*/
@@ -196,12 +194,12 @@
log4cxx_status_t stat = APR_SUCCESS;
if (iter != in.end()) {
while(out.remaining() > 0 && iter != in.end()) {
- LogString::const_iterator prev(iter);
- unsigned int sv = UnicodeHelper::decode(in, iter);
+ LogString::const_iterator prev(iter);
+ unsigned int sv = Transcoder::decode(in, iter);
if (sv <= 0x7F) {
out.put((char) sv);
} else {
- iter = prev;
+ iter = prev;
stat = APR_BADARG;
break;
}
@@ -231,7 +229,7 @@
if (iter != in.end()) {
while(out.remaining() > 0 && iter != in.end()) {
LogString::const_iterator prev(iter);
- unsigned int sv = UnicodeHelper::decode(in, iter);
+ unsigned int sv = Transcoder::decode(in, iter);
if (sv <= 0xFF) {
out.put((char) sv);
} else {
@@ -283,252 +281,143 @@
#if LOG4CXX_LOGCHAR_IS_UTF8
typedef TrivialCharsetEncoder UTF8CharsetEncoder;
-#endif
-
-#if LOG4CXX_LOGCHAR_IS_WCHAR
-#if defined(_WIN32) || defined(__STDC_ISO_10646__) || defined(__APPLE__)
- /**
- * Converts a wstring to UTF-8.
- */
- class UTF8CharsetEncoder : public CharsetEncoder
- {
- public:
- UTF8CharsetEncoder() {
- }
-
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out) {
- log4cxx_status_t stat = APR_SUCCESS;
- if (iter != in.end()) {
- const logchar* const srcBase = in.data();
- const logchar* const srcEnd = srcBase + in.length();
- const logchar* src = in.data() + (iter - in.begin());
- while(out.remaining() >= 8 && src < srcEnd) {
- unsigned int sv = decodeWide(src, srcEnd);
- if (sv == 0xFFFF) {
- stat = APR_BADARG;
- break;
- }
- int bytes = UnicodeHelper::encodeUTF8(sv, out.data() + out.position());
- out.position(out.position() + bytes);
- }
- iter = in.begin() + (src - srcBase);
- }
- return APR_SUCCESS;
- }
-
- private:
- UTF8CharsetEncoder(const UTF8CharsetEncoder&);
- UTF8CharsetEncoder& operator=(const UTF8CharsetEncoder&);
-
-#if defined(_WIN32)
- unsigned int decodeWide(const wchar_t*& src, const wchar_t* srcEnd) {
- unsigned int sv = *(src++);
- if (sv < 0xDC00 || sv >= 0xDC00) {
- return sv;
- }
- if (src < srcEnd) {
- unsigned short ls = *(src++);
- unsigned char w = (unsigned char) ((sv >> 6) & 0x0F);
- return ((w + 1) << 16) + ((sv & 0x3F) << 10) + (ls & 0x3FF);
- }
- return 0xFFFF;
- }
-#endif
-#if defined(__STDC_ISO_10646__) || defined(__APPLE__)
- unsigned int decodeWide(const wchar_t*& src, const wchar_t* /* srcEnd */) {
- return *(src++);
- }
-#endif
- };
#else
-#error logchar cannot be wchar_t unless _WIN32, __STDC_ISO_10646___ or __APPLE__ is defined
-#endif
-#endif
-
- /**
- * Encodes a LogString to UTF16-BE.
- */
- class UTF16BECharsetEncoder : public CharsetEncoder
- {
- public:
- UTF16BECharsetEncoder() {
- }
-
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out) {
- log4cxx_status_t stat = APR_SUCCESS;
- while(iter != in.end() && out.remaining() >= 4) {
- unsigned int sv = UnicodeHelper::decode(in, iter);
- if (sv == 0xFFFF) {
- stat = APR_BADARG;
- break;
- }
- int bytes = UnicodeHelper::encodeUTF16BE(sv, out.current());
- out.position(out.position() + bytes);
- }
- return stat;
- }
-
- private:
- UTF16BECharsetEncoder(const UTF16BECharsetEncoder&);
- UTF16BECharsetEncoder& operator=(const UTF16BECharsetEncoder&);
- };
-
- /**
- * Encodes a LogString to UTF16-LE.
- */
- class UTF16LECharsetEncoder : public CharsetEncoder
- {
- public:
- UTF16LECharsetEncoder() {
- }
-
+/**
+ * Converts a LogString to UTF-8.
+ */
+class UTF8CharsetEncoder : public CharsetEncoder {
+public:
+ UTF8CharsetEncoder() {
+ }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out) {
- log4cxx_status_t stat = APR_SUCCESS;
- while(iter != in.end() && out.remaining() >= 4) {
- unsigned int sv = UnicodeHelper::decode(in, iter);
- if (sv == 0xFFFF) {
- stat = APR_BADARG;
- break;
- }
- int bytes = UnicodeHelper::encodeUTF16LE(sv, out.current());
- out.position(out.position() + bytes);
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out) {
+ while(iter != in.end() && out.remaining() >= 8) {
+ unsigned int sv = Transcoder::decode(in, iter);
+ if (sv == 0xFFFF) {
+ return APR_BADARG;
+ }
+ Transcoder::encodeUTF8(sv, out);
+ }
+ return APR_SUCCESS;
+ }
+
+private:
+ UTF8CharsetEncoder(const UTF8CharsetEncoder&);
+ UTF8CharsetEncoder& operator=(const UTF8CharsetEncoder&);
+};
+#endif
+
+/**
+ * Encodes a LogString to UTF16-BE.
+ */
+class UTF16BECharsetEncoder : public CharsetEncoder {
+public:
+ UTF16BECharsetEncoder() {
+ }
+
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out) {
+ while(iter != in.end() && out.remaining() >= 4) {
+ unsigned int sv = Transcoder::decode(in, iter);
+ if (sv == 0xFFFF) {
+ return APR_BADARG;
}
- return stat;
- }
-
- private:
- UTF16LECharsetEncoder(const UTF16LECharsetEncoder&);
- UTF16LECharsetEncoder& operator=(const UTF16LECharsetEncoder&);
- };
-
-#if LOG4CXX_LOGCHAR_IS_UTF8 && (defined(_WIN32) || defined(__STDC_ISO_10646__) || defined(__APPLE__))
-
- /**
- * Converts a LogString to an array of wchar_t.
- */
- class WideCharsetEncoder : public CharsetEncoder
- {
- public:
- WideCharsetEncoder() {
- }
-
-
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out) {
- log4cxx_status_t stat = APR_SUCCESS;
- while(iter != in.end() && out.remaining() >= 4) {
- unsigned int sv = UnicodeHelper::decode(in, iter);
- if (sv == 0xFFFF) {
- stat = APR_BADARG;
- break;
- }
- int count = encodeWide(sv, (wchar_t*) out.current());
- out.position(out.position() + count * sizeof(wchar_t));
+ Transcoder::encodeUTF16BE(sv, out);
+ }
+ return APR_SUCCESS;
+ }
+
+private:
+ UTF16BECharsetEncoder(const UTF16BECharsetEncoder&);
+ UTF16BECharsetEncoder& operator=(const UTF16BECharsetEncoder&);
+};
+
+/**
+ * Encodes a LogString to UTF16-LE.
+ */
+class UTF16LECharsetEncoder : public CharsetEncoder {
+public:
+ UTF16LECharsetEncoder() {
+ }
+
+
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out) {
+ while(iter != in.end() && out.remaining() >= 4) {
+ unsigned int sv = Transcoder::decode(in, iter);
+ if (sv == 0xFFFF) {
+ return APR_BADARG;
}
- return stat;
- }
-
- private:
- WideCharsetEncoder(const WideCharsetEncoder&);
- WideCharsetEncoder& operator=(const WideCharsetEncoder&);
-
-#if defined(_WIN32)
- int encodeWide(unsigned int ch, wchar_t* dst) {
- if (ch <= 0xFFFF) {
- *dst = (wchar_t) ch;
- return 1;
- }
- unsigned char u = (unsigned char) (ch >> 16);
- unsigned char w = (unsigned char) (u - 1);
- wchar_t hs = (wchar_t) (0xD800 + ((w & 0xF) << 6) + ((ch & 0xFFFF) >> 10));
- wchar_t ls = (wchar_t) (0xDC00 + (ch && 0x3FF));
- dst[0] = hs;
- dst[1] = ls;
- return 2;
- }
-#endif
-
-#if defined(__STDC_ISO_10646__) || defined(__APPLE__)
- int encodeWide(unsigned int ch, wchar_t* dst) {
- *dst = ch;
- return 1;
- }
-#endif
-
- };
-#endif
-
- /**
- * Charset encoder that uses an embedded CharsetEncoder consistent
- * with current locale settings.
- */
- class LocaleCharsetEncoder : public CharsetEncoder {
- public:
- LocaleCharsetEncoder() : pool(), mutex(pool), encoder(), encoding() {
- }
- virtual ~LocaleCharsetEncoder() {
- }
- virtual log4cxx_status_t encode(const LogString& in,
- LogString::const_iterator& iter,
- ByteBuffer& out) {
- log4cxx_status_t stat = APR_SUCCESS;
- if (iter != in.end()) {
- for(LogString::const_iterator i(iter);
- i != in.end();
- i++) {
- //
- // non-ASCII character, delegate to APRCharsetEncoder.
- //
-#if LOG4CXX_LOGCHAR_IS_UTF8
- if (((unsigned char) *i) > 127) {
-#else
- if (*i > 127) {
-#endif
- Pool subpool;
- const char* enc = apr_os_locale_encoding((apr_pool_t*) subpool.getAPRPool());
- {
- synchronized sync(mutex);
- if (enc == 0) {
- if (encoder == 0) {
- encoding = "C";
- encoder = new USASCIICharsetEncoder();
- }
- } else if (encoding != enc) {
- encoding = enc;
- try {
- encoder = CharsetEncoder::getEncoder(encoding);
- } catch(IllegalArgumentException ex) {
- encoder = new USASCIICharsetEncoder();
- }
- }
+ Transcoder::encodeUTF16LE(sv, out);
+ }
+ return APR_SUCCESS;
+ }
+private:
+ UTF16LECharsetEncoder(const UTF16LECharsetEncoder&);
+ UTF16LECharsetEncoder& operator=(const UTF16LECharsetEncoder&);
+};
+
+/**
+ * Charset encoder that uses an embedded CharsetEncoder consistent
+ * with current locale settings.
+ */
+class LocaleCharsetEncoder : public CharsetEncoder {
+public:
+ LocaleCharsetEncoder() : pool(), mutex(pool), encoder(), encoding() {
+ }
+ virtual ~LocaleCharsetEncoder() {
+ }
+ virtual log4cxx_status_t encode(const LogString& in,
+ LogString::const_iterator& iter,
+ ByteBuffer& out) {
+#if !LOG4CXX_CHARSET_EBCDIC
+ char* current = out.current();
+ size_t remain = out.remaining();
+ for(;
+ iter != in.end() && ((unsigned int) *iter) < 0x80 && remain > 0;
+ iter++, remain--, current++) {
+ *current = *iter;
+ }
+ out.position(current - out.data());
+#endif
+ if (iter != in.end() && out.remaining() > 0) {
+ Pool subpool;
+ const char* enc = apr_os_locale_encoding((apr_pool_t*) subpool.getAPRPool());
+ {
+ synchronized sync(mutex);
+ if (enc == 0) {
+ if (encoder == 0) {
+ encoding = "C";
+ encoder = new USASCIICharsetEncoder();
}
- return encoder->encode(in, iter, out);
- }
- }
- size_t limit = out.limit();
- size_t pos = out.position();
- char* current = out.current();
- for (; iter != in.end() && pos < limit; pos++, iter++, current++) {
- *current = (char) *iter;
- }
- out.position(pos);
- }
- return stat;
- }
- private:
- Pool pool;
- Mutex mutex;
- CharsetEncoderPtr encoder;
- std::string encoding;
- };
+ } else if (encoding != enc) {
+ encoding = enc;
+ LogString ename;
+ Transcoder::decode(encoding, ename);
+ try {
+ encoder = CharsetEncoder::getEncoder(ename);
+ } catch(IllegalArgumentException ex) {
+ encoder = new USASCIICharsetEncoder();
+ }
+ }
+ }
+ return encoder->encode(in, iter, out);
+ }
+ return APR_SUCCESS;
+ }
+
+private:
+ LocaleCharsetEncoder(const LocaleCharsetEncoder&);
+ LocaleCharsetEncoder& operator=(const LocaleCharsetEncoder&);
+ Pool pool;
+ Mutex mutex;
+ CharsetEncoderPtr encoder;
+ std::string encoding;
+};
} // namespace helpers
@@ -557,84 +446,46 @@
}
CharsetEncoder* CharsetEncoder::createDefaultEncoder() {
-#if LOG4CXX_LOCALE_ENCODING_UTF8
+#if LOG4CXX_CHARSET_UTF8
return new UTF8CharsetEncoder();
-#elif LOG4CXX_LOCALE_ENCODING_ISO_8859_1
+#elif LOG4CXX_CHARSET_ISO88591
return new ISOLatinCharsetEncoder();
-#elif LOG4CXX_LOCALE_ENCODING_US_ASCII
+#elif LOG4CXX_CHARSET_USASCII
return new USASCIICharsetEncoder();
-#elif LOG4CXX_LOGCHAR_IS_WCHAR
+#elif LOG4CXX_LOGCHAR_IS_WCHAR && LOG4CXX_HAS_WCSTOMBS
return new WcstombsCharsetEncoder();
#else
return new LocaleCharsetEncoder();
#endif
}
-#if LOG4CXX_HAS_WCHAR_T
-CharsetEncoderPtr CharsetEncoder::getEncoder(const std::wstring& charset) {
- std::string cs(charset.size(), ' ');
- for(std::wstring::size_type i = 0;
- i < charset.length();
- i++) {
- cs[i] = (char) charset[i];
- }
- return getEncoder(cs);
-}
-#endif
CharsetEncoderPtr CharsetEncoder::getUTF8Encoder() {
return new UTF8CharsetEncoder();
}
-#if LOG4CXX_HAS_WCHAR_T
-CharsetEncoder* CharsetEncoder::createWideEncoder() {
-#if LOG4CXX_LOGCHAR_IS_WCHAR
- return new TrivialCharsetEncoder();
-#elif LOG4CXX_LOGCHAR_IS_UTF8 && (defined(_WIN32) || defined(__STDC_ISO_10646__) || defined(__APPLE__))
- return new WideCharsetEncoder();
-#else
- return new APRCharsetEncoder("WCHAR_T");
-#endif
-
-}
-
-CharsetEncoderPtr CharsetEncoder::getWideEncoder() {
- static CharsetEncoderPtr encoder(createWideEncoder());
- //
- // if invoked after static variable destruction
- // (if logging is called in the destructor of a static object)
- // then create a new decoder.
- //
- if (encoder == 0) {
- return createWideEncoder();
- }
- return encoder;
-}
-#endif
-
-
-CharsetEncoderPtr CharsetEncoder::getEncoder(const std::string& charset) {
- if (StringHelper::equalsIgnoreCase(charset, "UTF-8", "utf-8")) {
+CharsetEncoderPtr CharsetEncoder::getEncoder(const LogString& charset) {
+ if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-8"), LOG4CXX_STR("utf-8"))) {
return new UTF8CharsetEncoder();
- } else if (StringHelper::equalsIgnoreCase(charset, "C", "c") ||
- charset == "646" ||
- StringHelper::equalsIgnoreCase(charset, "US-ASCII", "us-ascii") ||
- StringHelper::equalsIgnoreCase(charset, "ISO646-US", "iso646-US") ||
- StringHelper::equalsIgnoreCase(charset, "ANSI_X3.4-1968", "ansi_x3.4-1968")) {
+ } else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("C"), LOG4CXX_STR("c")) ||
+ charset == LOG4CXX_STR("646") ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("US-ASCII"), LOG4CXX_STR("us-ascii")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO646-US"), LOG4CXX_STR("iso646-US")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ANSI_X3.4-1968"), LOG4CXX_STR("ansi_x3.4-1968"))) {
return new USASCIICharsetEncoder();
- } else if (StringHelper::equalsIgnoreCase(charset, "ISO-8859-1", "iso-8859-1") ||
- StringHelper::equalsIgnoreCase(charset, "ISO-LATIN-1", "iso-latin-1")) {
+ } else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-8859-1"), LOG4CXX_STR("iso-8859-1")) ||
+ StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("ISO-LATIN-1"), LOG4CXX_STR("iso-latin-1"))) {
return new ISOLatinCharsetEncoder();
- } else if (StringHelper::equalsIgnoreCase(charset, "UTF-16BE", "utf-16be")
- || StringHelper::equalsIgnoreCase(charset, "UTF-16", "utf-16")) {
+ } else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16BE"), LOG4CXX_STR("utf-16be"))
+ || StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16"), LOG4CXX_STR("utf-16"))) {
return new UTF16BECharsetEncoder();
- } else if (StringHelper::equalsIgnoreCase(charset, "UTF-16LE", "utf-16le")) {
+ } else if (StringHelper::equalsIgnoreCase(charset, LOG4CXX_STR("UTF-16LE"), LOG4CXX_STR("utf-16le"))) {
return new UTF16LECharsetEncoder();
}
#if APR_HAS_XLATE || !defined(_WIN32)
- return new APRCharsetEncoder(charset.c_str());
+ return new APRCharsetEncoder(charset);
#else
throw IllegalArgumentException(charset);
#endif
@@ -654,7 +505,7 @@
ByteBuffer& dst) {
log4cxx_status_t stat = enc->encode(src, iter, dst);
if (stat != APR_SUCCESS && iter != src.end()) {
-#if LOG4CXX_LOGCHAR_IS_WCHAR
+#if LOG4CXX_LOGCHAR_IS_WCHAR || LOG4CXX_LOGCHAR_IS_UNICHAR
iter++;
#elif LOG4CXX_LOGCHAR_IS_UTF8
// advance past this character and all continuation characters
@@ -662,7 +513,6 @@
#else
#error logchar is unrecognized
#endif
-
- dst.put('?');
+ dst.put(Transcoder::LOSSCHAR);
}
}
Modified: logging/log4cxx/trunk/src/main/cpp/class.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/class.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/class.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/class.cpp Thu Dec 20 18:52:29 2007
@@ -82,14 +82,14 @@
{
}
-const LogString Class::toString() const
+LogString Class::toString() const
{
return getName();
}
ObjectPtr Class::newInstance() const
{
- throw InstantiationException("Cannot create new instances of Class.");
+ throw InstantiationException(LOG4CXX_STR("Cannot create new instances of Class."));
#if LOG4CXX_RETURN_AFTER_THROW
return 0;
#endif
@@ -145,7 +145,7 @@
#endif
ConsoleAppender::registerClass();
FileAppender::registerClass();
- log4cxx::db::ODBCAppender::registerClass();
+ log4cxx::db::ODBCAppender::registerClass();
#if (defined(WIN32) || defined(_WIN32))
#if !defined(_WIN32_WCE)
log4cxx::nt::NTEventLogAppender::registerClass();
Modified: logging/log4cxx/trunk/src/main/cpp/cyclicbuffer.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/cyclicbuffer.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/cyclicbuffer.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/cyclicbuffer.cpp Thu Dec 20 18:52:29 2007
@@ -36,10 +36,10 @@
{
if(maxSize1 < 1)
{
- std::string msg("The maxSize argument (");
+ LogString msg(LOG4CXX_STR("The maxSize argument ("));
Pool p;
StringHelper::toString(maxSize1, p, msg);
- msg.append(") is not a positive integer.");
+ msg.append(LOG4CXX_STR(") is not a positive integer."));
throw IllegalArgumentException(msg);
}
}
@@ -111,10 +111,10 @@
{
if(newSize < 0)
{
- std::string msg("Negative array size [");
+ LogString msg(LOG4CXX_STR("Negative array size ["));
Pool p;
StringHelper::toString(newSize, p, msg);
- msg.append("] not allowed.");
+ msg.append(LOG4CXX_STR("] not allowed."));
throw IllegalArgumentException(msg);
}
if(newSize == numElems)
Modified: logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/dailyrollingfileappender.cpp Thu Dec 20 18:52:29 2007
@@ -64,16 +64,17 @@
bool inPattern = false;
for (size_t i = 0; i < datePattern.length(); i++) {
- if (datePattern[i] == LOG4CXX_STR('\'')) {
+ if (datePattern[i] == 0x27 /* '\'' */) {
inLiteral = !inLiteral;
if (inLiteral && inPattern) {
- pattern.append(1, LOG4CXX_STR('}'));
+ pattern.append(1, 0x7D /* '}' */);
inPattern = false;
}
} else {
if (!inLiteral && !inPattern) {
- pattern.append(LOG4CXX_STR("%d{"));
+ const logchar dbrace[] = { 0x25, 0x64, 0x7B, 0 }; // "%d{"
+ pattern.append(dbrace);
inPattern = true;
}
@@ -82,7 +83,7 @@
}
if (inPattern) {
- pattern.append(1, LOG4CXX_STR('}'));
+ pattern.append(1, 0x7D /* '}' */);
}
policy->setFileNamePattern(pattern);
Modified: logging/log4cxx/trunk/src/main/cpp/datelayout.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/datelayout.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/datelayout.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/datelayout.cpp Thu Dec 20 18:52:29 2007
@@ -115,7 +115,7 @@
if(dateFormat != 0)
{
dateFormat->format(s, event->getTimeStamp(), p);
- s.append(1, LOG4CXX_STR(' '));
+ s.append(1, 0x20 /* ' ' */);
}
}
Modified: logging/log4cxx/trunk/src/main/cpp/datepatternconverter.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/datepatternconverter.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/datepatternconverter.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/datepatternconverter.cpp Thu Dec 20 18:52:29 2007
@@ -61,7 +61,7 @@
LOG4CXX_STR("DATE"), LOG4CXX_STR("date"))) {
df = new DateTimeDateFormat();
} else {
- if (dateFormatStr.find(LOG4CXX_STR('%')) == std::string::npos) {
+ if (dateFormatStr.find(0x25 /*'%'*/) == std::string::npos) {
try {
df = new SimpleDateFormat(dateFormatStr);
maximumCacheValidity =
Modified: logging/log4cxx/trunk/src/main/cpp/defaultconfigurator.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/defaultconfigurator.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/defaultconfigurator.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/defaultconfigurator.cpp Thu Dec 20 18:52:29 2007
@@ -33,7 +33,8 @@
const LogString configuratorClassName(getConfiguratorClass());
LogString configurationOptionStr(getConfigurationFileName());
- File configuration(configurationOptionStr);
+ File configuration;
+ configuration.setName(configurationOptionStr);
if (configurationOptionStr.empty())
{
Modified: logging/log4cxx/trunk/src/main/cpp/domconfigurator.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/domconfigurator.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/domconfigurator.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/domconfigurator.cpp Thu Dec 20 18:52:29 2007
@@ -57,7 +57,7 @@
class XMLWatchdog : public FileWatchdog
{
public:
- XMLWatchdog(const LogString& filename) : FileWatchdog(filename)
+ XMLWatchdog(const File& filename) : FileWatchdog(filename)
{
}
@@ -738,61 +738,111 @@
void DOMConfigurator::configure(const std::string& filename)
{
- LOG4CXX_DECODE_CHAR(fn, filename);
- DOMConfigurator().doConfigure(fn, LogManager::getLoggerRepository());
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
}
-#if LOG4CXX_HAS_WCHAR_T
+#if LOG4CXX_WCHAR_T_API
void DOMConfigurator::configure(const std::wstring& filename)
{
- LOG4CXX_DECODE_WCHAR(fn, filename);
- DOMConfigurator().doConfigure(fn, LogManager::getLoggerRepository());
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
}
#endif
+#if LOG4CXX_UNICHAR_API
+void DOMConfigurator::configure(const std::basic_string<UniChar>& filename)
+{
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+}
+#endif
+
+#if LOG4CXX_CFSTRING_API
+void DOMConfigurator::configure(const CFStringRef& filename)
+{
+ File file(filename);
+ DOMConfigurator().doConfigure(file, LogManager::getLoggerRepository());
+}
+#endif
+
+
void DOMConfigurator::configureAndWatch(const std::string& filename)
{
-#if APR_HAS_THREADS
- LOG4CXX_DECODE_CHAR(fn, filename);
- configureAndWatch(fn, FileWatchdog::DEFAULT_DELAY);
-#else
- configure(filename);
-#endif
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
}
-#if LOG4CXX_HAS_WCHAR_T
+#if LOG4CXX_WCHAR_T_API
void DOMConfigurator::configureAndWatch(const std::wstring& filename)
{
-#if APR_HAS_THREADS
- LOG4CXX_DECODE_WCHAR(fn, filename);
- configureAndWatch(fn, FileWatchdog::DEFAULT_DELAY);
-#else
- configure(fn);
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
+}
+#endif
+
+#if LOG4CXX_UNICHAR_API
+void DOMConfigurator::configureAndWatch(const std::basic_string<UniChar>& filename)
+{
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
+}
#endif
+
+#if LOG4CXX_CFSTRING_API
+void DOMConfigurator::configureAndWatch(const CFStringRef& filename)
+{
+ configureAndWatch(filename, FileWatchdog::DEFAULT_DELAY);
}
#endif
void DOMConfigurator::configureAndWatch(const std::string& filename, long delay)
{
+ File file(filename);
#if APR_HAS_THREADS
- LOG4CXX_DECODE_CHAR(fn, filename);
- XMLWatchdog * xdog = new XMLWatchdog(fn);
+ XMLWatchdog * xdog = new XMLWatchdog(file);
xdog->setDelay(delay);
xdog->start();
#else
- configure(filename);
+ configure(file);
#endif
}
-#if LOG4CXX_HAS_WCHAR_T
+
+#if LOG4CXX_WCHAR_T_API
void DOMConfigurator::configureAndWatch(const std::wstring& filename, long delay)
{
+ File file(filename);
+#if APR_HAS_THREADS
+ XMLWatchdog * xdog = new XMLWatchdog(file);
+ xdog->setDelay(delay);
+ xdog->start();
+#else
+ configure(file);
+#endif
+}
+#endif
+
+#if LOG4CXX_UNICHAR_API
+void DOMConfigurator::configureAndWatch(const std::basic_string<UniChar>& filename, long delay)
+{
+ File file(filename);
+#if APR_HAS_THREADS
+ XMLWatchdog * xdog = new XMLWatchdog(file);
+ xdog->setDelay(delay);
+ xdog->start();
+#else
+ configure(file);
+#endif
+}
+#endif
+
+#if LOG4CXX_CFSTRING_API
+void DOMConfigurator::configureAndWatch(const CFStringRef& filename, long delay)
+{
+ File file(filename);
#if APR_HAS_THREADS
- LOG4CXX_DECODE_WCHAR(fn, filename);
- XMLWatchdog * xdog = new XMLWatchdog(fn);
+ XMLWatchdog * xdog = new XMLWatchdog(file);
xdog->setDelay(delay);
xdog->start();
#else
- configure(filename);
+ configure(file);
#endif
}
#endif
Modified: logging/log4cxx/trunk/src/main/cpp/exception.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/exception.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/exception.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/exception.cpp Thu Dec 20 18:52:29 2007
@@ -26,11 +26,19 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-Exception::Exception(const std::string& msg1) {
- size_t msgLen = msg1.length();
- if (msgLen > MSG_SIZE) msgLen = MSG_SIZE;
- memcpy(this->msg, (char*) msg1.data(), msgLen);
- this->msg[msgLen] = 0;
+Exception::Exception(const LogString& msg1) {
+ std::string m;
+ Transcoder::encode(msg1, m);
+ size_t len = m.size();
+ if (len > MSG_SIZE) {
+ len = MSG_SIZE;
+ }
+#if defined(__STDC_LIB_EXT1__) || defined(__STDC_SECURE_LIB__)
+ memcpy_s(msg, sizeof msg, m.data(), len);
+#else
+ memcpy(msg, m.data(), len);
+#endif
+ msg[len] = 0;
}
Exception::Exception(const Exception& src) : std::exception() {
@@ -58,7 +66,7 @@
: Exception(formatMessage(stat)) {
}
-RuntimeException::RuntimeException(const std::string& msg1)
+RuntimeException::RuntimeException(const LogString& msg1)
: Exception(msg1) {
}
@@ -71,14 +79,14 @@
return *this;
}
-std::string RuntimeException::formatMessage(log4cxx_status_t stat) {
- std::string s("RuntimeException: return code = ");
+LogString RuntimeException::formatMessage(log4cxx_status_t stat) {
+ LogString s(LOG4CXX_STR("RuntimeException: return code = "));
Pool p;
StringHelper::toString(stat, p, s);
return s;
}
-NullPointerException::NullPointerException(const std::string& msg1)
+NullPointerException::NullPointerException(const LogString& msg1)
: RuntimeException(msg1) {
}
@@ -91,7 +99,7 @@
return *this;
}
-IllegalArgumentException::IllegalArgumentException(const std::string& msg1)
+IllegalArgumentException::IllegalArgumentException(const LogString& msg1)
: RuntimeException(msg1) {
}
@@ -105,7 +113,7 @@
}
IOException::IOException()
- : Exception("IO exception") {
+ : Exception(LOG4CXX_STR("IO exception")) {
}
IOException::IOException(log4cxx_status_t stat)
@@ -113,7 +121,7 @@
}
-IOException::IOException(const std::string& msg1)
+IOException::IOException(const LogString& msg1)
: Exception(msg1) {
}
@@ -126,8 +134,8 @@
return *this;
}
-std::string IOException::formatMessage(log4cxx_status_t stat) {
- std::string s("IO Exception : status code = ");
+LogString IOException::formatMessage(log4cxx_status_t stat) {
+ LogString s(LOG4CXX_STR("IO Exception : status code = "));
Pool p;
StringHelper::toString(stat, p, s);
return s;
@@ -148,10 +156,10 @@
return *this;
}
-std::string MissingResourceException::formatMessage(const LogString& key) {
- std::string s("MissingResourceException: resource key = \"");
- Transcoder::encode(key, s);
- s.append("\".");
+LogString MissingResourceException::formatMessage(const LogString& key) {
+ LogString s(LOG4CXX_STR("MissingResourceException: resource key = \""));
+ s.append(key);
+ s.append(LOG4CXX_STR("\"."));
return s;
}
@@ -168,8 +176,8 @@
return *this;
}
-std::string PoolException::formatMessage(log4cxx_status_t) {
- return "Pool exception";
+LogString PoolException::formatMessage(log4cxx_status_t) {
+ return LOG4CXX_STR("Pool exception");
}
@@ -186,8 +194,8 @@
return *this;
}
-std::string TranscoderException::formatMessage(log4cxx_status_t) {
- return "Transcoder exception";
+LogString TranscoderException::formatMessage(log4cxx_status_t) {
+ return LOG4CXX_STR("Transcoder exception");
}
@@ -204,14 +212,14 @@
return *this;
}
-std::string MutexException::formatMessage(log4cxx_status_t stat) {
- std::string s("Mutex exception: stat = ");
+LogString MutexException::formatMessage(log4cxx_status_t stat) {
+ LogString s(LOG4CXX_STR("Mutex exception: stat = "));
Pool p;
StringHelper::toString(stat, p, s);
return s;
}
-InterruptedException::InterruptedException() : Exception("Thread was interrupted") {
+InterruptedException::InterruptedException() : Exception(LOG4CXX_STR("Thread was interrupted")) {
}
InterruptedException::InterruptedException(log4cxx_status_t stat)
@@ -227,8 +235,8 @@
return *this;
}
-std::string InterruptedException::formatMessage(log4cxx_status_t stat) {
- std::string s("InterruptedException: stat = ");
+LogString InterruptedException::formatMessage(log4cxx_status_t stat) {
+ LogString s(LOG4CXX_STR("InterruptedException: stat = "));
Pool p;
StringHelper::toString(stat, p, s);
return s;
@@ -247,14 +255,14 @@
return *this;
}
-std::string ThreadException::formatMessage(log4cxx_status_t stat) {
- std::string s("Thread exception: stat = ");
+LogString ThreadException::formatMessage(log4cxx_status_t stat) {
+ LogString s(LOG4CXX_STR("Thread exception: stat = "));
Pool p;
StringHelper::toString(stat, p, s);
return s;
}
-IllegalMonitorStateException::IllegalMonitorStateException(const std::string& msg1)
+IllegalMonitorStateException::IllegalMonitorStateException(const LogString& msg1)
: Exception(msg1) {
}
@@ -267,7 +275,7 @@
return *this;
}
-InstantiationException::InstantiationException(const std::string& msg1)
+InstantiationException::InstantiationException(const LogString& msg1)
: Exception(msg1) {
}
@@ -294,15 +302,15 @@
return *this;
}
-std::string ClassNotFoundException::formatMessage(const LogString& className) {
- std::string s("Class not found: ");
- Transcoder::encode(className, s);
+LogString ClassNotFoundException::formatMessage(const LogString& className) {
+ LogString s(LOG4CXX_STR("Class not found: "));
+ s.append(className);
return s;
}
NoSuchElementException::NoSuchElementException()
- : Exception("No such element") {
+ : Exception(LOG4CXX_STR("No such element")) {
}
NoSuchElementException::NoSuchElementException(const NoSuchElementException& src)
@@ -316,7 +324,7 @@
IllegalStateException::IllegalStateException()
- : Exception("Illegal state") {
+ : Exception(LOG4CXX_STR("Illegal state")) {
}
IllegalStateException::IllegalStateException(const IllegalStateException& src)
Modified: logging/log4cxx/trunk/src/main/cpp/file.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/file.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/file.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/file.cpp Thu Dec 20 18:52:29 2007
@@ -36,7 +36,7 @@
Transcoder::encode(this->name, osName);
}
-#if LOG4CXX_HAS_WCHAR_T
+#if LOG4CXX_WCHAR_T_API
File::File(const std::wstring& name1)
: name(), osName() {
Transcoder::decode(name1, this->name);
@@ -44,6 +44,22 @@
}
#endif
+#if LOG4CXX_UNICHAR_API
+File::File(const std::basic_string<UniChar>& name1)
+ : name(), osName() {
+ Transcoder::decode(name1, this->name);
+ Transcoder::encode(this->name, osName);
+}
+#endif
+
+#if LOG4CXX_CFSTRING_API
+File::File(const CFStringRef& name1)
+ : name(), osName() {
+ Transcoder::decode(name1, this->name);
+ Transcoder::encode(this->name, osName);
+}
+#endif
+
File::File(const File& src)
: name(src.name), osName(src.osName) {
}
@@ -61,6 +77,20 @@
File::~File() {
}
+
+LogString File::getName() const {
+ return name;
+}
+
+File& File::setName(const LogString& newName) {
+ name.assign(newName);
+ Transcoder::encode(newName, osName);
+ return *this;
+}
+
+std::string File::getOSName() const {
+ return osName;
+}
log4cxx_status_t File::open(apr_file_t** file, int flags,
int perm, Pool& p) const {
Modified: logging/log4cxx/trunk/src/main/cpp/fileappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/fileappender.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/fileappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/fileappender.cpp Thu Dec 20 18:52:29 2007
@@ -155,10 +155,12 @@
setFile(fileName, fileAppend, bufferedIO, bufferSize, p);
} catch (IOException& e) {
errors++;
- LogLog::error(
- LogString(LOG4CXX_STR("setFile(")) + fileName
- + LOG4CXX_STR(",") + StringHelper::toString(fileAppend) +
- LOG4CXX_STR(") call failed."), e);
+ LogString msg(LOG4CXX_STR("setFile("));
+ msg.append(fileName);
+ msg.append(1, 0x2C /* ',' */);
+ StringHelper::toString(fileAppend, msg);
+ msg.append(LOG4CXX_STR(") call failed."));
+ LogLog::error(msg, e);
}
} else {
errors++;
@@ -184,7 +186,7 @@
*
*/
LogString FileAppender::stripDuplicateBackslashes(const LogString& src) {
- logchar backslash = LOG4CXX_STR('\\');
+ logchar backslash = 0x5C; // '\\'
LogString::size_type i = src.find_last_of(backslash);
if (i != LogString::npos) {
LogString tmp(src);
@@ -254,7 +256,8 @@
// don't want to write a byte order mark if the file exists
//
if (append1) {
- File outFile(filename);
+ File outFile;
+ outFile.setName(filename);
writeBOM = !outFile.exists(p);
} else {
writeBOM = true;
@@ -265,9 +268,10 @@
try {
outStream = new FileOutputStream(filename, append1);
} catch(IOException& ex) {
- LogString parentName = File(filename).getParent(p);
+ LogString parentName = File().setName(filename).getParent(p);
if (!parentName.empty()) {
- File parentDir(parentName);
+ File parentDir;
+ parentDir.setName(parentName);
if(!parentDir.exists(p) && parentDir.mkdirs(p)) {
outStream = new FileOutputStream(filename, append1);
} else {
Modified: logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/fileinputstream.cpp Thu Dec 20 18:52:29 2007
@@ -34,7 +34,7 @@
FileInputStream::FileInputStream(const LogString& filename) {
apr_fileperms_t perm = APR_OS_DEFAULT;
apr_int32_t flags = APR_READ;
- apr_status_t stat = File(filename).open(&fileptr, flags, perm, pool);
+ apr_status_t stat = File().setName(filename).open(&fileptr, flags, perm, pool);
if (stat != APR_SUCCESS) {
throw IOException(stat);
}
Modified: logging/log4cxx/trunk/src/main/cpp/fixedwindowrollingpolicy.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/fixedwindowrollingpolicy.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/fixedwindowrollingpolicy.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/fixedwindowrollingpolicy.cpp Thu Dec 20 18:52:29 2007
@@ -143,17 +143,17 @@
renameTo.resize(renameTo.size() - 3);
compressAction =
new GZCompressAction(
- renameTo, compressedName, true);
+ File().setName(renameTo), File().setName(compressedName), true);
} else if (StringHelper::endsWith(renameTo, LOG4CXX_STR(".zip"))) {
renameTo.resize(renameTo.size() - 4);
compressAction =
new ZipCompressAction(
- renameTo, compressedName, true);
+ File().setName(renameTo), File().setName(compressedName), true);
}
FileRenameActionPtr renameAction =
new FileRenameAction(
- currentFileName, renameTo, false);
+ File().setName(currentFileName), File().setName(renameTo), false);
desc = new RolloverDescription(
currentFileName, false, renameAction, compressAction);
@@ -203,8 +203,10 @@
}
for (int i = lowIndex; i <= highIndex; i++) {
- File toRenameCompressed(lowFilename);
- File toRenameBase(lowFilename.substr(0, lowFilename.length() - suffixLength));
+ File toRenameCompressed;
+ toRenameCompressed.setName(lowFilename);
+ File toRenameBase;
+ toRenameBase.setName(lowFilename.substr(0, lowFilename.length() - suffixLength));
File* toRename = &toRenameCompressed;
bool isBase = false;
bool exists = toRenameCompressed.exists(p);
@@ -249,7 +251,7 @@
highFilename.substr(0, highFilename.length() - suffixLength);
}
- renames.push_back(new FileRenameAction(*toRename, File(renameTo), true));
+ renames.push_back(new FileRenameAction(*toRename, File().setName(renameTo), true));
lowFilename = highFilename;
} else {
break;
Modified: logging/log4cxx/trunk/src/main/cpp/formattinginfo.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/formattinginfo.cpp?rev=606089&r1=606088&r2=606089&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/formattinginfo.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/formattinginfo.cpp Thu Dec 20 18:52:29 2007
@@ -60,9 +60,9 @@
buffer.begin() + fieldStart + (rawLength - maxLength));
} else if (rawLength < minLength) {
if (leftAlign) {
- buffer.append(minLength - rawLength, LOG4CXX_STR(' '));
+ buffer.append(minLength - rawLength, 0x20 /* ' ' */);
} else {
- buffer.insert(fieldStart, minLength - rawLength, LOG4CXX_STR(' '));
+ buffer.insert(fieldStart, minLength - rawLength, 0x20 /* ' ' */);
}
}
}