Merge pull request #1 from pocoproject/develop

upstream refresh
This commit is contained in:
Marian Krivoš 2014-12-09 14:44:10 +01:00
commit d01ec3f8c5
6 changed files with 34 additions and 22 deletions

2
.gitignore vendored
View File

@ -13,6 +13,8 @@
*.la *.la
*.a *.a
*.d *.d
*.vsp
*.psess
# Make # # Make #
######## ########

View File

@ -43,7 +43,7 @@ public:
static void assertion(const char* cond, const char* file, int line, const char* text = 0); static void assertion(const char* cond, const char* file, int line, const char* text = 0);
/// An assertion failed. Break into the debugger, if /// An assertion failed. Break into the debugger, if
/// possible, then throw an AssertionViolationException. /// possible, then throw an AssertionViolationException.
static void nullPointer(const char* ptr, const char* file, int line); static void nullPointer(const char* ptr, const char* file, int line);
/// An null pointer was encountered. Break into the debugger, if /// An null pointer was encountered. Break into the debugger, if
/// possible, then throw an NullPointerException. /// possible, then throw an NullPointerException.
@ -111,8 +111,8 @@ protected:
#define poco_bugcheck_msg(msg) \ #define poco_bugcheck_msg(msg) \
Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__)
#define poco_unexpected() \ #define poco_unexpected() \
Poco::Bugcheck::unexpected(__FILE__, __LINE__); Poco::Bugcheck::unexpected(__FILE__, __LINE__);
@ -143,22 +143,25 @@ protected:
// //
// poco_static_assert // poco_static_assert
// //
// The following was ported from <boost/static_assert.hpp> // The following was ported from <boost/static_assert.hpp>
// //
GCC_DIAG_OFF(unused-local-typedefs) // supress numerous gcc warnings
template <bool x> template <bool x>
struct POCO_STATIC_ASSERTION_FAILURE; struct POCO_STATIC_ASSERTION_FAILURE;
template <> template <>
struct POCO_STATIC_ASSERTION_FAILURE<true> struct POCO_STATIC_ASSERTION_FAILURE<true>
{ {
enum enum
{ {
value = 1 value = 1
}; };
}; };

View File

@ -47,9 +47,12 @@ int LogStreamBuf::writeToDevice(char c)
{ {
if (c == '\n' || c == '\r') if (c == '\n' || c == '\r')
{ {
Message msg(_logger.name(), _message, _priority); if (_message.find_first_not_of("\r\n") != std::string::npos)
_message.clear(); {
_logger.log(msg); Message msg(_logger.name(), _message, _priority);
_message.clear();
_logger.log(msg);
}
} }
else _message += c; else _message += c;
return c; return c;

View File

@ -55,14 +55,16 @@ std::string PathImpl::systemImpl()
std::string PathImpl::homeImpl() std::string PathImpl::homeImpl()
{ {
std::string result; std::string result;
if (EnvironmentImpl::hasImpl("USERPROFILE"))
// windows service has no home dir, return system directory instead {
try result = EnvironmentImpl::getImpl("USERPROFILE");
}
else if (EnvironmentImpl::hasImpl("HOMEDRIVE") && EnvironmentImpl::hasImpl("HOMEPATH"))
{ {
result = EnvironmentImpl::getImpl("HOMEDRIVE"); result = EnvironmentImpl::getImpl("HOMEDRIVE");
result.append(EnvironmentImpl::getImpl("HOMEPATH")); result.append(EnvironmentImpl::getImpl("HOMEPATH"));
} }
catch (NotFoundException&) else
{ {
result = systemImpl(); result = systemImpl();
} }

View File

@ -65,14 +65,16 @@ std::string PathImpl::systemImpl()
std::string PathImpl::homeImpl() std::string PathImpl::homeImpl()
{ {
std::string result; std::string result;
if (EnvironmentImpl::hasImpl("USERPROFILE"))
// windows service has no home dir, return system directory instead {
try result = EnvironmentImpl::getImpl("USERPROFILE");
}
else if (EnvironmentImpl::hasImpl("HOMEDRIVE") && EnvironmentImpl::hasImpl("HOMEPATH"))
{ {
result = EnvironmentImpl::getImpl("HOMEDRIVE"); result = EnvironmentImpl::getImpl("HOMEDRIVE");
result.append(EnvironmentImpl::getImpl("HOMEPATH")); result.append(EnvironmentImpl::getImpl("HOMEPATH"));
} }
catch (NotFoundException&) else
{ {
result = systemImpl(); result = systemImpl();
} }

View File

@ -159,7 +159,7 @@ private:
enum Limits enum Limits
{ {
MAX_METHOD_LENGTH = 32, MAX_METHOD_LENGTH = 32,
MAX_URI_LENGTH = 4096, MAX_URI_LENGTH = 16384,
MAX_VERSION_LENGTH = 8 MAX_VERSION_LENGTH = 8
}; };