You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ts...@apache.org on 2020/02/16 18:44:55 UTC

[logging-log4cxx] 01/05: Prevent compiler warnings when building a Windows dll

This is an automated email from the ASF dual-hosted git repository.

tschoening pushed a commit to branch ghpr_14_replace-ant-build-with-cmake
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 6c798a28df8d4faab6a0144c502764cb859d2948
Author: Stephen Webb <st...@sabreautonomous.com.au>
AuthorDate: Tue Feb 11 18:34:31 2020 +1100

    Prevent compiler warnings when building a Windows dll
---
 src/examples/cpp/delayedloop.cpp                       |  2 +-
 src/main/cpp/appenderattachableimpl.cpp                |  2 +-
 src/main/cpp/asyncappender.cpp                         |  8 ++++----
 src/main/cpp/bytearrayinputstream.cpp                  |  2 +-
 src/main/cpp/cacheddateformat.cpp                      |  2 +-
 src/main/cpp/charsetdecoder.cpp                        |  2 +-
 src/main/cpp/charsetencoder.cpp                        |  2 +-
 src/main/cpp/classnamepatternconverter.cpp             |  2 +-
 src/main/cpp/fileappender.cpp                          |  4 ++--
 src/main/cpp/fileinputstream.cpp                       |  2 +-
 src/main/cpp/filewatchdog.cpp                          |  4 ++--
 src/main/cpp/fixedwindowrollingpolicy.cpp              |  2 +-
 src/main/cpp/formattinginfo.cpp                        |  2 +-
 src/main/cpp/hierarchy.cpp                             |  2 +-
 src/main/cpp/loader.cpp                                |  2 +-
 src/main/cpp/loggerpatternconverter.cpp                |  2 +-
 src/main/cpp/logstream.cpp                             | 16 ++++++++--------
 src/main/cpp/ndc.cpp                                   |  2 +-
 src/main/cpp/odbcappender.cpp                          |  2 +-
 src/main/cpp/optionconverter.cpp                       | 11 +++++------
 src/main/cpp/patternlayout.cpp                         |  2 +-
 src/main/cpp/patternparser.cpp                         | 18 +++++++++---------
 src/main/cpp/propertyconfigurator.cpp                  |  2 +-
 src/main/cpp/propertysetter.cpp                        |  2 +-
 src/main/cpp/rollingfileappender.cpp                   | 10 +++++-----
 src/main/cpp/socketappender.cpp                        |  2 +-
 src/main/cpp/telnetappender.cpp                        |  6 +++---
 src/main/cpp/xmlsocketappender.cpp                     |  2 +-
 src/main/include/log4cxx/consoleappender.h             |  9 +++++++++
 src/main/include/log4cxx/file.h                        |  9 +++++++++
 src/main/include/log4cxx/fileappender.h                |  9 +++++++++
 src/main/include/log4cxx/filter/stringmatchfilter.h    |  9 +++++++++
 src/main/include/log4cxx/helpers/bufferedwriter.h      |  9 +++++++++
 src/main/include/log4cxx/helpers/cacheddateformat.h    |  9 +++++++++
 src/main/include/log4cxx/helpers/datelayout.h          |  9 +++++++++
 src/main/include/log4cxx/helpers/exception.h           |  9 +++++++++
 src/main/include/log4cxx/helpers/locale.h              |  9 +++++++++
 src/main/include/log4cxx/helpers/messagebuffer.h       | 10 ++++++++++
 .../include/log4cxx/helpers/onlyonceerrorhandler.h     |  9 +++++++++
 src/main/include/log4cxx/helpers/strftimedateformat.h  |  9 +++++++++
 src/main/include/log4cxx/helpers/stringtokenizer.h     |  9 +++++++++
 src/main/include/log4cxx/helpers/syslogwriter.h        |  9 +++++++++
 src/main/include/log4cxx/helpers/threadspecificdata.h  |  8 ++++++++
 src/main/include/log4cxx/helpers/timezone.h            |  9 +++++++++
 src/main/include/log4cxx/jsonlayout.h                  |  7 +++++++
 src/main/include/log4cxx/level.h                       |  7 +++++++
 src/main/include/log4cxx/logstring.h                   |  2 --
 src/main/include/log4cxx/mdc.h                         |  9 +++++----
 src/main/include/log4cxx/ndc.h                         |  9 +++++----
 src/main/include/log4cxx/net/smtpappender.h            |  9 +++++++++
 src/main/include/log4cxx/net/socketappenderskeleton.h  |  9 +++++++++
 src/main/include/log4cxx/net/syslogappender.h          |  9 +++++++++
 src/main/include/log4cxx/nt/nteventlogappender.h       |  8 ++++++++
 .../include/log4cxx/pattern/literalpatternconverter.h  | 10 ++++++++++
 src/main/include/log4cxx/pattern/patternparser.h       |  8 ++++----
 .../include/log4cxx/rolling/timebasedrollingpolicy.h   |  9 +++++++++
 src/test/cpp/asyncappendertestcase.cpp                 |  2 +-
 src/test/cpp/util/serializationtesthelper.cpp          |  2 +-
 58 files changed, 286 insertions(+), 75 deletions(-)

diff --git a/src/examples/cpp/delayedloop.cpp b/src/examples/cpp/delayedloop.cpp
index ff785d5..194473a 100644
--- a/src/examples/cpp/delayedloop.cpp
+++ b/src/examples/cpp/delayedloop.cpp
@@ -93,7 +93,7 @@ public:
                         {
                                 apr_sleep(1000000);
                         }
-                        catch(std::exception& e)
+                        catch(std::exception&)
                         {
                         }
                 }
diff --git a/src/main/cpp/appenderattachableimpl.cpp b/src/main/cpp/appenderattachableimpl.cpp
index 92c4fad..ad85216 100644
--- a/src/main/cpp/appenderattachableimpl.cpp
+++ b/src/main/cpp/appenderattachableimpl.cpp
@@ -73,7 +73,7 @@ int AppenderAttachableImpl::appendLoopOnAppenders(
 		(*it)->doAppend(event, p);
 	}
 
-	return appenderList.size();
+	return (int)appenderList.size();
 }
 
 AppenderList AppenderAttachableImpl::getAllAppenders() const
diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp
index 603b42c..20b80b7 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -143,9 +143,9 @@ void AsyncAppender::append(const spi::LoggingEventPtr& event, Pool& p)
 
 		while (true)
 		{
-			int previousSize = buffer.size();
+			size_t previousSize = buffer.size();
 
-			if (previousSize < bufferSize)
+			if (previousSize < (size_t)bufferSize)
 			{
 				buffer.push_back(event);
 
@@ -175,7 +175,7 @@ void AsyncAppender::append(const spi::LoggingEventPtr& event, Pool& p)
 					bufferNotFull.await(bufferMutex);
 					discard = false;
 				}
-				catch (InterruptedException& e)
+				catch (InterruptedException&)
 				{
 					//
 					//  reset interrupt status so
@@ -442,7 +442,7 @@ void* LOG4CXX_THREAD_FUNC AsyncAppender::dispatch(apr_thread_t* /*thread*/, void
 			}
 		}
 	}
-	catch (InterruptedException& ex)
+	catch (InterruptedException&)
 	{
 		Thread::currentThreadInterrupt();
 	}
diff --git a/src/main/cpp/bytearrayinputstream.cpp b/src/main/cpp/bytearrayinputstream.cpp
index ee89744..566cffa 100644
--- a/src/main/cpp/bytearrayinputstream.cpp
+++ b/src/main/cpp/bytearrayinputstream.cpp
@@ -57,6 +57,6 @@ int ByteArrayInputStream::read(ByteBuffer& dst)
 		memcpy(dst.current(), &buf[pos], bytesCopied);
 		pos += bytesCopied;
 		dst.position(dst.position() + bytesCopied);
-		return bytesCopied;
+		return (int)bytesCopied;
 	}
 }
diff --git a/src/main/cpp/cacheddateformat.cpp b/src/main/cpp/cacheddateformat.cpp
index 713086c..37fa8ea 100644
--- a/src/main/cpp/cacheddateformat.cpp
+++ b/src/main/cpp/cacheddateformat.cpp
@@ -169,7 +169,7 @@ int CachedDateFormat::findMillisecondStart(
 				// the millis can occur everywhere in formatted. See LOGCXX-420 and following.
 				size_t  magicLength     = magicString.length();
 				size_t  overlapping     = magicString.find(plusMagic[i]);
-				int     possibleRetVal  = i - overlapping;
+				int     possibleRetVal  = int(i - overlapping);
 
 				if (plusZero.length() == formatted.length()
 					&& regionMatches(magicString,       0, plusMagic,   possibleRetVal, magicLength)
diff --git a/src/main/cpp/charsetdecoder.cpp b/src/main/cpp/charsetdecoder.cpp
index 1736414..395ee75 100644
--- a/src/main/cpp/charsetdecoder.cpp
+++ b/src/main/cpp/charsetdecoder.cpp
@@ -471,7 +471,7 @@ class LocaleCharsetDecoder : public CharsetDecoder
 							Transcoder::decode(encoding, e);
 							decoder = getDecoder(e);
 						}
-						catch (IllegalArgumentException& ex)
+						catch (IllegalArgumentException&)
 						{
 							decoder = new USASCIICharsetDecoder();
 						}
diff --git a/src/main/cpp/charsetencoder.cpp b/src/main/cpp/charsetencoder.cpp
index 6d6e309..1d4fd75 100644
--- a/src/main/cpp/charsetencoder.cpp
+++ b/src/main/cpp/charsetencoder.cpp
@@ -501,7 +501,7 @@ class LocaleCharsetEncoder : public CharsetEncoder
 						{
 							encoder = CharsetEncoder::getEncoder(ename);
 						}
-						catch (IllegalArgumentException& ex)
+						catch (IllegalArgumentException&)
 						{
 							encoder = new USASCIICharsetEncoder();
 						}
diff --git a/src/main/cpp/classnamepatternconverter.cpp b/src/main/cpp/classnamepatternconverter.cpp
index 7d9c72e..e39027a 100644
--- a/src/main/cpp/classnamepatternconverter.cpp
+++ b/src/main/cpp/classnamepatternconverter.cpp
@@ -55,7 +55,7 @@ void ClassNamePatternConverter::format(
 	LogString& toAppendTo,
 	Pool& /* p */) const
 {
-	int initialLength = toAppendTo.length();
+	int initialLength = (int)toAppendTo.length();
 	append(toAppendTo, event->getLocationInformation().getClassName());
 	abbreviate(initialLength, toAppendTo);
 }
diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp
index b83f0e1..8d678d4 100644
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@ -306,7 +306,7 @@ void FileAppender::setFile(
 	{
 		outStream = new FileOutputStream(filename, append1);
 	}
-	catch (IOException& ex)
+	catch (IOException&)
 	{
 		LogString parentName = File().setPath(filename).getParent(p);
 
@@ -353,7 +353,7 @@ void FileAppender::setFile(
 	this->fileAppend = append1;
 	this->bufferedIO = bufferedIO1;
 	this->fileName = filename;
-	this->bufferSize = bufferSize1;
+	this->bufferSize = (int)bufferSize1;
 	writeHeader(p);
 
 }
diff --git a/src/main/cpp/fileinputstream.cpp b/src/main/cpp/fileinputstream.cpp
index c177362..c075193 100644
--- a/src/main/cpp/fileinputstream.cpp
+++ b/src/main/cpp/fileinputstream.cpp
@@ -107,7 +107,7 @@ int FileInputStream::read(ByteBuffer& buf)
 		}
 
 		buf.position(buf.position() + bytesRead);
-		retval = bytesRead;
+		retval = (int)bytesRead;
 	}
 
 	return retval;
diff --git a/src/main/cpp/filewatchdog.cpp b/src/main/cpp/filewatchdog.cpp
index beea70d..b2771ff 100644
--- a/src/main/cpp/filewatchdog.cpp
+++ b/src/main/cpp/filewatchdog.cpp
@@ -46,7 +46,7 @@ FileWatchdog::~FileWatchdog()
 		thread.interrupt();
 		thread.join();
 	}
-	catch (Exception& e)
+	catch (Exception&)
 	{
 	}
 }
@@ -91,7 +91,7 @@ void* APR_THREAD_FUNC FileWatchdog::run(apr_thread_t* /* thread */, void* data)
 			Thread::sleep(pThis->delay);
 			pThis->checkAndConfigure();
 		}
-		catch (InterruptedException& ex)
+		catch (InterruptedException&)
 		{
 			interrupted = apr_atomic_read32(&pThis->interrupted);
 		}
diff --git a/src/main/cpp/fixedwindowrollingpolicy.cpp b/src/main/cpp/fixedwindowrollingpolicy.cpp
index 4f03e10..0cd9cea 100644
--- a/src/main/cpp/fixedwindowrollingpolicy.cpp
+++ b/src/main/cpp/fixedwindowrollingpolicy.cpp
@@ -332,7 +332,7 @@ bool FixedWindowRollingPolicy::purge(int lowIndex, int highIndex, Pool& p) const
 				return false;
 			}
 		}
-		catch (std::exception& ex)
+		catch (std::exception&)
 		{
 			LogLog::warn(LOG4CXX_STR("Exception during purge in RollingFileAppender"));
 
diff --git a/src/main/cpp/formattinginfo.cpp b/src/main/cpp/formattinginfo.cpp
index f91eb3f..c20347b 100644
--- a/src/main/cpp/formattinginfo.cpp
+++ b/src/main/cpp/formattinginfo.cpp
@@ -56,7 +56,7 @@ FormattingInfoPtr FormattingInfo::getDefault()
  */
 void FormattingInfo::format(const int fieldStart, LogString& buffer) const
 {
-	int rawLength = buffer.length() - fieldStart;
+	int rawLength = int(buffer.length() - fieldStart);
 
 	if (rawLength > maxLength)
 	{
diff --git a/src/main/cpp/hierarchy.cpp b/src/main/cpp/hierarchy.cpp
index b406e19..ee6d417 100644
--- a/src/main/cpp/hierarchy.cpp
+++ b/src/main/cpp/hierarchy.cpp
@@ -345,7 +345,7 @@ void Hierarchy::updateParents(LoggerPtr logger)
 {
 	synchronized sync(mutex);
 	const LogString name(logger->getName());
-	int length = name.size();
+	size_t length = name.size();
 	bool parentFound = false;
 
 
diff --git a/src/main/cpp/loader.cpp b/src/main/cpp/loader.cpp
index c8081de..cc1bec9 100644
--- a/src/main/cpp/loader.cpp
+++ b/src/main/cpp/loader.cpp
@@ -67,7 +67,7 @@ InputStreamPtr Loader::getResourceAsStream(const LogString& name)
 	{
 		return new FileInputStream(name);
 	}
-	catch (const IOException& ioex)
+	catch (const IOException&)
 	{
 	}
 
diff --git a/src/main/cpp/loggerpatternconverter.cpp b/src/main/cpp/loggerpatternconverter.cpp
index c5b38de..f9c0246 100644
--- a/src/main/cpp/loggerpatternconverter.cpp
+++ b/src/main/cpp/loggerpatternconverter.cpp
@@ -54,7 +54,7 @@ void LoggerPatternConverter::format(
 	LogString& toAppendTo,
 	Pool& /* p */ ) const
 {
-	int initialLength = toAppendTo.length();
+	int initialLength = (int)toAppendTo.length();
 	toAppendTo.append(event->getLoggerName());
 	abbreviate(initialLength, toAppendTo);
 }
diff --git a/src/main/cpp/logstream.cpp b/src/main/cpp/logstream.cpp
index ca5d045..de9a763 100644
--- a/src/main/cpp/logstream.cpp
+++ b/src/main/cpp/logstream.cpp
@@ -109,7 +109,7 @@ int log4cxx::logstream_base::precision(int p)
 {
 	get_stream_state(initclear, initset, fillchar, fillset);
 	initset.precision(p);
-	int oldVal = initclear.precision(p);
+	int oldVal = (int)initclear.precision(p);
 	refresh_stream_state();
 	return oldVal;
 }
@@ -117,14 +117,14 @@ int log4cxx::logstream_base::precision(int p)
 int log4cxx::logstream_base::precision()
 {
 	get_stream_state(initclear, initset, fillchar, fillset);
-	return initclear.precision();
+	return (int)initclear.precision();
 }
 
 int log4cxx::logstream_base::width(int w)
 {
 	get_stream_state(initclear, initset, fillchar, fillset);
 	initset.width(w);
-	int oldVal = initclear.width(w);
+	int oldVal = (int)initclear.width(w);
 	refresh_stream_state();
 	return oldVal;
 }
@@ -132,7 +132,7 @@ int log4cxx::logstream_base::width(int w)
 int log4cxx::logstream_base::width()
 {
 	get_stream_state(initclear, initset, fillchar, fillset);
-	return initclear.width();
+	return (int)initclear.width();
 }
 
 int log4cxx::logstream_base::fill(int newfill)
@@ -306,10 +306,10 @@ void logstream::get_stream_state(std::ios_base& base,
 		std::ios_base::fmtflags flags = stream->flags();
 		base.flags(flags);
 		mask.flags(flags);
-		int width = stream->width();
+		int width = (int)stream->width();
 		base.width(width);
 		mask.width(width);
-		int precision = stream->precision();
+		int precision = (int)stream->precision();
 		base.precision(precision);
 		mask.precision(precision);
 		fill = stream->fill();
@@ -435,10 +435,10 @@ void wlogstream::get_stream_state(std::ios_base& base,
 		std::ios_base::fmtflags flags = stream->flags();
 		base.flags(flags);
 		mask.flags(flags);
-		int width = stream->width();
+		int width = (int)stream->width();
 		base.width(width);
 		mask.width(width);
-		int precision = stream->precision();
+		int precision = (int)stream->precision();
 		base.precision(precision);
 		mask.precision(precision);
 		fill = stream->fill();
diff --git a/src/main/cpp/ndc.cpp b/src/main/cpp/ndc.cpp
index 87dfece..597f0fc 100644
--- a/src/main/cpp/ndc.cpp
+++ b/src/main/cpp/ndc.cpp
@@ -119,7 +119,7 @@ int NDC::getDepth()
 
 	if (data != 0)
 	{
-		size = data->getStack().size();
+		size = (int)data->getStack().size();
 
 		if (size == 0)
 		{
diff --git a/src/main/cpp/odbcappender.cpp b/src/main/cpp/odbcappender.cpp
index 7832762..6bfa519 100644
--- a/src/main/cpp/odbcappender.cpp
+++ b/src/main/cpp/odbcappender.cpp
@@ -187,7 +187,7 @@ void ODBCAppender::execute(const LogString& sql, log4cxx::helpers::Pool& p)
 			throw SQLException(SQL_HANDLE_STMT, stmt, "Failed to execute sql statement.", p);
 		}
 	}
-	catch (SQLException& e)
+	catch (SQLException&)
 	{
 		if (stmt != SQL_NULL_HSTMT)
 		{
diff --git a/src/main/cpp/optionconverter.cpp b/src/main/cpp/optionconverter.cpp
index 3325cc2..71a1513 100644
--- a/src/main/cpp/optionconverter.cpp
+++ b/src/main/cpp/optionconverter.cpp
@@ -187,14 +187,13 @@ LogString OptionConverter::substVars(const LogString& val, Properties& props)
 	const size_t DELIM_START_LEN = 2;
 	const size_t DELIM_STOP_LEN = 1;
 
-	int i = 0;
-	int j, k;
+	size_t i = 0;
 
 	while (true)
 	{
-		j = val.find(delimStart, i);
+		size_t j = val.find(delimStart, i);
 
-		if (j == -1)
+		if (j == val.npos)
 		{
 			// no more variables
 			if (i == 0)
@@ -212,9 +211,9 @@ LogString OptionConverter::substVars(const LogString& val, Properties& props)
 		else
 		{
 			sbuf.append(val.substr(i, j - i));
-			k = val.find(delimStop, j);
+			size_t k = val.find(delimStop, j);
 
-			if (k == -1)
+			if (k == val.npos)
 			{
 				LogString msg(1, (logchar) 0x22 /* '\"' */);
 				msg.append(val);
diff --git a/src/main/cpp/patternlayout.cpp b/src/main/cpp/patternlayout.cpp
index 1ba79ec..e3bd201 100644
--- a/src/main/cpp/patternlayout.cpp
+++ b/src/main/cpp/patternlayout.cpp
@@ -89,7 +89,7 @@ void PatternLayout::format(LogString& output,
 		converterIter != patternConverters.end();
 		converterIter++, formatterIter++)
 	{
-		int startField = output.length();
+		int startField = (int)output.length();
 		(*converterIter)->format(event, output, pool);
 		(*formatterIter)->format(startField, output);
 	}
diff --git a/src/main/cpp/patternparser.cpp b/src/main/cpp/patternparser.cpp
index 121e2b3..6e45fde 100644
--- a/src/main/cpp/patternparser.cpp
+++ b/src/main/cpp/patternparser.cpp
@@ -55,7 +55,7 @@ bool PatternParser::isUnicodeIdentifierPart(logchar ch)
 		|| (ch == 0x5F /* '_' */);
 }
 
-int PatternParser::extractConverter(
+size_t PatternParser::extractConverter(
 	logchar lastChar, const LogString& pattern,
 	LogString::size_type i, LogString& convBuf,
 	LogString& currentLiteral)
@@ -92,14 +92,14 @@ int PatternParser::extractConverter(
 }
 
 
-int PatternParser::extractOptions(const LogString& pattern, LogString::size_type i,
+size_t PatternParser::extractOptions(const LogString& pattern, LogString::size_type i,
 	std::vector<LogString>& options)
 {
 	while ((i < pattern.length()) && (pattern[i] == 0x7B /* '{' */))
 	{
-		int end = pattern.find(0x7D /* '}' */, i);
+		size_t end = pattern.find(0x7D /* '}' */, i);
 
-		if (end == -1)
+		if (end == pattern.npos)
 		{
 			break;
 		}
@@ -121,10 +121,10 @@ void PatternParser::parse(
 
 	LogString currentLiteral;
 
-	int patternLength = pattern.length();
+	size_t patternLength = pattern.length();
 	int state = LITERAL_STATE;
 	logchar c;
-	int i = 0;
+	size_t i = 0;
 	FormattingInfoPtr formattingInfo(FormattingInfo::getDefault());
 
 	while (i < patternLength)
@@ -318,7 +318,7 @@ PatternConverterPtr PatternParser::createConverter(
 
 	LogString converterName(converterId);
 
-	for (int i = converterId.length(); i > 0; i--)
+	for (size_t i = converterId.length(); i > 0; i--)
 	{
 		converterName = converterName.substr(0, i);
 		PatternMap::const_iterator iter = rules.find(converterName);
@@ -337,8 +337,8 @@ PatternConverterPtr PatternParser::createConverter(
 	return converterObj;
 }
 
-int PatternParser::finalizeConverter(
-	logchar c, const LogString& pattern, int i,
+size_t PatternParser::finalizeConverter(
+	logchar c, const LogString& pattern, size_t i,
 	LogString& currentLiteral, const FormattingInfoPtr& formattingInfo,
 	const PatternMap&  rules,
 	std::vector<PatternConverterPtr>& patternConverters,
diff --git a/src/main/cpp/propertyconfigurator.cpp b/src/main/cpp/propertyconfigurator.cpp
index 56eb1d2..905f968 100644
--- a/src/main/cpp/propertyconfigurator.cpp
+++ b/src/main/cpp/propertyconfigurator.cpp
@@ -111,7 +111,7 @@ void PropertyConfigurator::doConfigure(const File& configFileName,
 		InputStreamPtr inputStream = new FileInputStream(configFileName);
 		props.load(inputStream);
 	}
-	catch (const IOException& ie)
+	catch (const IOException&)
 	{
 		LogLog::error(((LogString) LOG4CXX_STR("Could not read configuration file ["))
 			+ configFileName.getPath() + LOG4CXX_STR("]."));
diff --git a/src/main/cpp/propertysetter.cpp b/src/main/cpp/propertysetter.cpp
index c1ce878..a21a186 100644
--- a/src/main/cpp/propertysetter.cpp
+++ b/src/main/cpp/propertysetter.cpp
@@ -48,7 +48,7 @@ void PropertySetter::setProperties(helpers::Properties& properties,
 	const LogString& prefix,
 	Pool& p)
 {
-	int len = prefix.length();
+	size_t len = prefix.length();
 
 	std::vector<LogString> names = properties.propertyNames();
 	std::vector<LogString>::iterator it;
diff --git a/src/main/cpp/rollingfileappender.cpp b/src/main/cpp/rollingfileappender.cpp
index 638dd23..dfabb3b 100644
--- a/src/main/cpp/rollingfileappender.cpp
+++ b/src/main/cpp/rollingfileappender.cpp
@@ -139,7 +139,7 @@ void RollingFileAppenderSkeleton::activateOptions(Pool& p)
 
 			FileAppender::activateOptions(p);
 		}
-		catch (std::exception& ex)
+		catch (std::exception&)
 		{
 			LogLog::warn(
 				LogString(LOG4CXX_STR("Exception will initializing RollingFileAppender named "))
@@ -301,7 +301,7 @@ bool RollingFileAppenderSkeleton::rollover(Pool& p)
 								{
 									success = rollover1->getSynchronous()->execute(p);
 								}
-								catch (std::exception& ex)
+								catch (std::exception&)
 								{
 									LogLog::warn(LOG4CXX_STR("Exception on rollover"));
 								}
@@ -357,7 +357,7 @@ bool RollingFileAppenderSkeleton::rollover(Pool& p)
 								{
 									success = rollover1->getSynchronous()->execute(p);
 								}
-								catch (std::exception& ex)
+								catch (std::exception&)
 								{
 									LogLog::warn(LOG4CXX_STR("Exception during rollover"));
 								}
@@ -394,7 +394,7 @@ bool RollingFileAppenderSkeleton::rollover(Pool& p)
 						return true;
 					}
 				}
-				catch (std::exception& ex)
+				catch (std::exception&)
 				{
 					LogLog::warn(LOG4CXX_STR("Exception during rollover"));
 				}
@@ -452,7 +452,7 @@ void RollingFileAppenderSkeleton::subAppend(const LoggingEventPtr& event, Pool&
 			_event = &(const_cast<LoggingEventPtr&>(event));
 			rollover(p);
 		}
-		catch (std::exception& ex)
+		catch (std::exception&)
 		{
 			LogLog::warn(LOG4CXX_STR("Exception during rollover attempt."));
 		}
diff --git a/src/main/cpp/socketappender.cpp b/src/main/cpp/socketappender.cpp
index 06d7b39..5b3e158 100644
--- a/src/main/cpp/socketappender.cpp
+++ b/src/main/cpp/socketappender.cpp
@@ -96,7 +96,7 @@ void SocketAppender::cleanUp(Pool& p)
 		oos->close(p);
 		oos = 0;
 	}
-	catch (std::exception& e)
+	catch (std::exception&)
 	{}
 }
 
diff --git a/src/main/cpp/telnetappender.cpp b/src/main/cpp/telnetappender.cpp
index 438616c..79b6edc 100644
--- a/src/main/cpp/telnetappender.cpp
+++ b/src/main/cpp/telnetappender.cpp
@@ -137,7 +137,7 @@ void TelnetAppender::close()
 	{
 		sh.join();
 	}
-	catch (Exception& ex)
+	catch (Exception&)
 	{
 	}
 
@@ -158,7 +158,7 @@ void TelnetAppender::write(ByteBuffer& buf)
 				ByteBuffer b(buf.current(), buf.remaining());
 				(*iter)->write(b);
 			}
-			catch (Exception& ex)
+			catch (Exception&)
 			{
 				// The client has closed the connection, remove it from our list:
 				*iter = 0;
@@ -279,7 +279,7 @@ void* APR_THREAD_FUNC TelnetAppender::acceptConnections(apr_thread_t* /* thread
 				pThis->writeStatus(newClient, oss, p);
 			}
 		}
-		catch (InterruptedIOException& e)
+		catch (InterruptedIOException&)
 		{
 			if (pThis->closed)
 			{
diff --git a/src/main/cpp/xmlsocketappender.cpp b/src/main/cpp/xmlsocketappender.cpp
index fe83c4d..98356db 100644
--- a/src/main/cpp/xmlsocketappender.cpp
+++ b/src/main/cpp/xmlsocketappender.cpp
@@ -99,7 +99,7 @@ void XMLSocketAppender::cleanUp(Pool& p)
 			writer->close(p);
 			writer = 0;
 		}
-		catch (std::exception& e)
+		catch (std::exception&)
 		{
 		}
 	}
diff --git a/src/main/include/log4cxx/consoleappender.h b/src/main/include/log4cxx/consoleappender.h
index d30fef4..51e0c21 100644
--- a/src/main/include/log4cxx/consoleappender.h
+++ b/src/main/include/log4cxx/consoleappender.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/writerappender.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 
@@ -74,5 +79,9 @@ class LOG4CXX_EXPORT ConsoleAppender : public WriterAppender
 LOG4CXX_PTR_DEF(ConsoleAppender);
 }  //namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif //_LOG4CXX_CONSOLE_APPENDER_H
 
diff --git a/src/main/include/log4cxx/file.h b/src/main/include/log4cxx/file.h
index 13847d5..661484c 100644
--- a/src/main/include/log4cxx/file.h
+++ b/src/main/include/log4cxx/file.h
@@ -21,6 +21,11 @@
 #include <log4cxx/logger.h>
 #include <log4cxx/logstring.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 extern "C" {
 	struct apr_file_t;
 	struct apr_finfo_t;
@@ -184,6 +189,10 @@ class LOG4CXX_EXPORT File
 } // namespace log4cxx
 
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #define LOG4CXX_FILE(name) log4cxx::File(name)
 
 #endif // _LOG4CXX_FILE_H
diff --git a/src/main/include/log4cxx/fileappender.h b/src/main/include/log4cxx/fileappender.h
index 468f135..3cdcaca 100644
--- a/src/main/include/log4cxx/fileappender.h
+++ b/src/main/include/log4cxx/fileappender.h
@@ -24,6 +24,11 @@
 #include <log4cxx/file.h>
 #include <log4cxx/helpers/pool.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -236,4 +241,8 @@ LOG4CXX_PTR_DEF(FileAppender);
 
 }  // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif
diff --git a/src/main/include/log4cxx/filter/stringmatchfilter.h b/src/main/include/log4cxx/filter/stringmatchfilter.h
index a244e3c..0e1745c 100644
--- a/src/main/include/log4cxx/filter/stringmatchfilter.h
+++ b/src/main/include/log4cxx/filter/stringmatchfilter.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/spi/filter.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace filter
@@ -97,4 +102,8 @@ LOG4CXX_PTR_DEF(StringMatchFilter);
 }  // namespace filter
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_FILTER_STRING_MATCH_FILTER_H
diff --git a/src/main/include/log4cxx/helpers/bufferedwriter.h b/src/main/include/log4cxx/helpers/bufferedwriter.h
index 2ed9f2c..a193221 100644
--- a/src/main/include/log4cxx/helpers/bufferedwriter.h
+++ b/src/main/include/log4cxx/helpers/bufferedwriter.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/helpers/writer.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 
@@ -61,4 +66,8 @@ class LOG4CXX_EXPORT BufferedWriter : public Writer
 
 }  //namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif //_LOG4CXX_HELPERS_BUFFEREDWRITER_H
diff --git a/src/main/include/log4cxx/helpers/cacheddateformat.h b/src/main/include/log4cxx/helpers/cacheddateformat.h
index 2f4cb7b..703b8ce 100644
--- a/src/main/include/log4cxx/helpers/cacheddateformat.h
+++ b/src/main/include/log4cxx/helpers/cacheddateformat.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/helpers/dateformat.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace pattern
@@ -223,4 +228,8 @@ class LOG4CXX_EXPORT CachedDateFormat : public log4cxx::helpers::DateFormat
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_HELPERS_SIMPLE_DATE_FORMAT_H
diff --git a/src/main/include/log4cxx/helpers/datelayout.h b/src/main/include/log4cxx/helpers/datelayout.h
index 6796d9f..39e5c3f 100644
--- a/src/main/include/log4cxx/helpers/datelayout.h
+++ b/src/main/include/log4cxx/helpers/datelayout.h
@@ -22,6 +22,11 @@
 #include <log4cxx/helpers/dateformat.h>
 #include <log4cxx/helpers/timezone.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -96,4 +101,8 @@ class LOG4CXX_EXPORT DateLayout : public Layout
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_HELPERS_DATE_LAYOUT_H
diff --git a/src/main/include/log4cxx/helpers/exception.h b/src/main/include/log4cxx/helpers/exception.h
index 0a1a8b0..2749544 100644
--- a/src/main/include/log4cxx/helpers/exception.h
+++ b/src/main/include/log4cxx/helpers/exception.h
@@ -22,6 +22,11 @@
 #include <log4cxx/log4cxx.h>
 #include <log4cxx/logstring.h>
 
+#ifdef _MSC_VER
+	#pragma warning ( push )
+	#pragma warning (disable : 4251 4275) // ::std::exception needs to have dll-interface
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -288,4 +293,8 @@ class LOG4CXX_EXPORT SocketTimeoutException : public InterruptedIOException
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+	#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_HELPERS_EXCEPTION_H
diff --git a/src/main/include/log4cxx/helpers/locale.h b/src/main/include/log4cxx/helpers/locale.h
index 5e86079..0ea8610 100644
--- a/src/main/include/log4cxx/helpers/locale.h
+++ b/src/main/include/log4cxx/helpers/locale.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/logstring.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -46,4 +51,8 @@ class LOG4CXX_EXPORT Locale
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_HELPERS_LOCALE_H
diff --git a/src/main/include/log4cxx/helpers/messagebuffer.h b/src/main/include/log4cxx/helpers/messagebuffer.h
index f3ed836..8b226ff 100644
--- a/src/main/include/log4cxx/helpers/messagebuffer.h
+++ b/src/main/include/log4cxx/helpers/messagebuffer.h
@@ -22,6 +22,11 @@
 #include <log4cxx/logstring.h>
 #include <sstream>
 
+#if defined(_MSC_VER)
+	#pragma warning ( push )
+	#pragma warning ( disable: 4251 4275 )
+#endif
+
 namespace log4cxx
 {
 
@@ -837,5 +842,10 @@ typedef CharMessageBuffer LogCharMessageBuffer;
 
 }
 }
+
+#if defined(_MSC_VER)
+	#pragma warning (pop)
+#endif
+
 #endif
 
diff --git a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
index e817812..a29ecf2 100644
--- a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
+++ b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
@@ -21,6 +21,11 @@
 #include <log4cxx/spi/errorhandler.h>
 #include <log4cxx/helpers/objectimpl.h>
 
+#ifdef _MSC_VER
+#pragma warning ( push )
+#pragma warning (disable : 4251) // ::std::exception needs to have dll-interface
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -99,5 +104,9 @@ class LOG4CXX_EXPORT OnlyOnceErrorHandler :
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif //_LOG4CXX_HELPERS_ONLY_ONCE_ERROR_HANDLER_H
 
diff --git a/src/main/include/log4cxx/helpers/strftimedateformat.h b/src/main/include/log4cxx/helpers/strftimedateformat.h
index a9b3ff7..9f7e20d 100644
--- a/src/main/include/log4cxx/helpers/strftimedateformat.h
+++ b/src/main/include/log4cxx/helpers/strftimedateformat.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/helpers/dateformat.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -65,4 +70,8 @@ class LOG4CXX_EXPORT StrftimeDateFormat : public DateFormat
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_HELPERS_STRFTIME_DATE_FORMAT_H
diff --git a/src/main/include/log4cxx/helpers/stringtokenizer.h b/src/main/include/log4cxx/helpers/stringtokenizer.h
index f227724..608fa4e 100644
--- a/src/main/include/log4cxx/helpers/stringtokenizer.h
+++ b/src/main/include/log4cxx/helpers/stringtokenizer.h
@@ -21,6 +21,11 @@
 #include <log4cxx/logstring.h>
 #include <log4cxx/helpers/exception.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -46,4 +51,8 @@ class LOG4CXX_EXPORT StringTokenizer
 }  // namespace helpers;
 } // namespace log4cxx;
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif //_LOG4CXX_HELPERS_STRING_TOKENIZER_H
diff --git a/src/main/include/log4cxx/helpers/syslogwriter.h b/src/main/include/log4cxx/helpers/syslogwriter.h
index faeb565..46a259f 100644
--- a/src/main/include/log4cxx/helpers/syslogwriter.h
+++ b/src/main/include/log4cxx/helpers/syslogwriter.h
@@ -23,6 +23,11 @@
 #include <log4cxx/helpers/inetaddress.h>
 #include <log4cxx/helpers/datagramsocket.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace helpers
@@ -47,4 +52,8 @@ class LOG4CXX_EXPORT SyslogWriter
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif
diff --git a/src/main/include/log4cxx/helpers/threadspecificdata.h b/src/main/include/log4cxx/helpers/threadspecificdata.h
index 66b8307..f6fcae0 100644
--- a/src/main/include/log4cxx/helpers/threadspecificdata.h
+++ b/src/main/include/log4cxx/helpers/threadspecificdata.h
@@ -21,6 +21,10 @@
 #include <log4cxx/ndc.h>
 #include <log4cxx/mdc.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
 
 namespace log4cxx
 {
@@ -64,4 +68,8 @@ class LOG4CXX_EXPORT ThreadSpecificData
 }  // namespace helpers
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif
diff --git a/src/main/include/log4cxx/helpers/timezone.h b/src/main/include/log4cxx/helpers/timezone.h
index 1a105d0..8a6f4bd 100644
--- a/src/main/include/log4cxx/helpers/timezone.h
+++ b/src/main/include/log4cxx/helpers/timezone.h
@@ -22,6 +22,11 @@
 #include <log4cxx/helpers/objectimpl.h>
 #include <log4cxx/helpers/objectptr.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 struct apr_time_exp_t;
 
 namespace log4cxx
@@ -68,4 +73,8 @@ class LOG4CXX_EXPORT TimeZone : public helpers::ObjectImpl
 }
 }
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif //_LOG4CXX_HELPERS_TIMEZONE_H
diff --git a/src/main/include/log4cxx/jsonlayout.h b/src/main/include/log4cxx/jsonlayout.h
index dd997d1..f49daed 100644
--- a/src/main/include/log4cxx/jsonlayout.h
+++ b/src/main/include/log4cxx/jsonlayout.h
@@ -22,6 +22,10 @@
 #include <log4cxx/helpers/iso8601dateformat.h>
 #include <log4cxx/spi/loggingevent.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
 
 
 namespace log4cxx
@@ -135,5 +139,8 @@ class LOG4CXX_EXPORT JSONLayout : public Layout
 LOG4CXX_PTR_DEF(JSONLayout);
 }  // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
 
 #endif // _LOG4CXX_JSON_LAYOUT_H
diff --git a/src/main/include/log4cxx/level.h b/src/main/include/log4cxx/level.h
index 034fb89..18ee6a1 100644
--- a/src/main/include/log4cxx/level.h
+++ b/src/main/include/log4cxx/level.h
@@ -24,6 +24,10 @@
 #include <log4cxx/helpers/objectimpl.h>
 #include <log4cxx/helpers/objectptr.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
 
 namespace log4cxx
 {
@@ -330,5 +334,8 @@ template<> inline bool LevelPtr::operator!=(const LevelPtr& rhs) const
 #define IMPLEMENT_LOG4CXX_LEVEL(level) \
 	IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(level, Class##level)
 
+#if defined(_MSC_VER)
+ #pragma warning (pop)
+#endif
 
 #endif //_LOG4CXX_LEVEL_H
diff --git a/src/main/include/log4cxx/logstring.h b/src/main/include/log4cxx/logstring.h
index 37b201b..f854fc3 100644
--- a/src/main/include/log4cxx/logstring.h
+++ b/src/main/include/log4cxx/logstring.h
@@ -37,8 +37,6 @@ extern "C" {
 }
 #endif
 
-
-
 namespace log4cxx
 {
 
diff --git a/src/main/include/log4cxx/mdc.h b/src/main/include/log4cxx/mdc.h
index 6088099..49214cf 100644
--- a/src/main/include/log4cxx/mdc.h
+++ b/src/main/include/log4cxx/mdc.h
@@ -18,17 +18,18 @@
 #ifndef _LOG4CXX_MDC_H
 #define _LOG4CXX_MDC_H
 
+#include <log4cxx/log4cxx.h>
+#include <log4cxx/logstring.h>
+#include <map>
+
 #if defined(_MSC_VER)
 	#pragma warning (push)
 	#pragma warning ( disable: 4231 4251 4275 4786 )
 #endif
 
-#include <log4cxx/log4cxx.h>
-#include <log4cxx/logstring.h>
-#include <map>
-
 namespace log4cxx
 {
+
 /**
 The MDC class is similar to the {@link log4cxx::NDC NDC} class except that it is
 based on a map instead of a stack. It provides <em>mapped
diff --git a/src/main/include/log4cxx/ndc.h b/src/main/include/log4cxx/ndc.h
index ec3c65a..704e0a7 100644
--- a/src/main/include/log4cxx/ndc.h
+++ b/src/main/include/log4cxx/ndc.h
@@ -18,17 +18,18 @@
 #ifndef _LOG4CXX_NDC_H
 #define _LOG4CXX_NDC_H
 
+#include <log4cxx/log4cxx.h>
+#include <log4cxx/logstring.h>
+#include <stack>
+
 #if defined(_MSC_VER)
 	#pragma warning ( push )
 	#pragma warning ( disable: 4231 4251 4275 4786 )
 #endif
 
-#include <log4cxx/log4cxx.h>
-#include <log4cxx/logstring.h>
-#include <stack>
-
 namespace log4cxx
 {
+
 /**
 the ndc class implements <i>nested diagnostic contexts</i> as
 defined by neil harrison in the article "patterns for logging
diff --git a/src/main/include/log4cxx/net/smtpappender.h b/src/main/include/log4cxx/net/smtpappender.h
index 35e1d59..fb1b275 100644
--- a/src/main/include/log4cxx/net/smtpappender.h
+++ b/src/main/include/log4cxx/net/smtpappender.h
@@ -23,6 +23,11 @@
 #include <log4cxx/helpers/cyclicbuffer.h>
 #include <log4cxx/spi/triggeringeventevaluator.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace net
@@ -282,4 +287,8 @@ LOG4CXX_PTR_DEF(SMTPAppender);
 }  // namespace net
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_NET_SMTP_H
diff --git a/src/main/include/log4cxx/net/socketappenderskeleton.h b/src/main/include/log4cxx/net/socketappenderskeleton.h
index 5f2b162..5772796 100644
--- a/src/main/include/log4cxx/net/socketappenderskeleton.h
+++ b/src/main/include/log4cxx/net/socketappenderskeleton.h
@@ -23,6 +23,11 @@
 #include <log4cxx/helpers/thread.h>
 #include <log4cxx/helpers/objectoutputstream.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 
@@ -193,5 +198,9 @@ class LOG4CXX_EXPORT SocketAppenderSkeleton : public AppenderSkeleton
 } // namespace net
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
 
diff --git a/src/main/include/log4cxx/net/syslogappender.h b/src/main/include/log4cxx/net/syslogappender.h
index 94df945..d044ec5 100644
--- a/src/main/include/log4cxx/net/syslogappender.h
+++ b/src/main/include/log4cxx/net/syslogappender.h
@@ -21,6 +21,11 @@
 #include <log4cxx/appenderskeleton.h>
 #include <log4cxx/helpers/syslogwriter.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace net
@@ -148,5 +153,9 @@ LOG4CXX_PTR_DEF(SyslogAppender);
 } // namespace net
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif // _LOG4CXX_NET_SYSLOG_APPENDER_H
 
diff --git a/src/main/include/log4cxx/nt/nteventlogappender.h b/src/main/include/log4cxx/nt/nteventlogappender.h
index a0ca67b..0e55a27 100644
--- a/src/main/include/log4cxx/nt/nteventlogappender.h
+++ b/src/main/include/log4cxx/nt/nteventlogappender.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/appenderskeleton.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 
 namespace log4cxx
 {
@@ -122,4 +127,7 @@ LOG4CXX_PTR_DEF(NTEventLogAppender);
 }  // namespace nt
 } // namespace log4cxx
 
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
 #endif //_LOG4CXX_NT_EVENT_LOG_APPENDER_HEADER_
diff --git a/src/main/include/log4cxx/pattern/literalpatternconverter.h b/src/main/include/log4cxx/pattern/literalpatternconverter.h
index 283e445..0eb2702 100644
--- a/src/main/include/log4cxx/pattern/literalpatternconverter.h
+++ b/src/main/include/log4cxx/pattern/literalpatternconverter.h
@@ -20,6 +20,11 @@
 
 #include <log4cxx/pattern/loggingeventpatternconverter.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 namespace pattern
@@ -68,5 +73,10 @@ class LOG4CXX_EXPORT LiteralPatternConverter : public LoggingEventPatternConvert
 
 }
 }
+
+#if defined(_MSC_VER)
+#pragma warning (pop)
+#endif
+
 #endif
 
diff --git a/src/main/include/log4cxx/pattern/patternparser.h b/src/main/include/log4cxx/pattern/patternparser.h
index 7f58470..39f4529 100644
--- a/src/main/include/log4cxx/pattern/patternparser.h
+++ b/src/main/include/log4cxx/pattern/patternparser.h
@@ -90,7 +90,7 @@ class LOG4CXX_EXPORT PatternParser
 		 * @param currentLiteral literal to be output in case format specifier in unrecognized.
 		 * @return position in pattern after converter.
 		 */
-		static int extractConverter(
+		static size_t extractConverter(
 			logchar lastChar, const LogString& pattern,
 			LogString::size_type i, LogString& convBuf,
 			LogString& currentLiteral);
@@ -102,7 +102,7 @@ class LOG4CXX_EXPORT PatternParser
 		 * @param options array to receive extracted options
 		 * @return position in pattern after options.
 		 */
-		static int extractOptions(const LogString& pattern, LogString::size_type i,
+		static size_t extractOptions(const LogString& pattern, LogString::size_type i,
 			std::vector<LogString>& options);
 
 	public:
@@ -150,8 +150,8 @@ class LOG4CXX_EXPORT PatternParser
 		 * @param formattingInfos list to receive corresponding field specifier.
 		 * @return position after format specifier sequence.
 		 */
-		static int finalizeConverter(
-			logchar c, const LogString& pattern, int i,
+		static size_t finalizeConverter(
+			logchar c, const LogString& pattern, size_t i,
 			LogString& currentLiteral, const FormattingInfoPtr& formattingInfo,
 			const PatternMap&  rules,
 			std::vector<PatternConverterPtr>& patternConverters,
diff --git a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
index 92e757c..e51dd56 100755
--- a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
+++ b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
@@ -26,6 +26,11 @@
 #include <log4cxx/helpers/outputstream.h>
 #include <apr_mmap.h>
 
+#if defined(_MSC_VER)
+#pragma warning ( push )
+#pragma warning ( disable: 4251 )
+#endif
+
 namespace log4cxx
 {
 
@@ -292,5 +297,9 @@ LOG4CXX_PTR_DEF(TimeBasedRollingPolicy);
 }
 }
 
+#if defined(_MSC_VER)
+#pragma warning ( pop )
+#endif
+
 #endif
 
diff --git a/src/test/cpp/asyncappendertestcase.cpp b/src/test/cpp/asyncappendertestcase.cpp
index 61853d4..3e2533d 100644
--- a/src/test/cpp/asyncappendertestcase.cpp
+++ b/src/test/cpp/asyncappendertestcase.cpp
@@ -216,7 +216,7 @@ public:
         try {
            LOG4CXX_INFO(root, "Message");
            LOGUNIT_FAIL("Should have thrown exception");
-        } catch(NullPointerException& ex) {
+        } catch(NullPointerException&) {
         }
     }
     
diff --git a/src/test/cpp/util/serializationtesthelper.cpp b/src/test/cpp/util/serializationtesthelper.cpp
index fa4b715..a14343f 100644
--- a/src/test/cpp/util/serializationtesthelper.cpp
+++ b/src/test/cpp/util/serializationtesthelper.cpp
@@ -64,7 +64,7 @@ bool SerializationTestHelper::compare(
           return false;
       }
 
-      int endScan = actual.size();
+      size_t endScan = actual.size();
 
       if (endScan > endCompare) {
         endScan = endCompare;