mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
integrated changes for 1.2.3
This commit is contained in:
parent
0a517d5e30
commit
a01116ca11
18
CHANGELOG
18
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 $
|
||||
|
71
Foundation/include/Poco/AbstractObserver.h
Normal file
71
Foundation/include/Poco/AbstractObserver.h
Normal 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
|
135
Foundation/include/Poco/NObserver.h
Normal file
135
Foundation/include/Poco/NObserver.h
Normal 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
|
@ -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<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:
|
||||
NotificationCenter();
|
||||
@ -102,6 +110,8 @@ public:
|
||||
/// Usage:
|
||||
/// Observer<MyClass, MyNotification> 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.
|
||||
|
@ -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 C, class N>
|
||||
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*);
|
||||
|
72
Foundation/include/Poco/SharedLibrary_WIN32U.h
Normal file
72
Foundation/include/Poco/SharedLibrary_WIN32U.h
Normal 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
|
@ -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* ()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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 {
|
@ -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 <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__)
|
||||
#include <semaphore.h>
|
||||
#else
|
||||
@ -45,7 +46,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
#include <errno.h>
|
||||
#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
|
||||
}
|
||||
|
||||
|
@ -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 <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#if defined(sun) || defined(__APPLE__) || defined(__osf__)
|
||||
#include <semaphore.h>
|
||||
#else
|
||||
@ -45,7 +46,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
#include <errno.h>
|
||||
#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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
5
MANIFEST
5
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
|
||||
|
132
Makefile
132
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
|
||||
|
6
NEWS
6
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 $
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 <algorithm>
|
||||
#include <string.h>
|
||||
|
||||
@ -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;
|
||||
|
@ -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 <string.h>
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
20
configure
vendored
20
configure
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user