AbstractConfiguration.h | AbstractConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// AbstractConfiguration.h | // AbstractConfiguration.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/AbstractConfiguration.h#1 $ | // $Id: //poco/1.4/Util/include/Poco/Util/AbstractConfiguration.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Configuration | // Package: Configuration | |||
// Module: AbstractConfiguration | // Module: AbstractConfiguration | |||
// | // | |||
// Definition of the AbstractConfiguration class. | // Definition of the AbstractConfiguration class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 259 | skipping to change at line 259 | |||
/// nothing is changed. | /// nothing is changed. | |||
/// | /// | |||
/// If a circular property reference is detected, a | /// If a circular property reference is detected, a | |||
/// CircularReferenceException will be thrown. | /// CircularReferenceException will be thrown. | |||
void remove(const std::string& key); | void remove(const std::string& key); | |||
/// Removes the property with the given key. | /// Removes the property with the given key. | |||
/// | /// | |||
/// Does nothing if the key does not exist. | /// Does nothing if the key does not exist. | |||
void enableEvents(bool enable = true); | ||||
/// Enables (or disables) events. | ||||
bool eventsEnabled() const; | ||||
/// Returns true iff events are enabled. | ||||
protected: | protected: | |||
virtual bool getRaw(const std::string& key, std::string& value) cons t = 0; | virtual bool getRaw(const std::string& key, std::string& value) cons t = 0; | |||
/// If the property with the given key exists, stores the pr operty's value | /// If the property with the given key exists, stores the pr operty's value | |||
/// in value and returns true. Otherwise, returns false. | /// in value and returns true. Otherwise, returns false. | |||
/// | /// | |||
/// Must be overridden by subclasses. | /// Must be overridden by subclasses. | |||
virtual void setRaw(const std::string& key, const std::string& value ) = 0; | virtual void setRaw(const std::string& key, const std::string& value ) = 0; | |||
/// Sets the property with the given key to the given value. | /// Sets the property with the given key to the given value. | |||
/// An already existing value for the key is overwritten. | /// An already existing value for the key is overwritten. | |||
skipping to change at line 298 | skipping to change at line 304 | |||
virtual ~AbstractConfiguration(); | virtual ~AbstractConfiguration(); | |||
private: | private: | |||
std::string internalExpand(const std::string& value) const; | std::string internalExpand(const std::string& value) const; | |||
std::string uncheckedExpand(const std::string& value) const; | std::string uncheckedExpand(const std::string& value) const; | |||
AbstractConfiguration(const AbstractConfiguration&); | AbstractConfiguration(const AbstractConfiguration&); | |||
AbstractConfiguration& operator = (const AbstractConfiguration&); | AbstractConfiguration& operator = (const AbstractConfiguration&); | |||
mutable int _depth; | mutable int _depth; | |||
bool _eventsEnabled; | ||||
mutable Poco::FastMutex _mutex; | mutable Poco::FastMutex _mutex; | |||
friend class LayeredConfiguration; | friend class LayeredConfiguration; | |||
friend class ConfigurationView; | friend class ConfigurationView; | |||
friend class ConfigurationMapper; | friend class ConfigurationMapper; | |||
}; | }; | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
#endif // Util_AbstractConfiguration_INCLUDED | #endif // Util_AbstractConfiguration_INCLUDED | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 8 lines changed or added | |||
AtomicCounter.h | AtomicCounter.h | |||
---|---|---|---|---|
// | // | |||
// AtomicCounter.h | // AtomicCounter.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/AtomicCounter.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/AtomicCounter.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: AtomicCounter | // Module: AtomicCounter | |||
// | // | |||
// Definition of the AtomicCounter class. | // Definition of the AtomicCounter class. | |||
// | // | |||
// Copyright (c) 2009, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 46 | skipping to change at line 46 | |||
// | // | |||
#ifndef Foundation_AtomicCounter_INCLUDED | #ifndef Foundation_AtomicCounter_INCLUDED | |||
#define Foundation_AtomicCounter_INCLUDED | #define Foundation_AtomicCounter_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#if POCO_OS == POCO_OS_WINDOWS_NT | #if POCO_OS == POCO_OS_WINDOWS_NT | |||
#include "Poco/UnWindows.h" | #include "Poco/UnWindows.h" | |||
#elif POCO_OS == POCO_OS_MAC_OS_X | #elif POCO_OS == POCO_OS_MAC_OS_X | |||
#include <libkern/OSAtomic.h> | #include <libkern/OSAtomic.h> | |||
#elif ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) || __GNUC__ > 4) && (define | ||||
d(__x86_64__) || defined(__i386__)) | ||||
#if !defined(POCO_HAVE_GCC_ATOMICS) | ||||
#define POCO_HAVE_GCC_ATOMICS | ||||
#endif | ||||
#else | #else | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#endif // POCO_OS | #endif // POCO_OS | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API AtomicCounter | class Foundation_API AtomicCounter | |||
/// This class implements a simple counter, which | /// This class implements a simple counter, which | |||
/// provides atomic operations that are safe to | /// provides atomic operations that are safe to | |||
/// use in a multithreaded environment. | /// use in a multithreaded environment. | |||
skipping to change at line 70 | skipping to change at line 74 | |||
/// On some platforms, the implementation of AtomicCounter | /// On some platforms, the implementation of AtomicCounter | |||
/// is based on atomic primitives specific to the platform | /// is based on atomic primitives specific to the platform | |||
/// (such as InterlockedIncrement, etc. on Windows), and | /// (such as InterlockedIncrement, etc. on Windows), and | |||
/// thus very efficient. On platforms that do not support | /// thus very efficient. On platforms that do not support | |||
/// atomic primitives, operations are guarded by a FastMutex. | /// atomic primitives, operations are guarded by a FastMutex. | |||
/// | /// | |||
/// The following platforms currently have atomic | /// The following platforms currently have atomic | |||
/// primitives: | /// primitives: | |||
/// - Windows | /// - Windows | |||
/// - Mac OS X | /// - Mac OS X | |||
/// - GCC 4.1+ (Intel platforms only) | ||||
{ | { | |||
public: | public: | |||
typedef int ValueType; /// The underlying integer type. | typedef int ValueType; /// The underlying integer type. | |||
AtomicCounter(); | AtomicCounter(); | |||
/// Creates a new AtomicCounter and initializes it to zero. | /// Creates a new AtomicCounter and initializes it to zero. | |||
explicit AtomicCounter(ValueType initialValue); | explicit AtomicCounter(ValueType initialValue); | |||
/// Creates a new AtomicCounter and initializes it with | /// Creates a new AtomicCounter and initializes it with | |||
/// the given value. | /// the given value. | |||
skipping to change at line 119 | skipping to change at line 124 | |||
/// Decrements the counter and returns the previous value. | /// Decrements the counter and returns the previous value. | |||
bool operator ! () const; | bool operator ! () const; | |||
/// Returns true if the counter is zero, false otherwise. | /// Returns true if the counter is zero, false otherwise. | |||
private: | private: | |||
#if POCO_OS == POCO_OS_WINDOWS_NT | #if POCO_OS == POCO_OS_WINDOWS_NT | |||
typedef volatile LONG ImplType; | typedef volatile LONG ImplType; | |||
#elif POCO_OS == POCO_OS_MAC_OS_X | #elif POCO_OS == POCO_OS_MAC_OS_X | |||
typedef int32_t ImplType; | typedef int32_t ImplType; | |||
#elif defined(POCO_HAVE_GCC_ATOMICS) | ||||
typedef int ImplType; | ||||
#else // generic implementation based on FastMutex | #else // generic implementation based on FastMutex | |||
struct ImplType | struct ImplType | |||
{ | { | |||
mutable FastMutex mutex; | mutable FastMutex mutex; | |||
volatile int value; | volatile int value; | |||
}; | }; | |||
#endif // POCO_OS | #endif // POCO_OS | |||
ImplType _counter; | ImplType _counter; | |||
}; | }; | |||
skipping to change at line 216 | skipping to change at line 223 | |||
{ | { | |||
ValueType result = OSAtomicDecrement32(&_counter); | ValueType result = OSAtomicDecrement32(&_counter); | |||
return ++result; | return ++result; | |||
} | } | |||
inline bool AtomicCounter::operator ! () const | inline bool AtomicCounter::operator ! () const | |||
{ | { | |||
return _counter == 0; | return _counter == 0; | |||
} | } | |||
#elif defined(POCO_HAVE_GCC_ATOMICS) | ||||
// | ||||
// GCC 4.1+ atomic builtins. | ||||
// | ||||
inline AtomicCounter::operator AtomicCounter::ValueType () const | ||||
{ | ||||
return _counter; | ||||
} | ||||
inline AtomicCounter::ValueType AtomicCounter::value() const | ||||
{ | ||||
return _counter; | ||||
} | ||||
inline AtomicCounter::ValueType AtomicCounter::operator ++ () // prefix | ||||
{ | ||||
return __sync_add_and_fetch(&_counter, 1); | ||||
} | ||||
inline AtomicCounter::ValueType AtomicCounter::operator ++ (int) // postfix | ||||
{ | ||||
return __sync_fetch_and_add(&_counter, 1); | ||||
} | ||||
inline AtomicCounter::ValueType AtomicCounter::operator -- () // prefix | ||||
{ | ||||
return __sync_sub_and_fetch(&_counter, 1); | ||||
} | ||||
inline AtomicCounter::ValueType AtomicCounter::operator -- (int) // postfix | ||||
{ | ||||
return __sync_fetch_and_sub(&_counter, 1); | ||||
} | ||||
inline bool AtomicCounter::operator ! () const | ||||
{ | ||||
return _counter == 0; | ||||
} | ||||
#else | #else | |||
// | // | |||
// Generic implementation based on FastMutex | // Generic implementation based on FastMutex | |||
// | // | |||
inline AtomicCounter::operator AtomicCounter::ValueType () const | inline AtomicCounter::operator AtomicCounter::ValueType () const | |||
{ | { | |||
ValueType result; | ValueType result; | |||
{ | { | |||
FastMutex::ScopedLock lock(_counter.mutex); | FastMutex::ScopedLock lock(_counter.mutex); | |||
result = _counter.value; | result = _counter.value; | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 48 lines changed or added | |||
Buffer.h | Buffer.h | |||
---|---|---|---|---|
// | // | |||
// Buffer.h | // Buffer.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Buffer.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Buffer.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Buffer | // Module: Buffer | |||
// | // | |||
// Definition of the Buffer class. | // Definition of the Buffer class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABL E | |||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWI SE, | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_Buffer_INCLUDED | #ifndef Foundation_Buffer_INCLUDED | |||
#define Foundation_Buffer_INCLUDED | #define Foundation_Buffer_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <cstring> | ||||
#include <cstddef> | #include <cstddef> | |||
namespace Poco { | namespace Poco { | |||
template <class T> | template <class T> | |||
class Buffer | class Buffer | |||
/// A very simple buffer class that allocates a buffer of | /// A very simple buffer class that allocates a buffer of | |||
/// a given type and size in the constructor and | /// a given type and size in the constructor and | |||
/// deallocates the buffer in the destructor. | /// deallocates the buffer in the destructor. | |||
/// | /// | |||
skipping to change at line 69 | skipping to change at line 70 | |||
/// Creates and allocates the Buffer. | /// Creates and allocates the Buffer. | |||
{ | { | |||
} | } | |||
~Buffer() | ~Buffer() | |||
/// Destroys the Buffer. | /// Destroys the Buffer. | |||
{ | { | |||
delete [] _ptr; | delete [] _ptr; | |||
} | } | |||
void resize(std::size_t newSize, bool preserveContent = true) | ||||
/// Resizes the buffer. If preserveContent is true, | ||||
/// the content of the old buffer is copied over to the | ||||
/// new buffer. NewSize can be larger or smaller than | ||||
/// the current size, but it must not be 0. | ||||
{ | ||||
T* ptr = new T[newSize]; | ||||
if (preserveContent) | ||||
{ | ||||
std::size_t n = newSize > _size ? _size : newSize; | ||||
std::memcpy(ptr, _ptr, n); | ||||
} | ||||
delete [] _ptr; | ||||
_ptr = ptr; | ||||
_size = newSize; | ||||
} | ||||
std::size_t size() const | std::size_t size() const | |||
/// Returns the size of the buffer. | /// Returns the size of the buffer. | |||
{ | { | |||
return _size; | return _size; | |||
} | } | |||
T* begin() | T* begin() | |||
/// Returns a pointer to the beginning of the buffer. | /// Returns a pointer to the beginning of the buffer. | |||
{ | { | |||
return _ptr; | return _ptr; | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
Config.h | Config.h | |||
---|---|---|---|---|
// | // | |||
// Config.h | // Config.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Config.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Config.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Foundation | // Module: Foundation | |||
// | // | |||
// Feature configuration for the POCO libraries. | // Feature configuration for the POCO libraries. | |||
// | // | |||
// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 56 | skipping to change at line 56 | |||
// Define to disable FPEnvironment support | // Define to disable FPEnvironment support | |||
// #define POCO_NO_FPENVIRONMENT | // #define POCO_NO_FPENVIRONMENT | |||
// Define if std::wstring is not available | // Define if std::wstring is not available | |||
// #define POCO_NO_WSTRING | // #define POCO_NO_WSTRING | |||
// Define to disable shared memory | // Define to disable shared memory | |||
// #define POCO_NO_SHAREDMEMORY | // #define POCO_NO_SHAREDMEMORY | |||
// Define if no <locale> header is available (such as on WinCE) | ||||
// #define POCO_NO_LOCALE | ||||
// Define to desired default thread stack size | // Define to desired default thread stack size | |||
// Zero means OS default | // Zero means OS default | |||
#ifndef POCO_THREAD_STACK_SIZE | #ifndef POCO_THREAD_STACK_SIZE | |||
#define POCO_THREAD_STACK_SIZE 0 | #define POCO_THREAD_STACK_SIZE 0 | |||
#endif | #endif | |||
// Define to override system-provided | // Define to override system-provided | |||
// minimum thread priority value on POSIX | // minimum thread priority value on POSIX | |||
// platforms (returned by Poco::Thread::getMinOSPriority()). | // platforms (returned by Poco::Thread::getMinOSPriority()). | |||
// #define POCO_THREAD_PRIORITY_MIN 0 | // #define POCO_THREAD_PRIORITY_MIN 0 | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
DialogSocket.h | DialogSocket.h | |||
---|---|---|---|---|
// | // | |||
// DialogSocket.h | // DialogSocket.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/DialogSocket.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/DialogSocket.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: DialogSocket | // Module: DialogSocket | |||
// | // | |||
// Definition of the DialogSocket class. | // Definition of the DialogSocket class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 84 | skipping to change at line 84 | |||
explicit DialogSocket(const SocketAddress& address); | explicit DialogSocket(const SocketAddress& address); | |||
/// Creates a stream socket and connects it to | /// Creates a stream socket and connects it to | |||
/// the socket specified by address. | /// the socket specified by address. | |||
DialogSocket(const Socket& socket); | DialogSocket(const Socket& socket); | |||
/// Creates the DialogSocket with the SocketImpl | /// Creates the DialogSocket with the SocketImpl | |||
/// from another socket. The SocketImpl must be | /// from another socket. The SocketImpl must be | |||
/// a StreamSocketImpl, otherwise an InvalidArgumentExceptio n | /// a StreamSocketImpl, otherwise an InvalidArgumentExceptio n | |||
/// will be thrown. | /// will be thrown. | |||
DialogSocket(const DialogSocket& socket); | ||||
/// Creates the DialogSocket as copy of another dialog socke | ||||
t. | ||||
~DialogSocket(); | ~DialogSocket(); | |||
/// Destroys the DialogSocket. | /// Destroys the DialogSocket. | |||
DialogSocket& operator = (const Socket& socket); | DialogSocket& operator = (const Socket& socket); | |||
/// Assignment operator. | /// Assignment operator. | |||
/// | /// | |||
/// Releases the socket's SocketImpl and | /// Releases the socket's SocketImpl and | |||
/// attaches the SocketImpl from the other socket and | /// attaches the SocketImpl from the other socket and | |||
/// increments the reference count of the SocketImpl. | /// increments the reference count of the SocketImpl. | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
Environment.h | Environment.h | |||
---|---|---|---|---|
// | // | |||
// Environment.h | // Environment.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the Environment class. | // Definition of the Environment class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 73 | skipping to change at line 73 | |||
/// Returns true iff an environment variable | /// Returns true iff an environment variable | |||
/// with the given name is defined. | /// with the given name is defined. | |||
static void set(const std::string& name, const std::string& value); | static void set(const std::string& name, const std::string& value); | |||
/// Sets the environment variable with the given name | /// Sets the environment variable with the given name | |||
/// to the given value. | /// to the given value. | |||
static std::string osName(); | static std::string osName(); | |||
/// Returns the operating system name. | /// Returns the operating system name. | |||
static std::string osDisplayName(); | ||||
/// Returns the operating system name in a | ||||
/// "user-friendly" way. | ||||
/// | ||||
/// Currently this is only implemented for | ||||
/// Windows. There it will return names like | ||||
/// "Windows XP" or "Windows 7/Server 2008 SP2". | ||||
/// On other platform, returns the same as | ||||
/// osName(). | ||||
static std::string osVersion(); | static std::string osVersion(); | |||
/// Returns the operating system version. | /// Returns the operating system version. | |||
static std::string osArchitecture(); | static std::string osArchitecture(); | |||
/// Returns the operating system architecture. | /// Returns the operating system architecture. | |||
static std::string nodeName(); | static std::string nodeName(); | |||
/// Returns the node (or host) name. | /// Returns the node (or host) name. | |||
static void nodeId(NodeId& id); | static void nodeId(NodeId& id); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 11 lines changed or added | |||
Environment_UNIX.h | Environment_UNIX.h | |||
---|---|---|---|---|
// | // | |||
// Environment_UNIX.h | // Environment_UNIX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment_UNIX.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment_UNIX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the EnvironmentImpl class for Unix. | // Definition of the EnvironmentImpl class for Unix. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 56 | skipping to change at line 56 | |||
class Foundation_API EnvironmentImpl | class Foundation_API EnvironmentImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt8 NodeId[6]; /// Ethernet address. | typedef UInt8 NodeId[6]; /// Ethernet address. | |||
static std::string getImpl(const std::string& name); | static std::string getImpl(const std::string& name); | |||
static bool hasImpl(const std::string& name); | static bool hasImpl(const std::string& name); | |||
static void setImpl(const std::string& name, const std::string& valu e); | static void setImpl(const std::string& name, const std::string& valu e); | |||
static std::string osNameImpl(); | static std::string osNameImpl(); | |||
static std::string osDisplayNameImpl(); | ||||
static std::string osVersionImpl(); | static std::string osVersionImpl(); | |||
static std::string osArchitectureImpl(); | static std::string osArchitectureImpl(); | |||
static std::string nodeNameImpl(); | static std::string nodeNameImpl(); | |||
static void nodeIdImpl(NodeId& id); | static void nodeIdImpl(NodeId& id); | |||
static unsigned processorCountImpl(); | static unsigned processorCountImpl(); | |||
private: | private: | |||
typedef std::map<std::string, std::string> StringMap; | typedef std::map<std::string, std::string> StringMap; | |||
static StringMap _map; | static StringMap _map; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Environment_VMS.h | Environment_VMS.h | |||
---|---|---|---|---|
// | // | |||
// Environment_VMS.h | // Environment_VMS.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment_VMS.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment_VMS.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the EnvironmentImpl class for OpenVMS. | // Definition of the EnvironmentImpl class for OpenVMS. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 55 | skipping to change at line 55 | |||
class Foundation_API EnvironmentImpl | class Foundation_API EnvironmentImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt8 NodeId[6]; /// Ethernet address. | typedef UInt8 NodeId[6]; /// Ethernet address. | |||
static std::string getImpl(const std::string& name); | static std::string getImpl(const std::string& name); | |||
static bool hasImpl(const std::string& name); | static bool hasImpl(const std::string& name); | |||
static void setImpl(const std::string& name, const std::string& valu e); | static void setImpl(const std::string& name, const std::string& valu e); | |||
static std::string osNameImpl(); | static std::string osNameImpl(); | |||
static std::string osDisplayNameImpl(); | ||||
static std::string osVersionImpl(); | static std::string osVersionImpl(); | |||
static std::string osArchitectureImpl(); | static std::string osArchitectureImpl(); | |||
static std::string nodeNameImpl(); | static std::string nodeNameImpl(); | |||
static void nodeIdImpl(NodeId& id); | static void nodeIdImpl(NodeId& id); | |||
static unsigned processorCountImpl(); | static unsigned processorCountImpl(); | |||
static std::string getsyi(unsigned short code); | static std::string getsyi(unsigned short code); | |||
/// a wrapper for $GETSYIW | /// a wrapper for $GETSYIW | |||
static std::string trnlnm(const std::string& name); | static std::string trnlnm(const std::string& name); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Environment_VX.h | Environment_VX.h | |||
---|---|---|---|---|
// | // | |||
// Environment_VX.h | // Environment_VX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment_VX.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment_VX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the EnvironmentImpl class for VxWorks. | // Definition of the EnvironmentImpl class for VxWorks. | |||
// | // | |||
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 56 | skipping to change at line 56 | |||
class Foundation_API EnvironmentImpl | class Foundation_API EnvironmentImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt8 NodeId[6]; /// Ethernet address. | typedef UInt8 NodeId[6]; /// Ethernet address. | |||
static std::string getImpl(const std::string& name); | static std::string getImpl(const std::string& name); | |||
static bool hasImpl(const std::string& name); | static bool hasImpl(const std::string& name); | |||
static void setImpl(const std::string& name, const std::string& valu e); | static void setImpl(const std::string& name, const std::string& valu e); | |||
static std::string osNameImpl(); | static std::string osNameImpl(); | |||
static std::string osDisplayNameImpl(); | ||||
static std::string osVersionImpl(); | static std::string osVersionImpl(); | |||
static std::string osArchitectureImpl(); | static std::string osArchitectureImpl(); | |||
static std::string nodeNameImpl(); | static std::string nodeNameImpl(); | |||
static void nodeIdImpl(NodeId& id); | static void nodeIdImpl(NodeId& id); | |||
static unsigned processorCountImpl(); | static unsigned processorCountImpl(); | |||
private: | private: | |||
typedef std::map<std::string, std::string> StringMap; | typedef std::map<std::string, std::string> StringMap; | |||
static StringMap _map; | static StringMap _map; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Environment_WIN32.h | Environment_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// Environment_WIN32.h | // Environment_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment_WIN32.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment_WIN32.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the EnvironmentImpl class for WIN32. | // Definition of the EnvironmentImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 54 | skipping to change at line 54 | |||
class Foundation_API EnvironmentImpl | class Foundation_API EnvironmentImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt8 NodeId[6]; /// Ethernet address. | typedef UInt8 NodeId[6]; /// Ethernet address. | |||
static std::string getImpl(const std::string& name); | static std::string getImpl(const std::string& name); | |||
static bool hasImpl(const std::string& name); | static bool hasImpl(const std::string& name); | |||
static void setImpl(const std::string& name, const std::string& valu e); | static void setImpl(const std::string& name, const std::string& valu e); | |||
static std::string osNameImpl(); | static std::string osNameImpl(); | |||
static std::string osDisplayNameImpl(); | ||||
static std::string osVersionImpl(); | static std::string osVersionImpl(); | |||
static std::string osArchitectureImpl(); | static std::string osArchitectureImpl(); | |||
static std::string nodeNameImpl(); | static std::string nodeNameImpl(); | |||
static void nodeIdImpl(NodeId& id); | static void nodeIdImpl(NodeId& id); | |||
static unsigned processorCountImpl(); | static unsigned processorCountImpl(); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Environment_WIN32_INCLUDED | #endif // Foundation_Environment_WIN32_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Environment_WIN32U.h | Environment_WIN32U.h | |||
---|---|---|---|---|
// | // | |||
// Environment_WIN32U.h | // Environment_WIN32U.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment_WIN32U.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment_WIN32U.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the EnvironmentImpl class for WIN32. | // Definition of the EnvironmentImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 54 | skipping to change at line 54 | |||
class Foundation_API EnvironmentImpl | class Foundation_API EnvironmentImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt8 NodeId[6]; /// Ethernet address. | typedef UInt8 NodeId[6]; /// Ethernet address. | |||
static std::string getImpl(const std::string& name); | static std::string getImpl(const std::string& name); | |||
static bool hasImpl(const std::string& name); | static bool hasImpl(const std::string& name); | |||
static void setImpl(const std::string& name, const std::string& valu e); | static void setImpl(const std::string& name, const std::string& valu e); | |||
static std::string osNameImpl(); | static std::string osNameImpl(); | |||
static std::string osDisplayNameImpl(); | ||||
static std::string osVersionImpl(); | static std::string osVersionImpl(); | |||
static std::string osArchitectureImpl(); | static std::string osArchitectureImpl(); | |||
static std::string nodeNameImpl(); | static std::string nodeNameImpl(); | |||
static void nodeIdImpl(NodeId& id); | static void nodeIdImpl(NodeId& id); | |||
static unsigned processorCountImpl(); | static unsigned processorCountImpl(); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Environment_WIN32U_INCLUDED | #endif // Foundation_Environment_WIN32U_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Environment_WINCE.h | Environment_WINCE.h | |||
---|---|---|---|---|
// | // | |||
// Environment_WINCE.h | // Environment_WINCE.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Environment_WINCE.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Environment_WINCE.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Environment | // Module: Environment | |||
// | // | |||
// Definition of the EnvironmentImpl class for WINCE. | // Definition of the EnvironmentImpl class for WINCE. | |||
// | // | |||
// Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 54 | skipping to change at line 54 | |||
class Foundation_API EnvironmentImpl | class Foundation_API EnvironmentImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt8 NodeId[6]; /// Ethernet address. | typedef UInt8 NodeId[6]; /// Ethernet address. | |||
static std::string getImpl(const std::string& name); | static std::string getImpl(const std::string& name); | |||
static bool hasImpl(const std::string& name); | static bool hasImpl(const std::string& name); | |||
static void setImpl(const std::string& name, const std::string& valu e); | static void setImpl(const std::string& name, const std::string& valu e); | |||
static std::string osNameImpl(); | static std::string osNameImpl(); | |||
static std::string osDisplayNameImpl(); | ||||
static std::string osVersionImpl(); | static std::string osVersionImpl(); | |||
static std::string osArchitectureImpl(); | static std::string osArchitectureImpl(); | |||
static std::string nodeNameImpl(); | static std::string nodeNameImpl(); | |||
static void nodeIdImpl(NodeId& id); | static void nodeIdImpl(NodeId& id); | |||
static unsigned processorCountImpl(); | static unsigned processorCountImpl(); | |||
private: | private: | |||
static bool envVar(const std::string& name, std::string* value); | static bool envVar(const std::string& name, std::string* value); | |||
static const std::string TEMP; | static const std::string TEMP; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Format.h | Format.h | |||
---|---|---|---|---|
// | // | |||
// Format.h | // Format.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Format.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Format.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Format | // Module: Format | |||
// | // | |||
// Definition of the format freestanding function. | // Definition of the format freestanding function. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 108 | skipping to change at line 108 | |||
/// * h argument is short (d, i), unsigned short (o, u, x, X) or float (e, E, f, g, G) | /// * h argument is short (d, i), unsigned short (o, u, x, X) or float (e, E, f, g, G) | |||
/// * ? argument is any signed or unsigned int, short, long, or 64-bit integer (d, i, o, x, X) | /// * ? argument is any signed or unsigned int, short, long, or 64-bit integer (d, i, o, x, X) | |||
/// | /// | |||
/// The width argument is a nonnegative decimal integer controlling the minimum number of characters printed. | /// The width argument is a nonnegative decimal integer controlling the minimum number of characters printed. | |||
/// If the number of characters in the output value is less than the specified width, blanks or | /// If the number of characters in the output value is less than the specified width, blanks or | |||
/// leading zeros are added, according to the specified flags (-, +, 0). | /// leading zeros are added, according to the specified flags (-, +, 0). | |||
/// | /// | |||
/// Precision is a nonnegative decimal integer, preceded by a period (.), which specifies the number of characters | /// Precision is a nonnegative decimal integer, preceded by a period (.), which specifies the number of characters | |||
/// to be printed, the number of decimal places, or the number of si gnificant digits. | /// to be printed, the number of decimal places, or the number of si gnificant digits. | |||
/// | /// | |||
/// Throws a BadCastException if an argument does not correspond to the type of its format specification. | ||||
/// Throws an InvalidArgumentException if an argument index is out o f range. | /// Throws an InvalidArgumentException if an argument index is out o f range. | |||
/// | /// | |||
/// Starting with release 1.4.3, an argument that does not match the | ||||
format | ||||
/// specifier no longer results in a BadCastException. The string [E | ||||
RRFMT] is | ||||
/// written to the result string instead. | ||||
/// | ||||
/// If there are more format specifiers than values, the format spec ifiers without a corresponding value | /// If there are more format specifiers than values, the format spec ifiers without a corresponding value | |||
/// are copied verbatim to output. | /// are copied verbatim to output. | |||
/// | /// | |||
/// If there are more values than format specifiers, the superfluous values are ignored. | /// If there are more values than format specifiers, the superfluous values are ignored. | |||
/// | /// | |||
/// Usage Examples: | /// Usage Examples: | |||
/// std::string s1 = format("The answer to life, the universe, a nd everything is %d", 42); | /// std::string s1 = format("The answer to life, the universe, a nd everything is %d", 42); | |||
/// std::string s2 = format("second: %[1]d, first: %[0]d", 1, 2) ; | /// std::string s2 = format("second: %[1]d, first: %[0]d", 1, 2) ; | |||
std::string Foundation_API format(const std::string& fmt, const Any& value1 , const Any& value2); | std::string Foundation_API format(const std::string& fmt, const Any& value1 , const Any& value2); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added | |||
HTMLForm.h | HTMLForm.h | |||
---|---|---|---|---|
// | // | |||
// HTMLForm.h | // HTMLForm.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTMLForm.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTMLForm.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTML | // Package: HTML | |||
// Module: HTMLForm | // Module: HTMLForm | |||
// | // | |||
// Definition of the HTMLForm class. | // Definition of the HTMLForm class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 57 | skipping to change at line 57 | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPRequest; | class HTTPRequest; | |||
class PartHandler; | class PartHandler; | |||
class PartSource; | class PartSource; | |||
class Net_API HTMLForm: public NameValueCollection | class Net_API HTMLForm: public NameValueCollection | |||
/// HTMLForm is a helper class for working with HTML forms, | /// HTMLForm is a helper class for working with HTML forms, | |||
/// both on the client and on the server side. | /// both on the client and on the server side. | |||
/// | ||||
/// The maximum number of form fields can be restricted | ||||
/// by calling setFieldLimit(). This is useful to | ||||
/// defend against certain kinds of denial-of-service | ||||
/// attacks. The limit is only enforced when parsing | ||||
/// form data from a stream or string, not when adding | ||||
/// form fields programmatically. The default limit is 100. | ||||
{ | { | |||
public: | public: | |||
HTMLForm(); | HTMLForm(); | |||
/// Creates an empty HTMLForm and sets the | /// Creates an empty HTMLForm and sets the | |||
/// encoding to "application/x-www-form-urlencoded". | /// encoding to "application/x-www-form-urlencoded". | |||
explicit HTMLForm(const std::string& encoding); | explicit HTMLForm(const std::string& encoding); | |||
/// Creates an empty HTMLForm that uses | /// Creates an empty HTMLForm that uses | |||
/// the given encoding. | /// the given encoding. | |||
/// | /// | |||
skipping to change at line 134 | skipping to change at line 141 | |||
/// must be in the query string (URL encoded). | /// must be in the query string (URL encoded). | |||
/// | /// | |||
/// For POST requests, you must use one of the overloads | /// For POST requests, you must use one of the overloads | |||
/// taking an additional input stream for the request body. | /// taking an additional input stream for the request body. | |||
void read(std::istream& istr, PartHandler& handler); | void read(std::istream& istr, PartHandler& handler); | |||
/// Reads the form data from the given input stream. | /// Reads the form data from the given input stream. | |||
/// | /// | |||
/// The form data read from the stream must be | /// The form data read from the stream must be | |||
/// in the encoding specified for the form. | /// in the encoding specified for the form. | |||
/// | ||||
/// Note that read() does not clear the form before | ||||
/// reading the new values. | ||||
void read(std::istream& istr); | ||||
/// Reads the URL-encoded form data from the given input str | ||||
eam. | ||||
/// | ||||
/// Note that read() does not clear the form before | ||||
/// reading the new values. | ||||
void read(const std::string& queryString); | ||||
/// Reads the form data from the given HTTP query string. | ||||
/// | ||||
/// Note that read() does not clear the form before | ||||
/// reading the new values. | ||||
void prepareSubmit(HTTPRequest& request); | void prepareSubmit(HTTPRequest& request); | |||
/// Fills out the request object for submitting the form. | /// Fills out the request object for submitting the form. | |||
/// | /// | |||
/// If the request method is GET, the encoded form is append ed to the | /// If the request method is GET, the encoded form is append ed to the | |||
/// request URI as query string. Otherwise (the method is | /// request URI as query string. Otherwise (the method is | |||
/// POST), the form's content type is set to the form's enco ding. | /// POST), the form's content type is set to the form's enco ding. | |||
/// The form's parameters must be written to the | /// The form's parameters must be written to the | |||
/// request body separately, with a call to write. | /// request body separately, with a call to write. | |||
/// If the request's HTTP version is HTTP/1.0: | /// If the request's HTTP version is HTTP/1.0: | |||
skipping to change at line 162 | skipping to change at line 184 | |||
/// using the specified encoding. | /// using the specified encoding. | |||
void write(std::ostream& ostr); | void write(std::ostream& ostr); | |||
/// Writes the form data to the given output stream, | /// Writes the form data to the given output stream, | |||
/// using the specified encoding. | /// using the specified encoding. | |||
const std::string& boundary() const; | const std::string& boundary() const; | |||
/// Returns the MIME boundary used for writing | /// Returns the MIME boundary used for writing | |||
/// multipart form data. | /// multipart form data. | |||
int getFieldLimit() const; | ||||
/// Returns the maximum number of header fields | ||||
/// allowed. | ||||
/// | ||||
/// See setFieldLimit() for more information. | ||||
void setFieldLimit(int limit); | ||||
/// Sets the maximum number of header fields | ||||
/// allowed. This limit is used to defend certain | ||||
/// kinds of denial-of-service attacks. | ||||
/// Specify 0 for unlimited (not recommended). | ||||
/// | ||||
/// The default limit is 100. | ||||
static const std::string ENCODING_URL; /// "application/x-www- form-urlencoded" | static const std::string ENCODING_URL; /// "application/x-www- form-urlencoded" | |||
static const std::string ENCODING_MULTIPART; /// "multipart/form-dat a" | static const std::string ENCODING_MULTIPART; /// "multipart/form-dat a" | |||
protected: | protected: | |||
void readUrl(std::istream& istr); | void readUrl(std::istream& istr); | |||
void readMultipart(std::istream& istr, PartHandler& handler); | void readMultipart(std::istream& istr, PartHandler& handler); | |||
void writeUrl(std::ostream& ostr); | void writeUrl(std::ostream& ostr); | |||
void writeMultipart(std::ostream& ostr); | void writeMultipart(std::ostream& ostr); | |||
private: | private: | |||
HTMLForm(const HTMLForm&); | HTMLForm(const HTMLForm&); | |||
HTMLForm& operator = (const HTMLForm&); | HTMLForm& operator = (const HTMLForm&); | |||
enum Limits | ||||
{ | ||||
DFL_FIELD_LIMIT = 100 | ||||
}; | ||||
struct Part | struct Part | |||
{ | { | |||
std::string name; | std::string name; | |||
PartSource* pSource; | PartSource* pSource; | |||
}; | }; | |||
typedef std::vector<Part> PartVec; | typedef std::vector<Part> PartVec; | |||
int _fieldLimit; | ||||
std::string _encoding; | std::string _encoding; | |||
std::string _boundary; | std::string _boundary; | |||
PartVec _parts; | PartVec _parts; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline const std::string& HTMLForm::getEncoding() const | inline const std::string& HTMLForm::getEncoding() const | |||
{ | { | |||
return _encoding; | return _encoding; | |||
} | } | |||
inline const std::string& HTMLForm::boundary() const | inline const std::string& HTMLForm::boundary() const | |||
{ | { | |||
return _boundary; | return _boundary; | |||
} | } | |||
inline int HTMLForm::getFieldLimit() const | ||||
{ | ||||
return _fieldLimit; | ||||
} | ||||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_HTMLForm_INCLUDED | #endif // Net_HTMLForm_INCLUDED | |||
End of changes. 7 change blocks. | ||||
1 lines changed or deleted | 49 lines changed or added | |||
HTTPBasicCredentials.h | HTTPBasicCredentials.h | |||
---|---|---|---|---|
// | // | |||
// HTTPBasicCredentials.h | // HTTPBasicCredentials.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPBasicCredentials.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPBasicCredentials.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPBasicCredentials | // Module: HTTPBasicCredentials | |||
// | // | |||
// Definition of the HTTPBasicCredentials class. | // Definition of the HTTPBasicCredentials class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 67 | skipping to change at line 67 | |||
HTTPBasicCredentials(const std::string& username, const std::string& password); | HTTPBasicCredentials(const std::string& username, const std::string& password); | |||
/// Creates a HTTPBasicCredentials object with the given use rname and password. | /// Creates a HTTPBasicCredentials object with the given use rname and password. | |||
explicit HTTPBasicCredentials(const HTTPRequest& request); | explicit HTTPBasicCredentials(const HTTPRequest& request); | |||
/// Creates a HTTPBasicCredentials object with the authentic ation information | /// Creates a HTTPBasicCredentials object with the authentic ation information | |||
/// from the given request. | /// from the given request. | |||
/// | /// | |||
/// Throws a NotAuthenticatedException if the request does | /// Throws a NotAuthenticatedException if the request does | |||
/// not contain basic authentication information. | /// not contain basic authentication information. | |||
explicit HTTPBasicCredentials(const std::string& authInfo); | ||||
/// Creates a HTTPBasicCredentials object with the authentic | ||||
ation information | ||||
/// in the given string. The authentication information can | ||||
be extracted | ||||
/// from a HTTPRequest object by calling HTTPRequest::getCre | ||||
dentials(). | ||||
~HTTPBasicCredentials(); | ~HTTPBasicCredentials(); | |||
/// Destroys the HTTPBasicCredentials. | /// Destroys the HTTPBasicCredentials. | |||
void setUsername(const std::string& username); | void setUsername(const std::string& username); | |||
/// Sets the username. | /// Sets the username. | |||
const std::string& getUsername() const; | const std::string& getUsername() const; | |||
/// Returns the username. | /// Returns the username. | |||
void setPassword(const std::string& password); | void setPassword(const std::string& password); | |||
/// Sets the password. | /// Sets the password. | |||
const std::string& getPassword() const; | const std::string& getPassword() const; | |||
/// Returns the password. | /// Returns the password. | |||
void authenticate(HTTPRequest& request); | void authenticate(HTTPRequest& request); | |||
/// Adds authentication information to the given HTTPRequest . | /// Adds authentication information to the given HTTPRequest . | |||
static const std::string SCHEME; | static const std::string SCHEME; | |||
protected: | ||||
void parseAuthInfo(const std::string& authInfo); | ||||
/// Extracts username and password from Basic authentication | ||||
info | ||||
/// by base64-decoding authInfo and splitting the resulting | ||||
/// string at the ':' delimiter. | ||||
private: | private: | |||
HTTPBasicCredentials(const HTTPBasicCredentials&); | HTTPBasicCredentials(const HTTPBasicCredentials&); | |||
HTTPBasicCredentials& operator = (const HTTPBasicCredentials); | HTTPBasicCredentials& operator = (const HTTPBasicCredentials&); | |||
std::string _username; | std::string _username; | |||
std::string _password; | std::string _password; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline const std::string& HTTPBasicCredentials::getUsername() const | inline const std::string& HTTPBasicCredentials::getUsername() const | |||
{ | { | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 17 lines changed or added | |||
HTTPClientSession.h | HTTPClientSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPClientSession.h | // HTTPClientSession.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTPClient | // Package: HTTPClient | |||
// Module: HTTPClientSession | // Module: HTTPClientSession | |||
// | // | |||
// Definition of the HTTPClientSession class. | // Definition of the HTTPClientSession class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 270 | skipping to change at line 270 | |||
/// Checks if we can reuse a persistent connection. | /// Checks if we can reuse a persistent connection. | |||
virtual void proxyAuthenticate(HTTPRequest& request); | virtual void proxyAuthenticate(HTTPRequest& request); | |||
/// Sets the proxy credentials (Proxy-Authorization header), if | /// Sets the proxy credentials (Proxy-Authorization header), if | |||
/// proxy username and password have been set. | /// proxy username and password have been set. | |||
void proxyAuthenticateImpl(HTTPRequest& request); | void proxyAuthenticateImpl(HTTPRequest& request); | |||
/// Sets the proxy credentials (Proxy-Authorization header), if | /// Sets the proxy credentials (Proxy-Authorization header), if | |||
/// proxy username and password have been set. | /// proxy username and password have been set. | |||
StreamSocket proxyConnect(); | ||||
/// Sends a CONNECT request to the proxy server and returns | ||||
/// a StreamSocket for the resulting connection. | ||||
void proxyTunnel(); | ||||
/// Calls proxyConnect() and attaches the resulting StreamSo | ||||
cket | ||||
/// to the HTTPClientSession. | ||||
private: | private: | |||
std::string _host; | std::string _host; | |||
Poco::UInt16 _port; | Poco::UInt16 _port; | |||
std::string _proxyHost; | std::string _proxyHost; | |||
Poco::UInt16 _proxyPort; | Poco::UInt16 _proxyPort; | |||
std::string _proxyUsername; | std::string _proxyUsername; | |||
std::string _proxyPassword; | std::string _proxyPassword; | |||
Poco::Timespan _keepAliveTimeout; | Poco::Timespan _keepAliveTimeout; | |||
Poco::Timestamp _lastRequest; | Poco::Timestamp _lastRequest; | |||
bool _reconnect; | bool _reconnect; | |||
bool _mustReconnect; | bool _mustReconnect; | |||
bool _expectResponseBody; | bool _expectResponseBody; | |||
std::ostream* _pRequestStream; | std::ostream* _pRequestStream; | |||
std::istream* _pResponseStream; | std::istream* _pResponseStream; | |||
HTTPClientSession(const HTTPClientSession&); | HTTPClientSession(const HTTPClientSession&); | |||
HTTPClientSession& operator = (const HTTPClientSession&); | HTTPClientSession& operator = (const HTTPClientSession&); | |||
friend class WebSocket; | ||||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline const std::string& HTTPClientSession::getHost() const | inline const std::string& HTTPClientSession::getHost() const | |||
{ | { | |||
return _host; | return _host; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 12 lines changed or added | |||
HTTPMessage.h | HTTPMessage.h | |||
---|---|---|---|---|
// | // | |||
// HTTPMessage.h | // HTTPMessage.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPMessage.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPMessage.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPMessage | // Module: HTTPMessage | |||
// | // | |||
// Definition of the HTTPMessage class. | // Definition of the HTTPMessage class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 74 | skipping to change at line 74 | |||
/// Sets the Content-Length header. | /// Sets the Content-Length header. | |||
/// | /// | |||
/// If length is UNKNOWN_CONTENT_LENGTH, removes | /// If length is UNKNOWN_CONTENT_LENGTH, removes | |||
/// the Content-Length header. | /// the Content-Length header. | |||
std::streamsize getContentLength() const; | std::streamsize getContentLength() const; | |||
/// Returns the content length for this message, | /// Returns the content length for this message, | |||
/// which may be UNKNOWN_CONTENT_LENGTH if | /// which may be UNKNOWN_CONTENT_LENGTH if | |||
/// no Content-Length header is present. | /// no Content-Length header is present. | |||
#if defined(POCO_HAVE_INT64) | ||||
void setContentLength64(Poco::Int64 length); | ||||
/// Sets the Content-Length header. | ||||
/// | ||||
/// If length is UNKNOWN_CONTENT_LENGTH, removes | ||||
/// the Content-Length header. | ||||
/// | ||||
/// In contrast to setContentLength(), this method takes | ||||
/// a 64-bit integer as content length. | ||||
Poco::Int64 getContentLength64() const; | ||||
/// Returns the content length for this message, | ||||
/// which may be UNKNOWN_CONTENT_LENGTH if | ||||
/// no Content-Length header is present. | ||||
/// | ||||
/// In contrast to getContentLength(), this method | ||||
/// always returns a 64-bit integer for content length. | ||||
#endif // defined(POCO_HAVE_INT64) | ||||
void setTransferEncoding(const std::string& transferEncoding); | void setTransferEncoding(const std::string& transferEncoding); | |||
/// Sets the transfer encoding for this message. | /// Sets the transfer encoding for this message. | |||
/// | /// | |||
/// The value should be either IDENTITY_TRANSFER_CODING | /// The value should be either IDENTITY_TRANSFER_CODING | |||
/// or CHUNKED_TRANSFER_CODING. | /// or CHUNKED_TRANSFER_CODING. | |||
const std::string& getTransferEncoding() const; | const std::string& getTransferEncoding() const; | |||
/// Returns the transfer encoding used for this | /// Returns the transfer encoding used for this | |||
/// message. | /// message. | |||
/// | /// | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 20 lines changed or added | |||
HostEntry.h | HostEntry.h | |||
---|---|---|---|---|
// | // | |||
// HostEntry.h | // HostEntry.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HostEntry.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HostEntry.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: HostEntry | // Module: HostEntry | |||
// | // | |||
// Definition of the HostEntry class. | // Definition of the HostEntry class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 64 | skipping to change at line 64 | |||
public: | public: | |||
typedef std::vector<std::string> AliasList; | typedef std::vector<std::string> AliasList; | |||
typedef std::vector<IPAddress> AddressList; | typedef std::vector<IPAddress> AddressList; | |||
HostEntry(); | HostEntry(); | |||
/// Creates an empty HostEntry. | /// Creates an empty HostEntry. | |||
HostEntry(struct hostent* entry); | HostEntry(struct hostent* entry); | |||
/// Creates the HostEntry from the data in a hostent structu re. | /// Creates the HostEntry from the data in a hostent structu re. | |||
#if defined(POCO_HAVE_IPv6) | #if defined(POCO_HAVE_IPv6) || defined(POCO_HAVE_ADDRINFO) | |||
HostEntry(struct addrinfo* info); | HostEntry(struct addrinfo* info); | |||
/// Creates the HostEntry from the data in an addrinfo struc ture. | /// Creates the HostEntry from the data in an addrinfo struc ture. | |||
#endif | #endif | |||
#if defined(POCO_VXWORKS) | #if defined(POCO_VXWORKS) | |||
HostEntry(const std::string& name, const IPAddress& addr); | HostEntry(const std::string& name, const IPAddress& addr); | |||
#endif | #endif | |||
HostEntry(const HostEntry& entry); | HostEntry(const HostEntry& entry); | |||
/// Creates the HostEntry by copying another one. | /// Creates the HostEntry by copying another one. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
Logger.h | Logger.h | |||
---|---|---|---|---|
// | // | |||
// Logger.h | // Logger.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Logger.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/Logger.h#5 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: Logger | // Module: Logger | |||
// | // | |||
// Definition of the Logger class. | // Definition of the Logger class. | |||
// | // | |||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 338 | skipping to change at line 338 | |||
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2); | static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2); | |||
/// Replaces all occurences of $<n> in fmt with the string g iven in arg<n> and | /// Replaces all occurences of $<n> in fmt with the string g iven in arg<n> and | |||
/// returns the result. To include a dollar sign in the resu lt string, | /// returns the result. To include a dollar sign in the resu lt string, | |||
/// specify two dollar signs ($$) in the format string. | /// specify two dollar signs ($$) in the format string. | |||
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3); | static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3); | |||
/// Replaces all occurences of $<n> in fmt with the string g iven in arg<n> and | /// Replaces all occurences of $<n> in fmt with the string g iven in arg<n> and | |||
/// returns the result. To include a dollar sign in the resu lt string, | /// returns the result. To include a dollar sign in the resu lt string, | |||
/// specify two dollar signs ($$) in the format string. | /// specify two dollar signs ($$) in the format string. | |||
static void formatDump(std::string& message, const void* buffer, std | ||||
::size_t length); | ||||
/// Creates a hex-dump of the given buffer and appends it to | ||||
the | ||||
/// given message string. | ||||
static void setLevel(const std::string& name, int level); | static void setLevel(const std::string& name, int level); | |||
/// Sets the given log level on all loggers that are | /// Sets the given log level on all loggers that are | |||
/// descendants of the Logger with the given name. | /// descendants of the Logger with the given name. | |||
static void setChannel(const std::string& name, Channel* pChannel); | static void setChannel(const std::string& name, Channel* pChannel); | |||
/// Attaches the given Channel to all loggers that are | /// Attaches the given Channel to all loggers that are | |||
/// descendants of the Logger with the given name. | /// descendants of the Logger with the given name. | |||
static void setProperty(const std::string& loggerName, const std::st ring& propertyName, const std::string& value); | static void setProperty(const std::string& loggerName, const std::st ring& propertyName, const std::string& value); | |||
/// Sets or changes a configuration property for all loggers | /// Sets or changes a configuration property for all loggers | |||
skipping to change at line 393 | skipping to change at line 397 | |||
/// become invalid. | /// become invalid. | |||
static void shutdown(); | static void shutdown(); | |||
/// Shuts down the logging framework and releases all | /// Shuts down the logging framework and releases all | |||
/// Loggers. | /// Loggers. | |||
static void names(std::vector<std::string>& names); | static void names(std::vector<std::string>& names); | |||
/// Fills the given vector with the names | /// Fills the given vector with the names | |||
/// of all currently defined loggers. | /// of all currently defined loggers. | |||
static int parseLevel(const std::string& level); | ||||
/// Parses a symbolic log level from a string and | ||||
/// returns the resulting numeric level. | ||||
/// | ||||
/// Valid symbolic levels are: | ||||
/// - none (turns off logging) | ||||
/// - fatal | ||||
/// - critical | ||||
/// - error | ||||
/// - warning | ||||
/// - notice | ||||
/// - information | ||||
/// - debug | ||||
/// - trace | ||||
/// | ||||
/// The level is not case sensitive. | ||||
static const std::string ROOT; /// The name of the root logger (""). | static const std::string ROOT; /// The name of the root logger (""). | |||
protected: | protected: | |||
typedef std::map<std::string, Logger*> LoggerMap; | typedef std::map<std::string, Logger*> LoggerMap; | |||
Logger(const std::string& name, Channel* pChannel, int level); | Logger(const std::string& name, Channel* pChannel, int level); | |||
~Logger(); | ~Logger(); | |||
void log(const std::string& text, Message::Priority prio); | void log(const std::string& text, Message::Priority prio); | |||
void log(const std::string& text, Message::Priority prio, const char * file, int line); | void log(const std::string& text, Message::Priority prio, const char * file, int line); | |||
static std::string format(const std::string& fmt, int argc, std::str ing argv[]); | static std::string format(const std::string& fmt, int argc, std::str ing argv[]); | |||
static void formatDump(std::string& message, const void* buffer, std ::size_t length); | ||||
static Logger& parent(const std::string& name); | static Logger& parent(const std::string& name); | |||
static void add(Logger* pLogger); | static void add(Logger* pLogger); | |||
static Logger* find(const std::string& name); | static Logger* find(const std::string& name); | |||
private: | private: | |||
Logger(); | Logger(); | |||
Logger(const Logger&); | Logger(const Logger&); | |||
Logger& operator = (const Logger&); | Logger& operator = (const Logger&); | |||
std::string _name; | std::string _name; | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 24 lines changed or added | |||
MessageHeader.h | MessageHeader.h | |||
---|---|---|---|---|
// | // | |||
// MessageHeader.h | // MessageHeader.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/MessageHeader.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/MessageHeader.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Messages | // Package: Messages | |||
// Module: MessageHeader | // Module: MessageHeader | |||
// | // | |||
// Definition of the MessageHeader class. | // Definition of the MessageHeader class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 61 | skipping to change at line 61 | |||
/// A collection of name-value pairs that are used in | /// A collection of name-value pairs that are used in | |||
/// various internet protocols like HTTP and SMTP. | /// various internet protocols like HTTP and SMTP. | |||
/// | /// | |||
/// The name is case-insensitive. | /// The name is case-insensitive. | |||
/// | /// | |||
/// There can be more than one name-value pair with the | /// There can be more than one name-value pair with the | |||
/// same name. | /// same name. | |||
/// | /// | |||
/// MessageHeader supports writing and reading the | /// MessageHeader supports writing and reading the | |||
/// header data in RFC 2822 format. | /// header data in RFC 2822 format. | |||
/// | ||||
/// The maximum number of fields can be restricted | ||||
/// by calling setFieldLimit(). This is useful to | ||||
/// defend against certain kinds of denial-of-service | ||||
/// attacks. The limit is only enforced when parsing | ||||
/// header fields from a stream, not when programmatically | ||||
/// adding them. The default limit is 100. | ||||
{ | { | |||
public: | public: | |||
MessageHeader(); | MessageHeader(); | |||
/// Creates the MessageHeader. | /// Creates the MessageHeader. | |||
MessageHeader(const MessageHeader& messageHeader); | MessageHeader(const MessageHeader& messageHeader); | |||
/// Creates the MessageHeader by copying | /// Creates the MessageHeader by copying | |||
/// another one. | /// another one. | |||
virtual ~MessageHeader(); | virtual ~MessageHeader(); | |||
skipping to change at line 101 | skipping to change at line 108 | |||
/// Reading stops at the first empty line (a line only | /// Reading stops at the first empty line (a line only | |||
/// containing \r\n or \n), as well as at the end of | /// containing \r\n or \n), as well as at the end of | |||
/// the stream. | /// the stream. | |||
/// | /// | |||
/// Some basic sanity checking of the input stream is | /// Some basic sanity checking of the input stream is | |||
/// performed. | /// performed. | |||
/// | /// | |||
/// Throws a MessageException if the input stream is | /// Throws a MessageException if the input stream is | |||
/// malformed. | /// malformed. | |||
int getFieldLimit() const; | ||||
/// Returns the maximum number of header fields | ||||
/// allowed. | ||||
/// | ||||
/// See setFieldLimit() for more information. | ||||
void setFieldLimit(int limit); | ||||
/// Sets the maximum number of header fields | ||||
/// allowed. This limit is used to defend certain | ||||
/// kinds of denial-of-service attacks. | ||||
/// Specify 0 for unlimited (not recommended). | ||||
/// | ||||
/// The default limit is 100. | ||||
static void splitElements(const std::string& s, std::vector<std::str ing>& elements, bool ignoreEmpty = true); | static void splitElements(const std::string& s, std::vector<std::str ing>& elements, bool ignoreEmpty = true); | |||
/// Splits the given string into separate elements. Elements are expected | /// Splits the given string into separate elements. Elements are expected | |||
/// to be separated by commas. | /// to be separated by commas. | |||
/// | /// | |||
/// For example, the string | /// For example, the string | |||
/// text/plain; q=0.5, text/html, text/x-dvi; q=0.8 | /// text/plain; q=0.5, text/html, text/x-dvi; q=0.8 | |||
/// is split into the elements | /// is split into the elements | |||
/// text/plain; q=0.5 | /// text/plain; q=0.5 | |||
/// text/html | /// text/html | |||
/// text/x-dvi; q=0.8 | /// text/x-dvi; q=0.8 | |||
skipping to change at line 145 | skipping to change at line 166 | |||
static void quote(const std::string& value, std::string& result, boo l allowSpace = false); | static void quote(const std::string& value, std::string& result, boo l allowSpace = false); | |||
/// Checks if the value must be quoted. If so, the value is | /// Checks if the value must be quoted. If so, the value is | |||
/// appended to result, enclosed in double-quotes. | /// appended to result, enclosed in double-quotes. | |||
/// Otherwise, the value is appended to result as-is. | /// Otherwise, the value is appended to result as-is. | |||
private: | private: | |||
enum Limits | enum Limits | |||
/// Limits for basic sanity checks when reading a header | /// Limits for basic sanity checks when reading a header | |||
{ | { | |||
MAX_NAME_LENGTH = 256, | MAX_NAME_LENGTH = 256, | |||
MAX_VALUE_LENGTH = 4096 | MAX_VALUE_LENGTH = 4096, | |||
DFL_FIELD_LIMIT = 100 | ||||
}; | }; | |||
int _fieldLimit; | ||||
}; | }; | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_MessageHeader_INCLUDED | #endif // Net_MessageHeader_INCLUDED | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 26 lines changed or added | |||
NetException.h | NetException.h | |||
---|---|---|---|---|
// | // | |||
// NetException.h | // NetException.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/NetException.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/NetException.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: NetException | // Module: NetException | |||
// | // | |||
// Definition of the NetException class. | // Definition of the NetException class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 68 | skipping to change at line 68 | |||
POCO_DECLARE_EXCEPTION(Net_API, NoMessageException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, NoMessageException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, MessageException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, MessageException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, MultipartException, MessageException) | POCO_DECLARE_EXCEPTION(Net_API, MultipartException, MessageException) | |||
POCO_DECLARE_EXCEPTION(Net_API, HTTPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, HTTPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, NotAuthenticatedException, HTTPException) | POCO_DECLARE_EXCEPTION(Net_API, NotAuthenticatedException, HTTPException) | |||
POCO_DECLARE_EXCEPTION(Net_API, UnsupportedRedirectException, HTTPException ) | POCO_DECLARE_EXCEPTION(Net_API, UnsupportedRedirectException, HTTPException ) | |||
POCO_DECLARE_EXCEPTION(Net_API, FTPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, FTPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, SMTPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, SMTPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, POP3Exception, NetException) | POCO_DECLARE_EXCEPTION(Net_API, POP3Exception, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, ICMPException, NetException) | POCO_DECLARE_EXCEPTION(Net_API, ICMPException, NetException) | |||
POCO_DECLARE_EXCEPTION(Net_API, HTMLFormException, NetException) | ||||
POCO_DECLARE_EXCEPTION(Net_API, WebSocketException, NetException) | ||||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_NetException_INCLUDED | #endif // Net_NetException_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
NetworkInterface.h | NetworkInterface.h | |||
---|---|---|---|---|
// | // | |||
// NetworkInterface.h | // NetworkInterface.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/NetworkInterface.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/NetworkInterface.h#4 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Sockets | // Package: Sockets | |||
// Module: NetworkInterface | // Module: NetworkInterface | |||
// | // | |||
// Definition of the NetworkInterface class. | // Definition of the NetworkInterface class. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
OptionProcessor.h | OptionProcessor.h | |||
---|---|---|---|---|
// | // | |||
// OptionProcessor.h | // OptionProcessor.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/OptionProcessor.h#1 $ | // $Id: //poco/1.4/Util/include/Poco/Util/OptionProcessor.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Options | // Package: Options | |||
// Module: OptionProcessor | // Module: OptionProcessor | |||
// | // | |||
// Definition of the OptionProcessor class. | // Definition of the OptionProcessor class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 56 | skipping to change at line 56 | |||
class OptionSet; | class OptionSet; | |||
class Util_API OptionProcessor | class Util_API OptionProcessor | |||
/// An OptionProcessor is used to process the command line | /// An OptionProcessor is used to process the command line | |||
/// arguments of an application. | /// arguments of an application. | |||
/// | /// | |||
/// The process() method takes an argument from the command line. | /// The process() method takes an argument from the command line. | |||
/// If that argument starts with an option prefix, the argument | /// If that argument starts with an option prefix, the argument | |||
/// is further processed. Otherwise, the argument is ignored and | /// is further processed. Otherwise, the argument is ignored and | |||
/// false is ignored. The argument must match one of the options | /// false is returned. The argument must match one of the options | |||
/// given in the OptionSet that is passed to the OptionProcessor | /// given in the OptionSet that is passed to the OptionProcessor | |||
/// with the constructor. If an option is part of a group, at most | /// with the constructor. If an option is part of a group, at most | |||
/// one option of the group can be passed to the OptionProcessor. | /// one option of the group can be passed to the OptionProcessor. | |||
/// Otherwise an IncompatibleOptionsException is thrown. | /// Otherwise an IncompatibleOptionsException is thrown. | |||
/// If the same option is given multiple times, but the option | /// If the same option is given multiple times, but the option | |||
/// is not repeatable, a DuplicateOptionException is thrown. | /// is not repeatable, a DuplicateOptionException is thrown. | |||
/// If the option is not recognized, a UnexpectedArgumentException | /// If the option is not recognized, a UnexpectedArgumentException | |||
/// is thrown. | /// is thrown. | |||
/// If the option requires an argument, but none is given, an | /// If the option requires an argument, but none is given, an | |||
/// MissingArgumentException is thrown. | /// MissingArgumentException is thrown. | |||
skipping to change at line 80 | skipping to change at line 80 | |||
/// is thrown. | /// is thrown. | |||
/// | /// | |||
/// The OptionProcessor supports two modes: Unix mode and default mo de. | /// The OptionProcessor supports two modes: Unix mode and default mo de. | |||
/// In Unix mode, the option prefix is a dash '-'. A dash must be fo llowed | /// In Unix mode, the option prefix is a dash '-'. A dash must be fo llowed | |||
/// by a short option name, or another dash, followed by a (partial) | /// by a short option name, or another dash, followed by a (partial) | |||
/// long option name. | /// long option name. | |||
/// In default mode, the option prefix is a slash '/', followed by | /// In default mode, the option prefix is a slash '/', followed by | |||
/// a (partial) long option name. | /// a (partial) long option name. | |||
/// If the special option '--' is encountered in Unix mode, all foll owing | /// If the special option '--' is encountered in Unix mode, all foll owing | |||
/// options are ignored. | /// options are ignored. | |||
/// | ||||
/// Option arguments can be specified in three ways. If a Unix short | ||||
option | ||||
/// ("-o") is given, the argument directly follows the option name, | ||||
without | ||||
/// any delimiting character or space ("-ovalue"). In default option | ||||
mode, or if a | ||||
/// Unix long option ("--option") is given, the option argument is | ||||
/// delimited from the option name with either an equal sign ('=') o | ||||
r | ||||
/// a colon (':'), as in "--option=value" or "/option:value". Finall | ||||
y, | ||||
/// a required option argument can be specified on the command line | ||||
after the | ||||
/// option, delimited with a space, as in "--option value" or "-o va | ||||
lue". | ||||
/// The latter only works for required option arguments, not optiona | ||||
l ones. | ||||
{ | { | |||
public: | public: | |||
OptionProcessor(const OptionSet& options); | OptionProcessor(const OptionSet& options); | |||
/// Creates the OptionProcessor, using the given OptionSet. | /// Creates the OptionProcessor, using the given OptionSet. | |||
~OptionProcessor(); | ~OptionProcessor(); | |||
/// Destroys the OptionProcessor. | /// Destroys the OptionProcessor. | |||
void setUnixStyle(bool flag); | void setUnixStyle(bool flag); | |||
/// Enables (flag == true) or disables (flag == false) Unix- style | /// Enables (flag == true) or disables (flag == false) Unix- style | |||
skipping to change at line 128 | skipping to change at line 138 | |||
private: | private: | |||
bool processUnix(const std::string& argument, std::string& optionNam e, std::string& optionArg); | bool processUnix(const std::string& argument, std::string& optionNam e, std::string& optionArg); | |||
bool processDefault(const std::string& argument, std::string& option Name, std::string& optionArg); | bool processDefault(const std::string& argument, std::string& option Name, std::string& optionArg); | |||
bool processCommon(const std::string& option, bool isShort, std::str ing& optionName, std::string& optionArg); | bool processCommon(const std::string& option, bool isShort, std::str ing& optionName, std::string& optionArg); | |||
const OptionSet& _options; | const OptionSet& _options; | |||
bool _unixStyle; | bool _unixStyle; | |||
bool _ignore; | bool _ignore; | |||
std::set<std::string> _groups; | std::set<std::string> _groups; | |||
std::set<std::string> _specifiedOptions; | std::set<std::string> _specifiedOptions; | |||
std::string _deferredOption; | ||||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline bool OptionProcessor::isUnixStyle() const | inline bool OptionProcessor::isUnixStyle() const | |||
{ | { | |||
return _unixStyle; | return _unixStyle; | |||
} | } | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 21 lines changed or added | |||
Process.h | Process.h | |||
---|---|---|---|---|
// | // | |||
// Process.h | // Process.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Process.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Process.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: Process | // Module: Process | |||
// | // | |||
// Definition of the Process class. | // Definition of the Process class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 150 | skipping to change at line 150 | |||
/// Process::Args args; | /// Process::Args args; | |||
/// ProcessHandle ph(launch("/bin/ps", args, 0, &outPipe , 0)); | /// ProcessHandle ph(launch("/bin/ps", args, 0, &outPipe , 0)); | |||
/// PipeInputStream istr(outPipe); | /// PipeInputStream istr(outPipe); | |||
/// ... // read output of ps from istr | /// ... // read output of ps from istr | |||
/// int rc = ph.wait(); | /// int rc = ph.wait(); | |||
static int wait(const ProcessHandle& handle); | static int wait(const ProcessHandle& handle); | |||
/// Waits for the process specified by handle to terminate | /// Waits for the process specified by handle to terminate | |||
/// and returns the exit code of the process. | /// and returns the exit code of the process. | |||
static void kill(const ProcessHandle& handle); | ||||
/// Kills the process specified by handle. | ||||
/// | ||||
/// This is preferable on Windows where process IDs | ||||
/// may be reused. | ||||
static void kill(PID pid); | static void kill(PID pid); | |||
/// Kills the process with the given pid. | /// Kills the process with the given pid. | |||
static void requestTermination(PID pid); | static void requestTermination(PID pid); | |||
/// Requests termination of the process with the give PID. | /// Requests termination of the process with the give PID. | |||
/// | /// | |||
/// On Unix platforms, this will send a SIGINT to the | /// On Unix platforms, this will send a SIGINT to the | |||
/// process and thus work with arbitrary processes. | /// process and thus work with arbitrary processes. | |||
/// | /// | |||
/// On other platforms, a global event flag | /// On other platforms, a global event flag | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
Process_UNIX.h | Process_UNIX.h | |||
---|---|---|---|---|
// | // | |||
// Process_UNIX.h | // Process_UNIX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Process_UNIX.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Process_UNIX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: Process | // Module: Process | |||
// | // | |||
// Definition of the ProcessImpl class for Unix. | // Definition of the ProcessImpl class for Unix. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 72 | skipping to change at line 72 | |||
class Foundation_API ProcessImpl | class Foundation_API ProcessImpl | |||
{ | { | |||
public: | public: | |||
typedef pid_t PIDImpl; | typedef pid_t PIDImpl; | |||
typedef std::vector<std::string> ArgsImpl; | typedef std::vector<std::string> ArgsImpl; | |||
static PIDImpl idImpl(); | static PIDImpl idImpl(); | |||
static void timesImpl(long& userTime, long& kernelTime); | static void timesImpl(long& userTime, long& kernelTime); | |||
static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | |||
static void killImpl(const ProcessHandleImpl& handle); | ||||
static void killImpl(PIDImpl pid); | static void killImpl(PIDImpl pid); | |||
static void requestTerminationImpl(PIDImpl pid); | static void requestTerminationImpl(PIDImpl pid); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Process_UNIX_INCLUDED | #endif // Foundation_Process_UNIX_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Process_VMS.h | Process_VMS.h | |||
---|---|---|---|---|
// | // | |||
// Process_VMS.h | // Process_VMS.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Process_VMS.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Process_VMS.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: Process | // Module: Process | |||
// | // | |||
// Definition of the ProcessImpl class for OpenVMS. | // Definition of the ProcessImpl class for OpenVMS. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 73 | skipping to change at line 73 | |||
class ProcessImpl | class ProcessImpl | |||
{ | { | |||
public: | public: | |||
typedef pid_t PIDImpl; | typedef pid_t PIDImpl; | |||
typedef std::vector<std::string> ArgsImpl; | typedef std::vector<std::string> ArgsImpl; | |||
static PIDImpl idImpl(); | static PIDImpl idImpl(); | |||
static void timesImpl(long& userTime, long& kernelTime); | static void timesImpl(long& userTime, long& kernelTime); | |||
static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | |||
static int waitImpl(PIDImpl pid); | static int waitImpl(PIDImpl pid); | |||
static void killImpl(const ProcessHandleImpl& handle); | ||||
static void killImpl(PIDImpl pid); | static void killImpl(PIDImpl pid); | |||
static void requestTerminationImpl(PIDImpl pid); | static void requestTerminationImpl(PIDImpl pid); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Process_VMS_INCLUDED | #endif // Foundation_Process_VMS_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Process_VX.h | Process_VX.h | |||
---|---|---|---|---|
// | // | |||
// Process_VX.h | // Process_VX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Process_VX.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Process_VX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: Process | // Module: Process | |||
// | // | |||
// Definition of the ProcessImpl class for VxWorks. | // Definition of the ProcessImpl class for VxWorks. | |||
// | // | |||
// Copyright (c) 2004-20011, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-20011, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 73 | skipping to change at line 73 | |||
class Foundation_API ProcessImpl | class Foundation_API ProcessImpl | |||
{ | { | |||
public: | public: | |||
typedef int PIDImpl; | typedef int PIDImpl; | |||
typedef std::vector<std::string> ArgsImpl; | typedef std::vector<std::string> ArgsImpl; | |||
static PIDImpl idImpl(); | static PIDImpl idImpl(); | |||
static void timesImpl(long& userTime, long& kernelTime); | static void timesImpl(long& userTime, long& kernelTime); | |||
static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | |||
static void killImpl(const ProcessHandleImpl& handle); | ||||
static void killImpl(PIDImpl pid); | static void killImpl(PIDImpl pid); | |||
static void requestTerminationImpl(PIDImpl pid); | static void requestTerminationImpl(PIDImpl pid); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Process_UNIX_INCLUDED | #endif // Foundation_Process_UNIX_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
Process_WIN32.h | Process_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// Process_WIN32.h | // Process_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Process_WIN32.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Process_WIN32.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: Process | // Module: Process | |||
// | // | |||
// Definition of the ProcessImpl class for WIN32. | // Definition of the ProcessImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 57 | skipping to change at line 57 | |||
class Pipe; | class Pipe; | |||
class Foundation_API ProcessHandleImpl: public RefCountedObject | class Foundation_API ProcessHandleImpl: public RefCountedObject | |||
{ | { | |||
public: | public: | |||
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid); | ProcessHandleImpl(HANDLE _hProcess, UInt32 pid); | |||
~ProcessHandleImpl(); | ~ProcessHandleImpl(); | |||
UInt32 id() const; | UInt32 id() const; | |||
HANDLE process() const; | ||||
int wait() const; | int wait() const; | |||
private: | private: | |||
HANDLE _hProcess; | HANDLE _hProcess; | |||
UInt32 _pid; | UInt32 _pid; | |||
ProcessHandleImpl(const ProcessHandleImpl&); | ProcessHandleImpl(const ProcessHandleImpl&); | |||
ProcessHandleImpl& operator = (const ProcessHandleImpl&); | ProcessHandleImpl& operator = (const ProcessHandleImpl&); | |||
}; | }; | |||
class Foundation_API ProcessImpl | class Foundation_API ProcessImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt32 PIDImpl; | typedef UInt32 PIDImpl; | |||
typedef std::vector<std::string> ArgsImpl; | typedef std::vector<std::string> ArgsImpl; | |||
static PIDImpl idImpl(); | static PIDImpl idImpl(); | |||
static void timesImpl(long& userTime, long& kernelTime); | static void timesImpl(long& userTime, long& kernelTime); | |||
static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | |||
static void killImpl(const ProcessHandleImpl& handle); | ||||
static void killImpl(PIDImpl pid); | static void killImpl(PIDImpl pid); | |||
static void requestTerminationImpl(PIDImpl pid); | static void requestTerminationImpl(PIDImpl pid); | |||
static std::string terminationEventName(PIDImpl pid); | static std::string terminationEventName(PIDImpl pid); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Process_WIN32_INCLUDED | #endif // Foundation_Process_WIN32_INCLUDED | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
Process_WIN32U.h | Process_WIN32U.h | |||
---|---|---|---|---|
// | // | |||
// Process_WIN32U.h | // Process_WIN32U.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Process_WIN32U.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Process_WIN32U.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: Process | // Module: Process | |||
// | // | |||
// Definition of the ProcessImpl class for WIN32. | // Definition of the ProcessImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 57 | skipping to change at line 57 | |||
class Pipe; | class Pipe; | |||
class Foundation_API ProcessHandleImpl: public RefCountedObject | class Foundation_API ProcessHandleImpl: public RefCountedObject | |||
{ | { | |||
public: | public: | |||
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid); | ProcessHandleImpl(HANDLE _hProcess, UInt32 pid); | |||
~ProcessHandleImpl(); | ~ProcessHandleImpl(); | |||
UInt32 id() const; | UInt32 id() const; | |||
HANDLE process() const; | ||||
int wait() const; | int wait() const; | |||
private: | private: | |||
HANDLE _hProcess; | HANDLE _hProcess; | |||
UInt32 _pid; | UInt32 _pid; | |||
ProcessHandleImpl(const ProcessHandleImpl&); | ProcessHandleImpl(const ProcessHandleImpl&); | |||
ProcessHandleImpl& operator = (const ProcessHandleImpl&); | ProcessHandleImpl& operator = (const ProcessHandleImpl&); | |||
}; | }; | |||
class Foundation_API ProcessImpl | class Foundation_API ProcessImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt32 PIDImpl; | typedef UInt32 PIDImpl; | |||
typedef std::vector<std::string> ArgsImpl; | typedef std::vector<std::string> ArgsImpl; | |||
static PIDImpl idImpl(); | static PIDImpl idImpl(); | |||
static void timesImpl(long& userTime, long& kernelTime); | static void timesImpl(long& userTime, long& kernelTime); | |||
static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | |||
static void killImpl(const ProcessHandleImpl& handle); | ||||
static void killImpl(PIDImpl pid); | static void killImpl(PIDImpl pid); | |||
static void requestTerminationImpl(PIDImpl pid); | static void requestTerminationImpl(PIDImpl pid); | |||
static std::string terminationEventName(PIDImpl pid); | static std::string terminationEventName(PIDImpl pid); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Process_WIN32U_INCLUDED | #endif // Foundation_Process_WIN32U_INCLUDED | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
Process_WINCE.h | Process_WINCE.h | |||
---|---|---|---|---|
// | // | |||
// Process_WINCE.h | // Process_WINCE.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Process_WINCE.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Process_WINCE.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Processes | // Package: Processes | |||
// Module: Process | // Module: Process | |||
// | // | |||
// Definition of the ProcessImpl class for WIN32. | // Definition of the ProcessImpl class for WIN32. | |||
// | // | |||
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 57 | skipping to change at line 57 | |||
class Pipe; | class Pipe; | |||
class Foundation_API ProcessHandleImpl: public RefCountedObject | class Foundation_API ProcessHandleImpl: public RefCountedObject | |||
{ | { | |||
public: | public: | |||
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid); | ProcessHandleImpl(HANDLE _hProcess, UInt32 pid); | |||
~ProcessHandleImpl(); | ~ProcessHandleImpl(); | |||
UInt32 id() const; | UInt32 id() const; | |||
HANDLE process() const; | ||||
int wait() const; | int wait() const; | |||
private: | private: | |||
HANDLE _hProcess; | HANDLE _hProcess; | |||
UInt32 _pid; | UInt32 _pid; | |||
ProcessHandleImpl(const ProcessHandleImpl&); | ProcessHandleImpl(const ProcessHandleImpl&); | |||
ProcessHandleImpl& operator = (const ProcessHandleImpl&); | ProcessHandleImpl& operator = (const ProcessHandleImpl&); | |||
}; | }; | |||
class Foundation_API ProcessImpl | class Foundation_API ProcessImpl | |||
{ | { | |||
public: | public: | |||
typedef UInt32 PIDImpl; | typedef UInt32 PIDImpl; | |||
typedef std::vector<std::string> ArgsImpl; | typedef std::vector<std::string> ArgsImpl; | |||
static PIDImpl idImpl(); | static PIDImpl idImpl(); | |||
static void timesImpl(long& userTime, long& kernelTime); | static void timesImpl(long& userTime, long& kernelTime); | |||
static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | static ProcessHandleImpl* launchImpl(const std::string& command, con st ArgsImpl& args, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe); | |||
static void killImpl(const ProcessHandleImpl& handle); | ||||
static void killImpl(PIDImpl pid); | static void killImpl(PIDImpl pid); | |||
static void requestTerminationImpl(PIDImpl pid); | static void requestTerminationImpl(PIDImpl pid); | |||
static std::string terminationEventName(PIDImpl pid); | static std::string terminationEventName(PIDImpl pid); | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Process_WINCE_INCLUDED | #endif // Foundation_Process_WINCE_INCLUDED | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
ScopedLock.h | ScopedLock.h | |||
---|---|---|---|---|
// | // | |||
// ScopedLock.h | // ScopedLock.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ScopedLock.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/ScopedLock.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Mutex | // Module: Mutex | |||
// | // | |||
// Definition of the ScopedLock template class. | // Definition of the ScopedLock template class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 49 | skipping to change at line 49 | |||
#define Foundation_ScopedLock_INCLUDED | #define Foundation_ScopedLock_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
namespace Poco { | namespace Poco { | |||
template <class M> | template <class M> | |||
class ScopedLock | class ScopedLock | |||
/// A class that simplifies thread synchronization | /// A class that simplifies thread synchronization | |||
/// with a mutex. | /// with a mutex. | |||
/// The constructor accepts a Mutex and locks it. | /// The constructor accepts a Mutex (and optionally | |||
/// a timeout value in milliseconds) and locks it. | ||||
/// The destructor unlocks the mutex. | /// The destructor unlocks the mutex. | |||
{ | { | |||
public: | public: | |||
ScopedLock(M& mutex): _mutex(mutex) | explicit ScopedLock(M& mutex): _mutex(mutex) | |||
{ | { | |||
_mutex.lock(); | _mutex.lock(); | |||
} | } | |||
ScopedLock(M& mutex, long milliseconds): _mutex(mutex) | ||||
{ | ||||
_mutex.lock(milliseconds); | ||||
} | ||||
~ScopedLock() | ~ScopedLock() | |||
{ | { | |||
_mutex.unlock(); | _mutex.unlock(); | |||
} | } | |||
private: | private: | |||
M& _mutex; | M& _mutex; | |||
ScopedLock(); | ScopedLock(); | |||
ScopedLock(const ScopedLock&); | ScopedLock(const ScopedLock&); | |||
ScopedLock& operator = (const ScopedLock&); | ScopedLock& operator = (const ScopedLock&); | |||
}; | }; | |||
template <class M> | template <class M> | |||
class ScopedLockWithUnlock | class ScopedLockWithUnlock | |||
/// A class that simplifies thread synchronization | /// A class that simplifies thread synchronization | |||
/// with a mutex. | /// with a mutex. | |||
/// The constructor accepts a Mutex and locks it. | /// The constructor accepts a Mutex (and optionally | |||
/// a timeout value in milliseconds) and locks it. | ||||
/// The destructor unlocks the mutex. | /// The destructor unlocks the mutex. | |||
/// The unlock() member function allows for manual | /// The unlock() member function allows for manual | |||
/// unlocking of the mutex. | /// unlocking of the mutex. | |||
{ | { | |||
public: | public: | |||
ScopedLockWithUnlock(M& mutex): _pMutex(&mutex) | explicit ScopedLockWithUnlock(M& mutex): _pMutex(&mutex) | |||
{ | { | |||
_pMutex->lock(); | _pMutex->lock(); | |||
} | } | |||
ScopedLockWithUnlock(M& mutex, long milliseconds): _pMutex(&mutex) | ||||
{ | ||||
_pMutex->lock(milliseconds); | ||||
} | ||||
~ScopedLockWithUnlock() | ~ScopedLockWithUnlock() | |||
{ | { | |||
unlock(); | unlock(); | |||
} | } | |||
void unlock() | void unlock() | |||
{ | { | |||
if (_pMutex) | if (_pMutex) | |||
{ | { | |||
_pMutex->unlock(); | _pMutex->unlock(); | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 17 lines changed or added | |||
SharedLibrary.h | SharedLibrary.h | |||
---|---|---|---|---|
// | // | |||
// SharedLibrary.h | // SharedLibrary.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: SharedLibrary | // Package: SharedLibrary | |||
// Module: SharedLibrary | // Module: SharedLibrary | |||
// | // | |||
// Definition of the SharedLibrary class. | // Definition of the SharedLibrary class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 64 | skipping to change at line 64 | |||
#include "Poco/SharedLibrary_VMS.h" | #include "Poco/SharedLibrary_VMS.h" | |||
#endif | #endif | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API SharedLibrary: private SharedLibraryImpl | class Foundation_API SharedLibrary: private SharedLibraryImpl | |||
/// The SharedLibrary class dynamically | /// The SharedLibrary class dynamically | |||
/// loads shared libraries at run-time. | /// loads shared libraries at run-time. | |||
{ | { | |||
public: | public: | |||
enum Flags | ||||
{ | ||||
SHLIB_GLOBAL = 1, | ||||
/// On platforms that use dlopen(), use RTLD_GLOBAL. | ||||
This is the default | ||||
/// if no flags are given. | ||||
/// | ||||
/// This flag is ignored on platforms that do not us | ||||
e dlopen(). | ||||
SHLIB_LOCAL = 2 | ||||
/// On platforms that use dlopen(), use RTLD_LOCAL i | ||||
nstead of RTLD_GLOBAL. | ||||
/// | ||||
/// Note that if this flag is specified, RTTI (inclu | ||||
ding dynamic_cast and throw) will | ||||
/// not work for types defined in the shared library | ||||
with GCC and possibly other | ||||
/// compilers as well. See http://gcc.gnu.org/faq.ht | ||||
ml#dso for more information. | ||||
/// | ||||
/// This flag is ignored on platforms that do not us | ||||
e dlopen(). | ||||
}; | ||||
SharedLibrary(); | SharedLibrary(); | |||
/// Creates a SharedLibrary object. | /// Creates a SharedLibrary object. | |||
SharedLibrary(const std::string& path); | SharedLibrary(const std::string& path); | |||
/// Creates a SharedLibrary object and loads a library | /// Creates a SharedLibrary object and loads a library | |||
/// from the given path. | /// from the given path. | |||
SharedLibrary(const std::string& path, int flags); | ||||
/// Creates a SharedLibrary object and loads a library | ||||
/// from the given path, using the given flags. | ||||
/// See the Flags enumeration for valid values. | ||||
virtual ~SharedLibrary(); | virtual ~SharedLibrary(); | |||
/// Destroys the SharedLibrary. The actual library | /// Destroys the SharedLibrary. The actual library | |||
/// remains loaded. | /// remains loaded. | |||
void load(const std::string& path); | void load(const std::string& path); | |||
/// Loads a shared library from the given path. | /// Loads a shared library from the given path. | |||
/// Throws a LibraryAlreadyLoadedException if | /// Throws a LibraryAlreadyLoadedException if | |||
/// a library has already been loaded. | /// a library has already been loaded. | |||
/// Throws a LibraryLoadException if the library | /// Throws a LibraryLoadException if the library | |||
/// cannot be loaded. | /// cannot be loaded. | |||
void load(const std::string& path, int flags); | ||||
/// Loads a shared library from the given path, | ||||
/// using the given flags. See the Flags enumeration | ||||
/// for valid values. | ||||
/// Throws a LibraryAlreadyLoadedException if | ||||
/// a library has already been loaded. | ||||
/// Throws a LibraryLoadException if the library | ||||
/// cannot be loaded. | ||||
void unload(); | void unload(); | |||
/// Unloads a shared library. | /// Unloads a shared library. | |||
bool isLoaded() const; | bool isLoaded() const; | |||
/// Returns true iff a library has been loaded. | /// Returns true iff a library has been loaded. | |||
bool hasSymbol(const std::string& name); | bool hasSymbol(const std::string& name); | |||
/// Returns true iff the loaded library contains | /// Returns true iff the loaded library contains | |||
/// a symbol with the given name. | /// a symbol with the given name. | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 40 lines changed or added | |||
SharedLibrary_HPUX.h | SharedLibrary_HPUX.h | |||
---|---|---|---|---|
// | // | |||
// SharedLibrary_HPUX.h | // SharedLibrary_HPUX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_HPUX.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_HPUX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: SharedLibrary | // Package: SharedLibrary | |||
// Module: SharedLibrary | // Module: SharedLibrary | |||
// | // | |||
// Definition of the SharedLibraryImpl class for HP-UX. | // Definition of the SharedLibraryImpl class for HP-UX. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 52 | skipping to change at line 52 | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include <dl.h> | #include <dl.h> | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API SharedLibraryImpl | class Foundation_API SharedLibraryImpl | |||
{ | { | |||
protected: | protected: | |||
SharedLibraryImpl(); | SharedLibraryImpl(); | |||
~SharedLibraryImpl(); | ~SharedLibraryImpl(); | |||
void loadImpl(const std::string& path); | void loadImpl(const std::string& path, int flags); | |||
void unloadImpl(); | void unloadImpl(); | |||
bool isLoadedImpl() const; | bool isLoadedImpl() const; | |||
void* findSymbolImpl(const std::string& name); | void* findSymbolImpl(const std::string& name); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
static std::string suffixImpl(); | static std::string suffixImpl(); | |||
private: | private: | |||
std::string _path; | std::string _path; | |||
shl_t _handle; | shl_t _handle; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SharedLibrary_UNIX.h | SharedLibrary_UNIX.h | |||
---|---|---|---|---|
// | // | |||
// SharedLibrary_UNIX.h | // SharedLibrary_UNIX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_UNIX.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_UNIX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: SharedLibrary | // Package: SharedLibrary | |||
// Module: SharedLibrary | // Module: SharedLibrary | |||
// | // | |||
// Definition of the SharedLibraryImpl class for UNIX (dlopen). | // Definition of the SharedLibraryImpl class for UNIX (dlopen). | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 49 | skipping to change at line 49 | |||
#define Foundation_SharedLibrary_UNIX_INCLUDED | #define Foundation_SharedLibrary_UNIX_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API SharedLibraryImpl | class Foundation_API SharedLibraryImpl | |||
{ | { | |||
protected: | protected: | |||
enum Flags | ||||
{ | ||||
SHLIB_GLOBAL_IMPL = 1, | ||||
SHLIB_LOCAL_IMPL = 2 | ||||
}; | ||||
SharedLibraryImpl(); | SharedLibraryImpl(); | |||
~SharedLibraryImpl(); | ~SharedLibraryImpl(); | |||
void loadImpl(const std::string& path); | void loadImpl(const std::string& path, int flags); | |||
void unloadImpl(); | void unloadImpl(); | |||
bool isLoadedImpl() const; | bool isLoadedImpl() const; | |||
void* findSymbolImpl(const std::string& name); | void* findSymbolImpl(const std::string& name); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
static std::string suffixImpl(); | static std::string suffixImpl(); | |||
private: | private: | |||
std::string _path; | std::string _path; | |||
void* _handle; | void* _handle; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 8 lines changed or added | |||
SharedLibrary_VMS.h | SharedLibrary_VMS.h | |||
---|---|---|---|---|
// | // | |||
// SharedLibrary_VMS.h | // SharedLibrary_VMS.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_VMS.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_VMS.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: SharedLibrary | // Package: SharedLibrary | |||
// Module: SharedLibrary | // Module: SharedLibrary | |||
// | // | |||
// Definition of the SharedLibraryImpl class for VMS (dlopen). | // Definition of the SharedLibraryImpl class for VMS (dlopen). | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 51 | skipping to change at line 51 | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API SharedLibraryImpl | class Foundation_API SharedLibraryImpl | |||
{ | { | |||
protected: | protected: | |||
SharedLibraryImpl(); | SharedLibraryImpl(); | |||
~SharedLibraryImpl(); | ~SharedLibraryImpl(); | |||
void loadImpl(const std::string& path); | void loadImpl(const std::string& path, int flags); | |||
void unloadImpl(); | void unloadImpl(); | |||
bool isLoadedImpl() const; | bool isLoadedImpl() const; | |||
void* findSymbolImpl(const std::string& name); | void* findSymbolImpl(const std::string& name); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
static std::string suffixImpl(); | static std::string suffixImpl(); | |||
private: | private: | |||
std::string _path; | std::string _path; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SharedLibrary_VX.h | SharedLibrary_VX.h | |||
---|---|---|---|---|
// | // | |||
// SharedLibrary_VX.h | // SharedLibrary_VX.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_VX.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_VX.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: SharedLibrary | // Package: SharedLibrary | |||
// Module: SharedLibrary | // Module: SharedLibrary | |||
// | // | |||
// Definition of the SharedLibraryImpl class for VxWorks. | // Definition of the SharedLibraryImpl class for VxWorks. | |||
// | // | |||
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 52 | skipping to change at line 52 | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include <moduleLib.h> | #include <moduleLib.h> | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API SharedLibraryImpl | class Foundation_API SharedLibraryImpl | |||
{ | { | |||
protected: | protected: | |||
SharedLibraryImpl(); | SharedLibraryImpl(); | |||
~SharedLibraryImpl(); | ~SharedLibraryImpl(); | |||
void loadImpl(const std::string& path); | void loadImpl(const std::string& path, int flags); | |||
void unloadImpl(); | void unloadImpl(); | |||
bool isLoadedImpl() const; | bool isLoadedImpl() const; | |||
void* findSymbolImpl(const std::string& name); | void* findSymbolImpl(const std::string& name); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
static std::string suffixImpl(); | static std::string suffixImpl(); | |||
private: | private: | |||
std::string _path; | std::string _path; | |||
MODULE_ID _moduleId; | MODULE_ID _moduleId; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SharedLibrary_WIN32.h | SharedLibrary_WIN32.h | |||
---|---|---|---|---|
// | // | |||
// SharedLibrary_WIN32.h | // SharedLibrary_WIN32.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_WIN32.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_WIN32.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: SharedLibrary | // Package: SharedLibrary | |||
// Module: SharedLibrary | // Module: SharedLibrary | |||
// | // | |||
// Definition of the SharedLibraryImpl class for Win32. | // Definition of the SharedLibraryImpl class for Win32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 51 | skipping to change at line 51 | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API SharedLibraryImpl | class Foundation_API SharedLibraryImpl | |||
{ | { | |||
protected: | protected: | |||
SharedLibraryImpl(); | SharedLibraryImpl(); | |||
~SharedLibraryImpl(); | ~SharedLibraryImpl(); | |||
void loadImpl(const std::string& path); | void loadImpl(const std::string& path, int flags); | |||
void unloadImpl(); | void unloadImpl(); | |||
bool isLoadedImpl() const; | bool isLoadedImpl() const; | |||
void* findSymbolImpl(const std::string& name); | void* findSymbolImpl(const std::string& name); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
static std::string suffixImpl(); | static std::string suffixImpl(); | |||
private: | private: | |||
std::string _path; | std::string _path; | |||
void* _handle; | void* _handle; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SharedLibrary_WIN32U.h | SharedLibrary_WIN32U.h | |||
---|---|---|---|---|
// | // | |||
// SharedLibrary_WIN32U.h | // SharedLibrary_WIN32U.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_WIN32U.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedLibrary_WIN32U.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: SharedLibrary | // Package: SharedLibrary | |||
// Module: SharedLibrary | // Module: SharedLibrary | |||
// | // | |||
// Definition of the SharedLibraryImpl class for Win32. | // Definition of the SharedLibraryImpl class for Win32. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 51 | skipping to change at line 51 | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API SharedLibraryImpl | class Foundation_API SharedLibraryImpl | |||
{ | { | |||
protected: | protected: | |||
SharedLibraryImpl(); | SharedLibraryImpl(); | |||
~SharedLibraryImpl(); | ~SharedLibraryImpl(); | |||
void loadImpl(const std::string& path); | void loadImpl(const std::string& path, int flags); | |||
void unloadImpl(); | void unloadImpl(); | |||
bool isLoadedImpl() const; | bool isLoadedImpl() const; | |||
void* findSymbolImpl(const std::string& name); | void* findSymbolImpl(const std::string& name); | |||
const std::string& getPathImpl() const; | const std::string& getPathImpl() const; | |||
static std::string suffixImpl(); | static std::string suffixImpl(); | |||
private: | private: | |||
std::string _path; | std::string _path; | |||
void* _handle; | void* _handle; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SocketDefs.h | SocketDefs.h | |||
---|---|---|---|---|
// | // | |||
// SocketDefs.h | // SocketDefs.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#3 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#5 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: SocketDefs | // Module: SocketDefs | |||
// | // | |||
// Include platform-specific header files for sockets. | // Include platform-specific header files for sockets. | |||
// | // | |||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 235 | skipping to change at line 235 | |||
#define POCO_HOST_NOT_FOUND HOST_NOT_FOUND | #define POCO_HOST_NOT_FOUND HOST_NOT_FOUND | |||
#define POCO_TRY_AGAIN TRY_AGAIN | #define POCO_TRY_AGAIN TRY_AGAIN | |||
#define POCO_NO_RECOVERY NO_RECOVERY | #define POCO_NO_RECOVERY NO_RECOVERY | |||
#define POCO_NO_DATA NO_DATA | #define POCO_NO_DATA NO_DATA | |||
#endif | #endif | |||
#if defined(POCO_OS_FAMILY_BSD) || (POCO_OS == POCO_OS_TRU64) || (POCO_OS = = POCO_OS_AIX) || (POCO_OS == POCO_OS_IRIX) || (POCO_OS == POCO_OS_QNX) || (POCO_OS == POCO_OS_VXWORKS) | #if defined(POCO_OS_FAMILY_BSD) || (POCO_OS == POCO_OS_TRU64) || (POCO_OS = = POCO_OS_AIX) || (POCO_OS == POCO_OS_IRIX) || (POCO_OS == POCO_OS_QNX) || (POCO_OS == POCO_OS_VXWORKS) | |||
#define POCO_HAVE_SALEN 1 | #define POCO_HAVE_SALEN 1 | |||
#endif | #endif | |||
#if POCO_OS != POCO_OS_VXWORKS | ||||
#define POCO_HAVE_ADDRINFO 1 | ||||
#endif | ||||
#if (POCO_OS == POCO_OS_HPUX) || (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS = = POCO_OS_WINDOWS_CE) | #if (POCO_OS == POCO_OS_HPUX) || (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS = = POCO_OS_WINDOWS_CE) | |||
#define POCO_BROKEN_TIMEOUTS 1 | #define POCO_BROKEN_TIMEOUTS 1 | |||
#endif | #endif | |||
#if defined(POCO_HAVE_ADDRINFO) | ||||
#if !defined(AI_ADDRCONFIG) | ||||
#define AI_ADDRCONFIG 0 | ||||
#endif | ||||
#endif | ||||
#if defined(POCO_HAVE_SALEN) | #if defined(POCO_HAVE_SALEN) | |||
#define poco_set_sa_len(pSA, len) (pSA)->sa_len = (len) | #define poco_set_sa_len(pSA, len) (pSA)->sa_len = (len) | |||
#define poco_set_sin_len(pSA) (pSA)->sin_len = sizeof(struct sockaddr_ in) | #define poco_set_sin_len(pSA) (pSA)->sin_len = sizeof(struct sockaddr_ in) | |||
#if defined(POCO_HAVE_IPv6) | #if defined(POCO_HAVE_IPv6) | |||
#define poco_set_sin6_len(pSA) (pSA)->sin6_len = sizeof(struct sockaddr_ in6) | #define poco_set_sin6_len(pSA) (pSA)->sin6_len = sizeof(struct sockaddr_ in6) | |||
#endif | #endif | |||
#else | #else | |||
#define poco_set_sa_len(pSA, len) (void) 0 | #define poco_set_sa_len(pSA, len) (void) 0 | |||
#define poco_set_sin_len(pSA) (void) 0 | #define poco_set_sin_len(pSA) (void) 0 | |||
#define poco_set_sin6_len(pSA) (void) 0 | #define poco_set_sin6_len(pSA) (void) 0 | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 11 lines changed or added | |||
StreamCopier.h | StreamCopier.h | |||
---|---|---|---|---|
// | // | |||
// StreamCopier.h | // StreamCopier.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/StreamCopier.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/StreamCopier.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: StreamCopier | // Module: StreamCopier | |||
// | // | |||
// Definition of class StreamCopier. | // Definition of class StreamCopier. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 44 | skipping to change at line 44 | |||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT HER | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Foundation_StreamCopier_INCLUDED | #ifndef Foundation_StreamCopier_INCLUDED | |||
#define Foundation_StreamCopier_INCLUDED | #define Foundation_StreamCopier_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <istream> | #include <istream> | |||
#include <ostream> | #include <ostream> | |||
#include <cstddef> | ||||
namespace Poco { | namespace Poco { | |||
class Foundation_API StreamCopier | class Foundation_API StreamCopier | |||
/// This class provides static methods to copy the contents from one stream | /// This class provides static methods to copy the contents from one stream | |||
/// into another. | /// into another. | |||
{ | { | |||
public: | public: | |||
static std::streamsize copyStream(std::istream& istr, std::ostream& ost r, unsigned bufferSize = 8192); | static std::streamsize copyStream(std::istream& istr, std::ostream& ost r, std::size_t bufferSize = 8192); | |||
/// Writes all bytes readable from istr to ostr, using an in ternal buffer. | /// Writes all bytes readable from istr to ostr, using an in ternal buffer. | |||
/// | /// | |||
/// Returns the number of bytes copied. | /// Returns the number of bytes copied. | |||
#if defined(POCO_HAVE_INT64) | ||||
static Poco::UInt64 copyStream64(std::istream& istr, std::ostream& ostr | ||||
, std::size_t bufferSize = 8192); | ||||
/// Writes all bytes readable from istr to ostr, using an in | ||||
ternal buffer. | ||||
/// | ||||
/// Returns the number of bytes copied as a 64-bit unsigned | ||||
integer. | ||||
/// | ||||
/// Note: the only difference to copyStream() is that a 64-b | ||||
it unsigned | ||||
/// integer is used to count the number of bytes copied. | ||||
#endif | ||||
static std::streamsize copyStreamUnbuffered(std::istream& istr, std::os tream& ostr); | static std::streamsize copyStreamUnbuffered(std::istream& istr, std::os tream& ostr); | |||
/// Writes all bytes readable from istr to ostr. | /// Writes all bytes readable from istr to ostr. | |||
/// | /// | |||
/// Returns the number of bytes copied. | /// Returns the number of bytes copied. | |||
static std::streamsize copyToString(std::istream& istr, std::string& st | #if defined(POCO_HAVE_INT64) | |||
r, unsigned bufferSize = 8192); | static Poco::UInt64 copyStreamUnbuffered64(std::istream& istr, std::ost | |||
ream& ostr); | ||||
/// Writes all bytes readable from istr to ostr. | ||||
/// | ||||
/// Returns the number of bytes copied as a 64-bit unsigned | ||||
integer. | ||||
/// | ||||
/// Note: the only difference to copyStreamUnbuffered() is t | ||||
hat a 64-bit unsigned | ||||
/// integer is used to count the number of bytes copied. | ||||
#endif | ||||
static std::streamsize copyToString(std::istream& istr, std::string& st | ||||
r, std::size_t bufferSize = 8192); | ||||
/// Appends all bytes readable from istr to the given string , using an internal buffer. | /// Appends all bytes readable from istr to the given string , using an internal buffer. | |||
/// | /// | |||
/// Returns the number of bytes copied. | /// Returns the number of bytes copied. | |||
#if defined(POCO_HAVE_INT64) | ||||
static Poco::UInt64 copyToString64(std::istream& istr, std::string& str | ||||
, std::size_t bufferSize = 8192); | ||||
/// Appends all bytes readable from istr to the given string | ||||
, using an internal buffer. | ||||
/// | ||||
/// Returns the number of bytes copied as a 64-bit unsigned | ||||
integer. | ||||
/// | ||||
/// Note: the only difference to copyToString() is that a 64 | ||||
-bit unsigned | ||||
/// integer is used to count the number of bytes copied. | ||||
#endif | ||||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_StreamCopier_INCLUDED | #endif // Foundation_StreamCopier_INCLUDED | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 46 lines changed or added | |||
Version.h | Version.h | |||
---|---|---|---|---|
// | // | |||
// Version.h | // Version.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Version.h#7 $ | // $Id: //poco/1.4/Foundation/include/Poco/Version.h#9 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Version | // Module: Version | |||
// | // | |||
// Version information for the POCO C++ Libraries. | // Version information for the POCO C++ Libraries. | |||
// | // | |||
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
// Permission is hereby granted, free of charge, to any person or organizat ion | // Permission is hereby granted, free of charge, to any person or organizat ion | |||
// obtaining a copy of the software and accompanying documentation covered by | // obtaining a copy of the software and accompanying documentation covered by | |||
// this license (the "Software") to use, reproduce, display, distribute, | // this license (the "Software") to use, reproduce, display, distribute, | |||
// execute, and transmit the Software, and to prepare derivative works of t he | // execute, and transmit the Software, and to prepare derivative works of t he | |||
// Software, and to permit third-parties to whom the Software is furnished to | // Software, and to permit third-parties to whom the Software is furnished to | |||
// do so, all subject to the following: | // do so, all subject to the following: | |||
// | // | |||
// The copyright notices in the Software and this entire statement, includi ng | // The copyright notices in the Software and this entire statement, includi ng | |||
skipping to change at line 55 | skipping to change at line 55 | |||
// - AA is the major version number, | // - AA is the major version number, | |||
// - BB is the minor version number, | // - BB is the minor version number, | |||
// - CC is the revision number, and | // - CC is the revision number, and | |||
// - DD is the patch level number. | // - DD is the patch level number. | |||
// Note that some patch level numbers have | // Note that some patch level numbers have | |||
// a special meaning: | // a special meaning: | |||
// Dx are development releases | // Dx are development releases | |||
// Ax are alpha releases | // Ax are alpha releases | |||
// Bx are beta releases | // Bx are beta releases | |||
// | // | |||
#define POCO_VERSION 0x01040200 | #define POCO_VERSION 0x01040300 | |||
#endif // Foundation_Version_INCLUDED | #endif // Foundation_Version_INCLUDED | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
WinRegistryConfiguration.h | WinRegistryConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// WinRegistryConfiguration.h | // WinRegistryConfiguration.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/WinRegistryConfiguration.h#1 $ | // $Id: //poco/1.4/Util/include/Poco/Util/WinRegistryConfiguration.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Windows | // Package: Windows | |||
// Module: WinRegistryConfiguration | // Module: WinRegistryConfiguration | |||
// | // | |||
// Definition of the WinRegistryConfiguration class. | // Definition of the WinRegistryConfiguration class. | |||
// | // | |||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 56 | skipping to change at line 56 | |||
namespace Util { | namespace Util { | |||
class Util_API WinRegistryConfiguration: public AbstractConfiguration | class Util_API WinRegistryConfiguration: public AbstractConfiguration | |||
/// An implementation of AbstractConfiguration that stores configura tion data | /// An implementation of AbstractConfiguration that stores configura tion data | |||
/// in the Windows registry. | /// in the Windows registry. | |||
/// | /// | |||
/// Removing key is not supported. An attempt to remove a key result s | /// Removing key is not supported. An attempt to remove a key result s | |||
/// in a NotImplementedException being thrown. | /// in a NotImplementedException being thrown. | |||
{ | { | |||
public: | public: | |||
WinRegistryConfiguration(const std::string& rootPath); | WinRegistryConfiguration(const std::string& rootPath, REGSAM extraSa m = 0); | |||
/// Creates the WinRegistryConfiguration. | /// Creates the WinRegistryConfiguration. | |||
/// The rootPath must start with one of the root key names | /// The rootPath must start with one of the root key names | |||
/// like HKEY_CLASSES_ROOT, e.g. HKEY_LOCAL_MACHINE\SYSTEM\C urrentControlSet\Services. | /// like HKEY_CLASSES_ROOT, e.g. HKEY_LOCAL_MACHINE\SYSTEM\C urrentControlSet\Services. | |||
/// All further keys are relativ to the root path and can be | /// All further keys are relativ to the root path and can be | |||
/// dot seperated, e.g. the path MyService.ServiceName will be converted to | /// dot seperated, e.g. the path MyService.ServiceName will be converted to | |||
/// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyS ervice\ServiceName. | /// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyS ervice\ServiceName. | |||
/// The extraSam parameter will be passed along to WinRegistryKey, | ||||
to control | ||||
/// registry virtualization for example. | ||||
protected: | protected: | |||
~WinRegistryConfiguration(); | ~WinRegistryConfiguration(); | |||
/// Destroys the WinRegistryConfiguration. | /// Destroys the WinRegistryConfiguration. | |||
bool getRaw(const std::string& key, std::string& value) const; | bool getRaw(const std::string& key, std::string& value) const; | |||
void setRaw(const std::string& key, const std::string& value); | void setRaw(const std::string& key, const std::string& value); | |||
void enumerate(const std::string& key, Keys& range) const; | void enumerate(const std::string& key, Keys& range) const; | |||
void removeRaw(const std::string& key); | void removeRaw(const std::string& key); | |||
std::string ConvertToRegFormat(const std::string& key, std::string& keyName) const; | std::string ConvertToRegFormat(const std::string& key, std::string& keyName) const; | |||
/// takes a key in the format of A.B.C and converts it to | /// takes a key in the format of A.B.C and converts it to | |||
/// registry format A\B\C, the last entry is the keyName, th e rest is returned as path | /// registry format A\B\C, the last entry is the keyName, th e rest is returned as path | |||
private: | private: | |||
std::string _rootPath; | std::string _rootPath; | |||
REGSAM _extraSam; | ||||
}; | }; | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
#endif // Util_WinRegistryConfiguration_INCLUDED | #endif // Util_WinRegistryConfiguration_INCLUDED | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added | |||
XMLConfiguration.h | XMLConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// XMLConfiguration.h | // XMLConfiguration.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/XMLConfiguration.h#1 $ | // $Id: //poco/1.4/Util/include/Poco/Util/XMLConfiguration.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Configuration | // Package: Configuration | |||
// Module: XMLConfiguration | // Module: XMLConfiguration | |||
// | // | |||
// Definition of the XMLConfiguration class. | // Definition of the XMLConfiguration class. | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 88 | skipping to change at line 88 | |||
/// prop3.prop4 -> (empty string) | /// prop3.prop4 -> (empty string) | |||
/// prop3.prop4[@attr] -> value3 | /// prop3.prop4[@attr] -> value3 | |||
/// prop3.prop4[1][@attr] -> value4 | /// prop3.prop4[1][@attr] -> value4 | |||
/// prop5[0] -> value5 | /// prop5[0] -> value5 | |||
/// prop5[1] -> value6 | /// prop5[1] -> value6 | |||
/// prop5[@id=first] -> value5 | /// prop5[@id=first] -> value5 | |||
/// prop5[@id='second'] -> value6 | /// prop5[@id='second'] -> value6 | |||
/// | /// | |||
/// Enumerating attributes is not supported. | /// Enumerating attributes is not supported. | |||
/// Calling keys("prop3.prop4") will return an empty range. | /// Calling keys("prop3.prop4") will return an empty range. | |||
/// | ||||
/// As a special feature, the delimiter character used to delimit | ||||
/// property names can be changed to something other than period ('. | ||||
') by | ||||
/// passing the desired character to the constructor. This allows | ||||
/// working with XML documents having element names with periods | ||||
/// in them. | ||||
{ | { | |||
public: | public: | |||
XMLConfiguration(); | XMLConfiguration(); | |||
/// Creates an empty XMLConfiguration. | /// Creates an empty XMLConfiguration. | |||
XMLConfiguration(char delim); | ||||
/// Creates an empty XMLConfiguration, using the given | ||||
/// delimiter char instead of the default '.'. | ||||
XMLConfiguration(Poco::XML::InputSource* pInputSource); | XMLConfiguration(Poco::XML::InputSource* pInputSource); | |||
/// Creates an XMLConfiguration and loads the XML document f rom | /// Creates an XMLConfiguration and loads the XML document f rom | |||
/// the given InputSource. | /// the given InputSource. | |||
XMLConfiguration(Poco::XML::InputSource* pInputSource, char delim); | ||||
/// Creates an XMLConfiguration and loads the XML document f | ||||
rom | ||||
/// the given InputSource. Uses the given delimiter char ins | ||||
tead | ||||
/// of the default '.'. | ||||
XMLConfiguration(std::istream& istr); | XMLConfiguration(std::istream& istr); | |||
/// Creates an XMLConfiguration and loads the XML document f rom | /// Creates an XMLConfiguration and loads the XML document f rom | |||
/// the given stream. | /// the given stream. | |||
XMLConfiguration(std::istream& istr, char delim); | ||||
/// Creates an XMLConfiguration and loads the XML document f | ||||
rom | ||||
/// the given stream. Uses the given delimiter char instead | ||||
/// of the default '.'. | ||||
XMLConfiguration(const std::string& path); | XMLConfiguration(const std::string& path); | |||
/// Creates an XMLConfiguration and loads the XML document f rom | /// Creates an XMLConfiguration and loads the XML document f rom | |||
/// the given path. | /// the given path. | |||
XMLConfiguration(const std::string& path, char delim); | ||||
/// Creates an XMLConfiguration and loads the XML document f | ||||
rom | ||||
/// the given path. Uses the given delimiter char instead | ||||
/// of the default '.'. | ||||
XMLConfiguration(const Poco::XML::Document* pDocument); | XMLConfiguration(const Poco::XML::Document* pDocument); | |||
/// Creates the XMLConfiguration using the given XML documen t. | /// Creates the XMLConfiguration using the given XML documen t. | |||
XMLConfiguration(const Poco::XML::Document* pDocument, char delim); | ||||
/// Creates the XMLConfiguration using the given XML documen | ||||
t. | ||||
/// Uses the given delimiter char instead of the default '.' | ||||
. | ||||
XMLConfiguration(const Poco::XML::Node* pNode); | XMLConfiguration(const Poco::XML::Node* pNode); | |||
/// Creates the XMLConfiguration using the given XML node. | /// Creates the XMLConfiguration using the given XML node. | |||
XMLConfiguration(const Poco::XML::Node* pNode, char delim); | ||||
/// Creates the XMLConfiguration using the given XML node. | ||||
/// Uses the given delimiter char instead of the default '.' | ||||
. | ||||
void load(Poco::XML::InputSource* pInputSource); | void load(Poco::XML::InputSource* pInputSource); | |||
/// Loads the XML document containing the configuration data | /// Loads the XML document containing the configuration data | |||
/// from the given InputSource. | /// from the given InputSource. | |||
void load(std::istream& istr); | void load(std::istream& istr); | |||
/// Loads the XML document containing the configuration data | /// Loads the XML document containing the configuration data | |||
/// from the given stream. | /// from the given stream. | |||
void load(const std::string& path); | void load(const std::string& path); | |||
/// Loads the XML document containing the configuration data | /// Loads the XML document containing the configuration data | |||
skipping to change at line 165 | skipping to change at line 198 | |||
protected: | protected: | |||
bool getRaw(const std::string& key, std::string& value) const; | bool getRaw(const std::string& key, std::string& value) const; | |||
void setRaw(const std::string& key, const std::string& value); | void setRaw(const std::string& key, const std::string& value); | |||
void enumerate(const std::string& key, Keys& range) const; | void enumerate(const std::string& key, Keys& range) const; | |||
void removeRaw(const std::string& key); | void removeRaw(const std::string& key); | |||
~XMLConfiguration(); | ~XMLConfiguration(); | |||
private: | private: | |||
const Poco::XML::Node* findNode(const std::string& key) const; | const Poco::XML::Node* findNode(const std::string& key) const; | |||
Poco::XML::Node* findNode(const std::string& key); | Poco::XML::Node* findNode(const std::string& key); | |||
static Poco::XML::Node* findNode(std::string::const_iterator& it, co nst std::string::const_iterator& end, Poco::XML::Node* pNode, bool create = false); | Poco::XML::Node* findNode(std::string::const_iterator& it, const std ::string::const_iterator& end, Poco::XML::Node* pNode, bool create = false) const; | |||
static Poco::XML::Node* findElement(const std::string& name, Poco::X ML::Node* pNode, bool create); | static Poco::XML::Node* findElement(const std::string& name, Poco::X ML::Node* pNode, bool create); | |||
static Poco::XML::Node* findElement(int index, Poco::XML::Node* pNod e, bool create); | static Poco::XML::Node* findElement(int index, Poco::XML::Node* pNod e, bool create); | |||
static Poco::XML::Node* findElement(const std::string& attr, const s td::string& value, Poco::XML::Node* pNode); | static Poco::XML::Node* findElement(const std::string& attr, const s td::string& value, Poco::XML::Node* pNode); | |||
static Poco::XML::Node* findAttribute(const std::string& name, Poco: :XML::Node* pNode, bool create); | static Poco::XML::Node* findAttribute(const std::string& name, Poco: :XML::Node* pNode, bool create); | |||
Poco::XML::AutoPtr<Poco::XML::Node> _pRoot; | Poco::XML::AutoPtr<Poco::XML::Node> _pRoot; | |||
Poco::XML::AutoPtr<Poco::XML::Document> _pDocument; | Poco::XML::AutoPtr<Poco::XML::Document> _pDocument; | |||
char _delim; | ||||
}; | }; | |||
} } // namespace Poco::Util | } } // namespace Poco::Util | |||
#endif // Util_XMLConfiguration_INCLUDED | #endif // Util_XMLConfiguration_INCLUDED | |||
End of changes. 10 change blocks. | ||||
2 lines changed or deleted | 44 lines changed or added | |||
zconf.h | zconf.h | |||
---|---|---|---|---|
/* zconf.h -- configuration of the zlib compression library | /* zconf.h -- configuration of the zlib compression library | |||
* Copyright (C) 1995-2005 Jean-loup Gailly. | * Copyright (C) 1995-2010 Jean-loup Gailly. | |||
* For conditions of distribution and use, see copyright notice in zlib.h | * For conditions of distribution and use, see copyright notice in zlib.h | |||
*/ | */ | |||
/* @(#) $Id: //poco/1.4/Foundation/include/Poco/zconf.h#1 $ */ | /* @(#) $Id: //poco/1.4/Foundation/include/Poco/zconf.h#3 $ */ | |||
#ifndef ZCONF_H | #ifndef ZCONF_H | |||
#define ZCONF_H | #define ZCONF_H | |||
/* | /* | |||
* If you *really* need a unique prefix for all types and library functions , | * If you *really* need a unique prefix for all types and library functions , | |||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | |||
* Even better than compiling with -DZ_PREFIX would be to use configure to | ||||
set | ||||
* this permanently in zconf.h using "./configure --zprefix". | ||||
*/ | */ | |||
#ifdef Z_PREFIX | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | |||
# define deflateInit_ z_deflateInit_ | ||||
/* all linked symbols */ | ||||
# define _dist_code z__dist_code | ||||
# define _length_code z__length_code | ||||
# define _tr_align z__tr_align | ||||
# define _tr_flush_block z__tr_flush_block | ||||
# define _tr_init z__tr_init | ||||
# define _tr_stored_block z__tr_stored_block | ||||
# define _tr_tally z__tr_tally | ||||
# define adler32 z_adler32 | ||||
# define adler32_combine z_adler32_combine | ||||
# define adler32_combine64 z_adler32_combine64 | ||||
# define compress z_compress | ||||
# define compress2 z_compress2 | ||||
# define compressBound z_compressBound | ||||
# define crc32 z_crc32 | ||||
# define crc32_combine z_crc32_combine | ||||
# define crc32_combine64 z_crc32_combine64 | ||||
# define deflate z_deflate | # define deflate z_deflate | |||
# define deflateBound z_deflateBound | ||||
# define deflateCopy z_deflateCopy | ||||
# define deflateEnd z_deflateEnd | # define deflateEnd z_deflateEnd | |||
# define inflateInit_ z_inflateInit_ | ||||
# define inflate z_inflate | ||||
# define inflateEnd z_inflateEnd | ||||
# define deflateInit2_ z_deflateInit2_ | # define deflateInit2_ z_deflateInit2_ | |||
# define deflateSetDictionary z_deflateSetDictionary | # define deflateInit_ z_deflateInit_ | |||
# define deflateCopy z_deflateCopy | ||||
# define deflateReset z_deflateReset | ||||
# define deflateParams z_deflateParams | # define deflateParams z_deflateParams | |||
# define deflateBound z_deflateBound | ||||
# define deflatePrime z_deflatePrime | # define deflatePrime z_deflatePrime | |||
# define deflateReset z_deflateReset | ||||
# define deflateSetDictionary z_deflateSetDictionary | ||||
# define deflateSetHeader z_deflateSetHeader | ||||
# define deflateTune z_deflateTune | ||||
# define deflate_copyright z_deflate_copyright | ||||
# define get_crc_table z_get_crc_table | ||||
# define gz_error z_gz_error | ||||
# define gz_intmax z_gz_intmax | ||||
# define gz_strwinerror z_gz_strwinerror | ||||
# define gzbuffer z_gzbuffer | ||||
# define gzclearerr z_gzclearerr | ||||
# define gzclose z_gzclose | ||||
# define gzclose_r z_gzclose_r | ||||
# define gzclose_w z_gzclose_w | ||||
# define gzdirect z_gzdirect | ||||
# define gzdopen z_gzdopen | ||||
# define gzeof z_gzeof | ||||
# define gzerror z_gzerror | ||||
# define gzflush z_gzflush | ||||
# define gzgetc z_gzgetc | ||||
# define gzgets z_gzgets | ||||
# define gzoffset z_gzoffset | ||||
# define gzoffset64 z_gzoffset64 | ||||
# define gzopen z_gzopen | ||||
# define gzopen64 z_gzopen64 | ||||
# define gzprintf z_gzprintf | ||||
# define gzputc z_gzputc | ||||
# define gzputs z_gzputs | ||||
# define gzread z_gzread | ||||
# define gzrewind z_gzrewind | ||||
# define gzseek z_gzseek | ||||
# define gzseek64 z_gzseek64 | ||||
# define gzsetparams z_gzsetparams | ||||
# define gztell z_gztell | ||||
# define gztell64 z_gztell64 | ||||
# define gzungetc z_gzungetc | ||||
# define gzwrite z_gzwrite | ||||
# define inflate z_inflate | ||||
# define inflateBack z_inflateBack | ||||
# define inflateBackEnd z_inflateBackEnd | ||||
# define inflateBackInit_ z_inflateBackInit_ | ||||
# define inflateCopy z_inflateCopy | ||||
# define inflateEnd z_inflateEnd | ||||
# define inflateGetHeader z_inflateGetHeader | ||||
# define inflateInit2_ z_inflateInit2_ | # define inflateInit2_ z_inflateInit2_ | |||
# define inflateInit_ z_inflateInit_ | ||||
# define inflateMark z_inflateMark | ||||
# define inflatePrime z_inflatePrime | ||||
# define inflateReset z_inflateReset | ||||
# define inflateReset2 z_inflateReset2 | ||||
# define inflateSetDictionary z_inflateSetDictionary | # define inflateSetDictionary z_inflateSetDictionary | |||
# define inflateSync z_inflateSync | # define inflateSync z_inflateSync | |||
# define inflateSyncPoint z_inflateSyncPoint | # define inflateSyncPoint z_inflateSyncPoint | |||
# define inflateCopy z_inflateCopy | # define inflateUndermine z_inflateUndermine | |||
# define inflateReset z_inflateReset | # define inflate_copyright z_inflate_copyright | |||
# define inflateBack z_inflateBack | # define inflate_fast z_inflate_fast | |||
# define inflateBackEnd z_inflateBackEnd | # define inflate_table z_inflate_table | |||
# define compress z_compress | ||||
# define compress2 z_compress2 | ||||
# define compressBound z_compressBound | ||||
# define uncompress z_uncompress | # define uncompress z_uncompress | |||
# define adler32 z_adler32 | ||||
# define crc32 z_crc32 | ||||
# define get_crc_table z_get_crc_table | ||||
# define zError z_zError | # define zError z_zError | |||
# define zcalloc z_zcalloc | ||||
# define zcfree z_zcfree | ||||
# define zlibCompileFlags z_zlibCompileFlags | ||||
# define zlibVersion z_zlibVersion | ||||
/* all zlib typedefs in zlib.h and zconf.h */ | ||||
# define Byte z_Byte | ||||
# define Bytef z_Bytef | ||||
# define alloc_func z_alloc_func | # define alloc_func z_alloc_func | |||
# define charf z_charf | ||||
# define free_func z_free_func | # define free_func z_free_func | |||
# define gzFile z_gzFile | ||||
# define gz_header z_gz_header | ||||
# define gz_headerp z_gz_headerp | ||||
# define in_func z_in_func | # define in_func z_in_func | |||
# define intf z_intf | ||||
# define out_func z_out_func | # define out_func z_out_func | |||
# define Byte z_Byte | ||||
# define uInt z_uInt | # define uInt z_uInt | |||
# define uLong z_uLong | ||||
# define Bytef z_Bytef | ||||
# define charf z_charf | ||||
# define intf z_intf | ||||
# define uIntf z_uIntf | # define uIntf z_uIntf | |||
# define uLong z_uLong | ||||
# define uLongf z_uLongf | # define uLongf z_uLongf | |||
# define voidpf z_voidpf | ||||
# define voidp z_voidp | # define voidp z_voidp | |||
# define voidpc z_voidpc | ||||
# define voidpf z_voidpf | ||||
/* all zlib structs in zlib.h and zconf.h */ | ||||
# define gz_header_s z_gz_header_s | ||||
# define internal_state z_internal_state | ||||
#endif | #endif | |||
#if defined(__MSDOS__) && !defined(MSDOS) | #if defined(__MSDOS__) && !defined(MSDOS) | |||
# define MSDOS | # define MSDOS | |||
#endif | #endif | |||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) | |||
# define OS2 | # define OS2 | |||
#endif | #endif | |||
#if defined(_WINDOWS) && !defined(WINDOWS) | #if defined(_WINDOWS) && !defined(WINDOWS) | |||
# define WINDOWS | # define WINDOWS | |||
skipping to change at line 287 | skipping to change at line 359 | |||
#ifdef STDC | #ifdef STDC | |||
typedef void const *voidpc; | typedef void const *voidpc; | |||
typedef void FAR *voidpf; | typedef void FAR *voidpf; | |||
typedef void *voidp; | typedef void *voidp; | |||
#else | #else | |||
typedef Byte const *voidpc; | typedef Byte const *voidpc; | |||
typedef Byte FAR *voidpf; | typedef Byte FAR *voidpf; | |||
typedef Byte *voidp; | typedef Byte *voidp; | |||
#endif | #endif | |||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ | #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | |||
# include <sys/types.h> /* for off_t */ | # define Z_HAVE_UNISTD_H | |||
# include <unistd.h> /* for SEEK_* and off_t */ | #endif | |||
#ifndef _WIN32_WCE | ||||
#ifdef STDC | ||||
# include <sys/types.h> /* for off_t */ | ||||
#endif | ||||
#endif | ||||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | ||||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | ||||
* though the former does not conform to the LFS document), but considering | ||||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | ||||
* equivalently requesting no 64-bit operations | ||||
*/ | ||||
#if -_LARGEFILE64_SOURCE - -1 == 1 | ||||
# undef _LARGEFILE64_SOURCE | ||||
#endif | ||||
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) | ||||
# include <unistd.h> /* for SEEK_* and off_t */ | ||||
# ifdef VMS | # ifdef VMS | |||
# include <unixio.h> /* for off_t */ | # include <unixio.h> /* for off_t */ | |||
# endif | ||||
# ifndef z_off_t | ||||
# define z_off_t off_t | ||||
# endif | # endif | |||
# define z_off_t off_t | ||||
#endif | #endif | |||
#ifndef SEEK_SET | #ifndef SEEK_SET | |||
# define SEEK_SET 0 /* Seek from beginning of file. */ | # define SEEK_SET 0 /* Seek from beginning of file. */ | |||
# define SEEK_CUR 1 /* Seek from current position. */ | # define SEEK_CUR 1 /* Seek from current position. */ | |||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | |||
#endif | #endif | |||
#ifndef z_off_t | #ifndef z_off_t | |||
# define z_off_t long | # define z_off_t long | |||
#endif | #endif | |||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 | ||||
# define z_off64_t off64_t | ||||
#else | ||||
# define z_off64_t z_off_t | ||||
#endif | ||||
#if defined(__OS400__) | #if defined(__OS400__) | |||
# define NO_vsnprintf | # define NO_vsnprintf | |||
#endif | #endif | |||
#if defined(__MVS__) | #if defined(__MVS__) | |||
# define NO_vsnprintf | # define NO_vsnprintf | |||
# ifdef FAR | ||||
# undef FAR | ||||
# endif | ||||
#endif | #endif | |||
/* MVS linker does not support external names larger than 8 bytes */ | /* MVS linker does not support external names larger than 8 bytes */ | |||
#if defined(__MVS__) | #if defined(__MVS__) | |||
# pragma map(deflateInit_,"DEIN") | #pragma map(deflateInit_,"DEIN") | |||
# pragma map(deflateInit2_,"DEIN2") | #pragma map(deflateInit2_,"DEIN2") | |||
# pragma map(deflateEnd,"DEEND") | #pragma map(deflateEnd,"DEEND") | |||
# pragma map(deflateBound,"DEBND") | #pragma map(deflateBound,"DEBND") | |||
# pragma map(inflateInit_,"ININ") | #pragma map(inflateInit_,"ININ") | |||
# pragma map(inflateInit2_,"ININ2") | #pragma map(inflateInit2_,"ININ2") | |||
# pragma map(inflateEnd,"INEND") | #pragma map(inflateEnd,"INEND") | |||
# pragma map(inflateSync,"INSY") | #pragma map(inflateSync,"INSY") | |||
# pragma map(inflateSetDictionary,"INSEDI") | #pragma map(inflateSetDictionary,"INSEDI") | |||
# pragma map(compressBound,"CMBND") | #pragma map(compressBound,"CMBND") | |||
# pragma map(inflate_table,"INTABL") | #pragma map(inflate_table,"INTABL") | |||
# pragma map(inflate_fast,"INFA") | #pragma map(inflate_fast,"INFA") | |||
# pragma map(inflate_copyright,"INCOPY") | #pragma map(inflate_copyright,"INCOPY") | |||
#endif | #endif | |||
#endif /* ZCONF_H */ | #endif /* ZCONF_H */ | |||
End of changes. 30 change blocks. | ||||
48 lines changed or deleted | 147 lines changed or added | |||
zlib.h | zlib.h | |||
---|---|---|---|---|
/* zlib.h -- interface of the 'zlib' general purpose compression library | /* zlib.h -- interface of the 'zlib' general purpose compression library | |||
version 1.2.3, July 18th, 2005 | version 1.2.5, April 19th, 2010 | |||
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler | Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler | |||
This software is provided 'as-is', without any express or implied | This software is provided 'as-is', without any express or implied | |||
warranty. In no event will the authors be held liable for any damages | warranty. In no event will the authors be held liable for any damages | |||
arising from the use of this software. | arising from the use of this software. | |||
Permission is granted to anyone to use this software for any purpose, | Permission is granted to anyone to use this software for any purpose, | |||
including commercial applications, and to alter it and redistribute it | including commercial applications, and to alter it and redistribute it | |||
freely, subject to the following restrictions: | freely, subject to the following restrictions: | |||
1. The origin of this software must not be misrepresented; you must not | 1. The origin of this software must not be misrepresented; you must not | |||
skipping to change at line 39 | skipping to change at line 39 | |||
#ifndef ZLIB_H | #ifndef ZLIB_H | |||
#define ZLIB_H | #define ZLIB_H | |||
#include "zconf.h" | #include "zconf.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#define ZLIB_VERSION "1.2.3" | #define ZLIB_VERSION "1.2.5" | |||
#define ZLIB_VERNUM 0x1230 | #define ZLIB_VERNUM 0x1250 | |||
#define ZLIB_VER_MAJOR 1 | ||||
#define ZLIB_VER_MINOR 2 | ||||
#define ZLIB_VER_REVISION 5 | ||||
#define ZLIB_VER_SUBREVISION 0 | ||||
/* | /* | |||
The 'zlib' compression library provides in-memory compression and | The 'zlib' compression library provides in-memory compression and | |||
decompression functions, including integrity checks of the uncompressed | decompression functions, including integrity checks of the uncompressed d | |||
data. This version of the library supports only one compression method | ata. | |||
(deflation) but other algorithms will be added later and will have the sa | This version of the library supports only one compression method (deflati | |||
me | on) | |||
stream interface. | but other algorithms will be added later and will have the same stream | |||
interface. | ||||
Compression can be done in a single step if the buffers are large | Compression can be done in a single step if the buffers are large enoug | |||
enough (for example if an input file is mmap'ed), or can be done by | h, | |||
repeated calls of the compression function. In the latter case, the | or can be done by repeated calls of the compression function. In the lat | |||
application must provide more input and/or consume the output | ter | |||
case, the application must provide more input and/or consume the output | ||||
(providing more output space) before each call. | (providing more output space) before each call. | |||
The compressed data format used by default by the in-memory functions is | The compressed data format used by default by the in-memory functions i s | |||
the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped | the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped | |||
around a deflate stream, which is itself documented in RFC 1951. | around a deflate stream, which is itself documented in RFC 1951. | |||
The library also supports reading and writing files in gzip (.gz) form at | The library also supports reading and writing files in gzip (.gz) forma t | |||
with an interface similar to that of stdio using the functions that start | with an interface similar to that of stdio using the functions that start | |||
with "gz". The gzip format is different from the zlib format. gzip is a | with "gz". The gzip format is different from the zlib format. gzip is a | |||
gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. | gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. | |||
This library can optionally read and write gzip streams in memory as w ell. | This library can optionally read and write gzip streams in memory as we ll. | |||
The zlib format was designed to be compact and fast for use in memory | The zlib format was designed to be compact and fast for use in memory | |||
and on communications channels. The gzip format was designed for single- | and on communications channels. The gzip format was designed for single- | |||
file compression on file systems, has a larger header than zlib to mainta in | file compression on file systems, has a larger header than zlib to mainta in | |||
directory information, and uses a different, slower check method than zli b. | directory information, and uses a different, slower check method than zli b. | |||
The library does not install any signal handler. The decoder checks | The library does not install any signal handler. The decoder checks | |||
the consistency of the compressed data, so the library should never | the consistency of the compressed data, so the library should never crash | |||
crash even in case of corrupted input. | even in case of corrupted input. | |||
*/ | */ | |||
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); | typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); | |||
typedef void (*free_func) OF((voidpf opaque, voidpf address)); | typedef void (*free_func) OF((voidpf opaque, voidpf address)); | |||
struct internal_state; | struct internal_state; | |||
typedef struct z_stream_s { | typedef struct z_stream_s { | |||
Bytef *next_in; /* next input byte */ | Bytef *next_in; /* next input byte */ | |||
uInt avail_in; /* number of bytes available at next_in */ | uInt avail_in; /* number of bytes available at next_in */ | |||
skipping to change at line 128 | skipping to change at line 131 | |||
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ | Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ | |||
uInt comm_max; /* space at comment (only when reading header) */ | uInt comm_max; /* space at comment (only when reading header) */ | |||
int hcrc; /* true if there was or will be a header crc */ | int hcrc; /* true if there was or will be a header crc */ | |||
int done; /* true when done reading gzip header (not used | int done; /* true when done reading gzip header (not used | |||
when writing a gzip file) */ | when writing a gzip file) */ | |||
} gz_header; | } gz_header; | |||
typedef gz_header FAR *gz_headerp; | typedef gz_header FAR *gz_headerp; | |||
/* | /* | |||
The application must update next_in and avail_in when avail_in has | The application must update next_in and avail_in when avail_in has dro | |||
dropped to zero. It must update next_out and avail_out when avail_out | pped | |||
has dropped to zero. The application must initialize zalloc, zfree and | to zero. It must update next_out and avail_out when avail_out has dropp | |||
opaque before calling the init function. All other fields are set by the | ed | |||
compression library and must not be updated by the application. | to zero. The application must initialize zalloc, zfree and opaque befor | |||
e | ||||
calling the init function. All other fields are set by the compression | ||||
library and must not be updated by the application. | ||||
The opaque value provided by the application will be passed as the first | The opaque value provided by the application will be passed as the fir | |||
parameter for calls of zalloc and zfree. This can be useful for custom | st | |||
memory management. The compression library attaches no meaning to the | parameter for calls of zalloc and zfree. This can be useful for custom | |||
memory management. The compression library attaches no meaning to the | ||||
opaque value. | opaque value. | |||
zalloc must return Z_NULL if there is not enough memory for the object. | zalloc must return Z_NULL if there is not enough memory for the object . | |||
If zlib is used in a multi-threaded application, zalloc and zfree must b e | If zlib is used in a multi-threaded application, zalloc and zfree must b e | |||
thread safe. | thread safe. | |||
On 16-bit systems, the functions zalloc and zfree must be able to alloca | On 16-bit systems, the functions zalloc and zfree must be able to allo | |||
te | cate | |||
exactly 65536 bytes, but will not be required to allocate more than this | exactly 65536 bytes, but will not be required to allocate more than this | |||
if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, | if | |||
pointers returned by zalloc for objects of exactly 65536 bytes *must* | the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, poin | |||
have their offset normalized to zero. The default allocation function | ters | |||
provided by this library ensures this (see zutil.c). To reduce memory | returned by zalloc for objects of exactly 65536 bytes *must* have their | |||
requirements and avoid any allocation of 64K objects, at the expense of | offset normalized to zero. The default allocation function provided by | |||
compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h) | this | |||
. | library ensures this (see zutil.c). To reduce memory requirements and a | |||
void | ||||
any allocation of 64K objects, at the expense of compression ratio, comp | ||||
ile | ||||
the library with -DMAX_WBITS=14 (see zconf.h). | ||||
The fields total_in and total_out can be used for statistics or | The fields total_in and total_out can be used for statistics or progre | |||
progress reports. After compression, total_in holds the total size of | ss | |||
the uncompressed data and may be saved for use in the decompressor | reports. After compression, total_in holds the total size of the | |||
(particularly if the decompressor wants to decompress everything in | uncompressed data and may be saved for use in the decompressor (particul | |||
a single step). | arly | |||
if the decompressor wants to decompress everything in a single step). | ||||
*/ | */ | |||
/* constants */ | /* constants */ | |||
#define Z_NO_FLUSH 0 | #define Z_NO_FLUSH 0 | |||
#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ | #define Z_PARTIAL_FLUSH 1 | |||
#define Z_SYNC_FLUSH 2 | #define Z_SYNC_FLUSH 2 | |||
#define Z_FULL_FLUSH 3 | #define Z_FULL_FLUSH 3 | |||
#define Z_FINISH 4 | #define Z_FINISH 4 | |||
#define Z_BLOCK 5 | #define Z_BLOCK 5 | |||
#define Z_TREES 6 | ||||
/* Allowed flush values; see deflate() and inflate() below for details */ | /* Allowed flush values; see deflate() and inflate() below for details */ | |||
#define Z_OK 0 | #define Z_OK 0 | |||
#define Z_STREAM_END 1 | #define Z_STREAM_END 1 | |||
#define Z_NEED_DICT 2 | #define Z_NEED_DICT 2 | |||
#define Z_ERRNO (-1) | #define Z_ERRNO (-1) | |||
#define Z_STREAM_ERROR (-2) | #define Z_STREAM_ERROR (-2) | |||
#define Z_DATA_ERROR (-3) | #define Z_DATA_ERROR (-3) | |||
#define Z_MEM_ERROR (-4) | #define Z_MEM_ERROR (-4) | |||
#define Z_BUF_ERROR (-5) | #define Z_BUF_ERROR (-5) | |||
#define Z_VERSION_ERROR (-6) | #define Z_VERSION_ERROR (-6) | |||
/* Return codes for the compression/decompression functions. Negative | /* Return codes for the compression/decompression functions. Negative value | |||
* values are errors, positive values are used for special but normal event | s | |||
s. | * are errors, positive values are used for special but normal events. | |||
*/ | */ | |||
#define Z_NO_COMPRESSION 0 | #define Z_NO_COMPRESSION 0 | |||
#define Z_BEST_SPEED 1 | #define Z_BEST_SPEED 1 | |||
#define Z_BEST_COMPRESSION 9 | #define Z_BEST_COMPRESSION 9 | |||
#define Z_DEFAULT_COMPRESSION (-1) | #define Z_DEFAULT_COMPRESSION (-1) | |||
/* compression levels */ | /* compression levels */ | |||
#define Z_FILTERED 1 | #define Z_FILTERED 1 | |||
#define Z_HUFFMAN_ONLY 2 | #define Z_HUFFMAN_ONLY 2 | |||
skipping to change at line 213 | skipping to change at line 216 | |||
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ | #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ | |||
#define zlib_version zlibVersion() | #define zlib_version zlibVersion() | |||
/* for compatibility with versions < 1.0.2 */ | /* for compatibility with versions < 1.0.2 */ | |||
/* basic functions */ | /* basic functions */ | |||
ZEXTERN const char * ZEXPORT zlibVersion OF((void)); | ZEXTERN const char * ZEXPORT zlibVersion OF((void)); | |||
/* The application can compare zlibVersion and ZLIB_VERSION for consistency . | /* The application can compare zlibVersion and ZLIB_VERSION for consistency . | |||
If the first character differs, the library code actually used is | If the first character differs, the library code actually used is not | |||
not compatible with the zlib.h header file used by the application. | compatible with the zlib.h header file used by the application. This ch | |||
This check is automatically made by deflateInit and inflateInit. | eck | |||
is automatically made by deflateInit and inflateInit. | ||||
*/ | */ | |||
/* | /* | |||
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); | ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); | |||
Initializes the internal stream state for compression. The fields | Initializes the internal stream state for compression. The fields | |||
zalloc, zfree and opaque must be initialized before by the caller. | zalloc, zfree and opaque must be initialized before by the caller. If | |||
If zalloc and zfree are set to Z_NULL, deflateInit updates them to | zalloc and zfree are set to Z_NULL, deflateInit updates them to use defa | |||
use default allocation functions. | ult | |||
allocation functions. | ||||
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: | The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: | |||
1 gives best speed, 9 gives best compression, 0 gives no compression at | 1 gives best speed, 9 gives best compression, 0 gives no compression at | |||
all (the input data is simply copied a block at a time). | all | |||
Z_DEFAULT_COMPRESSION requests a default compromise between speed and | (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESS | |||
compression (currently equivalent to level 6). | ION | |||
requests a default compromise between speed and compression (currently | ||||
equivalent to level 6). | ||||
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not | deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enou | |||
enough memory, Z_STREAM_ERROR if level is not a valid compression level, | gh | |||
memory, Z_STREAM_ERROR if level is not a valid compression level, or | ||||
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatib le | Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatib le | |||
with the version assumed by the caller (ZLIB_VERSION). | with the version assumed by the caller (ZLIB_VERSION). msg is set to nu | |||
msg is set to null if there is no error message. deflateInit does not | ll | |||
perform any compression: this will be done by deflate(). | if there is no error message. deflateInit does not perform any compress | |||
ion: | ||||
this will be done by deflate(). | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
/* | /* | |||
deflate compresses as much data as possible, and stops when the input | deflate compresses as much data as possible, and stops when the input | |||
buffer becomes empty or the output buffer becomes full. It may introduce | buffer becomes empty or the output buffer becomes full. It may introduce | |||
some | some output latency (reading input without producing any output) except w | |||
output latency (reading input without producing any output) except when | hen | |||
forced to flush. | forced to flush. | |||
The detailed semantics are as follows. deflate performs one or both of the | The detailed semantics are as follows. deflate performs one or both of the | |||
following actions: | following actions: | |||
- Compress more input starting at next_in and update next_in and avail_in | - Compress more input starting at next_in and update next_in and avail_in | |||
accordingly. If not all input can be processed (because there is not | accordingly. If not all input can be processed (because there is not | |||
enough room in the output buffer), next_in and avail_in are updated and | enough room in the output buffer), next_in and avail_in are updated and | |||
processing will resume at this point for the next call of deflate(). | processing will resume at this point for the next call of deflate(). | |||
- Provide more output starting at next_out and update next_out and avail_ out | - Provide more output starting at next_out and update next_out and avail_ out | |||
accordingly. This action is forced if the parameter flush is non zero. | accordingly. This action is forced if the parameter flush is non zero. | |||
Forcing flush frequently degrades the compression ratio, so this parame ter | Forcing flush frequently degrades the compression ratio, so this parame ter | |||
should be set only when necessary (in interactive applications). | should be set only when necessary (in interactive applications). Some | |||
Some output may be provided even if flush is not set. | output may be provided even if flush is not set. | |||
Before the call of deflate(), the application should ensure that at least | Before the call of deflate(), the application should ensure that at lea | |||
one of the actions is possible, by providing more input and/or consuming | st | |||
more output, and updating avail_in or avail_out accordingly; avail_out | one of the actions is possible, by providing more input and/or consuming | |||
should never be zero before the call. The application can consume the | more | |||
compressed output when it wants, for example when the output buffer is fu | output, and updating avail_in or avail_out accordingly; avail_out should | |||
ll | never be zero before the call. The application can consume the compresse | |||
(avail_out == 0), or after each call of deflate(). If deflate returns Z_O | d | |||
K | output when it wants, for example when the output buffer is full (avail_o | |||
and with zero avail_out, it must be called again after making room in the | ut | |||
output buffer because there might be more output pending. | == 0), or after each call of deflate(). If deflate returns Z_OK and with | |||
zero avail_out, it must be called again after making room in the output | ||||
buffer because there might be more output pending. | ||||
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to | Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to | |||
decide how much data to accumualte before producing output, in order to | decide how much data to accumulate before producing output, in order to | |||
maximize compression. | maximize compression. | |||
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is | |||
flushed to the output buffer and the output is aligned on a byte boundary , so | flushed to the output buffer and the output is aligned on a byte boundary , so | |||
that the decompressor can get all input data available so far. (In partic | that the decompressor can get all input data available so far. (In | |||
ular | particular avail_in is zero after the call if enough output space has bee | |||
avail_in is zero after the call if enough output space has been provided | n | |||
before the call.) Flushing may degrade compression for some compression | provided before the call.) Flushing may degrade compression for some | |||
algorithms and so it should be used only when necessary. | compression algorithms and so it should be used only when necessary. Thi | |||
s | ||||
completes the current deflate block and follows it with an empty stored b | ||||
lock | ||||
that is three bits plus filler bits to the next byte, followed by four by | ||||
tes | ||||
(00 00 ff ff). | ||||
If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to th | ||||
e | ||||
output buffer, but the output is not aligned to a byte boundary. All of | ||||
the | ||||
input data so far will be available to the decompressor, as for Z_SYNC_FL | ||||
USH. | ||||
This completes the current deflate block and follows it with an empty fix | ||||
ed | ||||
codes block that is 10 bits long. This assures that enough bytes are out | ||||
put | ||||
in order for the decompressor to finish the block before the empty fixed | ||||
code | ||||
block. | ||||
If flush is set to Z_BLOCK, a deflate block is completed and emitted, a | ||||
s | ||||
for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and u | ||||
p to | ||||
seven bits of the current block are held to be written as the next byte a | ||||
fter | ||||
the next deflate block is completed. In this case, the decompressor may | ||||
not | ||||
be provided enough bits at this point in order to complete decompression | ||||
of | ||||
the data provided so far to the compressor. It may need to wait for the | ||||
next | ||||
block to be emitted. This is for advanced applications that need to cont | ||||
rol | ||||
the emission of deflate blocks. | ||||
If flush is set to Z_FULL_FLUSH, all output is flushed as with | If flush is set to Z_FULL_FLUSH, all output is flushed as with | |||
Z_SYNC_FLUSH, and the compression state is reset so that decompression ca n | Z_SYNC_FLUSH, and the compression state is reset so that decompression ca n | |||
restart from this point if previous compressed data has been damaged or i f | restart from this point if previous compressed data has been damaged or i f | |||
random access is desired. Using Z_FULL_FLUSH too often can seriously degr ade | random access is desired. Using Z_FULL_FLUSH too often can seriously deg rade | |||
compression. | compression. | |||
If deflate returns with avail_out == 0, this function must be called ag ain | If deflate returns with avail_out == 0, this function must be called ag ain | |||
with the same value of the flush parameter and more output space (updated | with the same value of the flush parameter and more output space (updated | |||
avail_out), until the flush is complete (deflate returns with non-zero | avail_out), until the flush is complete (deflate returns with non-zero | |||
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that | avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure tha t | |||
avail_out is greater than six to avoid repeated flush markers due to | avail_out is greater than six to avoid repeated flush markers due to | |||
avail_out == 0 on return. | avail_out == 0 on return. | |||
If the parameter flush is set to Z_FINISH, pending input is processed, | If the parameter flush is set to Z_FINISH, pending input is processed, | |||
pending output is flushed and deflate returns with Z_STREAM_END if there | pending output is flushed and deflate returns with Z_STREAM_END if there | |||
was enough output space; if deflate returns with Z_OK, this function must | was | |||
be | enough output space; if deflate returns with Z_OK, this function must be | |||
called again with Z_FINISH and more output space (updated avail_out) but no | called again with Z_FINISH and more output space (updated avail_out) but no | |||
more input data, until it returns with Z_STREAM_END or an error. After | more input data, until it returns with Z_STREAM_END or an error. After | |||
deflate has returned Z_STREAM_END, the only possible operations on the | deflate has returned Z_STREAM_END, the only possible operations on the st | |||
stream are deflateReset or deflateEnd. | ream | |||
are deflateReset or deflateEnd. | ||||
Z_FINISH can be used immediately after deflateInit if all the compressi on | Z_FINISH can be used immediately after deflateInit if all the compressi on | |||
is to be done in a single step. In this case, avail_out must be at least | is to be done in a single step. In this case, avail_out must be at least | |||
the value returned by deflateBound (see below). If deflate does not retur | the | |||
n | value returned by deflateBound (see below). If deflate does not return | |||
Z_STREAM_END, then it must be called again as described above. | Z_STREAM_END, then it must be called again as described above. | |||
deflate() sets strm->adler to the adler32 checksum of all input read | deflate() sets strm->adler to the adler32 checksum of all input read | |||
so far (that is, total_in bytes). | so far (that is, total_in bytes). | |||
deflate() may update strm->data_type if it can make a good guess about | deflate() may update strm->data_type if it can make a good guess about | |||
the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considere | the input data type (Z_BINARY or Z_TEXT). In doubt, the data is consider | |||
d | ed | |||
binary. This field is only for information purposes and does not affect | binary. This field is only for information purposes and does not affect | |||
the compression algorithm in any manner. | the | |||
compression algorithm in any manner. | ||||
deflate() returns Z_OK if some progress has been made (more input | deflate() returns Z_OK if some progress has been made (more input | |||
processed or more output produced), Z_STREAM_END if all input has been | processed or more output produced), Z_STREAM_END if all input has been | |||
consumed and all output has been produced (only when flush is set to | consumed and all output has been produced (only when flush is set to | |||
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for examp le | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for examp le | |||
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible | if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possibl | |||
(for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is no | e | |||
t | (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is n | |||
ot | ||||
fatal, and deflate() can be called again with more input and more output | fatal, and deflate() can be called again with more input and more output | |||
space to continue compressing. | space to continue compressing. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); | ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); | |||
/* | /* | |||
All dynamically allocated data structures for this stream are freed. | All dynamically allocated data structures for this stream are freed. | |||
This function discards any unprocessed input and does not flush any | This function discards any unprocessed input and does not flush any pend | |||
pending output. | ing | |||
output. | ||||
deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the | deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the | |||
stream state was inconsistent, Z_DATA_ERROR if the stream was freed | stream state was inconsistent, Z_DATA_ERROR if the stream was freed | |||
prematurely (some input or output was discarded). In the error case, | prematurely (some input or output was discarded). In the error case, ms | |||
msg may be set but then points to a static string (which must not be | g | |||
may be set but then points to a static string (which must not be | ||||
deallocated). | deallocated). | |||
*/ | */ | |||
/* | /* | |||
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); | ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); | |||
Initializes the internal stream state for decompression. The fields | Initializes the internal stream state for decompression. The fields | |||
next_in, avail_in, zalloc, zfree and opaque must be initialized before b y | next_in, avail_in, zalloc, zfree and opaque must be initialized before b y | |||
the caller. If next_in is not Z_NULL and avail_in is large enough (the e | the caller. If next_in is not Z_NULL and avail_in is large enough (the | |||
xact | exact value depends on the compression method), inflateInit determines t | |||
value depends on the compression method), inflateInit determines the | he | |||
compression method from the zlib header and allocates all data structure s | compression method from the zlib header and allocates all data structure s | |||
accordingly; otherwise the allocation will be deferred to the first call of | accordingly; otherwise the allocation will be deferred to the first call of | |||
inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates the m to | inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates the m to | |||
use default allocation functions. | use default allocation functions. | |||
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enou gh | inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enou gh | |||
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the | memory, Z_VERSION_ERROR if the zlib library version is incompatible with the | |||
version assumed by the caller. msg is set to null if there is no error | version assumed by the caller, or Z_STREAM_ERROR if the parameters are | |||
message. inflateInit does not perform any decompression apart from readi | invalid, such as a null pointer to the structure. msg is set to null if | |||
ng | there is no error message. inflateInit does not perform any decompressi | |||
the zlib header if present: this will be done by inflate(). (So next_in | on | |||
and | apart from possibly reading the zlib header if present: actual decompres | |||
avail_in may be modified, but next_out and avail_out are unchanged.) | sion | |||
will be done by inflate(). (So next_in and avail_in may be modified, bu | ||||
t | ||||
next_out and avail_out are unused and unchanged.) The current implementa | ||||
tion | ||||
of inflateInit() does not process any header information -- that is defe | ||||
rred | ||||
until inflate() is called. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
/* | /* | |||
inflate decompresses as much data as possible, and stops when the input | inflate decompresses as much data as possible, and stops when the input | |||
buffer becomes empty or the output buffer becomes full. It may introduce | buffer becomes empty or the output buffer becomes full. It may introduce | |||
some output latency (reading input without producing any output) except w hen | some output latency (reading input without producing any output) except w hen | |||
forced to flush. | forced to flush. | |||
The detailed semantics are as follows. inflate performs one or both of th e | The detailed semantics are as follows. inflate performs one or both of t he | |||
following actions: | following actions: | |||
- Decompress more input starting at next_in and update next_in and avail_ in | - Decompress more input starting at next_in and update next_in and avail_ in | |||
accordingly. If not all input can be processed (because there is not | accordingly. If not all input can be processed (because there is not | |||
enough room in the output buffer), next_in is updated and processing | enough room in the output buffer), next_in is updated and processing wi | |||
will resume at this point for the next call of inflate(). | ll | |||
resume at this point for the next call of inflate(). | ||||
- Provide more output starting at next_out and update next_out and avail_ out | - Provide more output starting at next_out and update next_out and avail_ out | |||
accordingly. inflate() provides as much output as possible, until ther | accordingly. inflate() provides as much output as possible, until ther | |||
e | e is | |||
is no more input data or no more space in the output buffer (see below | no more input data or no more space in the output buffer (see below abo | |||
about the flush parameter). | ut | |||
the flush parameter). | ||||
Before the call of inflate(), the application should ensure that at least | Before the call of inflate(), the application should ensure that at lea | |||
one of the actions is possible, by providing more input and/or consuming | st | |||
more output, and updating the next_* and avail_* values accordingly. | one of the actions is possible, by providing more input and/or consuming | |||
The application can consume the uncompressed output when it wants, for | more | |||
example when the output buffer is full (avail_out == 0), or after each | output, and updating the next_* and avail_* values accordingly. The | |||
call of inflate(). If inflate returns Z_OK and with zero avail_out, it | application can consume the uncompressed output when it wants, for exampl | |||
must be called again after making room in the output buffer because there | e | |||
might be more output pending. | when the output buffer is full (avail_out == 0), or after each call of | |||
inflate(). If inflate returns Z_OK and with zero avail_out, it must be | ||||
called again after making room in the output buffer because there might b | ||||
e | ||||
more output pending. | ||||
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, | The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FIN | |||
Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much | ISH, | |||
output as possible to the output buffer. Z_BLOCK requests that inflate() | Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much | |||
stop | output as possible to the output buffer. Z_BLOCK requests that inflate() | |||
if and when it gets to the next deflate block boundary. When decoding the | stop if and when it gets to the next deflate block boundary. When decodi | |||
zlib or gzip format, this will cause inflate() to return immediately afte | ng | |||
r | the zlib or gzip format, this will cause inflate() to return immediately | |||
the header and before the first block. When doing a raw inflate, inflate( | after the header and before the first block. When doing a raw inflate, | |||
) | inflate() will go ahead and process the first block, and will return when | |||
will go ahead and process the first block, and will return when it gets t | it | |||
o | gets to the end of that block, or when it runs out of data. | |||
the end of that block, or when it runs out of data. | ||||
The Z_BLOCK option assists in appending to or combining deflate streams . | The Z_BLOCK option assists in appending to or combining deflate streams . | |||
Also to assist in this, on return inflate() will set strm->data_type to t he | Also to assist in this, on return inflate() will set strm->data_type to t he | |||
number of unused bits in the last byte taken from strm->next_in, plus 64 | number of unused bits in the last byte taken from strm->next_in, plus 64 | |||
if inflate() is currently decoding the last block in the deflate stream, | if | |||
plus 128 if inflate() returned immediately after decoding an end-of-block | inflate() is currently decoding the last block in the deflate stream, plu | |||
code or decoding the complete header up to just before the first byte of | s | |||
the | 128 if inflate() returned immediately after decoding an end-of-block code | |||
deflate stream. The end-of-block will not be indicated until all of the | or | |||
uncompressed data from that block has been written to strm->next_out. Th | decoding the complete header up to just before the first byte of the defl | |||
e | ate | |||
number of unused bits may in general be greater than seven, except when | stream. The end-of-block will not be indicated until all of the uncompre | |||
bit 7 of data_type is set, in which case the number of unused bits will b | ssed | |||
e | data from that block has been written to strm->next_out. The number of | |||
less than eight. | unused bits may in general be greater than seven, except when bit 7 of | |||
data_type is set, in which case the number of unused bits will be less th | ||||
an | ||||
eight. data_type is set as noted here every time inflate() returns for a | ||||
ll | ||||
flush options, and so can be used to determine the amount of currently | ||||
consumed input in bits. | ||||
The Z_TREES option behaves as Z_BLOCK does, but it also returns when th | ||||
e | ||||
end of each deflate block header is reached, before any actual data in th | ||||
at | ||||
block is decoded. This allows the caller to determine the length of the | ||||
deflate block header for later use in random access within a deflate bloc | ||||
k. | ||||
256 is added to the value of strm->data_type when inflate() returns | ||||
immediately after reaching the end of the deflate block header. | ||||
inflate() should normally be called until it returns Z_STREAM_END or an | inflate() should normally be called until it returns Z_STREAM_END or an | |||
error. However if all decompression is to be performed in a single step | error. However if all decompression is to be performed in a single step | |||
(a single call of inflate), the parameter flush should be set to | (a | |||
Z_FINISH. In this case all pending input is processed and all pending | single call of inflate), the parameter flush should be set to Z_FINISH. | |||
output is flushed; avail_out must be large enough to hold all the | In | |||
uncompressed data. (The size of the uncompressed data may have been saved | this case all pending input is processed and all pending output is flushe | |||
by the compressor for this purpose.) The next operation on this stream mu | d; | |||
st | avail_out must be large enough to hold all the uncompressed data. (The s | |||
be inflateEnd to deallocate the decompression state. The use of Z_FINISH | ize | |||
is never required, but can be used to inform inflate that a faster approa | of the uncompressed data may have been saved by the compressor for this | |||
ch | purpose.) The next operation on this stream must be inflateEnd to dealloc | |||
may be used for the single inflate() call. | ate | |||
the decompression state. The use of Z_FINISH is never required, but can | ||||
be | ||||
used to inform inflate that a faster approach may be used for the single | ||||
inflate() call. | ||||
In this implementation, inflate() always flushes as much output as | In this implementation, inflate() always flushes as much output as | |||
possible to the output buffer, and always uses the faster approach on the | possible to the output buffer, and always uses the faster approach on the | |||
first call. So the only effect of the flush parameter in this implementat ion | first call. So the only effect of the flush parameter in this implementa tion | |||
is on the return value of inflate(), as noted below, or when it returns e arly | is on the return value of inflate(), as noted below, or when it returns e arly | |||
because Z_BLOCK is used. | because Z_BLOCK or Z_TREES is used. | |||
If a preset dictionary is needed after this call (see inflateSetDictio nary | If a preset dictionary is needed after this call (see inflateSetDictio nary | |||
below), inflate sets strm->adler to the adler32 checksum of the dictionar y | below), inflate sets strm->adler to the adler32 checksum of the dictionar y | |||
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets | chosen by the compressor and returns Z_NEED_DICT; otherwise it sets | |||
strm->adler to the adler32 checksum of all output produced so far (that i s, | strm->adler to the adler32 checksum of all output produced so far (that i s, | |||
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as descr ibed | total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as descr ibed | |||
below. At the end of the stream, inflate() checks that its computed adler 32 | below. At the end of the stream, inflate() checks that its computed adle r32 | |||
checksum is equal to that saved by the compressor and returns Z_STREAM_EN D | checksum is equal to that saved by the compressor and returns Z_STREAM_EN D | |||
only if the checksum is correct. | only if the checksum is correct. | |||
inflate() will decompress and check either zlib-wrapped or gzip-wrapped | inflate() can decompress and check either zlib-wrapped or gzip-wrapped | |||
deflate data. The header type is detected automatically. Any informatio | deflate data. The header type is detected automatically, if requested wh | |||
n | en | |||
contained in the gzip header is not retained, so applications that need t | initializing with inflateInit2(). Any information contained in the gzip | |||
hat | header is not retained, so applications that need that information should | |||
information should instead use raw inflate, see inflateInit2() below, or | instead use raw inflate, see inflateInit2() below, or inflateBack() and | |||
inflateBack() and perform their own processing of the gzip header and | perform their own processing of the gzip header and trailer. | |||
trailer. | ||||
inflate() returns Z_OK if some progress has been made (more input proce ssed | inflate() returns Z_OK if some progress has been made (more input proce ssed | |||
or more output produced), Z_STREAM_END if the end of the compressed data has | or more output produced), Z_STREAM_END if the end of the compressed data has | |||
been reached and all uncompressed output has been produced, Z_NEED_DICT i f a | been reached and all uncompressed output has been produced, Z_NEED_DICT i f a | |||
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was | |||
corrupted (input stream not conforming to the zlib format or incorrect ch eck | corrupted (input stream not conforming to the zlib format or incorrect ch eck | |||
value), Z_STREAM_ERROR if the stream structure was inconsistent (for exam ple | value), Z_STREAM_ERROR if the stream structure was inconsistent (for exam ple | |||
if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough mem ory, | next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memo ry, | |||
Z_BUF_ERROR if no progress is possible or if there was not enough room in the | Z_BUF_ERROR if no progress is possible or if there was not enough room in the | |||
output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and | output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and | |||
inflate() can be called again with more input and more output space to | inflate() can be called again with more input and more output space to | |||
continue decompressing. If Z_DATA_ERROR is returned, the application may | continue decompressing. If Z_DATA_ERROR is returned, the application may | |||
then | then call inflateSync() to look for a good compression block if a partial | |||
call inflateSync() to look for a good compression block if a partial reco | recovery of the data is desired. | |||
very | ||||
of the data is desired. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); | ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); | |||
/* | /* | |||
All dynamically allocated data structures for this stream are freed. | All dynamically allocated data structures for this stream are freed. | |||
This function discards any unprocessed input and does not flush any | This function discards any unprocessed input and does not flush any pend | |||
pending output. | ing | |||
output. | ||||
inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state | inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state | |||
was inconsistent. In the error case, msg may be set but then points to a | was inconsistent. In the error case, msg may be set but then points to a | |||
static string (which must not be deallocated). | static string (which must not be deallocated). | |||
*/ | */ | |||
/* Advanced functions */ | /* Advanced functions */ | |||
/* | /* | |||
The following functions are needed only in some special applications. | The following functions are needed only in some special applications. | |||
*/ | */ | |||
/* | /* | |||
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | |||
int level, | int level, | |||
int method, | int method, | |||
int windowBits, | int windowBits, | |||
int memLevel, | int memLevel, | |||
int strategy)); | int strategy)); | |||
This is another version of deflateInit with more compression options. | This is another version of deflateInit with more compression options. | |||
The | The | |||
fields next_in, zalloc, zfree and opaque must be initialized before by | fields next_in, zalloc, zfree and opaque must be initialized before by t | |||
the caller. | he | |||
caller. | ||||
The method parameter is the compression method. It must be Z_DEFLATED in | The method parameter is the compression method. It must be Z_DEFLATED in | |||
this version of the library. | this version of the library. | |||
The windowBits parameter is the base two logarithm of the window size | The windowBits parameter is the base two logarithm of the window size | |||
(the size of the history buffer). It should be in the range 8..15 for th | (the size of the history buffer). It should be in the range 8..15 for t | |||
is | his | |||
version of the library. Larger values of this parameter result in better | version of the library. Larger values of this parameter result in bette | |||
compression at the expense of memory usage. The default value is 15 if | r | |||
compression at the expense of memory usage. The default value is 15 if | ||||
deflateInit is used instead. | deflateInit is used instead. | |||
windowBits can also be -8..-15 for raw deflate. In this case, -windowB | windowBits can also be -8..-15 for raw deflate. In this case, -window | |||
its | Bits | |||
determines the window size. deflate() will then generate raw deflate dat | determines the window size. deflate() will then generate raw deflate da | |||
a | ta | |||
with no zlib header or trailer, and will not compute an adler32 check va lue. | with no zlib header or trailer, and will not compute an adler32 check va lue. | |||
windowBits can also be greater than 15 for optional gzip encoding. Add | windowBits can also be greater than 15 for optional gzip encoding. Ad d | |||
16 to windowBits to write a simple gzip header and trailer around the | 16 to windowBits to write a simple gzip header and trailer around the | |||
compressed data instead of a zlib wrapper. The gzip header will have no | compressed data instead of a zlib wrapper. The gzip header will have no | |||
file name, no extra data, no comment, no modification time (set to zero) | file name, no extra data, no comment, no modification time (set to zero) | |||
, | , no | |||
no header crc, and the operating system will be set to 255 (unknown). I | header crc, and the operating system will be set to 255 (unknown). If a | |||
f a | ||||
gzip stream is being written, strm->adler is a crc32 instead of an adler 32. | gzip stream is being written, strm->adler is a crc32 instead of an adler 32. | |||
The memLevel parameter specifies how much memory should be allocated | The memLevel parameter specifies how much memory should be allocated | |||
for the internal compression state. memLevel=1 uses minimum memory but | for the internal compression state. memLevel=1 uses minimum memory but | |||
is slow and reduces compression ratio; memLevel=9 uses maximum memory | is | |||
for optimal speed. The default value is 8. See zconf.h for total memory | slow and reduces compression ratio; memLevel=9 uses maximum memory for | |||
usage as a function of windowBits and memLevel. | optimal speed. The default value is 8. See zconf.h for total memory us | |||
age | ||||
as a function of windowBits and memLevel. | ||||
The strategy parameter is used to tune the compression algorithm. Use the | The strategy parameter is used to tune the compression algorithm. Use the | |||
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced b y a | value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced b y a | |||
filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no | filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no | |||
string match), or Z_RLE to limit match distances to one (run-length | string match), or Z_RLE to limit match distances to one (run-length | |||
encoding). Filtered data consists mostly of small values with a somewhat | encoding). Filtered data consists mostly of small values with a somewha | |||
random distribution. In this case, the compression algorithm is tuned to | t | |||
compress them better. The effect of Z_FILTERED is to force more Huffman | random distribution. In this case, the compression algorithm is tuned t | |||
o | ||||
compress them better. The effect of Z_FILTERED is to force more Huffman | ||||
coding and less string matching; it is somewhat intermediate between | coding and less string matching; it is somewhat intermediate between | |||
Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as | Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost a | |||
Z_HUFFMAN_ONLY, but give better compression for PNG image data. The stra | s | |||
tegy | fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. | |||
parameter only affects the compression ratio but not the correctness of | The | |||
the | strategy parameter only affects the compression ratio but not the | |||
compressed output even if it is not set appropriately. Z_FIXED prevents | correctness of the compressed output even if it is not set appropriately | |||
the | . | |||
use of dynamic Huffman codes, allowing for a simpler decoder for special | Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simple | |||
applications. | r | |||
decoder for special applications. | ||||
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not en | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not eno | |||
ough | ugh | |||
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid | memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid | |||
method). msg is set to null if there is no error message. deflateInit2 | method), or Z_VERSION_ERROR if the zlib library version (zlib_version) i | |||
does | s | |||
not perform any compression: this will be done by deflate(). | incompatible with the version assumed by the caller (ZLIB_VERSION). msg | |||
is | ||||
set to null if there is no error message. deflateInit2 does not perform | ||||
any | ||||
compression: this will be done by deflate(). | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | |||
const Bytef *dictionary, | const Bytef *dictionary, | |||
uInt dictLength)); | uInt dictLength)); | |||
/* | /* | |||
Initializes the compression dictionary from the given byte sequence | Initializes the compression dictionary from the given byte sequence | |||
without producing any compressed output. This function must be called | without producing any compressed output. This function must be called | |||
immediately after deflateInit, deflateInit2 or deflateReset, before any | immediately after deflateInit, deflateInit2 or deflateReset, before any | |||
call of deflate. The compressor and decompressor must use exactly the sa | call | |||
me | of deflate. The compressor and decompressor must use exactly the same | |||
dictionary (see inflateSetDictionary). | dictionary (see inflateSetDictionary). | |||
The dictionary should consist of strings (byte sequences) that are lik ely | The dictionary should consist of strings (byte sequences) that are lik ely | |||
to be encountered later in the data to be compressed, with the most comm only | to be encountered later in the data to be compressed, with the most comm only | |||
used strings preferably put towards the end of the dictionary. Using a | used strings preferably put towards the end of the dictionary. Using a | |||
dictionary is most useful when the data to be compressed is short and ca n be | dictionary is most useful when the data to be compressed is short and ca n be | |||
predicted with good accuracy; the data can then be compressed better tha n | predicted with good accuracy; the data can then be compressed better tha n | |||
with the default empty dictionary. | with the default empty dictionary. | |||
Depending on the size of the compression data structures selected by | Depending on the size of the compression data structures selected by | |||
deflateInit or deflateInit2, a part of the dictionary may in effect be | deflateInit or deflateInit2, a part of the dictionary may in effect be | |||
discarded, for example if the dictionary is larger than the window size | discarded, for example if the dictionary is larger than the window size | |||
in | provided in deflateInit or deflateInit2. Thus the strings most likely t | |||
deflate or deflate2. Thus the strings most likely to be useful should be | o be | |||
put at the end of the dictionary, not at the front. In addition, the | useful should be put at the end of the dictionary, not at the front. In | |||
current implementation of deflate will use at most the window size minus | addition, the current implementation of deflate will use at most the win | |||
262 bytes of the provided dictionary. | dow | |||
size minus 262 bytes of the provided dictionary. | ||||
Upon return of this function, strm->adler is set to the adler32 value | Upon return of this function, strm->adler is set to the adler32 value | |||
of the dictionary; the decompressor may later use this value to determin e | of the dictionary; the decompressor may later use this value to determin e | |||
which dictionary has been used by the compressor. (The adler32 value | which dictionary has been used by the compressor. (The adler32 value | |||
applies to the whole dictionary even if only a subset of the dictionary is | applies to the whole dictionary even if only a subset of the dictionary is | |||
actually used by the compressor.) If a raw deflate was requested, then t he | actually used by the compressor.) If a raw deflate was requested, then t he | |||
adler32 value is not computed and strm->adler is not set. | adler32 value is not computed and strm->adler is not set. | |||
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a | |||
parameter is invalid (such as NULL dictionary) or the stream state is | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | |||
inconsistent (for example if deflate has already been called for this st ream | inconsistent (for example if deflate has already been called for this st ream | |||
or if the compression method is bsort). deflateSetDictionary does not | or if the compression method is bsort). deflateSetDictionary does not | |||
perform any compression: this will be done by deflate(). | perform any compression: this will be done by deflate(). | |||
*/ | */ | |||
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, | |||
z_streamp source)); | z_streamp source)); | |||
/* | /* | |||
Sets the destination stream as a complete copy of the source stream. | Sets the destination stream as a complete copy of the source stream. | |||
This function can be useful when several compression strategies will b e | This function can be useful when several compression strategies will b e | |||
tried, for example when there are several ways of pre-processing the inp ut | tried, for example when there are several ways of pre-processing the inp ut | |||
data with a filter. The streams that will be discarded should then be fr eed | data with a filter. The streams that will be discarded should then be f reed | |||
by calling deflateEnd. Note that deflateCopy duplicates the internal | by calling deflateEnd. Note that deflateCopy duplicates the internal | |||
compression state which can be quite large, so this strategy is slow and | compression state which can be quite large, so this strategy is slow and | |||
can consume lots of memory. | can | |||
consume lots of memory. | ||||
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | |||
enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t | enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t | |||
(such as zalloc being NULL). msg is left unchanged in both source and | (such as zalloc being Z_NULL). msg is left unchanged in both source and | |||
destination. | destination. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); | ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); | |||
/* | /* | |||
This function is equivalent to deflateEnd followed by deflateInit, | This function is equivalent to deflateEnd followed by deflateInit, | |||
but does not free and reallocate all the internal compression state. | but does not free and reallocate all the internal compression state. Th | |||
The stream will keep the same compression level and any other attributes | e | |||
that may have been set by deflateInit2. | stream will keep the same compression level and any other attributes tha | |||
t | ||||
may have been set by deflateInit2. | ||||
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | |||
stream state was inconsistent (such as zalloc or state being NULL). | stream state was inconsistent (such as zalloc or state being Z_NULL). | |||
*/ | */ | |||
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, | |||
int level, | int level, | |||
int strategy)); | int strategy)); | |||
/* | /* | |||
Dynamically update the compression level and compression strategy. Th e | Dynamically update the compression level and compression strategy. Th e | |||
interpretation of level and strategy is as in deflateInit2. This can be | interpretation of level and strategy is as in deflateInit2. This can be | |||
used to switch between compression and straight copy of the input data, or | used to switch between compression and straight copy of the input data, or | |||
to switch to a different kind of input data requiring a different | to switch to a different kind of input data requiring a different strate | |||
strategy. If the compression level is changed, the input available so fa | gy. | |||
r | If the compression level is changed, the input available so far is | |||
is compressed with the old level (and may be flushed); the new level wil | compressed with the old level (and may be flushed); the new level will t | |||
l | ake | |||
take effect only at the next call of deflate(). | effect only at the next call of deflate(). | |||
Before the call of deflateParams, the stream state must be set as for | Before the call of deflateParams, the stream state must be set as for | |||
a call of deflate(), since the currently available input may have to | a call of deflate(), since the currently available input may have to be | |||
be compressed and flushed. In particular, strm->avail_out must be non-ze | compressed and flushed. In particular, strm->avail_out must be non-zero | |||
ro. | . | |||
deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source | deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source | |||
stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR | stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR | |||
if strm->avail_out was zero. | if | |||
strm->avail_out was zero. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, | ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, | |||
int good_length, | int good_length, | |||
int max_lazy, | int max_lazy, | |||
int nice_length, | int nice_length, | |||
int max_chain)); | int max_chain)); | |||
/* | /* | |||
Fine tune deflate's internal compression parameters. This should only be | Fine tune deflate's internal compression parameters. This should only be | |||
used by someone who understands the algorithm used by zlib's deflate for | used by someone who understands the algorithm used by zlib's deflate for | |||
skipping to change at line 642 | skipping to change at line 680 | |||
max_lazy, good_length, nice_length, and max_chain parameters. | max_lazy, good_length, nice_length, and max_chain parameters. | |||
deflateTune() can be called after deflateInit() or deflateInit2(), and | deflateTune() can be called after deflateInit() or deflateInit2(), and | |||
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream . | returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream . | |||
*/ | */ | |||
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, | ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, | |||
uLong sourceLen)); | uLong sourceLen)); | |||
/* | /* | |||
deflateBound() returns an upper bound on the compressed size after | deflateBound() returns an upper bound on the compressed size after | |||
deflation of sourceLen bytes. It must be called after deflateInit() | deflation of sourceLen bytes. It must be called after deflateInit() or | |||
or deflateInit2(). This would be used to allocate an output buffer | deflateInit2(), and after deflateSetHeader(), if used. This would be us | |||
for deflation in a single pass, and so would be called before deflate(). | ed | |||
to allocate an output buffer for deflation in a single pass, and so woul | ||||
d be | ||||
called before deflate(). | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, | ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, | |||
int bits, | int bits, | |||
int value)); | int value)); | |||
/* | /* | |||
deflatePrime() inserts bits in the deflate output stream. The intent | deflatePrime() inserts bits in the deflate output stream. The intent | |||
is that this function is used to start off the deflate output with the | is that this function is used to start off the deflate output with the b | |||
bits leftover from a previous deflate stream when appending to it. As su | its | |||
ch, | leftover from a previous deflate stream when appending to it. As such, | |||
this function can only be used for raw deflate, and must be used before t | this | |||
he | function can only be used for raw deflate, and must be used before the f | |||
first deflate() call after a deflateInit2() or deflateReset(). bits must | irst | |||
be | deflate() call after a deflateInit2() or deflateReset(). bits must be l | |||
less than or equal to 16, and that many of the least significant bits of | ess | |||
value will be inserted in the output. | than or equal to 16, and that many of the least significant bits of valu | |||
e | ||||
will be inserted in the output. | ||||
deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source | deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source | |||
stream state was inconsistent. | stream state was inconsistent. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, | ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, | |||
gz_headerp head)); | gz_headerp head)); | |||
/* | /* | |||
deflateSetHeader() provides gzip header information for when a gzip | deflateSetHeader() provides gzip header information for when a gzip | |||
stream is requested by deflateInit2(). deflateSetHeader() may be called | stream is requested by deflateInit2(). deflateSetHeader() may be called | |||
after deflateInit2() or deflateReset() and before the first call of | after deflateInit2() or deflateReset() and before the first call of | |||
deflate(). The text, time, os, extra field, name, and comment informati on | deflate(). The text, time, os, extra field, name, and comment informati on | |||
in the provided gz_header structure are written to the gzip header (xfla g is | in the provided gz_header structure are written to the gzip header (xfla g is | |||
ignored -- the extra flags are set according to the compression level). The | ignored -- the extra flags are set according to the compression level). The | |||
caller must assure that, if not Z_NULL, name and comment are terminated with | caller must assure that, if not Z_NULL, name and comment are terminated with | |||
a zero byte, and that if extra is not Z_NULL, that extra_len bytes are | a zero byte, and that if extra is not Z_NULL, that extra_len bytes are | |||
available there. If hcrc is true, a gzip header crc is included. Note that | available there. If hcrc is true, a gzip header crc is included. Note that | |||
the current versions of the command-line version of gzip (up through ver sion | the current versions of the command-line version of gzip (up through ver sion | |||
1.3.x) do not support header crc's, and will report that it is a "multi- part | 1.3.x) do not support header crc's, and will report that it is a "multi- part | |||
gzip file" and give up. | gzip file" and give up. | |||
If deflateSetHeader is not used, the default gzip header has text fal se, | If deflateSetHeader is not used, the default gzip header has text fals e, | |||
the time set to zero, and os set to 255, with no extra, name, or comment | the time set to zero, and os set to 255, with no extra, name, or comment | |||
fields. The gzip header is returned to the default state by deflateRese t(). | fields. The gzip header is returned to the default state by deflateRese t(). | |||
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the so urce | deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the sou rce | |||
stream state was inconsistent. | stream state was inconsistent. | |||
*/ | */ | |||
/* | /* | |||
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, | |||
int windowBits)); | int windowBits)); | |||
This is another version of inflateInit with an extra parameter. The | This is another version of inflateInit with an extra parameter. The | |||
fields next_in, avail_in, zalloc, zfree and opaque must be initialized | fields next_in, avail_in, zalloc, zfree and opaque must be initialized | |||
before by the caller. | before by the caller. | |||
The windowBits parameter is the base two logarithm of the maximum wind ow | The windowBits parameter is the base two logarithm of the maximum wind ow | |||
size (the size of the history buffer). It should be in the range 8..15 for | size (the size of the history buffer). It should be in the range 8..15 for | |||
this version of the library. The default value is 15 if inflateInit is u | this version of the library. The default value is 15 if inflateInit is | |||
sed | used | |||
instead. windowBits must be greater than or equal to the windowBits valu | instead. windowBits must be greater than or equal to the windowBits val | |||
e | ue | |||
provided to deflateInit2() while compressing, or it must be equal to 15 if | provided to deflateInit2() while compressing, or it must be equal to 15 if | |||
deflateInit2() was not used. If a compressed stream with a larger window | deflateInit2() was not used. If a compressed stream with a larger windo w | |||
size is given as input, inflate() will return with the error code | size is given as input, inflate() will return with the error code | |||
Z_DATA_ERROR instead of trying to allocate a larger window. | Z_DATA_ERROR instead of trying to allocate a larger window. | |||
windowBits can also be -8..-15 for raw inflate. In this case, -windowB | windowBits can also be zero to request that inflate use the window siz | |||
its | e in | |||
determines the window size. inflate() will then process raw deflate data | the zlib header of the compressed stream. | |||
, | ||||
windowBits can also be -8..-15 for raw inflate. In this case, -window | ||||
Bits | ||||
determines the window size. inflate() will then process raw deflate dat | ||||
a, | ||||
not looking for a zlib or gzip header, not generating a check value, and not | not looking for a zlib or gzip header, not generating a check value, and not | |||
looking for any check values for comparison at the end of the stream. Th is | looking for any check values for comparison at the end of the stream. T his | |||
is for use with other formats that use the deflate compressed data forma t | is for use with other formats that use the deflate compressed data forma t | |||
such as zip. Those formats provide their own check values. If a custom | such as zip. Those formats provide their own check values. If a custom | |||
format is developed using the raw deflate format for compressed data, it is | format is developed using the raw deflate format for compressed data, it is | |||
recommended that a check value such as an adler32 or a crc32 be applied to | recommended that a check value such as an adler32 or a crc32 be applied to | |||
the uncompressed data as is done in the zlib, gzip, and zip formats. Fo r | the uncompressed data as is done in the zlib, gzip, and zip formats. Fo r | |||
most applications, the zlib format should be used as is. Note that comme nts | most applications, the zlib format should be used as is. Note that comm ents | |||
above on the use in deflateInit2() applies to the magnitude of windowBit s. | above on the use in deflateInit2() applies to the magnitude of windowBit s. | |||
windowBits can also be greater than 15 for optional gzip decoding. Add | windowBits can also be greater than 15 for optional gzip decoding. Ad d | |||
32 to windowBits to enable zlib and gzip decoding with automatic header | 32 to windowBits to enable zlib and gzip decoding with automatic header | |||
detection, or add 16 to decode only the gzip format (the zlib format wil l | detection, or add 16 to decode only the gzip format (the zlib format wil l | |||
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler | return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler | |||
is | is a | |||
a crc32 instead of an adler32. | crc32 instead of an adler32. | |||
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not eno ugh | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not eno ugh | |||
memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). | memory, Z_VERSION_ERROR if the zlib library version is incompatible with | |||
msg | the | |||
is set to null if there is no error message. inflateInit2 does not perf | version assumed by the caller, or Z_STREAM_ERROR if the parameters are | |||
orm | invalid, such as a null pointer to the structure. msg is set to null if | |||
any decompression apart from reading the zlib header if present: this wi | there is no error message. inflateInit2 does not perform any decompress | |||
ll | ion | |||
be done by inflate(). (So next_in and avail_in may be modified, but next | apart from possibly reading the zlib header if present: actual decompres | |||
_out | sion | |||
and avail_out are unchanged.) | will be done by inflate(). (So next_in and avail_in may be modified, bu | |||
t | ||||
next_out and avail_out are unused and unchanged.) The current implementa | ||||
tion | ||||
of inflateInit2() does not process any header information -- that is | ||||
deferred until inflate() is called. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | |||
const Bytef *dictionary, | const Bytef *dictionary, | |||
uInt dictLength)); | uInt dictLength)); | |||
/* | /* | |||
Initializes the decompression dictionary from the given uncompressed b yte | Initializes the decompression dictionary from the given uncompressed b yte | |||
sequence. This function must be called immediately after a call of infla | sequence. This function must be called immediately after a call of infl | |||
te, | ate, | |||
if that call returned Z_NEED_DICT. The dictionary chosen by the compress | if that call returned Z_NEED_DICT. The dictionary chosen by the compres | |||
or | sor | |||
can be determined from the adler32 value returned by that call of inflat e. | can be determined from the adler32 value returned by that call of inflat e. | |||
The compressor and decompressor must use exactly the same dictionary (se e | The compressor and decompressor must use exactly the same dictionary (se e | |||
deflateSetDictionary). For raw inflate, this function can be called | deflateSetDictionary). For raw inflate, this function can be called | |||
immediately after inflateInit2() or inflateReset() and before any call o f | immediately after inflateInit2() or inflateReset() and before any call o f | |||
inflate() to set the dictionary. The application must insure that the | inflate() to set the dictionary. The application must insure that the | |||
dictionary that was used for compression is provided. | dictionary that was used for compression is provided. | |||
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | |||
parameter is invalid (such as NULL dictionary) or the stream state is | parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | |||
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | |||
expected one (incorrect adler32 value). inflateSetDictionary does not | expected one (incorrect adler32 value). inflateSetDictionary does not | |||
perform any decompression: this will be done by subsequent calls of | perform any decompression: this will be done by subsequent calls of | |||
inflate(). | inflate(). | |||
*/ | */ | |||
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); | |||
/* | /* | |||
Skips invalid compressed data until a full flush point (see above the | Skips invalid compressed data until a full flush point (see above the | |||
description of deflate with Z_FULL_FLUSH) can be found, or until all | description of deflate with Z_FULL_FLUSH) can be found, or until all | |||
available input is skipped. No output is provided. | available input is skipped. No output is provided. | |||
inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ER | inflateSync returns Z_OK if a full flush point has been found, Z_BUF_E | |||
ROR | RROR | |||
if no more input was provided, Z_DATA_ERROR if no flush point has been fo | if no more input was provided, Z_DATA_ERROR if no flush point has been | |||
und, | found, or Z_STREAM_ERROR if the stream structure was inconsistent. In t | |||
or Z_STREAM_ERROR if the stream structure was inconsistent. In the succes | he | |||
s | success case, the application may save the current current value of tota | |||
case, the application may save the current current value of total_in whic | l_in | |||
h | which indicates where valid compressed data was found. In the error cas | |||
indicates where valid compressed data was found. In the error case, the | e, | |||
application may repeatedly call inflateSync, providing more input each ti | the application may repeatedly call inflateSync, providing more input ea | |||
me, | ch | |||
until success or end of the input data. | time, until success or end of the input data. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, | ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, | |||
z_streamp source)); | z_streamp source)); | |||
/* | /* | |||
Sets the destination stream as a complete copy of the source stream. | Sets the destination stream as a complete copy of the source stream. | |||
This function can be useful when randomly accessing a large stream. T he | This function can be useful when randomly accessing a large stream. T he | |||
first pass through the stream can periodically record the inflate state, | first pass through the stream can periodically record the inflate state, | |||
allowing restarting inflate at those points when randomly accessing the | allowing restarting inflate at those points when randomly accessing the | |||
stream. | stream. | |||
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | |||
enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t | enough memory, Z_STREAM_ERROR if the source stream state was inconsisten t | |||
(such as zalloc being NULL). msg is left unchanged in both source and | (such as zalloc being Z_NULL). msg is left unchanged in both source and | |||
destination. | destination. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); | ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); | |||
/* | /* | |||
This function is equivalent to inflateEnd followed by inflateInit, | This function is equivalent to inflateEnd followed by inflateInit, | |||
but does not free and reallocate all the internal decompression state. | but does not free and reallocate all the internal decompression state. | |||
The stream will keep attributes that may have been set by inflateInit2. | The | |||
stream will keep attributes that may have been set by inflateInit2. | ||||
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | |||
stream state was inconsistent (such as zalloc or state being NULL). | stream state was inconsistent (such as zalloc or state being Z_NULL). | |||
*/ | ||||
ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, | ||||
int windowBits)); | ||||
/* | ||||
This function is the same as inflateReset, but it also permits changin | ||||
g | ||||
the wrap and window size requests. The windowBits parameter is interpre | ||||
ted | ||||
the same as it is for inflateInit2. | ||||
inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source | ||||
stream state was inconsistent (such as zalloc or state being Z_NULL), or | ||||
if | ||||
the windowBits parameter is invalid. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, | ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, | |||
int bits, | int bits, | |||
int value)); | int value)); | |||
/* | /* | |||
This function inserts bits in the inflate input stream. The intent is | This function inserts bits in the inflate input stream. The intent is | |||
that this function is used to start inflating at a bit position in the | that this function is used to start inflating at a bit position in the | |||
middle of a byte. The provided bits will be used before any bytes are us | middle of a byte. The provided bits will be used before any bytes are u | |||
ed | sed | |||
from next_in. This function should only be used with raw inflate, and | from next_in. This function should only be used with raw inflate, and | |||
should be used before the first inflate() call after inflateInit2() or | should be used before the first inflate() call after inflateInit2() or | |||
inflateReset(). bits must be less than or equal to 16, and that many of | inflateReset(). bits must be less than or equal to 16, and that many of | |||
the | the | |||
least significant bits of value will be inserted in the input. | least significant bits of value will be inserted in the input. | |||
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source | If bits is negative, then the input stream bit buffer is emptied. The | |||
n | ||||
inflatePrime() can be called again to put bits in the buffer. This is u | ||||
sed | ||||
to clear out bits leftover after feeding inflate a block description pri | ||||
or | ||||
to feeding inflate codes. | ||||
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source | ||||
stream state was inconsistent. | stream state was inconsistent. | |||
*/ | */ | |||
ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); | ||||
/* | ||||
This function returns two values, one in the lower 16 bits of the retu | ||||
rn | ||||
value, and the other in the remaining upper bits, obtained by shifting t | ||||
he | ||||
return value down 16 bits. If the upper value is -1 and the lower value | ||||
is | ||||
zero, then inflate() is currently decoding information outside of a bloc | ||||
k. | ||||
If the upper value is -1 and the lower value is non-zero, then inflate i | ||||
s in | ||||
the middle of a stored block, with the lower value equaling the number o | ||||
f | ||||
bytes from the input remaining to copy. If the upper value is not -1, t | ||||
hen | ||||
it is the number of bits back from the current bit position in the input | ||||
of | ||||
the code (literal or length/distance pair) currently being processed. I | ||||
n | ||||
that case the lower value is the number of bytes already emitted for tha | ||||
t | ||||
code. | ||||
A code is being processed if inflate is waiting for more input to comp | ||||
lete | ||||
decoding of the code, or if it has completed decoding but is waiting for | ||||
more output space to write the literal or match data. | ||||
inflateMark() is used to mark locations in the input data for random | ||||
access, which may be at bit positions, and to note those cases where the | ||||
output of a code may span boundaries of random access blocks. The curre | ||||
nt | ||||
location in the input stream can be determined from avail_in and data_ty | ||||
pe | ||||
as noted in the description for the Z_BLOCK flush parameter for inflate. | ||||
inflateMark returns the value noted above or -1 << 16 if the provided | ||||
source stream state was inconsistent. | ||||
*/ | ||||
ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, | ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, | |||
gz_headerp head)); | gz_headerp head)); | |||
/* | /* | |||
inflateGetHeader() requests that gzip header information be stored in the | inflateGetHeader() requests that gzip header information be stored in the | |||
provided gz_header structure. inflateGetHeader() may be called after | provided gz_header structure. inflateGetHeader() may be called after | |||
inflateInit2() or inflateReset(), and before the first call of inflate() . | inflateInit2() or inflateReset(), and before the first call of inflate() . | |||
As inflate() processes the gzip stream, head->done is zero until the hea der | As inflate() processes the gzip stream, head->done is zero until the hea der | |||
is completed, at which time head->done is set to one. If a zlib stream is | is completed, at which time head->done is set to one. If a zlib stream is | |||
being decoded, then head->done is set to -1 to indicate that there will be | being decoded, then head->done is set to -1 to indicate that there will be | |||
no gzip header information forthcoming. Note that Z_BLOCK can be used t | no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES ca | |||
o | n be | |||
force inflate() to return immediately after header processing is complet | used to force inflate() to return immediately after header processing is | |||
e | complete and before any actual data is decompressed. | |||
and before any actual data is decompressed. | ||||
The text, time, xflags, and os fields are filled in with the gzip hea der | The text, time, xflags, and os fields are filled in with the gzip head er | |||
contents. hcrc is set to true if there is a header CRC. (The header CR C | contents. hcrc is set to true if there is a header CRC. (The header CR C | |||
was valid if done is set to one.) If extra is not Z_NULL, then extra_ma x | was valid if done is set to one.) If extra is not Z_NULL, then extra_max | |||
contains the maximum number of bytes to write to extra. Once done is tr ue, | contains the maximum number of bytes to write to extra. Once done is tr ue, | |||
extra_len contains the actual extra field length, and extra contains the | extra_len contains the actual extra field length, and extra contains the | |||
extra field, or that field truncated if extra_max is less than extra_len . | extra field, or that field truncated if extra_max is less than extra_len . | |||
If name is not Z_NULL, then up to name_max characters are written there, | If name is not Z_NULL, then up to name_max characters are written there, | |||
terminated with a zero unless the length is greater than name_max. If | terminated with a zero unless the length is greater than name_max. If | |||
comment is not Z_NULL, then up to comm_max characters are written there, | comment is not Z_NULL, then up to comm_max characters are written there, | |||
terminated with a zero unless the length is greater than comm_max. When | terminated with a zero unless the length is greater than comm_max. When | |||
any of extra, name, or comment are not Z_NULL and the respective field i | any | |||
s | of extra, name, or comment are not Z_NULL and the respective field is no | |||
not present in the header, then that field is set to Z_NULL to signal it | t | |||
s | present in the header, then that field is set to Z_NULL to signal its | |||
absence. This allows the use of deflateSetHeader() with the returned | absence. This allows the use of deflateSetHeader() with the returned | |||
structure to duplicate the header. However if those fields are set to | structure to duplicate the header. However if those fields are set to | |||
allocated memory, then the application will need to save those pointers | allocated memory, then the application will need to save those pointers | |||
elsewhere so that they can be eventually freed. | elsewhere so that they can be eventually freed. | |||
If inflateGetHeader is not used, then the header information is simpl y | If inflateGetHeader is not used, then the header information is simply | |||
discarded. The header is always checked for validity, including the hea der | discarded. The header is always checked for validity, including the hea der | |||
CRC if present. inflateReset() will reset the process to discard the he ader | CRC if present. inflateReset() will reset the process to discard the he ader | |||
information. The application would need to call inflateGetHeader() agai n to | information. The application would need to call inflateGetHeader() agai n to | |||
retrieve the header from the next gzip stream. | retrieve the header from the next gzip stream. | |||
inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the so urce | inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the sou rce | |||
stream state was inconsistent. | stream state was inconsistent. | |||
*/ | */ | |||
/* | /* | |||
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, | ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, | |||
unsigned char FAR *window)); | unsigned char FAR *window)); | |||
Initialize the internal stream state for decompression using inflateBa ck() | Initialize the internal stream state for decompression using inflateBa ck() | |||
calls. The fields zalloc, zfree and opaque in strm must be initialized | calls. The fields zalloc, zfree and opaque in strm must be initialized | |||
before the call. If zalloc and zfree are Z_NULL, then the default libra ry- | before the call. If zalloc and zfree are Z_NULL, then the default libra ry- | |||
derived memory allocation routines are used. windowBits is the base two | derived memory allocation routines are used. windowBits is the base two | |||
logarithm of the window size, in the range 8..15. window is a caller | logarithm of the window size, in the range 8..15. window is a caller | |||
supplied buffer of that size. Except for special applications where it is | supplied buffer of that size. Except for special applications where it is | |||
assured that deflate was used with small window sizes, windowBits must b e 15 | assured that deflate was used with small window sizes, windowBits must b e 15 | |||
and a 32K byte window must be supplied to be able to decompress general | and a 32K byte window must be supplied to be able to decompress general | |||
deflate streams. | deflate streams. | |||
See inflateBack() for the usage of these routines. | See inflateBack() for the usage of these routines. | |||
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of | inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of | |||
the paramaters are invalid, Z_MEM_ERROR if the internal state could not | the paramaters are invalid, Z_MEM_ERROR if the internal state could not | |||
be allocated, or Z_VERSION_ERROR if the version of the library does not | be | |||
match the version of the header file. | allocated, or Z_VERSION_ERROR if the version of the library does not mat | |||
ch | ||||
the version of the header file. | ||||
*/ | */ | |||
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); | typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); | |||
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | |||
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | |||
in_func in, void FAR *in_desc, | in_func in, void FAR *in_desc, | |||
out_func out, void FAR *out_desc)); | out_func out, void FAR *out_desc)); | |||
/* | /* | |||
inflateBack() does a raw inflate with a single call using a call-back | inflateBack() does a raw inflate with a single call using a call-back | |||
interface for input and output. This is more efficient than inflate() f or | interface for input and output. This is more efficient than inflate() f or | |||
file i/o applications in that it avoids copying between the output and t he | file i/o applications in that it avoids copying between the output and t he | |||
sliding window by simply making the window itself the output buffer. Th is | sliding window by simply making the window itself the output buffer. Th is | |||
function trusts the application to not change the output buffer passed b y | function trusts the application to not change the output buffer passed b y | |||
the output function, at least until inflateBack() returns. | the output function, at least until inflateBack() returns. | |||
inflateBackInit() must be called first to allocate the internal state | inflateBackInit() must be called first to allocate the internal state | |||
and to initialize the state with the user-provided window buffer. | and to initialize the state with the user-provided window buffer. | |||
inflateBack() may then be used multiple times to inflate a complete, raw | inflateBack() may then be used multiple times to inflate a complete, raw | |||
deflate stream with each call. inflateBackEnd() is then called to free | deflate stream with each call. inflateBackEnd() is then called to free | |||
the allocated state. | the | |||
allocated state. | ||||
A raw deflate stream is one with no zlib or gzip header or trailer. | A raw deflate stream is one with no zlib or gzip header or trailer. | |||
This routine would normally be used in a utility that reads zip or gzip | This routine would normally be used in a utility that reads zip or gzip | |||
files and writes out uncompressed files. The utility would decode the | files and writes out uncompressed files. The utility would decode the | |||
header and process the trailer on its own, hence this routine expects | header and process the trailer on its own, hence this routine expects on | |||
only the raw deflate stream to decompress. This is different from the | ly | |||
normal behavior of inflate(), which expects either a zlib or gzip header | the raw deflate stream to decompress. This is different from the normal | |||
and | behavior of inflate(), which expects either a zlib or gzip header and | |||
trailer around the deflate stream. | trailer around the deflate stream. | |||
inflateBack() uses two subroutines supplied by the caller that are the n | inflateBack() uses two subroutines supplied by the caller that are the n | |||
called by inflateBack() for input and output. inflateBack() calls those | called by inflateBack() for input and output. inflateBack() calls those | |||
routines until it reads a complete deflate stream and writes out all of the | routines until it reads a complete deflate stream and writes out all of the | |||
uncompressed data, or until it encounters an error. The function's | uncompressed data, or until it encounters an error. The function's | |||
parameters and return types are defined above in the in_func and out_fun c | parameters and return types are defined above in the in_func and out_fun c | |||
typedefs. inflateBack() will call in(in_desc, &buf) which should return the | typedefs. inflateBack() will call in(in_desc, &buf) which should return the | |||
number of bytes of provided input, and a pointer to that input in buf. If | number of bytes of provided input, and a pointer to that input in buf. If | |||
there is no input available, in() must return zero--buf is ignored in th at | there is no input available, in() must return zero--buf is ignored in th at | |||
skipping to change at line 922 | skipping to change at line 1013 | |||
inflateBackInit(), which is also the buffer that out() uses to write fro m. | inflateBackInit(), which is also the buffer that out() uses to write fro m. | |||
The length written by out() will be at most the window size. Any non-ze ro | The length written by out() will be at most the window size. Any non-ze ro | |||
amount of input may be provided by in(). | amount of input may be provided by in(). | |||
For convenience, inflateBack() can be provided input on the first call by | For convenience, inflateBack() can be provided input on the first call by | |||
setting strm->next_in and strm->avail_in. If that input is exhausted, t hen | setting strm->next_in and strm->avail_in. If that input is exhausted, t hen | |||
in() will be called. Therefore strm->next_in must be initialized before | in() will be called. Therefore strm->next_in must be initialized before | |||
calling inflateBack(). If strm->next_in is Z_NULL, then in() will be ca lled | calling inflateBack(). If strm->next_in is Z_NULL, then in() will be ca lled | |||
immediately for input. If strm->next_in is not Z_NULL, then strm->avail _in | immediately for input. If strm->next_in is not Z_NULL, then strm->avail _in | |||
must also be initialized, and then if strm->avail_in is not zero, input will | must also be initialized, and then if strm->avail_in is not zero, input will | |||
initially be taken from strm->next_in[0 .. strm->avail_in - 1]. | initially be taken from strm->next_in[0 .. strm->avail_in - 1]. | |||
The in_desc and out_desc parameters of inflateBack() is passed as the | The in_desc and out_desc parameters of inflateBack() is passed as the | |||
first parameter of in() and out() respectively when they are called. Th ese | first parameter of in() and out() respectively when they are called. Th ese | |||
descriptors can be optionally used to pass any information that the call er- | descriptors can be optionally used to pass any information that the call er- | |||
supplied in() and out() functions need to do their job. | supplied in() and out() functions need to do their job. | |||
On return, inflateBack() will set strm->next_in and strm->avail_in to | On return, inflateBack() will set strm->next_in and strm->avail_in to | |||
pass back any unused input that was provided by the last in() call. The | pass back any unused input that was provided by the last in() call. The | |||
return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERR OR | return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERR OR | |||
if in() or out() returned an error, Z_DATA_ERROR if there was a format | if in() or out() returned an error, Z_DATA_ERROR if there was a format e | |||
error in the deflate stream (in which case strm->msg is set to indicate | rror | |||
the | in the deflate stream (in which case strm->msg is set to indicate the na | |||
nature of the error), or Z_STREAM_ERROR if the stream was not properly | ture | |||
initialized. In the case of Z_BUF_ERROR, an input or output error can b | of the error), or Z_STREAM_ERROR if the stream was not properly initiali | |||
e | zed. | |||
distinguished using strm->next_in which will be Z_NULL only if in() retu | In the case of Z_BUF_ERROR, an input or output error can be distinguishe | |||
rned | d | |||
an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to | using strm->next_in which will be Z_NULL only if in() returned an error. | |||
out() returning non-zero. (in() will always be called before out(), so | If | |||
strm->next_in is assured to be defined if out() returns non-zero.) Note | strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() retur | |||
that inflateBack() cannot return Z_OK. | ning | |||
non-zero. (in() will always be called before out(), so strm->next_in is | ||||
assured to be defined if out() returns non-zero.) Note that inflateBack( | ||||
) | ||||
cannot return Z_OK. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); | ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); | |||
/* | /* | |||
All memory allocated by inflateBackInit() is freed. | All memory allocated by inflateBackInit() is freed. | |||
inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the str eam | inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the str eam | |||
state was inconsistent. | state was inconsistent. | |||
*/ | */ | |||
skipping to change at line 995 | skipping to change at line 1086 | |||
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! | 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! | |||
26: 0 = returns value, 1 = void -- 1 means inferred string length retu rned | 26: 0 = returns value, 1 = void -- 1 means inferred string length retu rned | |||
Remainder: | Remainder: | |||
27-31: 0 (reserved) | 27-31: 0 (reserved) | |||
*/ | */ | |||
/* utility functions */ | /* utility functions */ | |||
/* | /* | |||
The following utility functions are implemented on top of the | The following utility functions are implemented on top of the basic | |||
basic stream-oriented functions. To simplify the interface, some | stream-oriented functions. To simplify the interface, some default opti | |||
default options are assumed (compression level and memory usage, | ons | |||
standard memory allocation functions). The source code of these | are assumed (compression level and memory usage, standard memory allocat | |||
utility functions can easily be modified if you need special options. | ion | |||
functions). The source code of these utility functions can be modified | ||||
if | ||||
you need special options. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, | ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, | |||
const Bytef *source, uLong sourceLen)); | const Bytef *source, uLong sourceLen)); | |||
/* | /* | |||
Compresses the source buffer into the destination buffer. sourceLen i s | Compresses the source buffer into the destination buffer. sourceLen i s | |||
the byte length of the source buffer. Upon entry, destLen is the total | the byte length of the source buffer. Upon entry, destLen is the total | |||
size of the destination buffer, which must be at least the value returne | size | |||
d | of the destination buffer, which must be at least the value returned by | |||
by compressBound(sourceLen). Upon exit, destLen is the actual size of th | compressBound(sourceLen). Upon exit, destLen is the actual size of the | |||
e | ||||
compressed buffer. | compressed buffer. | |||
This function can be used to compress a whole file at once if the | ||||
input file is mmap'ed. | ||||
compress returns Z_OK if success, Z_MEM_ERROR if there was not | compress returns Z_OK if success, Z_MEM_ERROR if there was not | |||
enough memory, Z_BUF_ERROR if there was not enough room in the output | enough memory, Z_BUF_ERROR if there was not enough room in the output | |||
buffer. | buffer. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, | ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, | |||
const Bytef *source, uLong sourceLen, | const Bytef *source, uLong sourceLen, | |||
int level)); | int level)); | |||
/* | /* | |||
Compresses the source buffer into the destination buffer. The level | Compresses the source buffer into the destination buffer. The level | |||
parameter has the same meaning as in deflateInit. sourceLen is the byte | parameter has the same meaning as in deflateInit. sourceLen is the byte | |||
length of the source buffer. Upon entry, destLen is the total size of th e | length of the source buffer. Upon entry, destLen is the total size of t he | |||
destination buffer, which must be at least the value returned by | destination buffer, which must be at least the value returned by | |||
compressBound(sourceLen). Upon exit, destLen is the actual size of the | compressBound(sourceLen). Upon exit, destLen is the actual size of the | |||
compressed buffer. | compressed buffer. | |||
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | |||
memory, Z_BUF_ERROR if there was not enough room in the output buffer, | memory, Z_BUF_ERROR if there was not enough room in the output buffer, | |||
Z_STREAM_ERROR if the level parameter is invalid. | Z_STREAM_ERROR if the level parameter is invalid. | |||
*/ | */ | |||
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); | ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); | |||
/* | /* | |||
compressBound() returns an upper bound on the compressed size after | compressBound() returns an upper bound on the compressed size after | |||
compress() or compress2() on sourceLen bytes. It would be used before | compress() or compress2() on sourceLen bytes. It would be used before a | |||
a compress() or compress2() call to allocate the destination buffer. | compress() or compress2() call to allocate the destination buffer. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | |||
const Bytef *source, uLong sourceLen)); | const Bytef *source, uLong sourceLen)); | |||
/* | /* | |||
Decompresses the source buffer into the destination buffer. sourceLen is | Decompresses the source buffer into the destination buffer. sourceLen is | |||
the byte length of the source buffer. Upon entry, destLen is the total | the byte length of the source buffer. Upon entry, destLen is the total | |||
size of the destination buffer, which must be large enough to hold the | size | |||
entire uncompressed data. (The size of the uncompressed data must have | of the destination buffer, which must be large enough to hold the entire | |||
been saved previously by the compressor and transmitted to the decompres | uncompressed data. (The size of the uncompressed data must have been sa | |||
sor | ved | |||
by some mechanism outside the scope of this compression library.) | previously by the compressor and transmitted to the decompressor by some | |||
Upon exit, destLen is the actual size of the compressed buffer. | mechanism outside the scope of this compression library.) Upon exit, des | |||
This function can be used to decompress a whole file at once if the | tLen | |||
input file is mmap'ed. | is the actual size of the uncompressed buffer. | |||
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | |||
enough memory, Z_BUF_ERROR if there was not enough room in the output | enough memory, Z_BUF_ERROR if there was not enough room in the output | |||
buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. | buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. | |||
*/ | */ | |||
typedef voidp gzFile; | /* gzip file access functions */ | |||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | ||||
/* | /* | |||
Opens a gzip (.gz) file for reading or writing. The mode parameter | This library supports reading and writing files in gzip (.gz) format w | |||
is as in fopen ("rb" or "wb") but can also include a compression level | ith | |||
("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for | an interface similar to that of stdio, using the functions that start wi | |||
Huffman only compression as in "wb1h", or 'R' for run-length encoding | th | |||
as in "wb1R". (See the description of deflateInit2 for more information | "gz". The gzip format is different from the zlib format. gzip is a gzi | |||
about the strategy parameter.) | p | |||
wrapper, documented in RFC 1952, wrapped around a deflate stream. | ||||
*/ | ||||
typedef voidp gzFile; /* opaque gzip file descriptor */ | ||||
/* | ||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | ||||
Opens a gzip (.gz) file for reading or writing. The mode parameter is | ||||
as | ||||
in fopen ("rb" or "wb") but can also include a compression level ("wb9") | ||||
or | ||||
a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only | ||||
compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or ' | ||||
F' | ||||
for fixed code compression as in "wb9F". (See the description of | ||||
deflateInit2 for more information about the strategy parameter.) Also "a | ||||
" | ||||
can be used instead of "w" to request that the gzip stream that will be | ||||
written be appended to the file. "+" will result in an error, since rea | ||||
ding | ||||
and writing to the same gzip file is not supported. | ||||
gzopen can be used to read a file which is not in gzip format; in this | gzopen can be used to read a file which is not in gzip format; in this | |||
case gzread will directly read from the file without decompression. | case gzread will directly read from the file without decompression. | |||
gzopen returns NULL if the file could not be opened or if there was | gzopen returns NULL if the file could not be opened, if there was | |||
insufficient memory to allocate the (de)compression state; errno | insufficient memory to allocate the gzFile state, or if an invalid mode | |||
can be checked to distinguish the two cases (if errno is zero, the | was | |||
zlib error is Z_MEM_ERROR). */ | specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). | |||
errno can be checked to determine if the reason gzopen failed was that t | ||||
he | ||||
file could not be opened. | ||||
*/ | ||||
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | |||
/* | /* | |||
gzdopen() associates a gzFile with the file descriptor fd. File | gzdopen associates a gzFile with the file descriptor fd. File descrip | |||
descriptors are obtained from calls like open, dup, creat, pipe or | tors | |||
fileno (in the file has been previously opened with fopen). | are obtained from calls like open, dup, creat, pipe or fileno (if the fi | |||
The mode parameter is as in gzopen. | le | |||
The next call of gzclose on the returned gzFile will also close the | has been previously opened with fopen). The mode parameter is as in gzo | |||
file descriptor fd, just like fclose(fdopen(fd), mode) closes the file | pen. | |||
descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). | ||||
gzdopen returns NULL if there was insufficient memory to allocate | The next call of gzclose on the returned gzFile will also close the fi | |||
the (de)compression state. | le | |||
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descri | ||||
ptor | ||||
fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd | ||||
, | ||||
mode);. The duplicated descriptor should be saved to avoid a leak, sinc | ||||
e | ||||
gzdopen does not close fd if it fails. | ||||
gzdopen returns NULL if there was insufficient memory to allocate the | ||||
gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was | ||||
not | ||||
provided, or '+' was provided), or if fd is -1. The file descriptor is | ||||
not | ||||
used until the next gz* read, write, seek, or close operation, so gzdope | ||||
n | ||||
will not detect if fd is invalid (unless fd is -1). | ||||
*/ | ||||
ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); | ||||
/* | ||||
Set the internal buffer size used by this library's functions. The | ||||
default buffer size is 8192 bytes. This function must be called after | ||||
gzopen() or gzdopen(), and before any other calls that read or write the | ||||
file. The buffer memory allocation is always deferred to the first read | ||||
or | ||||
write. Two buffers are allocated, either both of the specified size whe | ||||
n | ||||
writing, or one of the specified size and the other twice that size when | ||||
reading. A larger buffer size of, for example, 64K or 128K bytes will | ||||
noticeably increase the speed of decompression (reading). | ||||
The new buffer size also affects the maximum length for gzprintf(). | ||||
gzbuffer() returns 0 on success, or -1 on failure, such as being calle | ||||
d | ||||
too late. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); | ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); | |||
/* | /* | |||
Dynamically update the compression level or strategy. See the descript ion | Dynamically update the compression level or strategy. See the descrip tion | |||
of deflateInit2 for the meaning of these parameters. | of deflateInit2 for the meaning of these parameters. | |||
gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not | gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not | |||
opened for writing. | opened for writing. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | |||
/* | /* | |||
Reads the given number of uncompressed bytes from the compressed file. | Reads the given number of uncompressed bytes from the compressed file. | |||
If the input file was not in gzip format, gzread copies the given number | If | |||
of bytes into the buffer. | the input file was not in gzip format, gzread copies the given number of | |||
gzread returns the number of uncompressed bytes actually read (0 for | bytes into the buffer. | |||
end of file, -1 for error). */ | ||||
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | After reaching the end of a gzip stream in the input, gzread will cont | |||
voidpc buf, unsigned len)); | inue | |||
to read, looking for another gzip stream, or failing that, reading the r | ||||
est | ||||
of the input file directly without decompression. The entire input file | ||||
will be read if gzread is called until it returns less than the requeste | ||||
d | ||||
len. | ||||
gzread returns the number of uncompressed bytes actually read, less th | ||||
an | ||||
len for end of file, or -1 for error. | ||||
*/ | ||||
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | ||||
voidpc buf, unsigned len)); | ||||
/* | /* | |||
Writes the given number of uncompressed bytes into the compressed file . | Writes the given number of uncompressed bytes into the compressed file . | |||
gzwrite returns the number of uncompressed bytes actually written | gzwrite returns the number of uncompressed bytes written or 0 in case of | |||
(0 in case of error). | error. | |||
*/ | */ | |||
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)) ; | ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); | |||
/* | /* | |||
Converts, formats, and writes the args to the compressed file under | Converts, formats, and writes the arguments to the compressed file und | |||
control of the format string, as in fprintf. gzprintf returns the number | er | |||
of | control of the format string, as in fprintf. gzprintf returns the numbe | |||
uncompressed bytes actually written (0 in case of error). The number of | r of | |||
uncompressed bytes written is limited to 4095. The caller should assure | uncompressed bytes actually written, or 0 in case of error. The number | |||
that | of | |||
this limit is not exceeded. If it is exceeded, then gzprintf() will retu | uncompressed bytes written is limited to 8191, or one less than the buff | |||
rn | er | |||
return an error (0) with nothing written. In this case, there may also b | size given to gzbuffer(). The caller should assure that this limit is n | |||
e a | ot | |||
buffer overflow with unpredictable consequences, which is possible only | exceeded. If it is exceeded, then gzprintf() will return an error (0) w | |||
if | ith | |||
zlib was compiled with the insecure functions sprintf() or vsprintf() | nothing written. In this case, there may also be a buffer overflow with | |||
because the secure snprintf() or vsnprintf() functions were not availabl | unpredictable consequences, which is possible only if zlib was compiled | |||
e. | with | |||
the insecure functions sprintf() or vsprintf() because the secure snprin | ||||
tf() | ||||
or vsnprintf() functions were not available. This can be determined usi | ||||
ng | ||||
zlibCompileFlags(). | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); | |||
/* | /* | |||
Writes the given null-terminated string to the compressed file, exclu ding | Writes the given null-terminated string to the compressed file, exclud ing | |||
the terminating null character. | the terminating null character. | |||
gzputs returns the number of characters written, or -1 in case of err | ||||
or. | gzputs returns the number of characters written, or -1 in case of erro | |||
r. | ||||
*/ | */ | |||
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); | ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); | |||
/* | /* | |||
Reads bytes from the compressed file until len-1 characters are read, | Reads bytes from the compressed file until len-1 characters are read, | |||
or | or a | |||
a newline character is read and transferred to buf, or an end-of-file | newline character is read and transferred to buf, or an end-of-file | |||
condition is encountered. The string is then terminated with a null | condition is encountered. If any characters are read or if len == 1, th | |||
character. | e | |||
gzgets returns buf, or Z_NULL in case of error. | string is terminated with a null character. If no characters are read d | |||
ue | ||||
to an end-of-file or len < 1, then the buffer is left untouched. | ||||
gzgets returns buf which is a null-terminated string, or it returns NU | ||||
LL | ||||
for end-of-file or in case of error. If there was an error, the content | ||||
s at | ||||
buf are indeterminate. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); | ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); | |||
/* | /* | |||
Writes c, converted to an unsigned char, into the compressed file. | Writes c, converted to an unsigned char, into the compressed file. gz | |||
gzputc returns the value that was written, or -1 in case of error. | putc | |||
returns the value that was written, or -1 in case of error. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); | |||
/* | /* | |||
Reads one byte from the compressed file. gzgetc returns this byte | Reads one byte from the compressed file. gzgetc returns this byte or | |||
or -1 in case of end of file or error. | -1 | |||
in case of end of file or error. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); | ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); | |||
/* | /* | |||
Push one character back onto the stream to be read again later. | Push one character back onto the stream to be read as the first charac | |||
Only one character of push-back is allowed. gzungetc() returns the | ter | |||
character pushed, or -1 on failure. gzungetc() will fail if a | on the next read. At least one character of push-back is allowed. | |||
character has been pushed but not read yet, or if c is -1. The pushed | gzungetc() returns the character pushed, or -1 on failure. gzungetc() w | |||
character will be discarded if the stream is repositioned with gzseek() | ill | |||
or gzrewind(). | fail if c is -1, and may fail if a character has been pushed but not rea | |||
d | ||||
yet. If gzungetc is used immediately after gzopen or gzdopen, at least | ||||
the | ||||
output buffer size of pushed characters is allowed. (See gzbuffer above | ||||
.) | ||||
The pushed character will be discarded if the stream is repositioned wit | ||||
h | ||||
gzseek() or gzrewind(). | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); | ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); | |||
/* | /* | |||
Flushes all pending output into the compressed file. The parameter | Flushes all pending output into the compressed file. The parameter fl | |||
flush is as in the deflate() function. The return value is the zlib | ush | |||
error number (see function gzerror below). gzflush returns Z_OK if | is as in the deflate() function. The return value is the zlib error num | |||
the flush parameter is Z_FINISH and all output could be flushed. | ber | |||
gzflush should be called only when strictly necessary because it can | (see function gzerror below). gzflush is only permitted when writing. | |||
degrade compression. | ||||
If the flush parameter is Z_FINISH, the remaining data is written and | ||||
the | ||||
gzip stream is completed in the output. If gzwrite() is called again, a | ||||
new | ||||
gzip stream will be started in the output. gzread() is able to read suc | ||||
h | ||||
concatented gzip streams. | ||||
gzflush should be called only when strictly necessary because it will | ||||
degrade compression if called too often. | ||||
*/ | */ | |||
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, | ||||
z_off_t offset, int whence)); | ||||
/* | /* | |||
Sets the starting position for the next gzread or gzwrite on the | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, | |||
given compressed file. The offset represents a number of bytes in the | z_off_t offset, int whence)); | |||
uncompressed data stream. The whence parameter is defined as in lseek(2) | ||||
; | Sets the starting position for the next gzread or gzwrite on the given | |||
compressed file. The offset represents a number of bytes in the | ||||
uncompressed data stream. The whence parameter is defined as in lseek(2 | ||||
); | ||||
the value SEEK_END is not supported. | the value SEEK_END is not supported. | |||
If the file is opened for reading, this function is emulated but can b e | If the file is opened for reading, this function is emulated but can b e | |||
extremely slow. If the file is opened for writing, only forward seeks ar e | extremely slow. If the file is opened for writing, only forward seeks a re | |||
supported; gzseek then compresses a sequence of zeroes up to the new | supported; gzseek then compresses a sequence of zeroes up to the new | |||
starting position. | starting position. | |||
gzseek returns the resulting offset location as measured in bytes fro m | gzseek returns the resulting offset location as measured in bytes from | |||
the beginning of the uncompressed stream, or -1 in case of error, in | the beginning of the uncompressed stream, or -1 in case of error, in | |||
particular if the file is opened for writing and the new starting positi on | particular if the file is opened for writing and the new starting positi on | |||
would be before the current position. | would be before the current position. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); | ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); | |||
/* | /* | |||
Rewinds the given file. This function is supported only for reading. | Rewinds the given file. This function is supported only for reading. | |||
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) | |||
*/ | */ | |||
/* | ||||
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); | |||
Returns the starting position for the next gzread or gzwrite on the gi | ||||
ven | ||||
compressed file. This position represents a number of bytes in the | ||||
uncompressed data stream, and is zero when starting, even if appending o | ||||
r | ||||
reading a gzip stream from the middle of a file using gzdopen(). | ||||
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) | ||||
*/ | ||||
/* | /* | |||
Returns the starting position for the next gzread or gzwrite on the | ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); | |||
given compressed file. This position represents a number of bytes in the | ||||
uncompressed data stream. | ||||
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) | Returns the current offset in the file being read or written. This of | |||
fset | ||||
includes the count of bytes that precede the gzip stream, for example wh | ||||
en | ||||
appending or when using gzdopen() for reading. When reading, the offset | ||||
does not include as yet unused buffered input. This information can be | ||||
used | ||||
for a progress indicator. On error, gzoffset() returns -1. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzeof OF((gzFile file)); | ZEXTERN int ZEXPORT gzeof OF((gzFile file)); | |||
/* | /* | |||
Returns 1 when EOF has previously been detected reading the given | Returns true (1) if the end-of-file indicator has been set while readi | |||
input stream, otherwise zero. | ng, | |||
false (0) otherwise. Note that the end-of-file indicator is set only if | ||||
the | ||||
read tried to go past the end of the input, but came up short. Therefor | ||||
e, | ||||
just like feof(), gzeof() may return false even if there is no more data | ||||
to | ||||
read, in the event that the last read request was for the exact number o | ||||
f | ||||
bytes remaining in the input file. This will happen if the input file s | ||||
ize | ||||
is an exact multiple of the buffer size. | ||||
If gzeof() returns true, then the read functions will return no more d | ||||
ata, | ||||
unless the end-of-file indicator is reset by gzclearerr() and the input | ||||
file | ||||
has grown since the previous end of file was detected. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); | ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); | |||
/* | /* | |||
Returns 1 if file is being read directly without decompression, otherw | Returns true (1) if file is being copied directly while reading, or fa | |||
ise | lse | |||
zero. | (0) if file is a gzip stream being decompressed. This state can change | |||
from | ||||
false to true while reading the input file if the end of a gzip stream i | ||||
s | ||||
reached, but is followed by data that is not another gzip stream. | ||||
If the input file is empty, gzdirect() will return true, since the inp | ||||
ut | ||||
does not contain a gzip stream. | ||||
If gzdirect() is used immediately after gzopen() or gzdopen() it will | ||||
cause buffers to be allocated to allow reading the file to determine if | ||||
it | ||||
is a gzip file. Therefore if gzbuffer() is used, it should be called be | ||||
fore | ||||
gzdirect(). | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | |||
/* | /* | |||
Flushes all pending output if necessary, closes the compressed file | Flushes all pending output if necessary, closes the compressed file an | |||
and deallocates all the (de)compression state. The return value is the z | d | |||
lib | deallocates the (de)compression state. Note that once file is closed, y | |||
error number (see function gzerror below). | ou | |||
cannot call gzerror with file, since its structures have been deallocate | ||||
d. | ||||
gzclose must not be called more than once on the same file, just as free | ||||
must not be called more than once on the same allocation. | ||||
gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a | ||||
file operation error, or Z_OK on success. | ||||
*/ | ||||
ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); | ||||
ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); | ||||
/* | ||||
Same as gzclose(), but gzclose_r() is only for use when reading, and | ||||
gzclose_w() is only for use when writing or appending. The advantage to | ||||
using these instead of gzclose() is that they avoid linking in zlib | ||||
compression or decompression code that is not used when only reading or | ||||
only | ||||
writing respectively. If gzclose() is used, then both compression and | ||||
decompression code will be included the application when linking to a st | ||||
atic | ||||
zlib library. | ||||
*/ | */ | |||
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | |||
/* | /* | |||
Returns the error message for the last error which occurred on the | Returns the error message for the last error which occurred on the giv | |||
given compressed file. errnum is set to zlib error number. If an | en | |||
error occurred in the file system and not in the compression library, | compressed file. errnum is set to zlib error number. If an error occur | |||
errnum is set to Z_ERRNO and the application may consult errno | red | |||
to get the exact error code. | in the file system and not in the compression library, errnum is set to | |||
Z_ERRNO and the application may consult errno to get the exact error cod | ||||
e. | ||||
The application must not modify the returned string. Future calls to | ||||
this function may invalidate the previously returned string. If file is | ||||
closed, then the string previously returned by gzerror will no longer be | ||||
available. | ||||
gzerror() should be used to distinguish errors from end-of-file for th | ||||
ose | ||||
functions above that do not distinguish those cases in their return valu | ||||
es. | ||||
*/ | */ | |||
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | |||
/* | /* | |||
Clears the error and end-of-file flags for file. This is analogous to | Clears the error and end-of-file flags for file. This is analogous to | |||
the | the | |||
clearerr() function in stdio. This is useful for continuing to read a gz | clearerr() function in stdio. This is useful for continuing to read a g | |||
ip | zip | |||
file that is being written concurrently. | file that is being written concurrently. | |||
*/ | */ | |||
/* checksum functions */ | /* checksum functions */ | |||
/* | /* | |||
These functions are not related to compression but are exported | These functions are not related to compression but are exported | |||
anyway because they might be useful in applications using the | anyway because they might be useful in applications using the compressio | |||
compression library. | n | |||
library. | ||||
*/ | */ | |||
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)) ; | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)) ; | |||
/* | /* | |||
Update a running Adler-32 checksum with the bytes buf[0..len-1] and | Update a running Adler-32 checksum with the bytes buf[0..len-1] and | |||
return the updated checksum. If buf is NULL, this function returns | return the updated checksum. If buf is Z_NULL, this function returns th | |||
the required initial value for the checksum. | e | |||
An Adler-32 checksum is almost as reliable as a CRC32 but can be compute | required initial value for the checksum. | |||
d | ||||
much faster. Usage example: | An Adler-32 checksum is almost as reliable as a CRC32 but can be compu | |||
ted | ||||
much faster. | ||||
Usage example: | ||||
uLong adler = adler32(0L, Z_NULL, 0); | uLong adler = adler32(0L, Z_NULL, 0); | |||
while (read_buffer(buffer, length) != EOF) { | while (read_buffer(buffer, length) != EOF) { | |||
adler = adler32(adler, buffer, length); | adler = adler32(adler, buffer, length); | |||
} | } | |||
if (adler != original_adler) error(); | if (adler != original_adler) error(); | |||
*/ | */ | |||
/* | ||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, | |||
z_off_t len2)); | z_off_t len2)); | |||
/* | ||||
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 | Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 | |||
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for | and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for | |||
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksu m of | each, adler1 and adler2. adler32_combine() returns the Adler-32 checksu m of | |||
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. | seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. | |||
*/ | */ | |||
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | |||
/* | /* | |||
Update a running CRC-32 with the bytes buf[0..len-1] and return the | Update a running CRC-32 with the bytes buf[0..len-1] and return the | |||
updated CRC-32. If buf is NULL, this function returns the required initi | updated CRC-32. If buf is Z_NULL, this function returns the required | |||
al | initial value for the for the crc. Pre- and post-conditioning (one's | |||
value for the for the crc. Pre- and post-conditioning (one's complement) | complement) is performed within this function so it shouldn't be done by | |||
is | the | |||
performed within this function so it shouldn't be done by the applicatio | application. | |||
n. | ||||
Usage example: | Usage example: | |||
uLong crc = crc32(0L, Z_NULL, 0); | uLong crc = crc32(0L, Z_NULL, 0); | |||
while (read_buffer(buffer, length) != EOF) { | while (read_buffer(buffer, length) != EOF) { | |||
crc = crc32(crc, buffer, length); | crc = crc32(crc, buffer, length); | |||
} | } | |||
if (crc != original_crc) error(); | if (crc != original_crc) error(); | |||
*/ | */ | |||
/* | ||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len 2)); | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len 2)); | |||
/* | ||||
Combine two CRC-32 check values into one. For two sequences of bytes, | Combine two CRC-32 check values into one. For two sequences of bytes, | |||
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were | seq1 and seq2 with lengths len1 and len2, CRC-32 check values were | |||
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 | calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 | |||
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, an d | check value of seq1 and seq2 concatenated, requiring only crc1, crc2, an d | |||
len2. | len2. | |||
*/ | */ | |||
/* various hacks, don't look :) */ | /* various hacks, don't look :) */ | |||
/* deflateInit and inflateInit are macros to allow checking the zlib versio n | /* deflateInit and inflateInit are macros to allow checking the zlib versio n | |||
skipping to change at line 1333 | skipping to change at line 1545 | |||
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) | |||
#define inflateInit(strm) \ | #define inflateInit(strm) \ | |||
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) | inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) | |||
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ | #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ | |||
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ | deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ | |||
(strategy), ZLIB_VERSION, sizeof(z_stream)) | (strategy), ZLIB_VERSION, sizeof(z_stream)) | |||
#define inflateInit2(strm, windowBits) \ | #define inflateInit2(strm, windowBits) \ | |||
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) | inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) | |||
#define inflateBackInit(strm, windowBits, window) \ | #define inflateBackInit(strm, windowBits, window) \ | |||
inflateBackInit_((strm), (windowBits), (window), \ | inflateBackInit_((strm), (windowBits), (window), \ | |||
ZLIB_VERSION, sizeof(z_stream)) | ZLIB_VERSION, sizeof(z_stream)) | |||
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or | ||||
* change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if | ||||
* both are true, the application gets the *64 functions, and the regular | ||||
* functions are changed to 64 bits) -- in case these are set on systems | ||||
* without large file support, _LFS64_LARGEFILE must also be true | ||||
*/ | ||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 | ||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | ||||
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); | ||||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); | ||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | ||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); | ||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); | ||||
#endif | ||||
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFIL | ||||
E-0 | ||||
# define gzopen gzopen64 | ||||
# define gzseek gzseek64 | ||||
# define gztell gztell64 | ||||
# define gzoffset gzoffset64 | ||||
# define adler32_combine adler32_combine64 | ||||
# define crc32_combine crc32_combine64 | ||||
# ifdef _LARGEFILE64_SOURCE | ||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | ||||
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); | ||||
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); | ||||
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); | ||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); | ||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); | ||||
# endif | ||||
#else | ||||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | ||||
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); | ||||
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | ||||
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); | ||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | ||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | ||||
#endif | ||||
/* hack for buggy compilers */ | ||||
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) | #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) | |||
struct internal_state {int dummy;}; /* hack for buggy compilers */ | struct internal_state {int dummy;}; | |||
#endif | #endif | |||
/* undocumented functions */ | ||||
ZEXTERN const char * ZEXPORT zError OF((int)); | ZEXTERN const char * ZEXPORT zError OF((int)); | |||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | |||
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); | |||
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* ZLIB_H */ | #endif /* ZLIB_H */ | |||
End of changes. 185 change blocks. | ||||
537 lines changed or deleted | 976 lines changed or added | |||