svn commit: r627977 - in /logging/log4cxx/trunk/src: main/cpp/file.cpp main/cpp/transcoder.cpp main/include/log4cxx/file.h main/include/log4cxx/helpers/transcoder.h test/cpp/logunit.cpp

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 01:02:24 2008
New Revision: 627977

URL: http://svn.apache.org/viewvc?rev=627977&view=rev
Log:
LOGCXX-241: File rework for non-ascii path names

Modified:
logging/log4cxx/trunk/src/main/cpp/file.cpp
logging/log4cxx/trunk/src/main/cpp/transcoder.cpp
logging/log4cxx/trunk/src/main/include/log4cxx/file.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/transcoder.h
logging/log4cxx/trunk/src/test/cpp/logunit.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/file.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/file.cpp?rev=627977&r1=627976&r2=627977&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/file.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/file.cpp Fri Feb 15 01:02:24 2008
@@ -31,67 +31,64 @@
 }
 
 template 
-static LogString decodeLS(const S& src) {
+static LogString decodeLS(const S* src) {
 LogString dst;
-Transcoder::decode(src, dst);
+if (src != 0) {
+   Transcoder::decode(src, dst);
+}
 return dst;
 }
 
 template 
-static std::string decodeOS(const S& src) {
-LogString ls;
-std::string os;
-Transcoder::decode(src, ls);
-Transcoder::encode(ls, os);
-return os;
+static LogString decodeLS(const std::basic_string& src) {
+LogString dst;
+Transcoder::decode(src, dst);
+return dst;
 }
 
 
 File::File(const std::string& name1)
-  : name(decodeLS(name1)), osName(decodeOS(name1)) {
+  : path(decodeLS(name1)) {
 }
 
 File::File(const char* name1)
-  : name(decodeLS(name1)), osName(decodeOS(name1)) {
+  : path(decodeLS(name1)) {
 }
 
 #if LOG4CXX_WCHAR_T_API
 File::File(const std::wstring& name1)
-   : name(decodeLS(name1)), osName(decodeOS(name1)) {
+   : path(decodeLS(name1)) {
 }
 
 File::File(const wchar_t* name1)
-   : name(decodeLS(name1)), osName(decodeOS(name1)) {
+   : path(decodeLS(name1)) {
 }
 #endif
 
 #if LOG4CXX_UNICHAR_API
 File::File(const std::basic_string& name1)
-   : name(decodeLS(name1)), osName(decodeOS(name1)) {
+   : path(decodeLS(name1)) {
 }
 
 File::File(const UniChar* name1)
-   : name(decodeLS(name1)), osName(decodeOS(name1)) {
+   : path(decodeLS(name1)) {
 }
 #endif
 
 #if LOG4CXX_CFSTRING_API
 File::File(const CFStringRef& name1)
-   : name(), osName() {
-  Transcoder::decode(name1, this->name);
-  Transcoder::encode(this->name, osName);
+   : path(name1) {
 }
 #endif
 
 File::File(const File& src)
-  : name(src.name), osName(src.osName) {
+  : path(src.path) {
 }
 
 File& File::operator=(const File& src) {
   if (this == &src) return *this;
 
-  name.assign(src.name);
-  osName.assign(src.osName);
+  path.assign(src.path);
 
   return *this;
 }
@@ -102,66 +99,68 @@
 
 
 LogString File::getPath() const {
-return name;
+return path;
 }
 
 File& File::setPath(const LogString& newName) {
-name.assign(newName);
-osName.erase();
-Transcoder::encode(newName, osName);
+path.assign(newName);
 return *this;
 }
 
 LogString File::getName() const {
-return name;
+const logchar slashes[] = { 0x2F, 0x5C, 0 };
+size_t lastSlash = path.find_last_of(slashes);
+if (lastSlash != LogString::npos) {
+return path.substr(lastSlash+1);
+}
+return path;
 }
 
-std::string File::getOSName() const {
-return osName;
+char* File::getPath(Pool& p) const {
+apr_pool_t* pool = reinterpret_cast(p.getAPRPool());
+int style = APR_FILEPATH_ENCODING_UNKNOWN;
+apr_filepath_encoding(&style, pool);
+char* retval = NULL;
+if (style == APR_FILEPATH_ENCODING_UTF8) {
+retval = Transcoder::encodeUTF8(path, p);
+} else {
+retval = Transcoder::encode(path, p);
+}
+return retval;
 }
 
 log4cxx_status_t File::open(apr_file_t** file, int flags,
   int perm, Pool& p) const {
-//
-//   The trunction to MBCS can corrupt filenames
-//   would be nice to be able to do something about
-//   it here since we have both Unicode
-//  and local code page file names
-//
-return apr_file_open(file, osName.c_str(), flags, perm, (apr_pool_t*) 
p.getAPRPool());
+return apr_file_open(file, getPath(p), flags, perm, (apr_pool_t*) 
p.getAPRPool());
 }
 
 
 
 bool File::exists(Pool& p) const {
   apr_finfo_t finfo;
-  apr_status_t rv = apr_stat(&finfo, osName.c_str(),
+  apr_status_t rv = apr_stat(&finfo, getPath(p),
 0, (apr_pool_t*) p.getAPRPool());
   return rv == APR_SUCCESS;
 }
 
-std::string File::convertBackSlashes(const std::string& src) {
-  std::string::size_type pos = src.find('\\');
-  if (pos == std::string::npos) {
-return src;
-  }
-  std::string mod(src);
-  while(pos != std::string::npos) {
-mod[pos] = '/';
-pos = mod.find('\\');
+char* File::convertBackSlashes(char* src) {
+  for(char* c = src; *c != 0; c++) {
+   if(*c == '\\') {
+   *c = '/';
+   }
   }
-  return mod;
+  return src;
 }
 
 bool File::de

svn commit: r627982 - in /logging/log4cxx/trunk/src/ant: find-apr-util.xml find-apr.xml find-libesmtp.xml

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 01:37:37 2008
New Revision: 627982

URL: http://svn.apache.org/viewvc?rev=627982&view=rev
Log:
LOGCXX-230: available gotcha

Modified:
logging/log4cxx/trunk/src/ant/find-apr-util.xml
logging/log4cxx/trunk/src/ant/find-apr.xml
logging/log4cxx/trunk/src/ant/find-libesmtp.xml

Modified: logging/log4cxx/trunk/src/ant/find-apr-util.xml
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/ant/find-apr-util.xml?rev=627982&r1=627981&r2=627982&view=diff
==
--- logging/log4cxx/trunk/src/ant/find-apr-util.xml (original)
+++ logging/log4cxx/trunk/src/ant/find-apr-util.xml Fri Feb 15 01:37:37 2008
@@ -30,57 +30,57 @@
 
 
 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 

-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+



@@ -89,18 +89,18 @@

 

-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+



@@ -113,37 +113,37 @@
 
 
 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+




Modified: logging/log4cxx/trunk/src/ant/find-apr.xml
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/ant/find-apr.xml?rev=627982&r1=627981&r2=627982&view=diff
==
--- logging/log4cxx/trunk/src/ant/find-apr.xml (original)
+++ logging/log4cxx/trunk/src/ant/find-apr.xml Fri Feb 15 01:37:37 2008
@@ -30,57 +30,57 @@
 
 
 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 

-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+



@@ -89,18 +89,18 @@

 

-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+



@@ -113,37 +113,37 @@
 
 
 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+




Modified: logging/log4cxx/trunk/src/ant/find-libesmtp.xml
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/ant/find-libesmtp.xml?rev=627982&r1=627981&r2=627982&view=diff
==
--- logging/log4cxx/trunk/src/ant/find-libesmtp.xml (original)
+++ logging/log4cxx/trunk/src/ant/find-libesmtp.xml Fri Feb 15 01:37:37 2008
@@ -30,57 +30,57 @@
 
 
 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 

-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+



@@ -89,18 +89,18 @@

 

-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+



@@ -113,37 +113,37 @@
 
 
 
-   
-   
-   
-   
-   
+   
+
+   
+
+   
+
+   
+
+   
+



 
-   
-   
-   
-   
+   
+
+

svn commit: r627988 - in /logging/log4cxx/trunk/src: main/cpp/file.cpp main/cpp/gzcompressaction.cpp main/cpp/zipcompressaction.cpp test/cpp/util/transformer.cpp test/cpp/xml/domtestcase.cpp

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 02:03:52 2008
New Revision: 627988

URL: http://svn.apache.org/viewvc?rev=627988&view=rev
Log:
LOGCXX-241: VC6 pass

Modified:
logging/log4cxx/trunk/src/main/cpp/file.cpp
logging/log4cxx/trunk/src/main/cpp/gzcompressaction.cpp
logging/log4cxx/trunk/src/main/cpp/zipcompressaction.cpp
logging/log4cxx/trunk/src/test/cpp/util/transformer.cpp
logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/file.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/file.cpp?rev=627988&r1=627987&r2=627988&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/file.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/file.cpp Fri Feb 15 02:03:52 2008
@@ -204,9 +204,9 @@
 if (entry.name != NULL) {
LogString filename;
if(style == APR_FILEPATH_ENCODING_UTF8) {
-  Transcoder::encodeUTF8(entry.name, filename);
+  Transcoder::decodeUTF8(entry.name, filename);
} else {
-   Transcoder::encode(entry.name, filename);
+   Transcoder::decode(entry.name, filename);
}
filenames.push_back(filename);
 }

Modified: logging/log4cxx/trunk/src/main/cpp/gzcompressaction.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/gzcompressaction.cpp?rev=627988&r1=627987&r2=627988&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/gzcompressaction.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/gzcompressaction.cpp Fri Feb 15 02:03:52 
2008
@@ -18,7 +18,8 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 
 using namespace log4cxx;
 using namespace log4cxx::rolling;

Modified: logging/log4cxx/trunk/src/main/cpp/zipcompressaction.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/zipcompressaction.cpp?rev=627988&r1=627987&r2=627988&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/zipcompressaction.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/zipcompressaction.cpp Fri Feb 15 
02:03:52 2008
@@ -18,7 +18,8 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
 
 using namespace log4cxx;
 using namespace log4cxx::rolling;

Modified: logging/log4cxx/trunk/src/test/cpp/util/transformer.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/util/transformer.cpp?rev=627988&r1=627987&r2=627988&view=diff
==
--- logging/log4cxx/trunk/src/test/cpp/util/transformer.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/util/transformer.cpp Fri Feb 15 02:03:52 
2008
@@ -17,6 +17,7 @@
 
 #include "transformer.h"
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp?rev=627988&r1=627987&r2=627988&view=diff
==
--- logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp Fri Feb 15 02:03:52 
2008
@@ -190,12 +190,10 @@
 
DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase3.xml"));
 LOG4CXX_INFO(logger, "File name is expected to end with a 
superscript 3");
 #if LOG4CXX_LOGCHAR_IS_UTF8
-const logchar end[] = { 0xC2, 0xB3, 0 };
+const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 
0x2F, 0x64, 0x6F, 0x6D, 0xC2, 0xB3, 0 };
 #else
-const logchar end[] = { 0xB3, 0 };
+const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 
0x2F, 0x64, 0x6F, 0x6D, 0xB3, 0 };
 #endif
-LogString fname("output/dom");
-fname.append(end);
 File file;
 file.setPath(fname);
 Pool p;
@@ -204,19 +202,17 @@
 }
 
 /**
- *   Creates a output file that ends with a superscript 3.
+ *   Creates a output file that ends with a ideographic 4.
  *   Output file is checked by build.xml after completion.
  */  
 void test4() {
 
DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase4.xml"));
 LOG4CXX_INFO(logger, "File name is expected to end with an 
ideographic 4");
 #if LOG4CXX_LOGCHAR_IS_UTF8
-const logchar end[] = { 0xE3, 0x86, 0x95, 0 };
+const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 
0x2F, 0x64, 0x6F, 0x6D, 0xE3, 0x86, 0x95, 0 };
 #else
-const logchar

svn commit: r627995 - /logging/log4cxx/trunk/src/main/cpp/file.cpp

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 02:17:34 2008
New Revision: 627995

URL: http://svn.apache.org/viewvc?rev=627995&view=rev
Log:
LOGCXX-241: CFStringRef file constructor fix

Modified:
logging/log4cxx/trunk/src/main/cpp/file.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/file.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/file.cpp?rev=627995&r1=627994&r2=627995&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/file.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/file.cpp Fri Feb 15 02:17:34 2008
@@ -77,7 +77,7 @@
 
 #if LOG4CXX_CFSTRING_API
 File::File(const CFStringRef& name1)
-   : path(name1) {
+   : path(decodeLS(name1)) {
 }
 #endif
 




svn commit: r627996 - in /logging/log4cxx/trunk/src: main/cpp/mdc.cpp test/cpp/filetestcase.cpp test/cpp/helpers/messagebuffertest.cpp test/cpp/leveltestcase.cpp test/cpp/logunit.cpp test/cpp/logunit.

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 02:18:20 2008
New Revision: 627996

URL: http://svn.apache.org/viewvc?rev=627996&view=rev
Log:
LOGCXX-85: Add missing log4cxx:: on UniChar references

Modified:
logging/log4cxx/trunk/src/main/cpp/mdc.cpp
logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp
logging/log4cxx/trunk/src/test/cpp/leveltestcase.cpp
logging/log4cxx/trunk/src/test/cpp/logunit.cpp
logging/log4cxx/trunk/src/test/cpp/logunit.h
logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/mdc.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/mdc.cpp?rev=627996&r1=627995&r2=627996&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/mdc.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/mdc.cpp Fri Feb 15 02:18:20 2008
@@ -154,7 +154,7 @@
 putLS(key, v);
 }
 
-std::basic_string MDC::get(const std::basic_string& key)
+std::basic_string MDC::get(const 
std::basic_string& key)
 {
 LOG4CXX_DECODE_UNICHAR(lkey, key);
 LogString lvalue;
@@ -165,7 +165,7 @@
 return std::basic_string();
 }
 
-void MDC::put(const std::basic_string& key, const 
std::basic_string& value)
+void MDC::put(const std::basic_string& key, const 
std::basic_string& value)
 {
 LOG4CXX_DECODE_UNICHAR(lkey, key);
 LOG4CXX_DECODE_UNICHAR(lvalue, value);
@@ -173,7 +173,7 @@
 }
 
 
-std::basic_string MDC::remove(const std::basic_string& key)
+std::basic_string MDC::remove(const 
std::basic_string& key)
 {
 LOG4CXX_DECODE_UNICHAR(lkey, key);
 LogString lvalue;

Modified: logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp?rev=627996&r1=627995&r2=627996&view=diff
==
--- logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp Fri Feb 15 02:18:20 2008
@@ -100,7 +100,7 @@
 
 #if LOG4CXX_UNICHAR_API
 void unicharConstructor() {
-const UniChar filename[] = { 'i', 'n', 'p', 'u', 't', '/', 
+const log4cxx::UniChar filename[] = { 'i', 'n', 'p', 'u', 't', 
'/', 
'p', 'a', 't', 't', 'e', 'r', 'n', 'L', 'a', 'y', 'o', 'u', 
't', '1', '.', 
'p', 'r', 'o', 'p', 'e', 'r', 't', 'i', 'e', 's', 0 };
 File propFile(filename);

Modified: logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp?rev=627996&r1=627995&r2=627996&view=diff
==
--- logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp Fri Feb 15 
02:18:20 2008
@@ -154,24 +154,24 @@
 #if LOG4CXX_UNICHAR_API
 void testInsertConstUStr() {
 MessageBuffer buf;
-const UniChar hello[] = { 'H', 'e', 'l', 'l', 'o', 0 };
-const UniChar world[] = { ',', ' ', 'W', 'o', 'r', 'l', 'd', 0 };
-const UniChar greeting[] = { 'H', 'e', 'l', 'l', 'o', 
+const log4cxx::UniChar hello[] = { 'H', 'e', 'l', 'l', 'o', 0 };
+const log4cxx::UniChar world[] = { ',', ' ', 'W', 'o', 'r', 'l', 'd', 
0 };
+const log4cxx::UniChar greeting[] = { 'H', 'e', 'l', 'l', 'o', 
   ',', ' ', 'W', 'o', 'r', 'l', 'd', 0 };
 UniCharMessageBuffer& retval = buf << hello << world;
-LOGUNIT_ASSERT_EQUAL(std::basic_string(greeting), 
buf.str(retval)); 
+LOGUNIT_ASSERT_EQUAL(std::basic_string(greeting), 
buf.str(retval)); 
 LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
 }
 
 void testInsertUString() {
 MessageBuffer buf;
-const UniChar hello[] = { 'H', 'e', 'l', 'l', 'o', 0 };
-const UniChar world[] = { ',', ' ', 'W', 'o', 'r', 'l', 'd', 0 };
-const UniChar greeting[] = { 'H', 'e', 'l', 'l', 'o', 
+const log4cxx::UniChar hello[] = { 'H', 'e', 'l', 'l', 'o', 0 };
+const log4cxx::UniChar world[] = { ',', ' ', 'W', 'o', 'r', 'l', 'd', 
0 };
+const log4cxx::UniChar greeting[] = { 'H', 'e', 'l', 'l', 'o', 
   ',', ' ', 'W', 'o', 'r', 'l', 'd', 0 };
-UniCharMessageBuffer& retval = buf << 
std::basic_string(hello) 
-   << 
std::basic_string(world);
-LOGUNIT_ASSERT_EQUAL(std::basic_string(greeting), 
buf.str(retval)); 
+UniCharMessageBuffer& retval = buf << 
std::basic_string(hello) 
+   << 
std::basic_string(world);
+LOGUNIT_ASSERT_EQUAL(std::basic_string(greeting), 
buf.str(retval));

svn commit: r628099 - in /logging/log4cxx/trunk/src: main/cpp/ main/include/log4cxx/helpers/ test/cpp/util/

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 08:13:11 2008
New Revision: 628099

URL: http://svn.apache.org/viewvc?rev=628099&view=rev
Log:
LOGCXX-68: Remove tabs and inconsistent EOLs

Modified:
logging/log4cxx/trunk/src/main/cpp/file.cpp
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/socketimpl.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/threadlocal.h
logging/log4cxx/trunk/src/test/cpp/util/transformer.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/file.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/file.cpp?rev=628099&r1=628098&r2=628099&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/file.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/file.cpp Fri Feb 15 08:13:11 2008
@@ -34,7 +34,7 @@
 static LogString decodeLS(const S* src) {
 LogString dst;
 if (src != 0) {
-   Transcoder::decode(src, dst);
+  Transcoder::decode(src, dst);
 }
 return dst;
 }
@@ -144,9 +144,9 @@
 
 char* File::convertBackSlashes(char* src) {
   for(char* c = src; *c != 0; c++) {
-   if(*c == '\\') {
-   *c = '/';
-   }
+   if(*c == '\\') {
+  *c = '/';
+   }
   }
   return src;
 }
@@ -203,7 +203,7 @@
 if (entry.name != NULL) {
LogString filename;
if(style == APR_FILEPATH_ENCODING_UTF8) {
-  Transcoder::decodeUTF8(entry.name, filename);
+ Transcoder::decodeUTF8(entry.name, filename);
} else {
Transcoder::decode(entry.name, filename);
}

Modified: 
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h?rev=628099&r1=628098&r2=628099&view=diff
==
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/fileoutputstream.h 
Fri Feb 15 08:13:11 2008
@@ -56,7 +56,7 @@
   FileOutputStream(const FileOutputStream&);
   FileOutputStream& operator=(const FileOutputStream&);
   static apr_file_t* open(const LogString& fn, bool append, 
-   log4cxx::helpers::Pool& p);
+ log4cxx::helpers::Pool& p);
   };
 
   LOG4CXX_PTR_DEF(FileOutputStream);

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h?rev=628099&r1=628098&r2=628099&view=diff
==
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h Fri Feb 
15 08:13:11 2008
@@ -168,11 +168,11 @@
 }
 return 0;
  }
-T* exchange(const T* newValue) {
+   T* exchange(const T* newValue) {
  return static_cast(ObjectPtrBase::exchange(
  reinterpret_cast(&p), 
  const_cast(newValue)));
-}
+   }
 
 };
 

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/socketimpl.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/socketimpl.h?rev=628099&r1=628098&r2=628099&view=diff
==
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/socketimpl.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/socketimpl.h Fri Feb 
15 08:13:11 2008
@@ -26,7 +26,7 @@
 
 
 extern "C" {
-   struct apr_socket_t;
+   struct apr_socket_t;
 }
 
 namespace log4cxx

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/threadlocal.h
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/threadlocal.h?rev=628099&r1=628098&r2=628099&view=diff
==
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/threadlocal.h 
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/threadlocal.h Fri 
Feb 15 08:13:11 2008
@@ -76,7 +76,7 @@
  
  static apr_threadkey_t* create(Pool& p);
 
-Pool p;
+Pool p;
  apr_threadkey_t* key;
 };
 } // namespace helpers

Modified: logging/log4cxx/trunk/src/test/cpp/util/transformer.cpp
URL: 
http://svn.apache.org/viewvc/logging/lo

svn commit: r628107 - in /logging/log4cxx/trunk/src/test/cpp: asyncappendertestcase.cpp rolling/timebasedrollingtest.cpp

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 08:33:28 2008
New Revision: 628107

URL: http://svn.apache.org/viewvc?rev=628107&view=rev
Log:
LOGCXX-206: TimeBasedRollingTest and AsyncAppenderTestCase seem to work now

Modified:
logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/timebasedrollingtest.cpp

Modified: logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp?rev=628107&r1=628106&r2=628107&view=diff
==
--- logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp Fri Feb 15 
08:33:28 2008
@@ -283,5 +283,5 @@
 
 };
 
-//LOGUNIT_TEST_SUITE_REGISTRATION(AsyncAppenderTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(AsyncAppenderTestCase);
 #endif

Modified: logging/log4cxx/trunk/src/test/cpp/rolling/timebasedrollingtest.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/rolling/timebasedrollingtest.cpp?rev=628107&r1=628106&r2=628107&view=diff
==
--- logging/log4cxx/trunk/src/test/cpp/rolling/timebasedrollingtest.cpp 
(original)
+++ logging/log4cxx/trunk/src/test/cpp/rolling/timebasedrollingtest.cpp Fri Feb 
15 08:33:28 2008
@@ -439,4 +439,4 @@
 
 LoggerPtr 
TimeBasedRollingTest::logger(Logger::getLogger("org.apache.log4j.TimeBasedRollingTest"));
 
-//LOGUNIT_TEST_SUITE_REGISTRATION(TimeBasedRollingTest);
+LOGUNIT_TEST_SUITE_REGISTRATION(TimeBasedRollingTest);




svn commit: r628179 - in /logging/log4cxx/trunk/src/main: cpp/loggingevent.cpp cpp/mdc.cpp cpp/ndc.cpp cpp/threadspecificdata.cpp include/log4cxx/helpers/threadspecificdata.h include/log4cxx/ndc.h

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 13:51:36 2008
New Revision: 628179

URL: http://svn.apache.org/viewvc?rev=628179&view=rev
Log:
LOGCXX-117: Memory leak with ThreadSpecificData

Modified:
logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp
logging/log4cxx/trunk/src/main/cpp/mdc.cpp
logging/log4cxx/trunk/src/main/cpp/ndc.cpp
logging/log4cxx/trunk/src/main/cpp/threadspecificdata.cpp
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/threadspecificdata.h
logging/log4cxx/trunk/src/main/include/log4cxx/ndc.h

Modified: logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp?rev=628179&r1=628178&r2=628179&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp Fri Feb 15 13:51:36 2008
@@ -144,12 +144,13 @@
 }
 else
 {
-MDC::Map& m = ThreadSpecificData::getCurrentThreadMap();
+ThreadSpecificData* data = 
ThreadSpecificData::getCurrentData();
+if (data != 0) {
+MDC::Map& m = data->getMap();
 
-MDC::Map::const_iterator it;
-for (it = m.begin(); it != m.end(); it++)
-{
+for(MDC::Map::const_iterator it = m.begin(); it != 
m.end(); it++) {
 set.push_back(it->first);
+}
 }
 }
 
@@ -162,8 +163,13 @@
 {
 mdcCopyLookupRequired = false;
 // the clone call is required for asynchronous logging.
-mdcCopy = new 
MDC::Map(ThreadSpecificData::getCurrentThreadMap());
-}
+ThreadSpecificData* data = 
ThreadSpecificData::getCurrentData();
+if (data != 0) {
+mdcCopy = new MDC::Map(data->getMap());
+} else {
+mdcCopy = new MDC::Map();
+}
+   }
 }
 
 bool LoggingEvent::getProperty(const LogString& key, LogString& dest) const

Modified: logging/log4cxx/trunk/src/main/cpp/mdc.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/mdc.cpp?rev=628179&r1=628178&r2=628179&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/mdc.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/mdc.cpp Fri Feb 15 13:51:36 2008
@@ -42,8 +42,7 @@
 
 void MDC::putLS(const LogString& key, const LogString& value)
 {
-Map& map = ThreadSpecificData::getCurrentThreadMap();
-map[key] = value;
+ThreadSpecificData::put(key, value);
 }
 
 void MDC::put(const std::string& key, const std::string& value)
@@ -55,12 +54,16 @@
 
 bool MDC::get(const LogString& key, LogString& value)
 {
-Map& map = ThreadSpecificData::getCurrentThreadMap();
+ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+if (data != 0) {
+Map& map = data->getMap();
 
-Map::iterator it = map.find(key);
-if (it != map.end()) {
+Map::iterator it = map.find(key);
+if (it != map.end()) {
 value.append(it->second);
 return true;
+}
+data->recycle();
 }
 return false;
 }
@@ -78,13 +81,16 @@
 
 bool MDC::remove(const LogString& key, LogString& value)
 {
-Map::iterator it;
-Map& map = ThreadSpecificData::getCurrentThreadMap();
-if ((it = map.find(key)) != map.end())
-{
+ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+if (data != 0) {
+Map& map = data->getMap();
+Map::iterator it;
+if ((it = map.find(key)) != map.end()) {
 value = it->second;
 map.erase(it);
+data->recycle();
 return true;
+}
 }
 return false;
 }
@@ -103,8 +109,12 @@
 
 void MDC::clear()
 {
-Map& map = ThreadSpecificData::getCurrentThreadMap();
-map.erase(map.begin(), map.end());
+ThreadSpecificData* data = ThreadSpecificData::getCurrentData();
+if (data != 0) {
+Map& map = data->getMap();
+map.erase(map.begin(), map.end());
+data->recycle();
+}
 }
 
 

Modified: logging/log4cxx/trunk/src/main/cpp/ndc.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/ndc.cpp?rev=628179&r1=628178&r2=628179&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/ndc.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/ndc.cpp Fri Feb 15 13:51:36 2008
@@ -27,33 +27,6 @@
 using namespace log4cxx;
 using namespace log4cxx::helpers;
 
-NDC::DiagnosticContext::DiagnosticContext(con

svn commit: r628211 - /logging/log4cxx/trunk/src/main/cpp/threadspecificdata.cpp

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 16:16:08 2008
New Revision: 628211

URL: http://svn.apache.org/viewvc?rev=628211&view=rev
Log:
LOGCXX-117: Missing using namespace for VC6

Modified:
logging/log4cxx/trunk/src/main/cpp/threadspecificdata.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/threadspecificdata.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/threadspecificdata.cpp?rev=628211&r1=628210&r2=628211&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/threadspecificdata.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/threadspecificdata.cpp Fri Feb 15 
16:16:08 2008
@@ -23,6 +23,7 @@
 #endif
 #include 
 
+using namespace log4cxx;
 using namespace log4cxx::helpers;
 
 




svn commit: r628234 - in /logging/log4cxx/trunk/src: main/cpp/ main/include/log4cxx/spi/ test/cpp/helpers/ test/cpp/nt/ test/cpp/pattern/ test/cpp/spi/ test/cpp/xml/

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 19:23:32 2008
New Revision: 628234

URL: http://svn.apache.org/viewvc?rev=628234&view=rev
Log:
LOGCXX-231: Remove LoggerPtr from LoggingEvent

Modified:
logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp
logging/log4cxx/trunk/src/main/cpp/logger.cpp
logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp
logging/log4cxx/trunk/src/main/include/log4cxx/spi/loggingevent.h
logging/log4cxx/trunk/src/test/cpp/helpers/cyclicbuffertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/nt/nteventlogappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/pattern/patternparsertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/spi/loggingeventtest.cpp
logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp?rev=628234&r1=628233&r2=628234&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp Fri Feb 15 19:23:32 
2008
@@ -305,7 +305,7 @@
 msg.append(LOG4CXX_STR(" messages due to a full event buffer including: 
"));
 msg.append(maxEvent->getMessage()); 
 return new LoggingEvent(   
-  Logger::getLoggerLS(maxEvent->getLoggerName()),
+  maxEvent->getLoggerName(),
   maxEvent->getLevel(),
   msg,
   LocationInfo::getLocationUnavailable());

Modified: logging/log4cxx/trunk/src/main/cpp/logger.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/logger.cpp?rev=628234&r1=628233&r2=628234&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/logger.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/logger.cpp Fri Feb 15 19:23:32 2008
@@ -120,7 +120,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_CHAR(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg, location));
+LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
 callAppenders(event, p);
 }
 
@@ -129,7 +129,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_CHAR(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg,
+LoggingEventPtr event(new LoggingEvent(name, level1, msg,
   LocationInfo::getLocationUnavailable()));
 callAppenders(event, p);
 }
@@ -138,7 +138,7 @@
 const LocationInfo& location) const
 {
 Pool p;
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, message, location));
+LoggingEventPtr event(new LoggingEvent(name, level1, message, 
location));
 callAppenders(event, p);
 }
 
@@ -621,7 +621,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_WCHAR(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg, location));
+LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
 callAppenders(event, p);
 }
 
@@ -629,7 +629,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_WCHAR(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg,
+LoggingEventPtr event(new LoggingEvent(name, level1, msg,
LocationInfo::getLocationUnavailable()));
 callAppenders(event, p);
 }
@@ -743,7 +743,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_UNICHAR(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg, location));
+LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
 callAppenders(event, p);
 }
 
@@ -751,7 +751,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_UNICHAR(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg,
+LoggingEventPtr event(new LoggingEvent(name, level1, msg,
LocationInfo::getLocationUnavailable()));
 callAppenders(event, p);
 }
@@ -862,7 +862,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_CFSTRING(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg, location));
+LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
 callAppenders(event, p);
 }
 
@@ -870,7 +870,7 @@
 {
 Pool p;
 LOG4CXX_DECODE_CFSTRING(msg, message);
-LoggingEventPtr event(new LoggingEvent(const_cast(this), 
level1, msg,
+LoggingEventPtr event(new LoggingEvent(name, level1, msg,
LocationInfo::getLocationUnavailable()));
 callAppenders(event, p);
 }

Modified: logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/loggingevent.cpp?rev=628234&r1=628233&r2=628234&view=diff
==

svn commit: r628239 - in /logging/log4cxx/trunk/src: main/cpp/class.cpp test/cpp/asyncappendertestcase.cpp

2008-02-15 Thread carnold
Author: carnold
Date: Fri Feb 15 21:00:09 2008
New Revision: 628239

URL: http://svn.apache.org/viewvc?rev=628239&view=rev
Log:
LOGCXX-77: Static builds broken

Modified:
logging/log4cxx/trunk/src/main/cpp/class.cpp
logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/class.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/class.cpp?rev=628239&r1=628238&r2=628239&view=diff
==
--- logging/log4cxx/trunk/src/main/cpp/class.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/class.cpp Fri Feb 15 21:00:09 2008
@@ -65,6 +65,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 
@@ -180,5 +182,7 @@
 log4cxx::rolling::ManualTriggeringPolicy::registerClass();
 log4cxx::rolling::FixedWindowRollingPolicy::registerClass();
 log4cxx::rolling::FilterBasedTriggeringPolicy::registerClass();
+log4cxx::xml::DOMConfigurator::registerClass();
+log4cxx::PropertyConfigurator::registerClass();
 }
 

Modified: logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp?rev=628239&r1=628238&r2=628239&view=diff
==
--- logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp Fri Feb 15 
21:00:09 2008
@@ -244,10 +244,11 @@
 }
 async->close();
 const std::vector& events = 
blockableAppender->getVector();
+LOGUNIT_ASSERT(events.size() > 0);
 LoggingEventPtr initialEvent = events[0];
 LoggingEventPtr discardEvent = events[events.size() - 1];
-  LOGUNIT_ASSERT(initialEvent->getMessage() == LOG4CXX_STR("Hello, 
World"));
-  LOGUNIT_ASSERT(discardEvent->getMessage().substr(0,10) == 
LOG4CXX_STR("Discarded "));
+LOGUNIT_ASSERT(initialEvent->getMessage() == LOG4CXX_STR("Hello, 
World"));
+LOGUNIT_ASSERT(discardEvent->getMessage().substr(0,10) == 
LOG4CXX_STR("Discarded "));
 
LOGUNIT_ASSERT_EQUAL(log4cxx::spi::LocationInfo::getLocationUnavailable().getClassName(),
 
 discardEvent->getLocationInformation().getClassName()); 
 }