diff --git a/Foundation/include/Poco/Format.h b/Foundation/include/Poco/Format.h index 396e5d05e..2ee578d92 100644 --- a/Foundation/include/Poco/Format.h +++ b/Foundation/include/Poco/Format.h @@ -1,7 +1,7 @@ // // Format.h // -// $Id: //poco/1.3/Foundation/include/Poco/Format.h#1 $ +// $Id: //poco/1.3/Foundation/include/Poco/Format.h#2 $ // // Library: Foundation // Package: Core @@ -93,6 +93,7 @@ std::string Foundation_API format(const std::string& fmt, const Any& value); /// * E signed floating-point value in the form [-]d.ddddE[]dd[d] /// * f signed floating-point value in the form [-]dddd.dddd /// * s std::string + /// * z std::size_t /// /// The following flags are supported: /// @@ -108,6 +109,7 @@ std::string Foundation_API format(const std::string& fmt, const Any& value); /// * l argument is long (d, i), unsigned long (o, u, x, X) or long double (e, E, f, g, G) /// * L argument is long long (d, i), unsigned long long (o, u, x, X) /// * h argument is short (d, i), unsigned short (o, u, x, X) or float (e, E, f, g, G) + /// * * argument is any signed or unsigned integer (d, i, o, x, X) /// /// The width argument is a nonnegative decimal integer controlling the minimum number of characters printed. /// If the number of characters in the output value is less than the specified width, blanks or diff --git a/Foundation/include/Poco/TaskNotification.h b/Foundation/include/Poco/TaskNotification.h index 26e40e629..06ad1fd1f 100644 --- a/Foundation/include/Poco/TaskNotification.h +++ b/Foundation/include/Poco/TaskNotification.h @@ -1,7 +1,7 @@ // // TaskNotification.h // -// $Id: //poco/1.3/Foundation/include/Poco/TaskNotification.h#1 $ +// $Id: //poco/1.3/Foundation/include/Poco/TaskNotification.h#2 $ // // Library: Foundation // Package: Tasks @@ -146,7 +146,7 @@ class TaskCustomNotification: public TaskNotification /// mechanism between the task and its observer(s). { public: - TaskCustomNotification(Task* pTask, C& custom): + TaskCustomNotification(Task* pTask, const C& custom): TaskNotification(pTask), _custom(custom) { diff --git a/Foundation/src/Format.cpp b/Foundation/src/Format.cpp index e69975660..285275e1f 100644 --- a/Foundation/src/Format.cpp +++ b/Foundation/src/Format.cpp @@ -1,7 +1,7 @@ // // Format.cpp // -// $Id: //poco/1.3/Foundation/src/Format.cpp#1 $ +// $Id: //poco/1.3/Foundation/src/Format.cpp#2 $ // // Library: Foundation // Package: Core @@ -50,7 +50,8 @@ #include "Poco/Format.h" #include "Poco/Exception.h" #include -#include +#include +#include namespace Poco { @@ -111,7 +112,8 @@ namespace { case 'l': case 'h': - case 'L': mod = *itFmt++; break; + case 'L': + case '*': mod = *itFmt++; break; } } return mod; @@ -132,6 +134,33 @@ namespace case 'f': str << std::fixed; break; } } + + + void writeAnyInt(std::ostream& str, const Any& any) + { + if (any.type() == typeid(char)) + str << static_cast(AnyCast(any)); + else if (any.type() == typeid(signed char)) + str << static_cast(AnyCast(any)); + else if (any.type() == typeid(unsigned char)) + str << static_cast(AnyCast(any)); + else if (any.type() == typeid(short)) + str << AnyCast(any); + else if (any.type() == typeid(unsigned short)) + str << AnyCast(any); + else if (any.type() == typeid(int)) + str << AnyCast(any); + else if (any.type() == typeid(unsigned int)) + str << AnyCast(any); + else if (any.type() == typeid(long)) + str << AnyCast(any); + else if (any.type() == typeid(unsigned long)) + str << AnyCast(any); + else if (any.type() == typeid(Int64)) + str << AnyCast(any); + else if (any.type() == typeid(UInt64)) + str << AnyCast(any); + } void formatOne(std::string& result, std::string::const_iterator& itFmt, const std::string::const_iterator& endFmt, std::vector::const_iterator& itVal) @@ -157,6 +186,7 @@ namespace case 'l': str << AnyCast(*itVal++); break; case 'L': str << AnyCast(*itVal++); break; case 'h': str << AnyCast(*itVal++); break; + case '*': writeAnyInt(str, *itVal++); break; default: str << AnyCast(*itVal++); break; } break; @@ -169,6 +199,7 @@ namespace case 'l': str << AnyCast(*itVal++); break; case 'L': str << AnyCast(*itVal++); break; case 'h': str << AnyCast(*itVal++); break; + case '*': writeAnyInt(str, *itVal++); break; default: str << AnyCast(*itVal++); break; } break; @@ -186,6 +217,11 @@ namespace case 's': str << RefAnyCast(*itVal++); break; + case 'z': + str << AnyCast(*itVal++); + break; + case 'I': + case 'D': default: str << type; } diff --git a/Foundation/src/PurgeStrategy.cpp b/Foundation/src/PurgeStrategy.cpp index 61f196c9c..60a6c1b1f 100644 --- a/Foundation/src/PurgeStrategy.cpp +++ b/Foundation/src/PurgeStrategy.cpp @@ -1,7 +1,7 @@ // // PurgeStrategy.cpp // -// $Id: //poco/1.3/Foundation/src/PurgeStrategy.cpp#1 $ +// $Id: //poco/1.3/Foundation/src/PurgeStrategy.cpp#2 $ // // Library: Foundation // Package: Logging @@ -66,7 +66,7 @@ void PurgeStrategy::list(const std::string& path, std::vector& files) std::string baseName = p.getFileName(); baseName.append("."); - DirectoryIterator it(Path::current()); + DirectoryIterator it(parent); DirectoryIterator end; while (it != end) { diff --git a/Foundation/testsuite/src/FormatTest.cpp b/Foundation/testsuite/src/FormatTest.cpp index 97a5906c0..caefc689c 100644 --- a/Foundation/testsuite/src/FormatTest.cpp +++ b/Foundation/testsuite/src/FormatTest.cpp @@ -1,7 +1,7 @@ // // FormatTest.cpp // -// $Id: //poco/1.3/Foundation/testsuite/src/FormatTest.cpp#1 $ +// $Id: //poco/1.3/Foundation/testsuite/src/FormatTest.cpp#2 $ // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // All rights reserved. @@ -208,7 +208,62 @@ void FormatTest::testInt() catch (BadCastException&) { } +} + +void FormatTest::testAnyInt() +{ + char c = 42; + std::string s(format("%*i", c)); + assert (s == "42"); + + signed char sc = -42; + s = format("%*i", sc); + assert (s == "-42"); + + unsigned char uc = 65; + s = format("%*i", uc); + assert (s == "65"); + + short ss = -134; + s = format("%*i", ss); + assert (s == "-134"); + + unsigned short us = 200; + s = format("%*i", us); + assert (s == "200"); + + int i = -12345; + s = format("%*i", i); + assert (s == "-12345"); + + unsigned ui = 12345; + s = format("%*i", ui); + assert (s == "12345"); + + long l = -54321; + s = format("%*i", l); + assert (s == "-54321"); + + unsigned long ul = 54321; + s = format("%*i", ul); + assert (s == "54321"); + + Int64 i64 = -12345678; + s = format("%*i", i64); + assert (s == "-12345678"); + + UInt64 ui64 = 12345678; + s = format("%*i", ui64); + assert (s == "12345678"); + + ss = 0x42; + s = format("%*x", ss); + assert (s == "42"); + + ss = 042; + s = format("%*o", ss); + assert (s == "42"); } @@ -301,6 +356,7 @@ CppUnit::Test* FormatTest::suite() CppUnit_addTest(pSuite, FormatTest, testChar); CppUnit_addTest(pSuite, FormatTest, testInt); + CppUnit_addTest(pSuite, FormatTest, testAnyInt); CppUnit_addTest(pSuite, FormatTest, testFloatFix); CppUnit_addTest(pSuite, FormatTest, testFloatSci); CppUnit_addTest(pSuite, FormatTest, testString); diff --git a/Foundation/testsuite/src/FormatTest.h b/Foundation/testsuite/src/FormatTest.h index d746e4a0e..02a86c5d3 100644 --- a/Foundation/testsuite/src/FormatTest.h +++ b/Foundation/testsuite/src/FormatTest.h @@ -1,7 +1,7 @@ // // FormatTest.h // -// $Id: //poco/1.3/Foundation/testsuite/src/FormatTest.h#1 $ +// $Id: //poco/1.3/Foundation/testsuite/src/FormatTest.h#2 $ // // Definition of the FormatTest class. // @@ -61,6 +61,7 @@ public: void testChar(); void testInt(); + void testAnyInt(); void testFloatFix(); void testFloatSci(); void testString(); diff --git a/Net/src/HTTPRequest.cpp b/Net/src/HTTPRequest.cpp index 86be506ad..95a7a04b0 100644 --- a/Net/src/HTTPRequest.cpp +++ b/Net/src/HTTPRequest.cpp @@ -1,7 +1,7 @@ // // HTTPRequest.cpp // -// $Id: //poco/1.3/Net/src/HTTPRequest.cpp#1 $ +// $Id: //poco/1.3/Net/src/HTTPRequest.cpp#2 $ // // Library: Net // Package: HTTP @@ -211,10 +211,10 @@ void HTTPRequest::read(std::istream& istr) while (isspace(ch)) ch = istr.get(); if (ch == eof) throw MessageException("No HTTP request header"); while (!isspace(ch) && ch != eof && method.length() < MAX_METHOD_LENGTH) { method += (char) ch; ch = istr.get(); } - if (!isspace(ch)) throw MessageException("HTTP request method too long"); + if (!isspace(ch)) throw MessageException("HTTP request method invalid or too long"); while (isspace(ch)) ch = istr.get(); while (!isspace(ch) && ch != eof && uri.length() < MAX_URI_LENGTH) { uri += (char) ch; ch = istr.get(); } - if (!isspace(ch)) throw MessageException("HTTP request URI too long"); + if (!isspace(ch)) throw MessageException("HTTP request URI invalid or too long"); while (isspace(ch)) ch = istr.get(); while (!isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); } if (!isspace(ch)) throw MessageException("Invalid HTTP version string"); diff --git a/Net/src/HTTPServerSession.cpp b/Net/src/HTTPServerSession.cpp index 5b4dab650..3bdb9f85f 100644 --- a/Net/src/HTTPServerSession.cpp +++ b/Net/src/HTTPServerSession.cpp @@ -1,7 +1,7 @@ // // HTTPServerSession.cpp // -// $Id: //poco/1.3/Net/src/HTTPServerSession.cpp#1 $ +// $Id: //poco/1.3/Net/src/HTTPServerSession.cpp#2 $ // // Library: Net // Package: HTTPServer @@ -64,9 +64,10 @@ bool HTTPServerSession::hasMoreRequests() --_maxKeepAliveRequests; return socket().poll(getTimeout(), Socket::SELECT_READ); } - else if (_maxKeepAliveRequests > 0 && getKeepAlive()) + else if (_maxKeepAliveRequests != 0 && getKeepAlive()) { - --_maxKeepAliveRequests; + if (_maxKeepAliveRequests > 0) + --_maxKeepAliveRequests; return socket().poll(_keepAliveTimeout, Socket::SELECT_READ); } else return false; diff --git a/VERSION b/VERSION index fc6d4c75c..eade51ef6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3-20061222 (2006-12-22) +1.3-20061227 (2006-12-27)