integrated changes for 1.2.3

This commit is contained in:
Guenter Obiltschnig 2006-09-14 16:46:36 +00:00
parent 0a517d5e30
commit a01116ca11
25 changed files with 550 additions and 136 deletions

View File

@ -1,5 +1,21 @@
This is the changelog file for POCO - the C++ Portable Components. 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) 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 $

View File

@ -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

View File

@ -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 C, class N>
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<N> 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<N*>(pNf);
if (pCastNf)
{
NotificationPtr ptr(pCastNf, true);
(_pObject->*_method)(ptr);
}
}
bool equals(const AbstractObserver& abstractObserver) const
{
const NObserver* pObs = dynamic_cast<const NObserver*>(&abstractObserver);
return pObs && pObs->_pObject == _pObject && pObs->_method == _method;
}
bool accepts(Notification* pNf) const
{
return dynamic_cast<N*>(pNf) != 0;
}
AbstractObserver* clone() const
{
return new NObserver(*this);
}
private:
NObserver();
C* _pObject;
Callback _method;
};
} // namespace Poco
#endif // Foundation_NObserver_INCLUDED

View File

@ -1,7 +1,7 @@
// //
// NotificationCenter.h // NotificationCenter.h
// //
// $Id: //poco/1.2/Foundation/include/Poco/NotificationCenter.h#1 $ // $Id: //poco/1.2/Foundation/include/Poco/NotificationCenter.h#2 $
// //
// Library: Foundation // Library: Foundation
// Package: Notifications // Package: Notifications
@ -89,6 +89,14 @@ class Foundation_API NotificationCenter
/// AutoPtr<MyNotification> nf(pNf); /// AutoPtr<MyNotification> 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<MyNotification>& pNf)
/// {
/// ...
/// }
{ {
public: public:
NotificationCenter(); NotificationCenter();
@ -102,6 +110,8 @@ public:
/// Usage: /// Usage:
/// Observer<MyClass, MyNotification> obs(*this, &MyClass::handleNotification); /// Observer<MyClass, MyNotification> obs(*this, &MyClass::handleNotification);
/// notificationCenter.addObserver(obs); /// notificationCenter.addObserver(obs);
///
/// Alternatively, the NObserver template class can be used instead of Observer.
void removeObserver(const AbstractObserver& observer); void removeObserver(const AbstractObserver& observer);
/// Unregisters an observer with the NotificationCenter. /// Unregisters an observer with the NotificationCenter.

View File

@ -1,13 +1,13 @@
// //
// Observer.h // Observer.h
// //
// $Id: //poco/1.2/Foundation/include/Poco/Observer.h#1 $ // $Id: //poco/1.2/Foundation/include/Poco/Observer.h#2 $
// //
// Library: Foundation // Library: Foundation
// Package: Notifications // Package: Notifications
// Module: NotificationCenter // Module: NotificationCenter
// //
// Definition of the Observer class. // Definition of the Observer class template.
// //
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
@ -41,30 +41,12 @@
#include "Poco/Foundation.h" #include "Poco/Foundation.h"
#include "Poco/Notification.h" #include "Poco/AbstractObserver.h"
namespace Poco { 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 C, class N> template <class C, class N>
class Observer: public AbstractObserver class Observer: public AbstractObserver
/// This template class implements an adapter that sits between /// This template class implements an adapter that sits between
@ -74,6 +56,11 @@ class Observer: public AbstractObserver
/// specific additional methods. /// specific additional methods.
/// See the NotificationCenter class for information on how /// See the NotificationCenter class for information on how
/// to use this template class. /// 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: public:
typedef void (C::*Callback)(N*); typedef void (C::*Callback)(N*);

View File

@ -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

View File

@ -1,7 +1,7 @@
// //
// SharedPtr.h // SharedPtr.h
// //
// $Id: //poco/1.2/Foundation/include/Poco/SharedPtr.h#1 $ // $Id: //poco/1.2/Foundation/include/Poco/SharedPtr.h#2 $
// //
// Library: Foundation // Library: Foundation
// Package: Core // Package: Core
@ -209,6 +209,11 @@ public:
{ {
return _ptr; return _ptr;
} }
bool isNull() const
{
return (_ptr == 0);
}
operator C* () operator C* ()
{ {

View File

@ -1,7 +1,7 @@
// //
// ThreadLocal.h // ThreadLocal.h
// //
// $Id: //poco/1.2/Foundation/include/Poco/ThreadLocal.h#1 $ // $Id: //poco/1.2/Foundation/include/Poco/ThreadLocal.h#2 $
// //
// Library: Foundation // Library: Foundation
// Package: Threading // Package: Threading
@ -65,7 +65,8 @@ class TLSSlot: public TLSAbstractSlot
/// must not create instances of it yourself. /// must not create instances of it yourself.
{ {
public: public:
TLSSlot() TLSSlot():
_value()
{ {
} }

View File

@ -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 // Library: Foundation
// Package: Notifications // Package: Notifications
@ -34,7 +34,7 @@
// //
#include "Poco/Observer.h" #include "Poco/AbstractObserver.h"
namespace Poco { namespace Poco {

View File

@ -1,7 +1,7 @@
// //
// NamedEvent_UNIX.cpp // 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 // Library: Foundation
// Package: Processes // Package: Processes
@ -38,6 +38,7 @@
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h>
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__)
#include <semaphore.h> #include <semaphore.h>
#else #else
@ -45,7 +46,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/sem.h> #include <sys/sem.h>
#include <errno.h>
#endif #endif
@ -120,7 +120,7 @@ void NamedEventImpl::setImpl()
struct sembuf op; struct sembuf op;
op.sem_num = 0; op.sem_num = 0;
op.sem_op = 1; op.sem_op = 1;
op.sem_flg = SEM_UNDO; op.sem_flg = 0;
if (semop(_semid, &op, 1) != 0) if (semop(_semid, &op, 1) != 0)
throw SystemException("cannot set named event", _name); throw SystemException("cannot set named event", _name);
#endif #endif
@ -130,15 +130,25 @@ void NamedEventImpl::setImpl()
void NamedEventImpl::waitImpl() void NamedEventImpl::waitImpl()
{ {
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__)
if (sem_wait(_sem) != 0) int err;
throw SystemException("cannot wait for named event", _name); do
{
err = sem_wait(_sem);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot wait for named event", _name);
#else #else
struct sembuf op; struct sembuf op;
op.sem_num = 0; op.sem_num = 0;
op.sem_op = -1; op.sem_op = -1;
op.sem_flg = SEM_UNDO; op.sem_flg = 0;
if (semop(_semid, &op, 1) != 0) int err;
throw SystemException("cannot wait for named event", _name); do
{
err = semop(_semid, &op, 1);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot wait for named event", _name);
#endif #endif
} }

View File

@ -1,7 +1,7 @@
// //
// NamedMutex_UNIX.cpp // 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 // Library: Foundation
// Package: Processes // Package: Processes
@ -38,6 +38,7 @@
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h>
#if defined(sun) || defined(__APPLE__) || defined(__osf__) #if defined(sun) || defined(__APPLE__) || defined(__osf__)
#include <semaphore.h> #include <semaphore.h>
#else #else
@ -45,7 +46,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/sem.h> #include <sys/sem.h>
#include <errno.h>
#endif #endif
@ -114,15 +114,25 @@ NamedMutexImpl::~NamedMutexImpl()
void NamedMutexImpl::lockImpl() void NamedMutexImpl::lockImpl()
{ {
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) #if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__)
if (sem_wait(_sem) != 0) int err;
throw SystemException("cannot lock named mutex", _name); do
{
err = sem_wait(_sem);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot lock named mutex", _name);
#else #else
struct sembuf op; struct sembuf op;
op.sem_num = 0; op.sem_num = 0;
op.sem_op = -1; op.sem_op = -1;
op.sem_flg = SEM_UNDO; op.sem_flg = SEM_UNDO;
if (semop(_semid, &op, 1) != 0) int err;
throw SystemException("cannot lock named mutex", _name); do
{
err = semop(_semid, &op, 1);
}
while (err && errno == EINTR);
if (err) throw SystemException("cannot lock named mutex", _name);
#endif #endif
} }

View File

@ -1,7 +1,7 @@
// //
// PipeImpl_POSIX.cpp // 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 // Library: Foundation
// Package: Processes // Package: Processes
@ -67,7 +67,12 @@ int PipeImpl::writeBytes(const void* buffer, int length)
{ {
poco_assert (_writefd != -1); 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) if (n >= 0)
return n; return n;
else else
@ -79,7 +84,12 @@ int PipeImpl::readBytes(void* buffer, int length)
{ {
poco_assert (_readfd != -1); 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) if (n >= 0)
return n; return n;
else else

View File

@ -1,7 +1,7 @@
// //
// Process_UNIX.cpp // 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 // Library: Foundation
// Package: Processes // Package: Processes
@ -79,7 +79,13 @@ pid_t ProcessHandleImpl::id() const
int ProcessHandleImpl::wait() const int ProcessHandleImpl::wait() const
{ {
int status; 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)); throw SystemException("Cannot wait for process", NumberFormatter::format(_pid));
return WEXITSTATUS(status); return WEXITSTATUS(status);
} }

View File

@ -1,7 +1,7 @@
// //
// Random.cpp // Random.cpp
// //
// $Id: //poco/1.2/Foundation/src/Random.cpp#1 $ // $Id: //poco/1.2/Foundation/src/Random.cpp#2 $
// //
// Library: Foundation // Library: Foundation
// Package: Crypt // Package: Crypt
@ -182,7 +182,7 @@ Random::Random(int stateSize)
Random::~Random() Random::~Random()
{ {
delete _pBuffer; delete [] _pBuffer;
} }

View File

@ -116,6 +116,7 @@ Foundation/include/Poco
Foundation/include/Poco/AbstractCache.h Foundation/include/Poco/AbstractCache.h
Foundation/include/Poco/AbstractDelegate.h Foundation/include/Poco/AbstractDelegate.h
Foundation/include/Poco/AbstractEvent.h Foundation/include/Poco/AbstractEvent.h
Foundation/include/Poco/AbstractObserver.h
Foundation/include/Poco/AbstractPriorityDelegate.h Foundation/include/Poco/AbstractPriorityDelegate.h
Foundation/include/Poco/AbstractStrategy.h Foundation/include/Poco/AbstractStrategy.h
Foundation/include/Poco/ActiveDispatcher.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_WIN32.h
Foundation/include/Poco/NamedMutex_WIN32U.h Foundation/include/Poco/NamedMutex_WIN32U.h
Foundation/include/Poco/NestedDiagnosticContext.h Foundation/include/Poco/NestedDiagnosticContext.h
Foundation/include/Poco/NObserver.h
Foundation/include/Poco/Notification.h Foundation/include/Poco/Notification.h
Foundation/include/Poco/NotificationCenter.h Foundation/include/Poco/NotificationCenter.h
Foundation/include/Poco/NotificationQueue.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_UNIX.h
Foundation/include/Poco/SharedLibrary_VMS.h Foundation/include/Poco/SharedLibrary_VMS.h
Foundation/include/Poco/SharedLibrary_WIN32.h Foundation/include/Poco/SharedLibrary_WIN32.h
Foundation/include/Poco/SharedLibrary_WIN32U.h
Foundation/include/Poco/SharedPtr.h Foundation/include/Poco/SharedPtr.h
Foundation/include/Poco/SignalHandler.h Foundation/include/Poco/SignalHandler.h
Foundation/include/Poco/SimpleFileChannel.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_vs71.vcproj
Foundation/samples/uuidgen/uuidgen_vs80.vcproj Foundation/samples/uuidgen/uuidgen_vs80.vcproj
Foundation/src Foundation/src
Foundation/src/AbstractObserver.cpp
Foundation/src/ActiveDispatcher.cpp Foundation/src/ActiveDispatcher.cpp
Foundation/src/adler32.c Foundation/src/adler32.c
Foundation/src/ArchiveStrategy.cpp Foundation/src/ArchiveStrategy.cpp
@ -603,7 +607,6 @@ Foundation/src/NullChannel.cpp
Foundation/src/NullStream.cpp Foundation/src/NullStream.cpp
Foundation/src/NumberFormatter.cpp Foundation/src/NumberFormatter.cpp
Foundation/src/NumberParser.cpp Foundation/src/NumberParser.cpp
Foundation/src/Observer.cpp
Foundation/src/OpcomChannel.cpp Foundation/src/OpcomChannel.cpp
Foundation/src/Path.cpp Foundation/src/Path.cpp
Foundation/src/Path_UNIX.cpp Foundation/src/Path_UNIX.cpp

132
Makefile
View File

@ -1,54 +1,78 @@
# #
# Makefile # Makefile
# #
# $Id: //poco/1.2/dist/Makefile#1 $ # The global Makefile for POCO [generated by mkrelease]
# #
# Makefile for Poco
# sinclude config.make
sinclude config.make ifndef POCO_BASE
$(warning WARNING: POCO_BASE is not defined. Assuming current directory.)
ifndef POCO_BASE export POCO_BASE=$(shell pwd)
$(warning WARNING: POCO_BASE is not defined. Assuming current directory.) endif
export POCO_BASE=$(shell pwd)
endif ifndef POCO_PREFIX
export POCO_PREFIX=/usr/local
ifndef POCO_PREFIX endif
export POCO_PREFIX=/usr/local
endif .PHONY: all libs cppunit tests samples install
INSTALLDIR = $(DESTDIR)$(POCO_PREFIX) all: libs tests samples
COMPONENTS = Foundation XML Util Net
INSTALLDIR = $(DESTDIR)$(POCO_PREFIX)
.PHONY: all libs cppunit tests samples install COMPONENTS = Foundation XML Util Net
all: libs tests samples cppunit:
$(MAKE) -C $(POCO_BASE)/CppUnit
libs:
$(MAKE) -C $(POCO_BASE)/Foundation install: libs
$(MAKE) -C $(POCO_BASE)/XML mkdir -p $(INSTALLDIR)/include/Poco
$(MAKE) -C $(POCO_BASE)/Util mkdir -p $(INSTALLDIR)/lib
$(MAKE) -C $(POCO_BASE)/Net for comp in $(COMPONENTS) ; do \
cp -Rf $(POCO_BASE)/$$comp/include/* $(INSTALLDIR)/include/ ; \
cppunit: done
$(MAKE) -C $(POCO_BASE)/CppUnit find $(POCO_BUILD)/lib -name "libPoco*" -exec cp -Rf {} $(INSTALLDIR)/lib \;
tests: cppunit libs .PHONY: Foundation-lib XML-lib Util-lib Net-lib
$(MAKE) -C $(POCO_BASE)/Foundation/testsuite .PHONY: Foundation-tests XML-tests Util-tests Net-tests
$(MAKE) -C $(POCO_BASE)/XML/testsuite .PHONY: Foundation-samples XML-samples Util-samples Net-samples
$(MAKE) -C $(POCO_BASE)/Util/testsuite
$(MAKE) -C $(POCO_BASE)/Net/testsuite libs: Foundation-lib XML-lib Util-lib Net-lib
tests: Foundation-tests XML-tests Util-tests Net-tests
samples: libs samples: Foundation-samples XML-samples Util-samples Net-samples
$(MAKE) -C $(POCO_BASE)/Foundation/samples
$(MAKE) -C $(POCO_BASE)/XML/samples Foundation-lib:
$(MAKE) -C $(POCO_BASE)/Util/samples $(MAKE) -C $(POCO_BASE)/Foundation
$(MAKE) -C $(POCO_BASE)/Net/samples
Foundation-tests: Foundation-lib cppunit
install: libs $(MAKE) -C $(POCO_BASE)/Foundation/testsuite
mkdir -p $(INSTALLDIR)/include/Poco
mkdir -p $(INSTALLDIR)/lib Foundation-samples: Foundation-lib
for comp in $(COMPONENTS) ; do \ $(MAKE) -C $(POCO_BASE)/Foundation/samples
cp -Rf $(POCO_BASE)/$$comp/include/* $(INSTALLDIR)/include/ ; \
done XML-lib: Foundation-lib
find $(POCO_BUILD)/lib -name "libPoco*" -exec cp -Rf {} $(INSTALLDIR)/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

6
NEWS
View File

@ -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. See the CHANGELOG for details.
@ -124,4 +124,4 @@ Please refer to the README file for more information and instructions for
building the libraries. building the libraries.
-- --
$Id: //poco/1.2/dist/NEWS#2 $ $Id: //poco/1.2/dist/NEWS#4 $

View File

@ -1,7 +1,7 @@
// //
// IPAddress.cpp // IPAddress.cpp
// //
// $Id: //poco/1.2/Net/src/IPAddress.cpp#1 $ // $Id: //poco/1.2/Net/src/IPAddress.cpp#2 $
// //
// Library: Net // Library: Net
// Package: NetCore // Package: NetCore
@ -221,6 +221,7 @@ public:
static IPv4AddressImpl* parse(const std::string& addr) static IPv4AddressImpl* parse(const std::string& addr)
{ {
if (addr.empty()) return 0;
#if defined(_WIN32) #if defined(_WIN32)
struct in_addr ia; struct in_addr ia;
ia.s_addr = inet_addr(addr.c_str()); ia.s_addr = inet_addr(addr.c_str());
@ -412,6 +413,7 @@ public:
static IPv6AddressImpl* parse(const std::string& addr) static IPv6AddressImpl* parse(const std::string& addr)
{ {
if (addr.empty()) return 0;
#if defined(_WIN32) #if defined(_WIN32)
struct addrinfo* pAI; struct addrinfo* pAI;
struct addrinfo hints; struct addrinfo hints;

View File

@ -1,7 +1,7 @@
// //
// MailMessage.cpp // MailMessage.cpp
// //
// $Id: //poco/1.2/Net/src/MailMessage.cpp#2 $ // $Id: //poco/1.2/Net/src/MailMessage.cpp#3 $
// //
// Library: Net // Library: Net
// Package: Mail // Package: Mail
@ -444,6 +444,8 @@ void MailMessage::setRecipientHeaders(MessageHeader& headers) const
case MailRecipient::CC_RECIPIENT: case MailRecipient::CC_RECIPIENT:
appendRecipient(*it, cc); appendRecipient(*it, cc);
break; break;
case MailRecipient::BCC_RECIPIENT:
break;
} }
} }
if (!to.empty()) headers.set(HEADER_TO, to); if (!to.empty()) headers.set(HEADER_TO, to);

View File

@ -1,7 +1,7 @@
// //
// Socket.cpp // Socket.cpp
// //
// $Id: //poco/1.2/Net/src/Socket.cpp#1 $ // $Id: //poco/1.2/Net/src/Socket.cpp#2 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@ -36,6 +36,7 @@
#include "Poco/Net/Socket.h" #include "Poco/Net/Socket.h"
#include "Poco/Net/StreamSocketImpl.h" #include "Poco/Net/StreamSocketImpl.h"
#include "Poco/Timestamp.h"
#include <algorithm> #include <algorithm>
#include <string.h> #include <string.h>
@ -111,10 +112,26 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce
nfd = int(it->sockfd()); nfd = int(it->sockfd());
FD_SET(it->sockfd(), &fdExcept); FD_SET(it->sockfd(), &fdExcept);
} }
struct timeval tv; Poco::Timespan remainingTime(timeout);
tv.tv_sec = (long) timeout.totalSeconds(); int rc;
tv.tv_usec = (long) timeout.useconds(); do
int rc = ::select(nfd + 1, &fdRead, &fdWrite, &fdExcept, &tv); {
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(); if (rc < 0) SocketImpl::error();
SocketList readyReadList; SocketList readyReadList;

View File

@ -1,7 +1,7 @@
// //
// SocketImpl.cpp // SocketImpl.cpp
// //
// $Id: //poco/1.2/Net/src/SocketImpl.cpp#1 $ // $Id: //poco/1.2/Net/src/SocketImpl.cpp#2 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@ -38,6 +38,7 @@
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include "Poco/Net/StreamSocketImpl.h" #include "Poco/Net/StreamSocketImpl.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/Timestamp.h"
#include <string.h> #include <string.h>
@ -345,10 +346,26 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
{ {
FD_SET(_sockfd, &fdExcept); FD_SET(_sockfd, &fdExcept);
} }
struct timeval tv; Poco::Timespan remainingTime(timeout);
tv.tv_sec = (long) timeout.totalSeconds(); int rc;
tv.tv_usec = (long) timeout.useconds(); do
int rc = ::select(int(_sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv); {
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(); if (rc < 0) error();
return rc > 0; return rc > 0;
} }

View File

@ -1 +1 @@
1.2.2 (2006-09-01) 1.2.3 (2006-09-14)

View File

@ -1,13 +1,18 @@
@echo off @echo off
rem rem
rem build.cmd rem build_vs71.cmd
rem rem
rem $Id: //poco/1.2/dist/build_vs71.cmd#1 $ rem command-line build script for VS 7.1 [generated by mkrelease]
rem
rem command-line build script for VS 7.1
rem 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 cd CppUnit
devenv /useenv /rebuild debug_shared CppUnit_vs71.sln devenv /useenv /rebuild debug_shared CppUnit_vs71.sln
devenv /useenv /rebuild release_shared CppUnit_vs71.sln devenv /useenv /rebuild release_shared CppUnit_vs71.sln

View File

@ -1,13 +1,18 @@
@echo off @echo off
rem rem
rem build.cmd rem build_vs80.cmd
rem rem
rem $Id: //poco/1.2/dist/build_vs80.cmd#1 $ rem command-line build script for VS 8 [generated by mkrelease]
rem
rem command-line build script for VS 8.0
rem 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 cd CppUnit
devenv /useenv /rebuild debug_shared CppUnit_vs80.sln devenv /useenv /rebuild debug_shared CppUnit_vs80.sln
devenv /useenv /rebuild release_shared CppUnit_vs80.sln devenv /useenv /rebuild release_shared CppUnit_vs80.sln

20
configure vendored
View File

@ -2,7 +2,7 @@
# #
# configure # configure
# #
# $Id: //poco/1.2/dist/configure#1 $ # $Id: //poco/1.2/dist/configure#3 $
# #
# Configuration script for POCO. # Configuration script for POCO.
# #
@ -56,23 +56,29 @@ while [ "$1" != "" ] ; do
shift shift
done done
# copy Makefile to build dir
if [ "$base" != "$build" ] ; then
cp $base/Makefile $build
fi
if [ "$config" = "" ] ; then if [ "$config" = "" ] ; then
config=`uname` config=`uname`
cyg=`expr $config : '\(CYGWIN\).*'` cyg=`expr $config : '\(CYGWIN\).*'`
if [ "$cyg" != "" ] ; then if [ "$cyg" = "CYGWIN" ] ; then
config=CYGWIN config=CYGWIN
fi fi
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 if [ "$prefix" = "" ] ; then
prefix=/usr/local prefix=/usr/local
fi fi
# copy Makefile to build dir
if [ "$base" != "$build" ] ; then
cp $base/Makefile $build
fi
# create config.make # create config.make
echo '# config.make generated by configure script' >$build/config.make echo '# config.make generated by configure script' >$build/config.make
echo "POCO_CONFIG = $config" >> $build/config.make echo "POCO_CONFIG = $config" >> $build/config.make