From a01116ca1139407d68cb4bd5afb95f394bbb635f Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Thu, 14 Sep 2006 16:46:36 +0000 Subject: [PATCH] integrated changes for 1.2.3 --- CHANGELOG | 18 ++- Foundation/include/Poco/AbstractObserver.h | 71 +++++++++ Foundation/include/Poco/NObserver.h | 135 ++++++++++++++++++ Foundation/include/Poco/NotificationCenter.h | 12 +- Foundation/include/Poco/Observer.h | 29 ++-- .../include/Poco/SharedLibrary_WIN32U.h | 72 ++++++++++ Foundation/include/Poco/SharedPtr.h | 7 +- Foundation/include/Poco/ThreadLocal.h | 5 +- .../{Observer.cpp => AbstractObserver.cpp} | 6 +- Foundation/src/NamedEvent_UNIX.cpp | 26 ++-- Foundation/src/NamedMutex_UNIX.cpp | 22 ++- Foundation/src/PipeImpl_POSIX.cpp | 16 ++- Foundation/src/Process_UNIX.cpp | 10 +- Foundation/src/Random.cpp | 4 +- MANIFEST | 5 +- Makefile | 132 ++++++++++------- NEWS | 6 +- Net/src/IPAddress.cpp | 4 +- Net/src/MailMessage.cpp | 4 +- Net/src/Socket.cpp | 27 +++- Net/src/SocketImpl.cpp | 27 +++- VERSION | 2 +- build_vs71.cmd | 13 +- build_vs80.cmd | 13 +- configure | 20 ++- 25 files changed, 550 insertions(+), 136 deletions(-) create mode 100644 Foundation/include/Poco/AbstractObserver.h create mode 100644 Foundation/include/Poco/NObserver.h create mode 100644 Foundation/include/Poco/SharedLibrary_WIN32U.h rename Foundation/src/{Observer.cpp => AbstractObserver.cpp} (91%) diff --git a/CHANGELOG b/CHANGELOG index 7edb2728d..c9b616505 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,21 @@ This is the changelog file for POCO - the C++ Portable Components. +Release 1.2.3 (2006-09-14) +========================== + +- configure script now checks if (auto)selected configuration is supported +- fixed SF #1552904: NamedEvent bug? +- fixed SF #1552787: POCO not handling EINTR +- fixed SF #1552846: Random::~Random uses scalar delete +- fixed SF #1552987: TLSSlot should explicitly default-construct _value +- IPAddress no longer accepts an empty address string +- split up Observer.h into AbstractObserver.h and Observer.h +- added NObserver class template which supports an AutoPtr + argument for the notification callback +- changed EchoServer sample to use NObserver +- some Windows-specific files were missing in the tarballs + + Release 1.2.2 (2006-09-01) ========================== @@ -483,4 +499,4 @@ building the libraries. -- -$Id: //poco/1.2/dist/CHANGELOG#4 $ +$Id: //poco/1.2/dist/CHANGELOG#6 $ diff --git a/Foundation/include/Poco/AbstractObserver.h b/Foundation/include/Poco/AbstractObserver.h new file mode 100644 index 000000000..7faafd955 --- /dev/null +++ b/Foundation/include/Poco/AbstractObserver.h @@ -0,0 +1,71 @@ +// +// AbstractObserver.h +// +// $Id: //poco/1.2/Foundation/include/Poco/AbstractObserver.h#1 $ +// +// Library: Foundation +// Package: Notifications +// Module: NotificationCenter +// +// Definition of the AbstractObserver class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_AbstractObserver_INCLUDED +#define Foundation_AbstractObserver_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Notification.h" + + +namespace Poco { + + +class Foundation_API AbstractObserver + /// The base class for all instantiations of + /// the Observer and NObserver template classes. +{ +public: + AbstractObserver(); + AbstractObserver(const AbstractObserver& observer); + virtual ~AbstractObserver(); + + AbstractObserver& operator = (const AbstractObserver& observer); + + virtual void notify(Notification* pNf) const = 0; + virtual bool equals(const AbstractObserver& observer) const = 0; + virtual bool accepts(Notification* pNf) const = 0; + virtual AbstractObserver* clone() const = 0; +}; + + +} // namespace Poco + + +#endif // Foundation_AbstractObserver_INCLUDED diff --git a/Foundation/include/Poco/NObserver.h b/Foundation/include/Poco/NObserver.h new file mode 100644 index 000000000..7f2f02410 --- /dev/null +++ b/Foundation/include/Poco/NObserver.h @@ -0,0 +1,135 @@ +// +// NObserver.h +// +// $Id: //poco/1.2/Foundation/include/Poco/NObserver.h#1 $ +// +// Library: Foundation +// Package: Notifications +// Module: NotificationCenter +// +// Definition of the NObserver class template. +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_NObserver_INCLUDED +#define Foundation_NObserver_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/AbstractObserver.h" +#include "Poco/AutoPtr.h" + + +namespace Poco { + + +template +class NObserver: public AbstractObserver + /// This template class implements an adapter that sits between + /// a NotificationCenter and an object receiving notifications + /// from it. It is quite similar in concept to the + /// RunnableAdapter, but provides some NotificationCenter + /// specific additional methods. + /// See the NotificationCenter class for information on how + /// to use this template class. + /// + /// This class template is quite similar to the Observer class + /// template. The only difference is that the NObserver + /// expects the callback function to accept a const AutoPtr& + /// instead of a plain pointer as argument, thus simplifying memory + /// management. +{ +public: + typedef AutoPtr NotificationPtr; + typedef void (C::*Callback)(const NotificationPtr&); + + NObserver(C& object, Callback method): + _pObject(&object), + _method(method) + { + } + + NObserver(const NObserver& observer): + AbstractObserver(observer), + _pObject(observer._pObject), + _method(observer._method) + { + } + + ~NObserver() + { + } + + NObserver& operator = (const NObserver& observer) + { + if (&observer != this) + { + _pObject = observer._pObject; + _method = observer._method; + } + return *this; + } + + void notify(Notification* pNf) const + { + N* pCastNf = dynamic_cast(pNf); + if (pCastNf) + { + NotificationPtr ptr(pCastNf, true); + (_pObject->*_method)(ptr); + } + } + + bool equals(const AbstractObserver& abstractObserver) const + { + const NObserver* pObs = dynamic_cast(&abstractObserver); + return pObs && pObs->_pObject == _pObject && pObs->_method == _method; + } + + bool accepts(Notification* pNf) const + { + return dynamic_cast(pNf) != 0; + } + + AbstractObserver* clone() const + { + return new NObserver(*this); + } + +private: + NObserver(); + + C* _pObject; + Callback _method; +}; + + +} // namespace Poco + + +#endif // Foundation_NObserver_INCLUDED diff --git a/Foundation/include/Poco/NotificationCenter.h b/Foundation/include/Poco/NotificationCenter.h index 2bfd686c1..f0b91f0bc 100644 --- a/Foundation/include/Poco/NotificationCenter.h +++ b/Foundation/include/Poco/NotificationCenter.h @@ -1,7 +1,7 @@ // // NotificationCenter.h // -// $Id: //poco/1.2/Foundation/include/Poco/NotificationCenter.h#1 $ +// $Id: //poco/1.2/Foundation/include/Poco/NotificationCenter.h#2 $ // // Library: Foundation // Package: Notifications @@ -89,6 +89,14 @@ class Foundation_API NotificationCenter /// AutoPtr nf(pNf); /// ... /// } + /// + /// Alternatively, the NObserver class template can be used to register a callback + /// method. In this case, the callback method receives the Notification in an + /// AutoPtr and thus does not have to deal with object ownership issues: + /// void MyClass::handleNotification(const AutoPtr& pNf) + /// { + /// ... + /// } { public: NotificationCenter(); @@ -102,6 +110,8 @@ public: /// Usage: /// Observer obs(*this, &MyClass::handleNotification); /// notificationCenter.addObserver(obs); + /// + /// Alternatively, the NObserver template class can be used instead of Observer. void removeObserver(const AbstractObserver& observer); /// Unregisters an observer with the NotificationCenter. diff --git a/Foundation/include/Poco/Observer.h b/Foundation/include/Poco/Observer.h index a68de2684..496a19ed1 100644 --- a/Foundation/include/Poco/Observer.h +++ b/Foundation/include/Poco/Observer.h @@ -1,13 +1,13 @@ // // Observer.h // -// $Id: //poco/1.2/Foundation/include/Poco/Observer.h#1 $ +// $Id: //poco/1.2/Foundation/include/Poco/Observer.h#2 $ // // Library: Foundation // Package: Notifications // Module: NotificationCenter // -// Definition of the Observer class. +// Definition of the Observer class template. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. @@ -41,30 +41,12 @@ #include "Poco/Foundation.h" -#include "Poco/Notification.h" +#include "Poco/AbstractObserver.h" namespace Poco { -class Foundation_API AbstractObserver - /// The base class for all instantiations of - /// the Observer template class. -{ -public: - AbstractObserver(); - AbstractObserver(const AbstractObserver& observer); - virtual ~AbstractObserver(); - - AbstractObserver& operator = (const AbstractObserver& observer); - - virtual void notify(Notification* pNf) const = 0; - virtual bool equals(const AbstractObserver& observer) const = 0; - virtual bool accepts(Notification* pNf) const = 0; - virtual AbstractObserver* clone() const = 0; -}; - - template class Observer: public AbstractObserver /// This template class implements an adapter that sits between @@ -74,6 +56,11 @@ class Observer: public AbstractObserver /// specific additional methods. /// See the NotificationCenter class for information on how /// to use this template class. + /// + /// Instead of the Observer class template, you might want to + /// use the NObserver class template, which uses an AutoPtr to + /// pass the Notification to the callback function, thus freeing + /// you from memory management issues. { public: typedef void (C::*Callback)(N*); diff --git a/Foundation/include/Poco/SharedLibrary_WIN32U.h b/Foundation/include/Poco/SharedLibrary_WIN32U.h new file mode 100644 index 000000000..4a7f4de8d --- /dev/null +++ b/Foundation/include/Poco/SharedLibrary_WIN32U.h @@ -0,0 +1,72 @@ +// +// SharedLibrary_WIN32U.h +// +// $Id: //poco/1.2/Foundation/include/Poco/SharedLibrary_WIN32U.h#1 $ +// +// Library: Foundation +// Package: SharedLibrary +// Module: SharedLibrary +// +// Definition of the SharedLibraryImpl class for Win32. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// + + +#ifndef Foundation_SharedLibrary_WIN32U_INCLUDED +#define Foundation_SharedLibrary_WIN32U_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Mutex.h" + + +namespace Poco { + + +class Foundation_API SharedLibraryImpl +{ +protected: + SharedLibraryImpl(); + ~SharedLibraryImpl(); + void loadImpl(const std::string& path); + void unloadImpl(); + bool isLoadedImpl() const; + void* findSymbolImpl(const std::string& name); + const std::string& getPathImpl() const; + static std::string suffixImpl(); + +private: + std::string _path; + void* _handle; + static FastMutex _mutex; +}; + + +} // namespace Poco + + +#endif // Foundation_SharedLibrary_WIN32U_INCLUDED diff --git a/Foundation/include/Poco/SharedPtr.h b/Foundation/include/Poco/SharedPtr.h index f8901bf8a..2a8b5073e 100644 --- a/Foundation/include/Poco/SharedPtr.h +++ b/Foundation/include/Poco/SharedPtr.h @@ -1,7 +1,7 @@ // // SharedPtr.h // -// $Id: //poco/1.2/Foundation/include/Poco/SharedPtr.h#1 $ +// $Id: //poco/1.2/Foundation/include/Poco/SharedPtr.h#2 $ // // Library: Foundation // Package: Core @@ -209,6 +209,11 @@ public: { return _ptr; } + + bool isNull() const + { + return (_ptr == 0); + } operator C* () { diff --git a/Foundation/include/Poco/ThreadLocal.h b/Foundation/include/Poco/ThreadLocal.h index 70c1618df..30a98c5be 100644 --- a/Foundation/include/Poco/ThreadLocal.h +++ b/Foundation/include/Poco/ThreadLocal.h @@ -1,7 +1,7 @@ // // ThreadLocal.h // -// $Id: //poco/1.2/Foundation/include/Poco/ThreadLocal.h#1 $ +// $Id: //poco/1.2/Foundation/include/Poco/ThreadLocal.h#2 $ // // Library: Foundation // Package: Threading @@ -65,7 +65,8 @@ class TLSSlot: public TLSAbstractSlot /// must not create instances of it yourself. { public: - TLSSlot() + TLSSlot(): + _value() { } diff --git a/Foundation/src/Observer.cpp b/Foundation/src/AbstractObserver.cpp similarity index 91% rename from Foundation/src/Observer.cpp rename to Foundation/src/AbstractObserver.cpp index 1c59ecec3..874453f8a 100644 --- a/Foundation/src/Observer.cpp +++ b/Foundation/src/AbstractObserver.cpp @@ -1,7 +1,7 @@ // -// Observer.cpp +// AbstractObserver.cpp // -// $Id: //poco/1.2/Foundation/src/Observer.cpp#1 $ +// $Id: //poco/1.2/Foundation/src/AbstractObserver.cpp#1 $ // // Library: Foundation // Package: Notifications @@ -34,7 +34,7 @@ // -#include "Poco/Observer.h" +#include "Poco/AbstractObserver.h" namespace Poco { diff --git a/Foundation/src/NamedEvent_UNIX.cpp b/Foundation/src/NamedEvent_UNIX.cpp index afca9a596..0b9e2b5da 100644 --- a/Foundation/src/NamedEvent_UNIX.cpp +++ b/Foundation/src/NamedEvent_UNIX.cpp @@ -1,7 +1,7 @@ // // NamedEvent_UNIX.cpp // -// $Id: //poco/1.2/Foundation/src/NamedEvent_UNIX.cpp#1 $ +// $Id: //poco/1.2/Foundation/src/NamedEvent_UNIX.cpp#2 $ // // Library: Foundation // Package: Processes @@ -38,6 +38,7 @@ #include "Poco/Exception.h" #include #include +#include #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) #include #else @@ -45,7 +46,6 @@ #include #include #include -#include #endif @@ -120,7 +120,7 @@ void NamedEventImpl::setImpl() struct sembuf op; op.sem_num = 0; op.sem_op = 1; - op.sem_flg = SEM_UNDO; + op.sem_flg = 0; if (semop(_semid, &op, 1) != 0) throw SystemException("cannot set named event", _name); #endif @@ -130,15 +130,25 @@ void NamedEventImpl::setImpl() void NamedEventImpl::waitImpl() { #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) - if (sem_wait(_sem) != 0) - throw SystemException("cannot wait for named event", _name); + int err; + do + { + err = sem_wait(_sem); + } + while (err && errno == EINTR); + if (err) throw SystemException("cannot wait for named event", _name); #else struct sembuf op; op.sem_num = 0; op.sem_op = -1; - op.sem_flg = SEM_UNDO; - if (semop(_semid, &op, 1) != 0) - throw SystemException("cannot wait for named event", _name); + op.sem_flg = 0; + int err; + do + { + err = semop(_semid, &op, 1); + } + while (err && errno == EINTR); + if (err) throw SystemException("cannot wait for named event", _name); #endif } diff --git a/Foundation/src/NamedMutex_UNIX.cpp b/Foundation/src/NamedMutex_UNIX.cpp index cbbee2b0b..5b91235e9 100644 --- a/Foundation/src/NamedMutex_UNIX.cpp +++ b/Foundation/src/NamedMutex_UNIX.cpp @@ -1,7 +1,7 @@ // // NamedMutex_UNIX.cpp // -// $Id: //poco/1.2/Foundation/src/NamedMutex_UNIX.cpp#1 $ +// $Id: //poco/1.2/Foundation/src/NamedMutex_UNIX.cpp#2 $ // // Library: Foundation // Package: Processes @@ -38,6 +38,7 @@ #include "Poco/Exception.h" #include #include +#include #if defined(sun) || defined(__APPLE__) || defined(__osf__) #include #else @@ -45,7 +46,6 @@ #include #include #include -#include #endif @@ -114,15 +114,25 @@ NamedMutexImpl::~NamedMutexImpl() void NamedMutexImpl::lockImpl() { #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) - if (sem_wait(_sem) != 0) - throw SystemException("cannot lock named mutex", _name); + int err; + do + { + err = sem_wait(_sem); + } + while (err && errno == EINTR); + if (err) throw SystemException("cannot lock named mutex", _name); #else struct sembuf op; op.sem_num = 0; op.sem_op = -1; op.sem_flg = SEM_UNDO; - if (semop(_semid, &op, 1) != 0) - throw SystemException("cannot lock named mutex", _name); + int err; + do + { + err = semop(_semid, &op, 1); + } + while (err && errno == EINTR); + if (err) throw SystemException("cannot lock named mutex", _name); #endif } diff --git a/Foundation/src/PipeImpl_POSIX.cpp b/Foundation/src/PipeImpl_POSIX.cpp index 3451a18cc..9fefa7f26 100644 --- a/Foundation/src/PipeImpl_POSIX.cpp +++ b/Foundation/src/PipeImpl_POSIX.cpp @@ -1,7 +1,7 @@ // // PipeImpl_POSIX.cpp // -// $Id: //poco/1.2/Foundation/src/PipeImpl_POSIX.cpp#1 $ +// $Id: //poco/1.2/Foundation/src/PipeImpl_POSIX.cpp#2 $ // // Library: Foundation // Package: Processes @@ -67,7 +67,12 @@ int PipeImpl::writeBytes(const void* buffer, int length) { poco_assert (_writefd != -1); - int n = write(_writefd, buffer, length); + int n; + do + { + n = write(_writefd, buffer, length); + } + while (n < 0 && errno == EINTR); if (n >= 0) return n; else @@ -79,7 +84,12 @@ int PipeImpl::readBytes(void* buffer, int length) { poco_assert (_readfd != -1); - int n = read(_readfd, buffer, length); + int n; + do + { + n = read(_readfd, buffer, length); + } + while (n < 0 && errno == EINTR); if (n >= 0) return n; else diff --git a/Foundation/src/Process_UNIX.cpp b/Foundation/src/Process_UNIX.cpp index 1be1d0a5c..faa327a90 100644 --- a/Foundation/src/Process_UNIX.cpp +++ b/Foundation/src/Process_UNIX.cpp @@ -1,7 +1,7 @@ // // Process_UNIX.cpp // -// $Id: //poco/1.2/Foundation/src/Process_UNIX.cpp#1 $ +// $Id: //poco/1.2/Foundation/src/Process_UNIX.cpp#2 $ // // Library: Foundation // Package: Processes @@ -79,7 +79,13 @@ pid_t ProcessHandleImpl::id() const int ProcessHandleImpl::wait() const { int status; - if (waitpid(_pid, &status, 0) != _pid) + int rc; + do + { + rc = waitpid(_pid, &status, 0); + } + while (rc < 0 && errno == EINTR); + if (rc != _pid) throw SystemException("Cannot wait for process", NumberFormatter::format(_pid)); return WEXITSTATUS(status); } diff --git a/Foundation/src/Random.cpp b/Foundation/src/Random.cpp index c12ca2d63..075c91156 100644 --- a/Foundation/src/Random.cpp +++ b/Foundation/src/Random.cpp @@ -1,7 +1,7 @@ // // Random.cpp // -// $Id: //poco/1.2/Foundation/src/Random.cpp#1 $ +// $Id: //poco/1.2/Foundation/src/Random.cpp#2 $ // // Library: Foundation // Package: Crypt @@ -182,7 +182,7 @@ Random::Random(int stateSize) Random::~Random() { - delete _pBuffer; + delete [] _pBuffer; } diff --git a/MANIFEST b/MANIFEST index 249eec354..29c00a707 100644 --- a/MANIFEST +++ b/MANIFEST @@ -116,6 +116,7 @@ Foundation/include/Poco Foundation/include/Poco/AbstractCache.h Foundation/include/Poco/AbstractDelegate.h Foundation/include/Poco/AbstractEvent.h +Foundation/include/Poco/AbstractObserver.h Foundation/include/Poco/AbstractPriorityDelegate.h Foundation/include/Poco/AbstractStrategy.h Foundation/include/Poco/ActiveDispatcher.h @@ -246,6 +247,7 @@ Foundation/include/Poco/NamedMutex_VMS.h Foundation/include/Poco/NamedMutex_WIN32.h Foundation/include/Poco/NamedMutex_WIN32U.h Foundation/include/Poco/NestedDiagnosticContext.h +Foundation/include/Poco/NObserver.h Foundation/include/Poco/Notification.h Foundation/include/Poco/NotificationCenter.h Foundation/include/Poco/NotificationQueue.h @@ -302,6 +304,7 @@ Foundation/include/Poco/SharedLibrary_HPUX.h Foundation/include/Poco/SharedLibrary_UNIX.h Foundation/include/Poco/SharedLibrary_VMS.h Foundation/include/Poco/SharedLibrary_WIN32.h +Foundation/include/Poco/SharedLibrary_WIN32U.h Foundation/include/Poco/SharedPtr.h Foundation/include/Poco/SignalHandler.h Foundation/include/Poco/SimpleFileChannel.h @@ -484,6 +487,7 @@ Foundation/samples/uuidgen/uuidgen.vmsbuild Foundation/samples/uuidgen/uuidgen_vs71.vcproj Foundation/samples/uuidgen/uuidgen_vs80.vcproj Foundation/src +Foundation/src/AbstractObserver.cpp Foundation/src/ActiveDispatcher.cpp Foundation/src/adler32.c Foundation/src/ArchiveStrategy.cpp @@ -603,7 +607,6 @@ Foundation/src/NullChannel.cpp Foundation/src/NullStream.cpp Foundation/src/NumberFormatter.cpp Foundation/src/NumberParser.cpp -Foundation/src/Observer.cpp Foundation/src/OpcomChannel.cpp Foundation/src/Path.cpp Foundation/src/Path_UNIX.cpp diff --git a/Makefile b/Makefile index 2caf2bd26..5d3c58265 100644 --- a/Makefile +++ b/Makefile @@ -1,54 +1,78 @@ -# -# Makefile -# -# $Id: //poco/1.2/dist/Makefile#1 $ -# -# Makefile for Poco -# - -sinclude config.make - -ifndef POCO_BASE -$(warning WARNING: POCO_BASE is not defined. Assuming current directory.) -export POCO_BASE=$(shell pwd) -endif - -ifndef POCO_PREFIX -export POCO_PREFIX=/usr/local -endif - -INSTALLDIR = $(DESTDIR)$(POCO_PREFIX) -COMPONENTS = Foundation XML Util Net - -.PHONY: all libs cppunit tests samples install - -all: libs tests samples - -libs: - $(MAKE) -C $(POCO_BASE)/Foundation - $(MAKE) -C $(POCO_BASE)/XML - $(MAKE) -C $(POCO_BASE)/Util - $(MAKE) -C $(POCO_BASE)/Net - -cppunit: - $(MAKE) -C $(POCO_BASE)/CppUnit - -tests: cppunit libs - $(MAKE) -C $(POCO_BASE)/Foundation/testsuite - $(MAKE) -C $(POCO_BASE)/XML/testsuite - $(MAKE) -C $(POCO_BASE)/Util/testsuite - $(MAKE) -C $(POCO_BASE)/Net/testsuite - -samples: libs - $(MAKE) -C $(POCO_BASE)/Foundation/samples - $(MAKE) -C $(POCO_BASE)/XML/samples - $(MAKE) -C $(POCO_BASE)/Util/samples - $(MAKE) -C $(POCO_BASE)/Net/samples - -install: libs - mkdir -p $(INSTALLDIR)/include/Poco - mkdir -p $(INSTALLDIR)/lib - for comp in $(COMPONENTS) ; do \ - cp -Rf $(POCO_BASE)/$$comp/include/* $(INSTALLDIR)/include/ ; \ - done - find $(POCO_BUILD)/lib -name "libPoco*" -exec cp -Rf {} $(INSTALLDIR)/lib \; +# +# Makefile +# +# The global Makefile for POCO [generated by mkrelease] +# + +sinclude config.make + +ifndef POCO_BASE +$(warning WARNING: POCO_BASE is not defined. Assuming current directory.) +export POCO_BASE=$(shell pwd) +endif + +ifndef POCO_PREFIX +export POCO_PREFIX=/usr/local +endif + +.PHONY: all libs cppunit tests samples install + +all: libs tests samples + +INSTALLDIR = $(DESTDIR)$(POCO_PREFIX) +COMPONENTS = Foundation XML Util Net + +cppunit: + $(MAKE) -C $(POCO_BASE)/CppUnit + +install: libs + mkdir -p $(INSTALLDIR)/include/Poco + mkdir -p $(INSTALLDIR)/lib + for comp in $(COMPONENTS) ; do \ + cp -Rf $(POCO_BASE)/$$comp/include/* $(INSTALLDIR)/include/ ; \ + done + find $(POCO_BUILD)/lib -name "libPoco*" -exec cp -Rf {} $(INSTALLDIR)/lib \; + +.PHONY: Foundation-lib XML-lib Util-lib Net-lib +.PHONY: Foundation-tests XML-tests Util-tests Net-tests +.PHONY: Foundation-samples XML-samples Util-samples Net-samples + +libs: Foundation-lib XML-lib Util-lib Net-lib +tests: Foundation-tests XML-tests Util-tests Net-tests +samples: Foundation-samples XML-samples Util-samples Net-samples + +Foundation-lib: + $(MAKE) -C $(POCO_BASE)/Foundation + +Foundation-tests: Foundation-lib cppunit + $(MAKE) -C $(POCO_BASE)/Foundation/testsuite + +Foundation-samples: Foundation-lib + $(MAKE) -C $(POCO_BASE)/Foundation/samples + +XML-lib: Foundation-lib + $(MAKE) -C $(POCO_BASE)/XML + +XML-tests: XML-lib cppunit + $(MAKE) -C $(POCO_BASE)/XML/testsuite + +XML-samples: XML-lib + $(MAKE) -C $(POCO_BASE)/XML/samples + +Util-lib: Foundation-lib XML-lib + $(MAKE) -C $(POCO_BASE)/Util + +Util-tests: Util-lib cppunit + $(MAKE) -C $(POCO_BASE)/Util/testsuite + +Util-samples: Util-lib + $(MAKE) -C $(POCO_BASE)/Util/samples + +Net-lib: Foundation-lib + $(MAKE) -C $(POCO_BASE)/Net + +Net-tests: Net-lib cppunit + $(MAKE) -C $(POCO_BASE)/Net/testsuite + +Net-samples: Net-lib + $(MAKE) -C $(POCO_BASE)/Net/samples diff --git a/NEWS b/NEWS index a1bb047a2..f44d0d8d4 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ -Release 1.2.2 (2006-09-01) +Release 1.2.3 (2006-09-14) ========================== -This release contains bugfixes only. +This release contains bugfixes and minor enchancements. See the CHANGELOG for details. @@ -124,4 +124,4 @@ Please refer to the README file for more information and instructions for building the libraries. -- -$Id: //poco/1.2/dist/NEWS#2 $ +$Id: //poco/1.2/dist/NEWS#4 $ diff --git a/Net/src/IPAddress.cpp b/Net/src/IPAddress.cpp index d207b024c..cdf76b5a2 100644 --- a/Net/src/IPAddress.cpp +++ b/Net/src/IPAddress.cpp @@ -1,7 +1,7 @@ // // IPAddress.cpp // -// $Id: //poco/1.2/Net/src/IPAddress.cpp#1 $ +// $Id: //poco/1.2/Net/src/IPAddress.cpp#2 $ // // Library: Net // Package: NetCore @@ -221,6 +221,7 @@ public: static IPv4AddressImpl* parse(const std::string& addr) { + if (addr.empty()) return 0; #if defined(_WIN32) struct in_addr ia; ia.s_addr = inet_addr(addr.c_str()); @@ -412,6 +413,7 @@ public: static IPv6AddressImpl* parse(const std::string& addr) { + if (addr.empty()) return 0; #if defined(_WIN32) struct addrinfo* pAI; struct addrinfo hints; diff --git a/Net/src/MailMessage.cpp b/Net/src/MailMessage.cpp index 184c54adf..0861821b7 100644 --- a/Net/src/MailMessage.cpp +++ b/Net/src/MailMessage.cpp @@ -1,7 +1,7 @@ // // MailMessage.cpp // -// $Id: //poco/1.2/Net/src/MailMessage.cpp#2 $ +// $Id: //poco/1.2/Net/src/MailMessage.cpp#3 $ // // Library: Net // Package: Mail @@ -444,6 +444,8 @@ void MailMessage::setRecipientHeaders(MessageHeader& headers) const case MailRecipient::CC_RECIPIENT: appendRecipient(*it, cc); break; + case MailRecipient::BCC_RECIPIENT: + break; } } if (!to.empty()) headers.set(HEADER_TO, to); diff --git a/Net/src/Socket.cpp b/Net/src/Socket.cpp index 7a931c1cd..324168427 100644 --- a/Net/src/Socket.cpp +++ b/Net/src/Socket.cpp @@ -1,7 +1,7 @@ // // Socket.cpp // -// $Id: //poco/1.2/Net/src/Socket.cpp#1 $ +// $Id: //poco/1.2/Net/src/Socket.cpp#2 $ // // Library: Net // Package: Sockets @@ -36,6 +36,7 @@ #include "Poco/Net/Socket.h" #include "Poco/Net/StreamSocketImpl.h" +#include "Poco/Timestamp.h" #include #include @@ -111,10 +112,26 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce nfd = int(it->sockfd()); FD_SET(it->sockfd(), &fdExcept); } - struct timeval tv; - tv.tv_sec = (long) timeout.totalSeconds(); - tv.tv_usec = (long) timeout.useconds(); - int rc = ::select(nfd + 1, &fdRead, &fdWrite, &fdExcept, &tv); + Poco::Timespan remainingTime(timeout); + int rc; + do + { + struct timeval tv; + tv.tv_sec = (long) remainingTime.totalSeconds(); + tv.tv_usec = (long) remainingTime.useconds(); + Poco::Timestamp start; + rc = ::select(nfd + 1, &fdRead, &fdWrite, &fdExcept, &tv); + if (rc < 0 && SocketImpl::lastError() == POCO_EINTR) + { + Poco::Timestamp end; + Poco::Timespan waited = end - start; + if (waited > remainingTime) + remainingTime -= waited; + else + remainingTime = 0; + } + } + while (rc < 0 && SocketImpl::lastError() == POCO_EINTR); if (rc < 0) SocketImpl::error(); SocketList readyReadList; diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index 38b164302..a62838641 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -1,7 +1,7 @@ // // SocketImpl.cpp // -// $Id: //poco/1.2/Net/src/SocketImpl.cpp#1 $ +// $Id: //poco/1.2/Net/src/SocketImpl.cpp#2 $ // // Library: Net // Package: Sockets @@ -38,6 +38,7 @@ #include "Poco/Net/NetException.h" #include "Poco/Net/StreamSocketImpl.h" #include "Poco/NumberFormatter.h" +#include "Poco/Timestamp.h" #include @@ -345,10 +346,26 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) { FD_SET(_sockfd, &fdExcept); } - struct timeval tv; - tv.tv_sec = (long) timeout.totalSeconds(); - tv.tv_usec = (long) timeout.useconds(); - int rc = ::select(int(_sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv); + Poco::Timespan remainingTime(timeout); + int rc; + do + { + struct timeval tv; + tv.tv_sec = (long) remainingTime.totalSeconds(); + tv.tv_usec = (long) remainingTime.useconds(); + Poco::Timestamp start; + rc = ::select(int(_sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv); + if (rc < 0 && lastError() == POCO_EINTR) + { + Poco::Timestamp end; + Poco::Timespan waited = end - start; + if (waited > remainingTime) + remainingTime -= waited; + else + remainingTime = 0; + } + } + while (rc < 0 && lastError() == POCO_EINTR); if (rc < 0) error(); return rc > 0; } diff --git a/VERSION b/VERSION index bcd7ef665..777319747 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2 (2006-09-01) +1.2.3 (2006-09-14) diff --git a/build_vs71.cmd b/build_vs71.cmd index e8abdf0c4..b99dca90a 100644 --- a/build_vs71.cmd +++ b/build_vs71.cmd @@ -1,13 +1,18 @@ @echo off rem -rem build.cmd +rem build_vs71.cmd rem -rem $Id: //poco/1.2/dist/build_vs71.cmd#1 $ -rem -rem command-line build script for VS 7.1 +rem command-line build script for VS 7.1 [generated by mkrelease] rem +rem Change OPENSSL_DIR to match your setup +set OPENSSL_DIR=c:\OpenSSL +set OPENSSL_INCLUDE=%OPENSSL_DIR%\include +set OPENSSL_LIB=%OPENSSL_DIR%\lib\VC +set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE% +set LIB=%LIB%;%OPENSSL_LIB% + cd CppUnit devenv /useenv /rebuild debug_shared CppUnit_vs71.sln devenv /useenv /rebuild release_shared CppUnit_vs71.sln diff --git a/build_vs80.cmd b/build_vs80.cmd index c70db962d..c52d353db 100644 --- a/build_vs80.cmd +++ b/build_vs80.cmd @@ -1,13 +1,18 @@ @echo off rem -rem build.cmd +rem build_vs80.cmd rem -rem $Id: //poco/1.2/dist/build_vs80.cmd#1 $ -rem -rem command-line build script for VS 8.0 +rem command-line build script for VS 8 [generated by mkrelease] rem +rem Change OPENSSL_DIR to match your setup +set OPENSSL_DIR=c:\OpenSSL +set OPENSSL_INCLUDE=%OPENSSL_DIR%\include +set OPENSSL_LIB=%OPENSSL_DIR%\lib\VC +set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE% +set LIB=%LIB%;%OPENSSL_LIB% + cd CppUnit devenv /useenv /rebuild debug_shared CppUnit_vs80.sln devenv /useenv /rebuild release_shared CppUnit_vs80.sln diff --git a/configure b/configure index 8663ce1e5..24534a57e 100644 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ # # configure # -# $Id: //poco/1.2/dist/configure#1 $ +# $Id: //poco/1.2/dist/configure#3 $ # # Configuration script for POCO. # @@ -56,23 +56,29 @@ while [ "$1" != "" ] ; do shift done -# copy Makefile to build dir -if [ "$base" != "$build" ] ; then - cp $base/Makefile $build -fi - if [ "$config" = "" ] ; then config=`uname` cyg=`expr $config : '\(CYGWIN\).*'` - if [ "$cyg" != "" ] ; then + if [ "$cyg" = "CYGWIN" ] ; then config=CYGWIN fi fi +if [ ! -f "$base/build/config/$config" ] ; then + echo "Unknown configuration: $config" + echo "Please use the --config option to specify another build configuration" + exit 1 +fi + if [ "$prefix" = "" ] ; then prefix=/usr/local fi +# copy Makefile to build dir +if [ "$base" != "$build" ] ; then + cp $base/Makefile $build +fi + # create config.make echo '# config.make generated by configure script' >$build/config.make echo "POCO_CONFIG = $config" >> $build/config.make