AbstractCache.h | AbstractCache.h | |||
---|---|---|---|---|
// | // | |||
// AbstractCache.h | // AbstractCache.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/AbstractCache.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/AbstractCache.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Cache | // Package: Cache | |||
// Module: AbstractCache | // Module: AbstractCache | |||
// | // | |||
// Definition of the AbstractCache class. | // Definition of the AbstractCache 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 83 | skipping to change at line 83 | |||
initialize(); | initialize(); | |||
} | } | |||
AbstractCache(const TStrategy& strat): _strategy(strat) | AbstractCache(const TStrategy& strat): _strategy(strat) | |||
{ | { | |||
initialize(); | initialize(); | |||
} | } | |||
virtual ~AbstractCache() | virtual ~AbstractCache() | |||
{ | { | |||
uninitialize(); | try | |||
{ | ||||
uninitialize(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
void add(const TKey& key, const TValue& val) | void add(const TKey& key, const TValue& val) | |||
/// Adds the key value pair to the cache. | /// Adds the key value pair to the cache. | |||
/// If for the key already an entry exists, it will be overw ritten. | /// If for the key already an entry exists, it will be overw ritten. | |||
{ | { | |||
typename TMutex::ScopedLock lock(_mutex); | typename TMutex::ScopedLock lock(_mutex); | |||
doAdd(key, val); | doAdd(key, val); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 9 lines changed or added | |||
ActiveDispatcher.h | ActiveDispatcher.h | |||
---|---|---|---|---|
// | // | |||
// ActiveDispatcher.h | // ActiveDispatcher.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ActiveDispatcher.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/ActiveDispatcher.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: ActiveObjects | // Module: ActiveObjects | |||
// | // | |||
// Definition of the ActiveDispatcher class. | // Definition of the ActiveDispatcher class. | |||
// | // | |||
// Copyright (c) 2006-2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2006-2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 54 | skipping to change at line 54 | |||
#include "Poco/ActiveStarter.h" | #include "Poco/ActiveStarter.h" | |||
#include "Poco/ActiveRunnable.h" | #include "Poco/ActiveRunnable.h" | |||
#include "Poco/NotificationQueue.h" | #include "Poco/NotificationQueue.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API ActiveDispatcher: protected Runnable | class Foundation_API ActiveDispatcher: protected Runnable | |||
/// This class is used to implement an active object | /// This class is used to implement an active object | |||
/// with strictly serialized method execution. | /// with strictly serialized method execution. | |||
/// | /// | |||
/// An active object, with is an ordinary object | /// An active object, which is an ordinary object | |||
/// containing ActiveMethod members, executes all | /// containing ActiveMethod members, executes all | |||
/// active methods in their own thread. | /// active methods in their own thread. | |||
/// This behavior does not fit the "classic" | /// This behavior does not fit the "classic" | |||
/// definition of an active object, which serializes | /// definition of an active object, which serializes | |||
/// the execution of active methods (in other words, | /// the execution of active methods (in other words, | |||
/// only one active method can be running at any given | /// only one active method can be running at any given | |||
/// time). | /// time). | |||
/// | /// | |||
/// Using this class as a base class, the serializing | /// Using this class as a base class, the serializing | |||
/// behavior for active objects can be implemented. | /// behavior for active objects can be implemented. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
Activity.h | Activity.h | |||
---|---|---|---|---|
// | // | |||
// Activity.h | // Activity.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Activity.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Activity.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: ActiveObjects | // Module: ActiveObjects | |||
// | // | |||
// Definition of the Activity template class. | // Definition of the Activity 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 113 | skipping to change at line 113 | |||
_done(false) | _done(false) | |||
/// Creates the activity. Call start() to | /// Creates the activity. Call start() to | |||
/// start it. | /// start it. | |||
{ | { | |||
poco_check_ptr (pOwner); | poco_check_ptr (pOwner); | |||
} | } | |||
~Activity() | ~Activity() | |||
/// Stops and destroys the activity. | /// Stops and destroys the activity. | |||
{ | { | |||
stop(); | try | |||
wait(); | { | |||
stop(); | ||||
wait(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
void start() | void start() | |||
/// Starts the activity by acquiring a | /// Starts the activity by acquiring a | |||
/// thread for it from the default thread pool. | /// thread for it from the default thread pool. | |||
{ | { | |||
FastMutex::ScopedLock lock(_mutex); | FastMutex::ScopedLock lock(_mutex); | |||
if (!_running) | if (!_running) | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 10 lines changed or added | |||
Buffer.h | Buffer.h | |||
---|---|---|---|---|
// | // | |||
// Buffer.h | // Buffer.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Buffer.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Buffer.h#3 $ | |||
// | // | |||
// 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 80 | skipping to change at line 80 | |||
void resize(std::size_t newSize, bool preserveContent = true) | void resize(std::size_t newSize, bool preserveContent = true) | |||
/// Resizes the buffer. If preserveContent is true, | /// Resizes the buffer. If preserveContent is true, | |||
/// the content of the old buffer is copied over to the | /// the content of the old buffer is copied over to the | |||
/// new buffer. NewSize can be larger or smaller than | /// new buffer. NewSize can be larger or smaller than | |||
/// the current size, but it must not be 0. | /// the current size, but it must not be 0. | |||
{ | { | |||
T* ptr = new T[newSize]; | T* ptr = new T[newSize]; | |||
if (preserveContent) | if (preserveContent) | |||
{ | { | |||
std::size_t n = newSize > _size ? _size : newSize; | std::size_t n = newSize > _size ? _size : newSize; | |||
std::memcpy(ptr, _ptr, n); | std::memcpy(ptr, _ptr, n*sizeof(T)); | |||
} | } | |||
delete [] _ptr; | delete [] _ptr; | |||
_ptr = ptr; | _ptr = ptr; | |||
_size = newSize; | _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; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
BufferAllocator.h | BufferAllocator.h | |||
---|---|---|---|---|
// | // | |||
// BufferAllocator.h | // BufferAllocator.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/BufferAllocator.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/BufferAllocator.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: BufferAllocator | // Module: BufferAllocator | |||
// | // | |||
// Definition of the BufferAllocator class. | // Definition of the BufferAllocator 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 60 | skipping to change at line 60 | |||
/// BufferAllocator has been specified. | /// BufferAllocator has been specified. | |||
{ | { | |||
public: | public: | |||
typedef ch char_type; | typedef ch char_type; | |||
static char_type* allocate(std::streamsize size) | static char_type* allocate(std::streamsize size) | |||
{ | { | |||
return new char_type[static_cast<std::size_t>(size)]; | return new char_type[static_cast<std::size_t>(size)]; | |||
} | } | |||
static void deallocate(char_type* ptr, std::streamsize size) | static void deallocate(char_type* ptr, std::streamsize /*size*/) | |||
{ | { | |||
delete [] ptr; | delete [] ptr; | |||
} | } | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_BufferAllocator_INCLUDED | #endif // Foundation_BufferAllocator_INCLUDED | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
BufferedBidirectionalStreamBuf.h | BufferedBidirectionalStreamBuf.h | |||
---|---|---|---|---|
// | // | |||
// BufferedBidirectionalStreamBuf.h | // BufferedBidirectionalStreamBuf.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h #1 $ | // $Id: //poco/1.4/Foundation/include/Poco/BufferedBidirectionalStreamBuf.h #2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: StreamBuf | // Module: StreamBuf | |||
// | // | |||
// Definition of template BasicBufferedBidirectionalStreamBuf and class Buf feredBidirectionalStreamBuf. | // Definition of template BasicBufferedBidirectionalStreamBuf and class Buf feredBidirectionalStreamBuf. | |||
// | // | |||
// 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 152 | skipping to change at line 152 | |||
return _mode; | return _mode; | |||
} | } | |||
void resetBuffers() | void resetBuffers() | |||
{ | { | |||
this->setg(_pReadBuffer + 4, _pReadBuffer + 4, _pReadBuffer + 4); | this->setg(_pReadBuffer + 4, _pReadBuffer + 4, _pReadBuffer + 4); | |||
this->setp(_pWriteBuffer, _pWriteBuffer + (_bufsize - 1)); | this->setp(_pWriteBuffer, _pWriteBuffer + (_bufsize - 1)); | |||
} | } | |||
private: | private: | |||
virtual int readFromDevice(char_type* buffer, std::streamsize length ) | virtual int readFromDevice(char_type* /*buffer*/, std::streamsize /* length*/) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
virtual int writeToDevice(const char_type* buffer, std::streamsize l ength) | virtual int writeToDevice(const char_type* /*buffer*/, std::streamsi ze /*length*/) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
int flushBuffer() | int flushBuffer() | |||
{ | { | |||
int n = int(this->pptr() - this->pbase()); | int n = int(this->pptr() - this->pbase()); | |||
if (writeToDevice(this->pbase(), n) == n) | if (writeToDevice(this->pbase(), n) == n) | |||
{ | { | |||
this->pbump(-n); | this->pbump(-n); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
BufferedStreamBuf.h | BufferedStreamBuf.h | |||
---|---|---|---|---|
// | // | |||
// BufferedStreamBuf.h | // BufferedStreamBuf.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/BufferedStreamBuf.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/BufferedStreamBuf.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: StreamBuf | // Module: StreamBuf | |||
// | // | |||
// Definition of template BasicBufferedStreamBuf and class BufferedStreamBu f. | // Definition of template BasicBufferedStreamBuf and class BufferedStreamBu f. | |||
// | // | |||
// 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 145 | skipping to change at line 145 | |||
{ | { | |||
_mode = mode; | _mode = mode; | |||
} | } | |||
openmode getMode() const | openmode getMode() const | |||
{ | { | |||
return _mode; | return _mode; | |||
} | } | |||
private: | private: | |||
virtual int readFromDevice(char_type* buffer, std::streamsize length ) | virtual int readFromDevice(char_type* /*buffer*/, std::streamsize /* length*/) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
virtual int writeToDevice(const char_type* buffer, std::streamsize l ength) | virtual int writeToDevice(const char_type* /*buffer*/, std::streamsi ze /*length*/) | |||
{ | { | |||
return 0; | return 0; | |||
} | } | |||
int flushBuffer() | int flushBuffer() | |||
{ | { | |||
int n = int(this->pptr() - this->pbase()); | int n = int(this->pptr() - this->pbase()); | |||
if (writeToDevice(this->pbase(), n) == n) | if (writeToDevice(this->pbase(), n) == n) | |||
{ | { | |||
this->pbump(-n); | this->pbump(-n); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
Bugcheck.h | Bugcheck.h | |||
---|---|---|---|---|
// | // | |||
// Bugcheck.h | // Bugcheck.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Bugcheck.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Bugcheck.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Bugcheck | // Module: Bugcheck | |||
// | // | |||
// Definition of the Bugcheck class and the self-testing macros. | // Definition of the Bugcheck class and the self-testing macros. | |||
// | // | |||
// 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 75 | skipping to change at line 75 | |||
/// possible, then throw an NullPointerException. | /// possible, then throw an NullPointerException. | |||
static void bugcheck(const char* file, int line); | static void bugcheck(const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible, then throw an BugcheckException. | /// possible, then throw an BugcheckException. | |||
static void bugcheck(const char* msg, const char* file, int line); | static void bugcheck(const char* msg, const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible, then throw an BugcheckException. | /// possible, then throw an BugcheckException. | |||
static void unexpected(const char* file, int line); | ||||
/// An exception was caught in a destructor. Break into debu | ||||
gger, | ||||
/// if possible and report exception. Must only be called fr | ||||
om | ||||
/// within a catch () block as it rethrows the exception to | ||||
/// determine its class. | ||||
static void debugger(const char* file, int line); | static void debugger(const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible. | /// possible. | |||
static void debugger(const char* msg, const char* file, int line); | static void debugger(const char* msg, const char* file, int line); | |||
/// An internal error was encountered. Break into the debugg er, if | /// An internal error was encountered. Break into the debugg er, if | |||
/// possible. | /// possible. | |||
protected: | protected: | |||
static std::string what(const char* msg, const char* file, int line) ; | static std::string what(const char* msg, const char* file, int line) ; | |||
skipping to change at line 111 | skipping to change at line 117 | |||
#define poco_check_ptr(ptr) \ | #define poco_check_ptr(ptr) \ | |||
if (!(ptr)) Poco::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); e lse (void) 0 | if (!(ptr)) Poco::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); e lse (void) 0 | |||
#define poco_bugcheck() \ | #define poco_bugcheck() \ | |||
Poco::Bugcheck::bugcheck(__FILE__, __LINE__) | Poco::Bugcheck::bugcheck(__FILE__, __LINE__) | |||
#define poco_bugcheck_msg(msg) \ | #define poco_bugcheck_msg(msg) \ | |||
Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) | Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__) | |||
#define poco_unexpected() \ | ||||
Poco::Bugcheck::unexpected(__FILE__, __LINE__); | ||||
#define poco_debugger() \ | #define poco_debugger() \ | |||
Poco::Bugcheck::debugger(__FILE__, __LINE__) | Poco::Bugcheck::debugger(__FILE__, __LINE__) | |||
#define poco_debugger_msg(msg) \ | #define poco_debugger_msg(msg) \ | |||
Poco::Bugcheck::debugger(msg, __FILE__, __LINE__) | Poco::Bugcheck::debugger(msg, __FILE__, __LINE__) | |||
#if defined(_DEBUG) | #if defined(_DEBUG) | |||
# define poco_stdout_dbg(outstr) \ | # define poco_stdout_dbg(outstr) \ | |||
std::cout << __FILE__ << '(' << std::dec << __LINE__ << "):" << outs tr << std::endl; | std::cout << __FILE__ << '(' << std::dec << __LINE__ << "):" << outs tr << std::endl; | |||
#else | #else | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 12 lines changed or added | |||
ByteOrder.h | ByteOrder.h | |||
---|---|---|---|---|
// | // | |||
// ByteOrder.h | // ByteOrder.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ByteOrder.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/ByteOrder.h#5 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: ByteOrder | // Module: ByteOrder | |||
// | // | |||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2014, 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 41 | skipping to change at line 41 | |||
// 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_ByteOrder_INCLUDED | #ifndef Foundation_ByteOrder_INCLUDED | |||
#define Foundation_ByteOrder_INCLUDED | #define Foundation_ByteOrder_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Types.h" | #include "Poco/Types.h" | |||
#if defined(_MSC_VER) | ||||
#include <stdlib.h> // builtins | ||||
#endif | ||||
namespace Poco { | namespace Poco { | |||
class Foundation_API ByteOrder | class Foundation_API ByteOrder | |||
/// This class contains a number of static methods | /// This class contains a number of static methods | |||
/// to convert between big-endian and little-endian | /// to convert between big-endian and little-endian | |||
/// integers of various sizes. | /// integers of various sizes. | |||
{ | { | |||
public: | public: | |||
static Int16 flipBytes(Int16 value); | static Int16 flipBytes(Int16 value); | |||
skipping to change at line 114 | skipping to change at line 117 | |||
static Int16 fromNetwork(Int16 value); | static Int16 fromNetwork(Int16 value); | |||
static UInt16 fromNetwork (UInt16 value); | static UInt16 fromNetwork (UInt16 value); | |||
static Int32 fromNetwork(Int32 value); | static Int32 fromNetwork(Int32 value); | |||
static UInt32 fromNetwork (UInt32 value); | static UInt32 fromNetwork (UInt32 value); | |||
#if defined(POCO_HAVE_INT64) | #if defined(POCO_HAVE_INT64) | |||
static Int64 fromNetwork(Int64 value); | static Int64 fromNetwork(Int64 value); | |||
static UInt64 fromNetwork (UInt64 value); | static UInt64 fromNetwork (UInt64 value); | |||
#endif | #endif | |||
}; | }; | |||
#if !defined(POCO_NO_BYTESWAP_BUILTINS) | ||||
#if defined(_MSC_VER) | ||||
#define POCO_HAVE_MSC_BYTESWAP 1 | ||||
#elif defined(__clang__) | ||||
#if __has_builtin(__builtin_bswap32) | ||||
#define POCO_HAVE_GCC_BYTESWAP 1 | ||||
#endif | ||||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR_ | ||||
_ >= 3)) | ||||
#define POCO_HAVE_GCC_BYTESWAP 1 | ||||
#endif | ||||
#endif | ||||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline UInt16 ByteOrder::flipBytes(UInt16 value) | inline UInt16 ByteOrder::flipBytes(UInt16 value) | |||
{ | { | |||
#if defined(POCO_HAVE_MSC_BYTESWAP) | ||||
return _byteswap_ushort(value); | ||||
#else | ||||
return ((value >> 8) & 0x00FF) | ((value << 8) & 0xFF00); | return ((value >> 8) & 0x00FF) | ((value << 8) & 0xFF00); | |||
#endif | ||||
} | } | |||
inline Int16 ByteOrder::flipBytes(Int16 value) | inline Int16 ByteOrder::flipBytes(Int16 value) | |||
{ | { | |||
return Int16(flipBytes(UInt16(value))); | return Int16(flipBytes(UInt16(value))); | |||
} | } | |||
inline UInt32 ByteOrder::flipBytes(UInt32 value) | inline UInt32 ByteOrder::flipBytes(UInt32 value) | |||
{ | { | |||
#if defined(POCO_HAVE_MSC_BYTESWAP) | ||||
return _byteswap_ulong(value); | ||||
#elif defined(POCO_HAVE_GCC_BYTESWAP) | ||||
return __builtin_bswap32(value); | ||||
#else | ||||
return ((value >> 24) & 0x000000FF) | ((value >> 8) & 0x0000FF00) | return ((value >> 24) & 0x000000FF) | ((value >> 8) & 0x0000FF00) | |||
| ((value << 8) & 0x00FF0000) | ((value << 24) & 0xFF000000); | | ((value << 8) & 0x00FF0000) | ((value << 24) & 0xFF000000); | |||
#endif | ||||
} | } | |||
inline Int32 ByteOrder::flipBytes(Int32 value) | inline Int32 ByteOrder::flipBytes(Int32 value) | |||
{ | { | |||
return Int32(flipBytes(UInt32(value))); | return Int32(flipBytes(UInt32(value))); | |||
} | } | |||
#if defined(POCO_HAVE_INT64) | #if defined(POCO_HAVE_INT64) | |||
inline UInt64 ByteOrder::flipBytes(UInt64 value) | inline UInt64 ByteOrder::flipBytes(UInt64 value) | |||
{ | { | |||
#if defined(POCO_HAVE_MSC_BYTESWAP) | ||||
return _byteswap_uint64(value); | ||||
#elif defined(POCO_HAVE_GCC_BYTESWAP) | ||||
return __builtin_bswap64(value); | ||||
#else | ||||
UInt32 hi = UInt32(value >> 32); | UInt32 hi = UInt32(value >> 32); | |||
UInt32 lo = UInt32(value & 0xFFFFFFFF); | UInt32 lo = UInt32(value & 0xFFFFFFFF); | |||
return UInt64(flipBytes(hi)) | (UInt64(flipBytes(lo)) << 32); | return UInt64(flipBytes(hi)) | (UInt64(flipBytes(lo)) << 32); | |||
#endif | ||||
} | } | |||
inline Int64 ByteOrder::flipBytes(Int64 value) | inline Int64 ByteOrder::flipBytes(Int64 value) | |||
{ | { | |||
return Int64(flipBytes(UInt64(value))); | return Int64(flipBytes(UInt64(value))); | |||
} | } | |||
#endif // POCO_HAVE_INT64 | #endif // POCO_HAVE_INT64 | |||
// | // | |||
// some macro trickery to automate the method implementation | // some macro trickery to automate the method implementation | |||
End of changes. 10 change blocks. | ||||
2 lines changed or deleted | 34 lines changed or added | |||
ConsoleChannel.h | ConsoleChannel.h | |||
---|---|---|---|---|
// | // | |||
// ConsoleChannel.h | // ConsoleChannel.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ConsoleChannel.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/ConsoleChannel.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: ConsoleChannel | // Module: ConsoleChannel | |||
// | // | |||
// Definition of the ConsoleChannel class. | // Definition of the ConsoleChannel 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 65 | skipping to change at line 65 | |||
/// appropriate Formatter to control what is contained | /// appropriate Formatter to control what is contained | |||
/// in the text. | /// in the text. | |||
/// | /// | |||
/// Similar to StreamChannel, except that a static | /// Similar to StreamChannel, except that a static | |||
/// mutex is used to protect against multiple | /// mutex is used to protect against multiple | |||
/// console channels concurrently writing to the | /// console channels concurrently writing to the | |||
/// same stream. | /// same stream. | |||
{ | { | |||
public: | public: | |||
ConsoleChannel(); | ConsoleChannel(); | |||
/// Creates the channel and attached std::clog. | /// Creates the channel and attaches std::clog. | |||
ConsoleChannel(std::ostream& str); | ConsoleChannel(std::ostream& str); | |||
/// Creates the channel. | /// Creates the channel using the given stream. | |||
void log(const Message& msg); | void log(const Message& msg); | |||
/// Logs the given message to the channel's stream. | /// Logs the given message to the channel's stream. | |||
protected: | protected: | |||
~ConsoleChannel(); | ~ConsoleChannel(); | |||
private: | private: | |||
std::ostream& _str; | std::ostream& _str; | |||
static FastMutex _mutex; | static FastMutex _mutex; | |||
}; | }; | |||
class Foundation_API ColorConsoleChannel: public Channel | ||||
/// A channel that writes to an ostream. | ||||
/// | ||||
/// Only the message's text is written, followed | ||||
/// by a newline. | ||||
/// | ||||
/// Messages can be colored depending on priority. | ||||
/// The console device must support ANSI escape codes | ||||
/// in order to display colored messages. | ||||
/// | ||||
/// To enable message coloring, set the "enableColors" | ||||
/// property to true (default). Furthermore, colors can be | ||||
/// configured by setting the following properties | ||||
/// (default values are given in parenthesis): | ||||
/// | ||||
/// * traceColor (gray) | ||||
/// * debugColor (gray) | ||||
/// * informationColor (default) | ||||
/// * noticeColor (default) | ||||
/// * warningColor (yellow) | ||||
/// * errorColor (lightRed) | ||||
/// * criticalColor (lightRed) | ||||
/// * fatalColor (lightRed) | ||||
/// | ||||
/// The following color values are supported: | ||||
/// | ||||
/// * default | ||||
/// * black | ||||
/// * red | ||||
/// * green | ||||
/// * brown | ||||
/// * blue | ||||
/// * magenta | ||||
/// * cyan | ||||
/// * gray | ||||
/// * darkgray | ||||
/// * lightRed | ||||
/// * lightGreen | ||||
/// * yellow | ||||
/// * lightBlue | ||||
/// * lightMagenta | ||||
/// * lightCyan | ||||
/// * white | ||||
/// | ||||
/// Chain this channel to a FormattingChannel with an | ||||
/// appropriate Formatter to control what is contained | ||||
/// in the text. | ||||
/// | ||||
/// Similar to StreamChannel, except that a static | ||||
/// mutex is used to protect against multiple | ||||
/// console channels concurrently writing to the | ||||
/// same stream. | ||||
{ | ||||
public: | ||||
ColorConsoleChannel(); | ||||
/// Creates the channel and attaches std::clog. | ||||
ColorConsoleChannel(std::ostream& str); | ||||
/// Creates the channel using the given stream. | ||||
void log(const Message& msg); | ||||
/// Logs the given message to the channel's stream. | ||||
void setProperty(const std::string& name, const std::string& value); | ||||
/// Sets the property with the given name. | ||||
/// | ||||
/// The following properties are supported: | ||||
/// * enableColors: Enable or disable colors. | ||||
/// * traceColor: Specify color for trace messages. | ||||
/// * debugColor: Specify color for debug messages. | ||||
/// * informationColor: Specify color for information mes | ||||
sages. | ||||
/// * noticeColor: Specify color for notice messages | ||||
. | ||||
/// * warningColor: Specify color for warning message | ||||
s. | ||||
/// * errorColor: Specify color for error messages. | ||||
/// * criticalColor: Specify color for critical messag | ||||
es. | ||||
/// * fatalColor: Specify color for fatal messages. | ||||
/// | ||||
/// See the class documentation for a list of supported colo | ||||
r values. | ||||
std::string getProperty(const std::string& name) const; | ||||
/// Returns the value of the property with the given name. | ||||
/// See setProperty() for a description of the supported | ||||
/// properties. | ||||
protected: | ||||
enum Color | ||||
{ | ||||
CC_DEFAULT = 0x0027, | ||||
CC_BLACK = 0x001e, | ||||
CC_RED = 0x001f, | ||||
CC_GREEN = 0x0020, | ||||
CC_BROWN = 0x0021, | ||||
CC_BLUE = 0x0022, | ||||
CC_MAGENTA = 0x0023, | ||||
CC_CYAN = 0x0024, | ||||
CC_GRAY = 0x0025, | ||||
CC_DARKGRAY = 0x011e, | ||||
CC_LIGHTRED = 0x011f, | ||||
CC_LIGHTGREEN = 0x0120, | ||||
CC_YELLOW = 0x0121, | ||||
CC_LIGHTBLUE = 0x0122, | ||||
CC_LIGHTMAGENTA = 0x0123, | ||||
CC_LIGHTCYAN = 0x0124, | ||||
CC_WHITE = 0x0125 | ||||
}; | ||||
~ColorConsoleChannel(); | ||||
Color parseColor(const std::string& color) const; | ||||
std::string formatColor(Color color) const; | ||||
void initColors(); | ||||
private: | ||||
std::ostream& _str; | ||||
bool _enableColors; | ||||
Color _colors[9]; | ||||
static FastMutex _mutex; | ||||
static const std::string CSI; | ||||
}; | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_ConsoleChannel_INCLUDED | #endif // Foundation_ConsoleChannel_INCLUDED | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 127 lines changed or added | |||
CountingStream.h | CountingStream.h | |||
---|---|---|---|---|
// | // | |||
// CountingStream.h | // CountingStream.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/CountingStream.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/CountingStream.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Streams | // Package: Streams | |||
// Module: CountingStream | // Module: CountingStream | |||
// | // | |||
// Definition of the CountingStreamBuf, CountingInputStream and CountingOut putStream classes. | // Definition of the CountingStreamBuf, CountingInputStream and CountingOut putStream classes. | |||
// | // | |||
// 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 173 | skipping to change at line 173 | |||
class Foundation_API CountingOutputStream: public CountingIOS, public std:: ostream | class Foundation_API CountingOutputStream: public CountingIOS, public std:: ostream | |||
/// This stream counts all characters and lines | /// This stream counts all characters and lines | |||
/// going through it. | /// going through it. | |||
{ | { | |||
public: | public: | |||
CountingOutputStream(); | CountingOutputStream(); | |||
/// Creates an unconnected CountingOutputStream. | /// Creates an unconnected CountingOutputStream. | |||
CountingOutputStream(std::ostream& ostr); | CountingOutputStream(std::ostream& ostr); | |||
/// Creates the CountingOutputStream and connects it | /// Creates the CountingOutputStream and connects it | |||
/// to the given input stream. | /// to the given output stream. | |||
~CountingOutputStream(); | ~CountingOutputStream(); | |||
/// Destroys the CountingOutputStream. | /// Destroys the CountingOutputStream. | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline int CountingStreamBuf::chars() const | inline int CountingStreamBuf::chars() const | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
DNS.h | DNS.h | |||
---|---|---|---|---|
// | // | |||
// DNS.h | // DNS.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/DNS.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/DNS.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: NetCore | // Package: NetCore | |||
// Module: DNS | // Module: DNS | |||
// | // | |||
// Definition of the DNS class. | // Definition of the DNS 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 45 | skipping to change at line 45 | |||
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. | |||
// | // | |||
#ifndef Net_DNS_INCLUDED | #ifndef Net_DNS_INCLUDED | |||
#define Net_DNS_INCLUDED | #define Net_DNS_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/SocketDefs.h" | #include "Poco/Net/SocketDefs.h" | |||
#include "Poco/Net/IPAddress.h" | #include "Poco/Net/IPAddress.h" | |||
#include "Poco/Net/HostEntry.h" | #include "Poco/Net/HostEntry.h" | |||
#include "Poco/Mutex.h" | ||||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class Net_API DNS | class Net_API DNS | |||
/// This class provides an interface to the | /// This class provides an interface to the | |||
/// domain name service. | /// domain name service. | |||
/// | /// | |||
/// An internal DNS cache is used to speed up name lookups. | /// An internal DNS cache is used to speed up name lookups. | |||
{ | { | |||
skipping to change at line 114 | skipping to change at line 113 | |||
/// Throws a HostNotFoundException if DNS information | /// Throws a HostNotFoundException if DNS information | |||
/// for this host cannot be found. | /// for this host cannot be found. | |||
/// | /// | |||
/// Throws a NoAddressFoundException if no address can be | /// Throws a NoAddressFoundException if no address can be | |||
/// found for this host. | /// found for this host. | |||
/// | /// | |||
/// Throws a DNSException in case of a general DNS error. | /// Throws a DNSException in case of a general DNS error. | |||
/// | /// | |||
/// Throws an IOException in case of any other error. | /// Throws an IOException in case of any other error. | |||
static void reload(); | ||||
/// Reloads the resolver configuration. | ||||
/// | ||||
/// This method will call res_init() if the Net library | ||||
/// has been compiled with -DPOCO_HAVE_LIBRESOLV. Otherwise | ||||
/// it will do nothing. | ||||
//@ deprecated | //@ deprecated | |||
static void flushCache(); | static void flushCache(); | |||
/// Flushes the internal DNS cache. | /// Flushes the internal DNS cache. | |||
/// | /// | |||
/// As of 1.4.2, the DNS cache is no longer used | /// As of 1.4.2, the DNS cache is no longer used | |||
/// and this method does not do anything. | /// and this method does not do anything. | |||
static std::string hostName(); | static std::string hostName(); | |||
/// Returns the host name of this host. | /// Returns the host name of this host. | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 8 lines changed or added | |||
FPEnvironment_DUMMY.h | FPEnvironment_DUMMY.h | |||
---|---|---|---|---|
// | // | |||
// FPEnvironment_DUMMY.h | // FPEnvironment_DUMMY.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/FPEnvironment_DUMMY.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/FPEnvironment_DUMMY.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: FPEnvironment | // Module: FPEnvironment | |||
// | // | |||
// Definition of class FPEnvironmentImpl for platforms that do not | // Definition of class FPEnvironmentImpl for platforms that do not | |||
// support IEEE 754 extensions. | // support IEEE 754 extensions. | |||
// | // | |||
// 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 123 | skipping to change at line 123 | |||
return std::isnan(value) != 0; | return std::isnan(value) != 0; | |||
} | } | |||
inline bool FPEnvironmentImpl::isNaNImpl(long double value) | inline bool FPEnvironmentImpl::isNaNImpl(long double value) | |||
{ | { | |||
return std::isnan((double) value) != 0; | return std::isnan((double) value) != 0; | |||
} | } | |||
inline float FPEnvironmentImpl::copySignImpl(float target, float source) | inline float FPEnvironmentImpl::copySignImpl(float target, float source) | |||
{ | { | |||
#if defined(__APPLE__) || defined(POCO_ANDROID) | ||||
return copysignf(target, source); | return copysignf(target, source); | |||
#else | ||||
return std::copysignf(target, source); | ||||
#endif | ||||
} | } | |||
inline double FPEnvironmentImpl::copySignImpl(double target, double source) | inline double FPEnvironmentImpl::copySignImpl(double target, double source) | |||
{ | { | |||
#if defined(__APPLE__) || defined(POCO_ANDROID) | ||||
return copysign(target, source); | return copysign(target, source); | |||
#else | ||||
return std::copysign(target, source); | ||||
#endif | ||||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_FPEnvironment_DUMMY_INCLUDED | #endif // Foundation_FPEnvironment_DUMMY_INCLUDED | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 1 lines changed or added | |||
FTPStreamFactory.h | FTPStreamFactory.h | |||
---|---|---|---|---|
// | // | |||
// FTPStreamFactory.h | // FTPStreamFactory.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/FTPStreamFactory.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/FTPStreamFactory.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: FTP | // Package: FTP | |||
// Module: FTPStreamFactory | // Module: FTPStreamFactory | |||
// | // | |||
// Definition of the FTPStreamFactory class. | // Definition of the FTPStreamFactory 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 119 | skipping to change at line 119 | |||
/// FTPStreamFactory is used for the first time. | /// FTPStreamFactory is used for the first time. | |||
static FTPPasswordProvider* getPasswordProvider(); | static FTPPasswordProvider* getPasswordProvider(); | |||
/// Returns the FTPPasswordProvider currently in use, | /// Returns the FTPPasswordProvider currently in use, | |||
/// or NULL if no one has been set. | /// or NULL if no one has been set. | |||
static void registerFactory(); | static void registerFactory(); | |||
/// Registers the FTPStreamFactory with the | /// Registers the FTPStreamFactory with the | |||
/// default URIStreamOpener instance. | /// default URIStreamOpener instance. | |||
static void unregisterFactory(); | ||||
/// Unregisters the FTPStreamFactory with the | ||||
/// default URIStreamOpener instance. | ||||
protected: | protected: | |||
static void splitUserInfo(const std::string& userInfo, std::string& username, std::string& password); | static void splitUserInfo(const std::string& userInfo, std::string& username, std::string& password); | |||
static void getUserInfo(const Poco::URI& uri, std::string& username, std::string& password); | static void getUserInfo(const Poco::URI& uri, std::string& username, std::string& password); | |||
static void getPathAndType(const Poco::URI& uri, std::string& path, char& type); | static void getPathAndType(const Poco::URI& uri, std::string& path, char& type); | |||
private: | private: | |||
static std::string _anonymousPassword; | static std::string _anonymousPassword; | |||
static FTPPasswordProvider* _pPasswordProvider; | static FTPPasswordProvider* _pPasswordProvider; | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
HTTPClientSession.h | HTTPClientSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPClientSession.h | // HTTPClientSession.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#4 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPClientSession.h#5 $ | |||
// | // | |||
// 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 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 Net_HTTPClientSession_INCLUDED | #ifndef Net_HTTPClientSession_INCLUDED | |||
#define Net_HTTPClientSession_INCLUDED | #define Net_HTTPClientSession_INCLUDED | |||
#include "Poco/Net/Net.h" | #include "Poco/Net/Net.h" | |||
#include "Poco/Net/HTTPSession.h" | #include "Poco/Net/HTTPSession.h" | |||
#include "Poco/Net/SocketAddress.h" | #include "Poco/Net/SocketAddress.h" | |||
#include "Poco/SharedPtr.h" | ||||
#include <istream> | #include <istream> | |||
#include <ostream> | #include <ostream> | |||
namespace Poco { | namespace Poco { | |||
namespace Net { | namespace Net { | |||
class HTTPRequest; | class HTTPRequest; | |||
class HTTPResponse; | class HTTPResponse; | |||
class Net_API HTTPClientSession: public HTTPSession | class Net_API HTTPClientSession: public HTTPSession | |||
skipping to change at line 232 | skipping to change at line 233 | |||
void reconnect(); | void reconnect(); | |||
/// Connects the underlying socket to the HTTP server. | /// Connects the underlying socket to the HTTP server. | |||
int write(const char* buffer, std::streamsize length); | int write(const char* buffer, std::streamsize length); | |||
/// Tries to re-connect if keep-alive is on. | /// Tries to re-connect if keep-alive is on. | |||
virtual std::string proxyRequestPrefix() const; | virtual std::string proxyRequestPrefix() const; | |||
/// Returns the prefix prepended to the URI for proxy reques ts | /// Returns the prefix prepended to the URI for proxy reques ts | |||
/// (e.g., "http://myhost.com"). | /// (e.g., "http://myhost.com"). | |||
void deleteResponseStream(); | ||||
/// Deletes the response stream and sets it to 0. | ||||
void deleteRequestStream(); | ||||
/// Deletes the request stream and sets it to 0. | ||||
void setResponseStream(std::istream* pRespStream); | ||||
/// Sets the response stream iff _pResponseStream is 0. | ||||
void setRequestStream(std::ostream* pRequestStream); | ||||
/// Sets the request stream iff _pRequestStream is 0. | ||||
std::istream* getResponseStream() const; | ||||
/// Returns the currently set response stream. Can return 0. | ||||
std::ostream* getRequestStream() const; | ||||
/// Returns the currently set request stream. Can return 0. | ||||
void setReconnect(bool recon); | ||||
/// Sets _reconnect. | ||||
void setExpectResponseBody(bool expect); | ||||
/// Sets _expectResponseBody. | ||||
bool getExpectResponseBody() const; | ||||
/// Returns _expectResponseBody. | ||||
virtual bool mustReconnect() const; | virtual bool mustReconnect() const; | |||
/// 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. | |||
skipping to change at line 290 | skipping to change at line 264 | |||
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; | Poco::SharedPtr<std::ostream> _pRequestStream; | |||
std::istream* _pResponseStream; | Poco::SharedPtr<std::istream> _pResponseStream; | |||
HTTPClientSession(const HTTPClientSession&); | HTTPClientSession(const HTTPClientSession&); | |||
HTTPClientSession& operator = (const HTTPClientSession&); | HTTPClientSession& operator = (const HTTPClientSession&); | |||
friend class WebSocket; | friend class WebSocket; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
skipping to change at line 332 | skipping to change at line 306 | |||
inline const std::string& HTTPClientSession::getProxyUsername() const | inline const std::string& HTTPClientSession::getProxyUsername() const | |||
{ | { | |||
return _proxyUsername; | return _proxyUsername; | |||
} | } | |||
inline const std::string& HTTPClientSession::getProxyPassword() const | inline const std::string& HTTPClientSession::getProxyPassword() const | |||
{ | { | |||
return _proxyPassword; | return _proxyPassword; | |||
} | } | |||
inline std::istream* HTTPClientSession::getResponseStream() const | ||||
{ | ||||
return _pResponseStream; | ||||
} | ||||
inline std::ostream* HTTPClientSession::getRequestStream() const | ||||
{ | ||||
return _pRequestStream; | ||||
} | ||||
inline void HTTPClientSession::setReconnect(bool recon) | ||||
{ | ||||
_reconnect = recon; | ||||
} | ||||
inline void HTTPClientSession::setExpectResponseBody(bool expect) | ||||
{ | ||||
_expectResponseBody = expect; | ||||
} | ||||
inline bool HTTPClientSession::getExpectResponseBody() const | ||||
{ | ||||
return _expectResponseBody; | ||||
} | ||||
inline const Poco::Timespan& HTTPClientSession::getKeepAliveTimeout() const | inline const Poco::Timespan& HTTPClientSession::getKeepAliveTimeout() const | |||
{ | { | |||
return _keepAliveTimeout; | return _keepAliveTimeout; | |||
} | } | |||
} } // namespace Poco::Net | } } // namespace Poco::Net | |||
#endif // Net_HTTPClientSession_INCLUDED | #endif // Net_HTTPClientSession_INCLUDED | |||
End of changes. 5 change blocks. | ||||
55 lines changed or deleted | 4 lines changed or added | |||
HTTPCookie.h | HTTPCookie.h | |||
---|---|---|---|---|
// | // | |||
// HTTPCookie.h | // HTTPCookie.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPCookie.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPCookie.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPCookie | // Module: HTTPCookie | |||
// | // | |||
// Definition of the HTTPCookie class. | // Definition of the HTTPCookie 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 138 | skipping to change at line 138 | |||
void setDomain(const std::string& domain); | void setDomain(const std::string& domain); | |||
/// Sets the domain for the cookie. | /// Sets the domain for the cookie. | |||
const std::string& getDomain() const; | const std::string& getDomain() const; | |||
/// Returns the domain for the cookie. | /// Returns the domain for the cookie. | |||
void setPath(const std::string& path); | void setPath(const std::string& path); | |||
/// Sets the path for the cookie. | /// Sets the path for the cookie. | |||
void setPriority(const std::string& priority); | ||||
/// Sets the priority for the cookie. | ||||
const std::string& getPath() const; | const std::string& getPath() const; | |||
/// Returns the path for the cookie. | /// Returns the path for the cookie. | |||
const std::string& getPriority() const; | ||||
/// Returns the priority for the cookie. | ||||
void setSecure(bool secure); | void setSecure(bool secure); | |||
/// Sets the value of the secure flag for | /// Sets the value of the secure flag for | |||
/// the cookie. | /// the cookie. | |||
bool getSecure() const; | bool getSecure() const; | |||
/// Returns the value of the secure flag | /// Returns the value of the secure flag | |||
/// for the cookie. | /// for the cookie. | |||
void setMaxAge(int maxAge); | void setMaxAge(int maxAge); | |||
/// Sets the maximum age in seconds for | /// Sets the maximum age in seconds for | |||
/// the cookie. | /// the cookie. | |||
/// | /// | |||
/// A value of -1 causes the cookie to | /// A value of -1 (default) causes the cookie | |||
/// never expire on the client. | /// to become a session cookie, which will | |||
/// be deleted when the browser window | ||||
/// is closed. | ||||
/// | /// | |||
/// A value of 0 deletes the cookie on | /// A value of 0 deletes the cookie on | |||
/// the client. | /// the client. | |||
int getMaxAge() const; | int getMaxAge() const; | |||
/// Returns the maximum age in seconds for | /// Returns the maximum age in seconds for | |||
/// the cookie. | /// the cookie. | |||
void setHttpOnly(bool flag = true); | void setHttpOnly(bool flag = true); | |||
/// Sets the HttpOnly flag for the cookie. | /// Sets the HttpOnly flag for the cookie. | |||
skipping to change at line 208 | skipping to change at line 216 | |||
/// escape sequences in the form %xx with the | /// escape sequences in the form %xx with the | |||
/// respective characters. | /// respective characters. | |||
private: | private: | |||
int _version; | int _version; | |||
std::string _name; | std::string _name; | |||
std::string _value; | std::string _value; | |||
std::string _comment; | std::string _comment; | |||
std::string _domain; | std::string _domain; | |||
std::string _path; | std::string _path; | |||
std::string _priority; | ||||
bool _secure; | bool _secure; | |||
int _maxAge; | int _maxAge; | |||
bool _httpOnly; | bool _httpOnly; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline int HTTPCookie::getVersion() const | inline int HTTPCookie::getVersion() const | |||
{ | { | |||
skipping to change at line 246 | skipping to change at line 255 | |||
inline const std::string& HTTPCookie::getDomain() const | inline const std::string& HTTPCookie::getDomain() const | |||
{ | { | |||
return _domain; | return _domain; | |||
} | } | |||
inline const std::string& HTTPCookie::getPath() const | inline const std::string& HTTPCookie::getPath() const | |||
{ | { | |||
return _path; | return _path; | |||
} | } | |||
inline const std::string& HTTPCookie::getPriority() const | ||||
{ | ||||
return _priority; | ||||
} | ||||
inline bool HTTPCookie::getSecure() const | inline bool HTTPCookie::getSecure() const | |||
{ | { | |||
return _secure; | return _secure; | |||
} | } | |||
inline int HTTPCookie::getMaxAge() const | inline int HTTPCookie::getMaxAge() const | |||
{ | { | |||
return _maxAge; | return _maxAge; | |||
} | } | |||
End of changes. 6 change blocks. | ||||
3 lines changed or deleted | 17 lines changed or added | |||
HTTPRequest.h | HTTPRequest.h | |||
---|---|---|---|---|
// | // | |||
// HTTPRequest.h | // HTTPRequest.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequest.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequest.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPRequest | // Module: HTTPRequest | |||
// | // | |||
// Definition of the HTTPRequest class. | // Definition of the HTTPRequest 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 160 | skipping to change at line 160 | |||
static const std::string HTTP_POST; | static const std::string HTTP_POST; | |||
static const std::string HTTP_OPTIONS; | static const std::string HTTP_OPTIONS; | |||
static const std::string HTTP_DELETE; | static const std::string HTTP_DELETE; | |||
static const std::string HTTP_TRACE; | static const std::string HTTP_TRACE; | |||
static const std::string HTTP_CONNECT; | static const std::string HTTP_CONNECT; | |||
static const std::string HOST; | static const std::string HOST; | |||
static const std::string COOKIE; | static const std::string COOKIE; | |||
static const std::string AUTHORIZATION; | static const std::string AUTHORIZATION; | |||
static const std::string PROXY_AUTHORIZATION; | static const std::string PROXY_AUTHORIZATION; | |||
static const std::string UPGRADE; | ||||
protected: | protected: | |||
void getCredentials(const std::string& header, std::string& scheme, std::string& authInfo) const; | void getCredentials(const std::string& header, std::string& scheme, std::string& authInfo) const; | |||
/// Returns the authentication scheme and additional authent ication | /// Returns the authentication scheme and additional authent ication | |||
/// information contained in the given header of request. | /// information contained in the given header of request. | |||
/// | /// | |||
/// Throws a NotAuthenticatedException if no authentication information | /// Throws a NotAuthenticatedException if no authentication information | |||
/// is contained in the request. | /// is contained in the request. | |||
void setCredentials(const std::string& header, const std::string& sc heme, const std::string& authInfo); | void setCredentials(const std::string& header, const std::string& sc heme, const std::string& authInfo); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
HTTPSession.h | HTTPSession.h | |||
---|---|---|---|---|
// | // | |||
// HTTPSession.h | // HTTPSession.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPSession.h#2 $ | // $Id: //poco/1.4/Net/include/Poco/Net/HTTPSession.h#3 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: HTTP | // Package: HTTP | |||
// Module: HTTPSession | // Module: HTTPSession | |||
// | // | |||
// Definition of the HTTPSession class. | // Definition of the HTTPSession 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 184 | skipping to change at line 184 | |||
void attachSocket(const StreamSocket& socket); | void attachSocket(const StreamSocket& socket); | |||
/// Attaches a socket to the session, replacing the | /// Attaches a socket to the session, replacing the | |||
/// previously attached socket. | /// previously attached socket. | |||
void close(); | void close(); | |||
/// Closes the underlying socket. | /// Closes the underlying socket. | |||
void setException(const Poco::Exception& exc); | void setException(const Poco::Exception& exc); | |||
/// Stores a clone of the exception. | /// Stores a clone of the exception. | |||
void clearException(); | ||||
/// Clears the stored exception. | ||||
private: | private: | |||
enum | enum | |||
{ | { | |||
HTTP_DEFAULT_TIMEOUT = 60000000 | HTTP_DEFAULT_TIMEOUT = 60000000 | |||
}; | }; | |||
HTTPSession(const HTTPSession&); | HTTPSession(const HTTPSession&); | |||
HTTPSession& operator = (const HTTPSession&); | HTTPSession& operator = (const HTTPSession&); | |||
StreamSocket _socket; | StreamSocket _socket; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
HashTable.h | HashTable.h | |||
---|---|---|---|---|
// | // | |||
// HashTable.h | // HashTable.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/HashTable.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/HashTable.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Hashing | // Package: Hashing | |||
// Module: HashTable | // Module: HashTable | |||
// | // | |||
// Definition of the HashTable class. | // Definition of the HashTable 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 347 | skipping to change at line 347 | |||
} | } | |||
} | } | |||
HashStatistic currentState(bool details = false) const | HashStatistic currentState(bool details = false) const | |||
/// Returns the current internal state | /// Returns the current internal state | |||
{ | { | |||
UInt32 numberOfEntries = (UInt32)_size; | UInt32 numberOfEntries = (UInt32)_size; | |||
UInt32 numZeroEntries = 0; | UInt32 numZeroEntries = 0; | |||
UInt32 maxEntriesPerHash = 0; | UInt32 maxEntriesPerHash = 0; | |||
std::vector<UInt32> detailedEntriesPerHash; | std::vector<UInt32> detailedEntriesPerHash; | |||
#ifdef DEBUG | #ifdef _DEBUG | |||
UInt32 totalSize = 0; | UInt32 totalSize = 0; | |||
#endif | #endif | |||
for (UInt32 i = 0; i < _maxCapacity; ++i) | for (UInt32 i = 0; i < _maxCapacity; ++i) | |||
{ | { | |||
if (_entries[i]) | if (_entries[i]) | |||
{ | { | |||
UInt32 size = (UInt32)_entries[i]->size(); | UInt32 size = (UInt32)_entries[i]->size(); | |||
poco_assert_dbg(size != 0); | poco_assert_dbg(size != 0); | |||
if (size > maxEntriesPerHash) | if (size > maxEntriesPerHash) | |||
maxEntriesPerHash = size; | maxEntriesPerHash = size; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(siz e); | detailedEntriesPerHash.push_back(siz e); | |||
#ifdef DEBUG | #ifdef _DEBUG | |||
totalSize += size; | totalSize += size; | |||
#endif | #endif | |||
} | } | |||
else | else | |||
{ | { | |||
numZeroEntries++; | numZeroEntries++; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(0); | detailedEntriesPerHash.push_back(0); | |||
} | } | |||
} | } | |||
#ifdef DEBUG | #ifdef _DEBUG | |||
poco_assert_dbg(totalSize == numberOfEntries); | poco_assert_dbg(totalSize == numberOfEntries); | |||
#endif | #endif | |||
return HashStatistic(_maxCapacity, numberOfEntries, numZeroE ntries, maxEntriesPerHash, detailedEntriesPerHash); | return HashStatistic(_maxCapacity, numberOfEntries, numZeroE ntries, maxEntriesPerHash, detailedEntriesPerHash); | |||
} | } | |||
private: | private: | |||
HashTableVector _entries; | HashTableVector _entries; | |||
std::size_t _size; | std::size_t _size; | |||
UInt32 _maxCapacity; | UInt32 _maxCapacity; | |||
KeyHashFunction _hash; | KeyHashFunction _hash; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
MapConfiguration.h | MapConfiguration.h | |||
---|---|---|---|---|
// | // | |||
// MapConfiguration.h | // MapConfiguration.h | |||
// | // | |||
// $Id: //poco/1.4/Util/include/Poco/Util/MapConfiguration.h#1 $ | // $Id: //poco/1.4/Util/include/Poco/Util/MapConfiguration.h#2 $ | |||
// | // | |||
// Library: Util | // Library: Util | |||
// Package: Configuration | // Package: Configuration | |||
// Module: MapConfiguration | // Module: MapConfiguration | |||
// | // | |||
// Definition of the MapConfiguration class. | // Definition of the MapConfiguration 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 58 | skipping to change at line 58 | |||
class Util_API MapConfiguration: public AbstractConfiguration | class Util_API MapConfiguration: public AbstractConfiguration | |||
/// An implementation of AbstractConfiguration that stores configura tion data in a map. | /// An implementation of AbstractConfiguration that stores configura tion data in a map. | |||
{ | { | |||
public: | public: | |||
MapConfiguration(); | MapConfiguration(); | |||
/// Creates an empty MapConfiguration. | /// Creates an empty MapConfiguration. | |||
void clear(); | void clear(); | |||
/// Clears the configuration. | /// Clears the configuration. | |||
void copyTo(AbstractConfiguration& config); | ||||
/// Copies all configuration properties to the given configu | ||||
ration. | ||||
protected: | protected: | |||
typedef std::map<std::string, std::string> StringMap; | typedef std::map<std::string, std::string> StringMap; | |||
typedef StringMap::const_iterator iterator; | typedef StringMap::const_iterator iterator; | |||
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); | |||
~MapConfiguration(); | ~MapConfiguration(); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
NumberParser.h | NumberParser.h | |||
---|---|---|---|---|
// | // | |||
// NumberParser.h | // NumberParser.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/NumberParser.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/NumberParser.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: NumberParser | // Module: NumberParser | |||
// | // | |||
// Definition of the NumberParser class. | // Definition of the NumberParser 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 57 | skipping to change at line 57 | |||
/// for parsing numbers out of strings. | /// for parsing numbers out of strings. | |||
{ | { | |||
public: | public: | |||
static int parse(const std::string& s); | static int parse(const std::string& s); | |||
/// Parses an integer value in decimal notation from the giv en string. | /// Parses an integer value in decimal notation from the giv en string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParse(const std::string& s, int& value); | static bool tryParse(const std::string& s, int& value); | |||
/// Parses an integer value in decimal notation from the giv en string. | /// Parses an integer value in decimal notation from the giv en string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static unsigned parseUnsigned(const std::string& s); | static unsigned parseUnsigned(const std::string& s); | |||
/// Parses an unsigned integer value in decimal notation fro m the given string. | /// Parses an unsigned integer value in decimal notation fro m the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParseUnsigned(const std::string& s, unsigned& value); | static bool tryParseUnsigned(const std::string& s, unsigned& value); | |||
/// Parses an unsigned integer value in decimal notation fro m the given string. | /// Parses an unsigned integer value in decimal notation fro m the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static unsigned parseHex(const std::string& s); | static unsigned parseHex(const std::string& s); | |||
/// Parses an integer value in hexadecimal notation from the given string. | /// Parses an integer value in hexadecimal notation from the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in | /// Throws a SyntaxException if the string does not hold a n umber in | |||
/// hexadecimal notation. | /// hexadecimal notation. | |||
static bool tryParseHex(const std::string& s, unsigned& value); | static bool tryParseHex(const std::string& s, unsigned& value); | |||
/// Parses an unsigned integer value in hexadecimal notation from the given string. | /// Parses an unsigned integer value in hexadecimal notation from the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
#if defined(POCO_HAVE_INT64) | #if defined(POCO_HAVE_INT64) | |||
static Int64 parse64(const std::string& s); | static Int64 parse64(const std::string& s); | |||
/// Parses a 64-bit integer value in decimal notation from t he given string. | /// Parses a 64-bit integer value in decimal notation from t he given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParse64(const std::string& s, Int64& value); | static bool tryParse64(const std::string& s, Int64& value); | |||
/// Parses a 64-bit integer value in decimal notation from t he given string. | /// Parses a 64-bit integer value in decimal notation from t he given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static UInt64 parseUnsigned64(const std::string& s); | static UInt64 parseUnsigned64(const std::string& s); | |||
/// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | /// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in decimal notation. | |||
static bool tryParseUnsigned64(const std::string& s, UInt64& value); | static bool tryParseUnsigned64(const std::string& s, UInt64& value); | |||
/// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | /// Parses an unsigned 64-bit integer value in decimal notat ion from the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
static UInt64 parseHex64(const std::string& s); | static UInt64 parseHex64(const std::string& s); | |||
/// Parses a 64 bit-integer value in hexadecimal notation fr om the given string. | /// Parses a 64 bit-integer value in hexadecimal notation fr om the given string. | |||
/// Throws a SyntaxException if the string does not hold a n umber in hexadecimal notation. | /// Throws a SyntaxException if the string does not hold a n umber in hexadecimal notation. | |||
static bool tryParseHex64(const std::string& s, UInt64& value); | static bool tryParseHex64(const std::string& s, UInt64& value); | |||
/// Parses an unsigned 64-bit integer value in hexadecimal n otation from the given string. | /// Parses an unsigned 64-bit integer value in hexadecimal n otation from the given string. | |||
/// Returns true if a valid integer has been found, false ot herwise. | /// Returns true if a valid integer has been found, false ot herwise. | |||
/// If parsing was not successful, value is undefined. | ||||
#endif // defined(POCO_HAVE_INT64) | #endif // defined(POCO_HAVE_INT64) | |||
static double parseFloat(const std::string& s); | static double parseFloat(const std::string& s); | |||
/// Parses a double value in decimal floating point notation | /// Parses a double value in decimal floating point notation | |||
/// from the given string. | /// from the given string. | |||
/// Throws a SyntaxException if the string does not hold a f loating-point | /// Throws a SyntaxException if the string does not hold a f loating-point | |||
/// number in decimal notation. | /// number in decimal notation. | |||
static bool tryParseFloat(const std::string& s, double& value); | static bool tryParseFloat(const std::string& s, double& value); | |||
/// Parses a double value in decimal floating point notation | /// Parses a double value in decimal floating point notation | |||
/// from the given string. | /// from the given string. | |||
/// Returns true if a valid floating point number has been f ound, | /// Returns true if a valid floating point number has been f ound, | |||
/// false otherwise. | /// false otherwise. | |||
/// If parsing was not successful, value is undefined. | ||||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_NumberParser_INCLUDED | #endif // Foundation_NumberParser_INCLUDED | |||
End of changes. 8 change blocks. | ||||
1 lines changed or deleted | 8 lines changed or added | |||
ObjectPool.h | ObjectPool.h | |||
---|---|---|---|---|
// | // | |||
// ObjectPool.h | // ObjectPool.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ObjectPool.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/ObjectPool.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: ObjectPool | // Module: ObjectPool | |||
// | // | |||
// Definition of the ObjectPool template class and friends. | // Definition of the ObjectPool template class and friends. | |||
// | // | |||
// Copyright (c) 2010-2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2010-2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 210 | skipping to change at line 210 | |||
_capacity(capacity), | _capacity(capacity), | |||
_peakCapacity(peakCapacity), | _peakCapacity(peakCapacity), | |||
_size(0) | _size(0) | |||
{ | { | |||
poco_assert (capacity <= peakCapacity); | poco_assert (capacity <= peakCapacity); | |||
} | } | |||
~ObjectPool() | ~ObjectPool() | |||
/// Destroys the ObjectPool. | /// Destroys the ObjectPool. | |||
{ | { | |||
for (typename std::vector<P>::iterator it = _pool.begin(); i t != _pool.end(); ++it) | try | |||
{ | { | |||
_factory.destroyObject(*it); | for (typename std::vector<P>::iterator it = _pool.be | |||
gin(); it != _pool.end(); ++it) | ||||
{ | ||||
_factory.destroyObject(*it); | ||||
} | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | } | |||
} | } | |||
P borrowObject() | P borrowObject() | |||
/// Obtains an object from the pool, or creates a new object if | /// Obtains an object from the pool, or creates a new object if | |||
/// possible. | /// possible. | |||
/// | /// | |||
/// Returns null if no object is available. | /// Returns null if no object is available. | |||
/// | /// | |||
/// If activating the object fails, the object is destroyed and | /// If activating the object fails, the object is destroyed and | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 11 lines changed or added | |||
Platform.h | Platform.h | |||
---|---|---|---|---|
// | // | |||
// Platform.h | // Platform.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Platform.h#7 $ | // $Id: //poco/1.4/Foundation/include/Poco/Platform.h#9 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Platform | // Module: Platform | |||
// | // | |||
// Platform and architecture identification macros. | // Platform and architecture identification macros. | |||
// | // | |||
// NOTE: This file may be included from both C++ and C code, so it | // NOTE: This file may be included from both C++ and C code, so it | |||
// must not contain any C++ specific things. | // must not contain any C++ specific things. | |||
// | // | |||
skipping to change at line 102 | skipping to change at line 102 | |||
#define POCO_OS POCO_OS_OPEN_BSD | #define POCO_OS POCO_OS_OPEN_BSD | |||
#elif defined(sgi) || defined(__sgi) | #elif defined(sgi) || defined(__sgi) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_IRIX | #define POCO_OS POCO_OS_IRIX | |||
#elif defined(sun) || defined(__sun) | #elif defined(sun) || defined(__sun) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_SOLARIS | #define POCO_OS POCO_OS_SOLARIS | |||
#elif defined(__QNX__) | #elif defined(__QNX__) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_QNX | #define POCO_OS POCO_OS_QNX | |||
#elif defined(__CYGWIN__) | ||||
#define POCO_OS_FAMILY_UNIX 1 | ||||
#define POCO_OS POCO_OS_CYGWIN | ||||
#elif defined(unix) || defined(__unix) || defined(__unix__) | #elif defined(unix) || defined(__unix) || defined(__unix__) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_UNKNOWN_UNIX | #define POCO_OS POCO_OS_UNKNOWN_UNIX | |||
#elif defined(_WIN32_WCE) | #elif defined(_WIN32_WCE) | |||
#define POCO_OS_FAMILY_WINDOWS 1 | #define POCO_OS_FAMILY_WINDOWS 1 | |||
#define POCO_OS POCO_OS_WINDOWS_CE | #define POCO_OS POCO_OS_WINDOWS_CE | |||
#elif defined(_WIN32) || defined(_WIN64) | #elif defined(_WIN32) || defined(_WIN64) | |||
#define POCO_OS_FAMILY_WINDOWS 1 | #define POCO_OS_FAMILY_WINDOWS 1 | |||
#define POCO_OS POCO_OS_WINDOWS_NT | #define POCO_OS POCO_OS_WINDOWS_NT | |||
#elif defined(__CYGWIN__) | ||||
#define POCO_OS_FAMILY_UNIX 1 | ||||
#define POCO_OS POCO_OS_CYGWIN | ||||
#elif defined(__VMS) | #elif defined(__VMS) | |||
#define POCO_OS_FAMILY_VMS 1 | #define POCO_OS_FAMILY_VMS 1 | |||
#define POCO_OS POCO_OS_VMS | #define POCO_OS POCO_OS_VMS | |||
#elif defined(POCO_VXWORKS) | #elif defined(POCO_VXWORKS) | |||
#define POCO_OS_FAMILY_UNIX 1 | #define POCO_OS_FAMILY_UNIX 1 | |||
#define POCO_OS POCO_OS_VXWORKS | #define POCO_OS POCO_OS_VXWORKS | |||
#endif | #endif | |||
#if !defined(POCO_OS) | #if !defined(POCO_OS) | |||
#error "Unknown Platform." | #error "Unknown Platform." | |||
skipping to change at line 143 | skipping to change at line 143 | |||
#define POCO_ARCH_HPPA 0x05 | #define POCO_ARCH_HPPA 0x05 | |||
#define POCO_ARCH_PPC 0x06 | #define POCO_ARCH_PPC 0x06 | |||
#define POCO_ARCH_POWER 0x07 | #define POCO_ARCH_POWER 0x07 | |||
#define POCO_ARCH_SPARC 0x08 | #define POCO_ARCH_SPARC 0x08 | |||
#define POCO_ARCH_AMD64 0x09 | #define POCO_ARCH_AMD64 0x09 | |||
#define POCO_ARCH_ARM 0x0a | #define POCO_ARCH_ARM 0x0a | |||
#define POCO_ARCH_M68K 0x0b | #define POCO_ARCH_M68K 0x0b | |||
#define POCO_ARCH_S390 0x0c | #define POCO_ARCH_S390 0x0c | |||
#define POCO_ARCH_SH 0x0d | #define POCO_ARCH_SH 0x0d | |||
#define POCO_ARCH_NIOS2 0x0e | #define POCO_ARCH_NIOS2 0x0e | |||
#define POCO_ARCH_ARM64 0x0f | ||||
#if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_ M_ALPHA) | #if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_ M_ALPHA) | |||
#define POCO_ARCH POCO_ARCH_ALPHA | #define POCO_ARCH POCO_ARCH_ALPHA | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_I X86) | #elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_I X86) | |||
#define POCO_ARCH POCO_ARCH_IA32 | #define POCO_ARCH POCO_ARCH_IA32 | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(_ _ia64) || defined(_M_IA64) | #elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(_ _ia64) || defined(_M_IA64) | |||
#define POCO_ARCH POCO_ARCH_IA64 | #define POCO_ARCH POCO_ARCH_IA64 | |||
#if defined(hpux) || defined(_hpux) | #if defined(hpux) || defined(_hpux) | |||
skipping to change at line 184 | skipping to change at line 185 | |||
#elif defined(__sparc__) || defined(__sparc) || defined(sparc) | #elif defined(__sparc__) || defined(__sparc) || defined(sparc) | |||
#define POCO_ARCH POCO_ARCH_SPARC | #define POCO_ARCH POCO_ARCH_SPARC | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM) | #elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM) | |||
#define POCO_ARCH POCO_ARCH_ARM | #define POCO_ARCH POCO_ARCH_ARM | |||
#if defined(__ARMEB__) | #if defined(__ARMEB__) | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#else | #else | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
#endif | #endif | |||
#elif defined(__arm64__) || defined(__arm64) | ||||
#define POCO_ARCH POCO_ARCH_ARM64 | ||||
#if defined(__ARMEB__) | ||||
#define POCO_ARCH_BIG_ENDIAN 1 | ||||
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __ | ||||
BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | ||||
#define POCO_ARCH_BIG_ENDIAN 1 | ||||
#else | ||||
#define POCO_ARCH_LITTLE_ENDIAN 1 | ||||
#endif | ||||
#elif defined(__m68k__) | #elif defined(__m68k__) | |||
#define POCO_ARCH POCO_ARCH_M68K | #define POCO_ARCH POCO_ARCH_M68K | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#elif defined(__s390__) | #elif defined(__s390__) | |||
#define POCO_ARCH POCO_ARCH_S390 | #define POCO_ARCH POCO_ARCH_S390 | |||
#define POCO_ARCH_BIG_ENDIAN 1 | #define POCO_ARCH_BIG_ENDIAN 1 | |||
#elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_) | #elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_) | |||
#define POCO_ARCH POCO_ARCH_SH | #define POCO_ARCH POCO_ARCH_SH | |||
#if defined(__LITTLE_ENDIAN__) || (POCO_OS == POCO_OS_WINDOWS_CE) | #if defined(__LITTLE_ENDIAN__) || (POCO_OS == POCO_OS_WINDOWS_CE) | |||
#define POCO_ARCH_LITTLE_ENDIAN 1 | #define POCO_ARCH_LITTLE_ENDIAN 1 | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 15 lines changed or added | |||
RWLock.h | RWLock.h | |||
---|---|---|---|---|
// | // | |||
// RWLock.h | // RWLock.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/RWLock.h#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/RWLock.h#4 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: RWLock | // Module: RWLock | |||
// | // | |||
// Definition of the RWLock class. | // Definition of the RWLock 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 175 | skipping to change at line 175 | |||
inline ScopedRWLock::ScopedRWLock(RWLock& rwl, bool write): _rwl(rwl) | inline ScopedRWLock::ScopedRWLock(RWLock& rwl, bool write): _rwl(rwl) | |||
{ | { | |||
if (write) | if (write) | |||
_rwl.writeLock(); | _rwl.writeLock(); | |||
else | else | |||
_rwl.readLock(); | _rwl.readLock(); | |||
} | } | |||
inline ScopedRWLock::~ScopedRWLock() | inline ScopedRWLock::~ScopedRWLock() | |||
{ | { | |||
_rwl.unlock(); | try | |||
{ | ||||
_rwl.unlock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
inline ScopedReadRWLock::ScopedReadRWLock(RWLock& rwl): ScopedRWLock(rwl, f alse) | inline ScopedReadRWLock::ScopedReadRWLock(RWLock& rwl): ScopedRWLock(rwl, f alse) | |||
{ | { | |||
} | } | |||
inline ScopedReadRWLock::~ScopedReadRWLock() | inline ScopedReadRWLock::~ScopedReadRWLock() | |||
{ | { | |||
} | } | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 9 lines changed or added | |||
RefCountedObject.h | RefCountedObject.h | |||
---|---|---|---|---|
// | // | |||
// RefCountedObject.h | // RefCountedObject.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/RefCountedObject.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/RefCountedObject.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: RefCountedObject | // Module: RefCountedObject | |||
// | // | |||
// Definition of the RefCountedObject class. | // Definition of the RefCountedObject class. | |||
// | // | |||
// Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 61 | skipping to change at line 61 | |||
/// by copying and assignment. | /// by copying and assignment. | |||
{ | { | |||
public: | public: | |||
RefCountedObject(); | RefCountedObject(); | |||
/// Creates the RefCountedObject. | /// Creates the RefCountedObject. | |||
/// The initial reference count is one. | /// The initial reference count is one. | |||
void duplicate() const; | void duplicate() const; | |||
/// Increments the object's reference count. | /// Increments the object's reference count. | |||
void release() const; | void release() const throw(); | |||
/// Decrements the object's reference count | /// Decrements the object's reference count | |||
/// and deletes the object if the count | /// and deletes the object if the count | |||
/// reaches zero. | /// reaches zero. | |||
int referenceCount() const; | int referenceCount() const; | |||
/// Returns the reference count. | /// Returns the reference count. | |||
protected: | protected: | |||
virtual ~RefCountedObject(); | virtual ~RefCountedObject(); | |||
/// Destroys the RefCountedObject. | /// Destroys the RefCountedObject. | |||
skipping to change at line 93 | skipping to change at line 93 | |||
inline int RefCountedObject::referenceCount() const | inline int RefCountedObject::referenceCount() const | |||
{ | { | |||
return _counter.value(); | return _counter.value(); | |||
} | } | |||
inline void RefCountedObject::duplicate() const | inline void RefCountedObject::duplicate() const | |||
{ | { | |||
++_counter; | ++_counter; | |||
} | } | |||
inline void RefCountedObject::release() const | inline void RefCountedObject::release() const throw() | |||
{ | { | |||
if (--_counter == 0) delete this; | if (--_counter == 0) delete this; | |||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_RefCountedObject_INCLUDED | #endif // Foundation_RefCountedObject_INCLUDED | |||
End of changes. 3 change blocks. | ||||
3 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#3 $ | // $Id: //poco/1.4/Foundation/include/Poco/ScopedLock.h#4 $ | |||
// | // | |||
// 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 66 | skipping to change at line 66 | |||
_mutex.lock(); | _mutex.lock(); | |||
} | } | |||
ScopedLock(M& mutex, long milliseconds): _mutex(mutex) | ScopedLock(M& mutex, long milliseconds): _mutex(mutex) | |||
{ | { | |||
_mutex.lock(milliseconds); | _mutex.lock(milliseconds); | |||
} | } | |||
~ScopedLock() | ~ScopedLock() | |||
{ | { | |||
_mutex.unlock(); | try | |||
{ | ||||
_mutex.unlock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
private: | private: | |||
M& _mutex; | M& _mutex; | |||
ScopedLock(); | ScopedLock(); | |||
ScopedLock(const ScopedLock&); | ScopedLock(const ScopedLock&); | |||
ScopedLock& operator = (const ScopedLock&); | ScopedLock& operator = (const ScopedLock&); | |||
}; | }; | |||
skipping to change at line 100 | skipping to change at line 107 | |||
_pMutex->lock(); | _pMutex->lock(); | |||
} | } | |||
ScopedLockWithUnlock(M& mutex, long milliseconds): _pMutex(&mutex) | ScopedLockWithUnlock(M& mutex, long milliseconds): _pMutex(&mutex) | |||
{ | { | |||
_pMutex->lock(milliseconds); | _pMutex->lock(milliseconds); | |||
} | } | |||
~ScopedLockWithUnlock() | ~ScopedLockWithUnlock() | |||
{ | { | |||
unlock(); | try | |||
{ | ||||
unlock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
void unlock() | void unlock() | |||
{ | { | |||
if (_pMutex) | if (_pMutex) | |||
{ | { | |||
_pMutex->unlock(); | _pMutex->unlock(); | |||
_pMutex = 0; | _pMutex = 0; | |||
} | } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 17 lines changed or added | |||
ScopedUnlock.h | ScopedUnlock.h | |||
---|---|---|---|---|
// | // | |||
// ScopedUnlock.h | // ScopedUnlock.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/ScopedUnlock.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/ScopedUnlock.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Mutex | // Module: Mutex | |||
// | // | |||
// Definition of the ScopedUnlock template class. | // Definition of the ScopedUnlock template class. | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 60 | skipping to change at line 60 | |||
/// The destructor locks the mutex. | /// The destructor locks the mutex. | |||
{ | { | |||
public: | public: | |||
inline ScopedUnlock(M& mutex, bool unlockNow = true): _mutex(mutex) | inline ScopedUnlock(M& mutex, bool unlockNow = true): _mutex(mutex) | |||
{ | { | |||
if (unlockNow) | if (unlockNow) | |||
_mutex.unlock(); | _mutex.unlock(); | |||
} | } | |||
inline ~ScopedUnlock() | inline ~ScopedUnlock() | |||
{ | { | |||
_mutex.lock(); | try | |||
{ | ||||
_mutex.lock(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
private: | private: | |||
M& _mutex; | M& _mutex; | |||
ScopedUnlock(); | ScopedUnlock(); | |||
ScopedUnlock(const ScopedUnlock&); | ScopedUnlock(const ScopedUnlock&); | |||
ScopedUnlock& operator = (const ScopedUnlock&); | ScopedUnlock& operator = (const ScopedUnlock&); | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 9 lines changed or added | |||
SharedPtr.h | SharedPtr.h | |||
---|---|---|---|---|
// | // | |||
// SharedPtr.h | // SharedPtr.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SharedPtr.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SharedPtr.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: SharedPtr | // Module: SharedPtr | |||
// | // | |||
// Definition of the SharedPtr template class. | // Definition of the SharedPtr template class. | |||
// | // | |||
// Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 152 | skipping to change at line 152 | |||
_pCounter->duplicate(); | _pCounter->duplicate(); | |||
} | } | |||
SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(ptr. _ptr) | SharedPtr(const SharedPtr& ptr): _pCounter(ptr._pCounter), _ptr(ptr. _ptr) | |||
{ | { | |||
_pCounter->duplicate(); | _pCounter->duplicate(); | |||
} | } | |||
~SharedPtr() | ~SharedPtr() | |||
{ | { | |||
release(); | try | |||
{ | ||||
release(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
SharedPtr& assign(C* ptr) | SharedPtr& assign(C* ptr) | |||
{ | { | |||
if (get() != ptr) | if (get() != ptr) | |||
{ | { | |||
RC* pTmp = new RC; | RC* pTmp = new RC; | |||
release(); | release(); | |||
_pCounter = pTmp; | _pCounter = pTmp; | |||
_ptr = ptr; | _ptr = ptr; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 9 lines changed or added | |||
SimpleHashTable.h | SimpleHashTable.h | |||
---|---|---|---|---|
// | // | |||
// SimpleHashTable.h | // SimpleHashTable.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/SimpleHashTable.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/SimpleHashTable.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Hashing | // Package: Hashing | |||
// Module: SimpleHashTable | // Module: SimpleHashTable | |||
// | // | |||
// Definition of the SimpleHashTable class. | // Definition of the SimpleHashTable 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 388 | skipping to change at line 388 | |||
UInt32 totalSize = 0; | UInt32 totalSize = 0; | |||
#endif | #endif | |||
for (int i=0; i < _capacity; ++i) | for (int i=0; i < _capacity; ++i) | |||
{ | { | |||
if (_entries[i]) | if (_entries[i]) | |||
{ | { | |||
maxEntriesPerHash = 1; | maxEntriesPerHash = 1; | |||
UInt32 size = 1; | UInt32 size = 1; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(siz e); | detailedEntriesPerHash.push_back(siz e); | |||
#ifdef DEBUG | #ifdef _DEBUG | |||
totalSize += size; | totalSize += size; | |||
#endif | #endif | |||
} | } | |||
else | else | |||
{ | { | |||
numZeroEntries++; | numZeroEntries++; | |||
if (details) | if (details) | |||
detailedEntriesPerHash.push_back(0); | detailedEntriesPerHash.push_back(0); | |||
} | } | |||
} | } | |||
#ifdef _DEBUG | ||||
poco_assert_dbg(totalSize == numberOfEntries); | poco_assert_dbg(totalSize == numberOfEntries); | |||
#endif | ||||
return HashStatistic(_capacity, numberOfEntries, numZeroEntr ies, maxEntriesPerHash, detailedEntriesPerHash); | return HashStatistic(_capacity, numberOfEntries, numZeroEntr ies, maxEntriesPerHash, detailedEntriesPerHash); | |||
} | } | |||
private: | private: | |||
HashTableVector _entries; | HashTableVector _entries; | |||
std::size_t _size; | std::size_t _size; | |||
UInt32 _capacity; | UInt32 _capacity; | |||
KeyHashFunction _hash; | KeyHashFunction _hash; | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added | |||
SocketAcceptor.h | SocketAcceptor.h | |||
---|---|---|---|---|
// | // | |||
// SocketAcceptor.h | // SocketAcceptor.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketAcceptor.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketAcceptor.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketAcceptor | // Module: SocketAcceptor | |||
// | // | |||
// Definition of the SocketAcceptor class. | // Definition of the SocketAcceptor 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 107 | skipping to change at line 107 | |||
_pReactor(0) | _pReactor(0) | |||
/// Creates an SocketAcceptor, using the given ServerSocket. | /// Creates an SocketAcceptor, using the given ServerSocket. | |||
/// The SocketAcceptor registers itself with the given Socke tReactor. | /// The SocketAcceptor registers itself with the given Socke tReactor. | |||
{ | { | |||
registerAcceptor(reactor); | registerAcceptor(reactor); | |||
} | } | |||
virtual ~SocketAcceptor() | virtual ~SocketAcceptor() | |||
/// Destroys the SocketAcceptor. | /// Destroys the SocketAcceptor. | |||
{ | { | |||
unregisterAcceptor(); | try | |||
{ | ||||
unregisterAcceptor(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
virtual void registerAcceptor(SocketReactor& reactor) | virtual void registerAcceptor(SocketReactor& reactor) | |||
/// Registers the SocketAcceptor with a SocketReactor. | /// Registers the SocketAcceptor with a SocketReactor. | |||
/// | /// | |||
/// A subclass can override this and, for example, also regi ster | /// A subclass can override this and, for example, also regi ster | |||
/// an event handler for a timeout event. | /// an event handler for a timeout event. | |||
/// | /// | |||
/// The overriding method must call the baseclass implementa tion first. | /// The overriding method must call the baseclass implementa tion first. | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 9 lines changed or added | |||
SocketConnector.h | SocketConnector.h | |||
---|---|---|---|---|
// | // | |||
// SocketConnector.h | // SocketConnector.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketConnector.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketConnector.h#2 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: Reactor | // Package: Reactor | |||
// Module: SocketConnector | // Module: SocketConnector | |||
// | // | |||
// Definition of the SocketConnector class. | // Definition of the SocketConnector 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 111 | skipping to change at line 111 | |||
/// Creates an acceptor, using the given ServerSocket. | /// Creates an acceptor, using the given ServerSocket. | |||
/// The SocketConnector registers itself with the given Sock etReactor. | /// The SocketConnector registers itself with the given Sock etReactor. | |||
{ | { | |||
_socket.connectNB(address); | _socket.connectNB(address); | |||
registerConnector(reactor); | registerConnector(reactor); | |||
} | } | |||
virtual ~SocketConnector() | virtual ~SocketConnector() | |||
/// Destroys the SocketConnector. | /// Destroys the SocketConnector. | |||
{ | { | |||
unregisterConnector(); | try | |||
{ | ||||
unregisterConnector(); | ||||
} | ||||
catch (...) | ||||
{ | ||||
poco_unexpected(); | ||||
} | ||||
} | } | |||
virtual void registerConnector(SocketReactor& reactor) | virtual void registerConnector(SocketReactor& reactor) | |||
/// Registers the SocketConnector with a SocketReactor. | /// Registers the SocketConnector with a SocketReactor. | |||
/// | /// | |||
/// A subclass can override this and, for example, also regi ster | /// A subclass can override this and, for example, also regi ster | |||
/// an event handler for a timeout event. | /// an event handler for a timeout event. | |||
/// | /// | |||
/// The overriding method must call the baseclass implementa tion first. | /// The overriding method must call the baseclass implementa tion first. | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 9 lines changed or added | |||
SocketDefs.h | SocketDefs.h | |||
---|---|---|---|---|
// | // | |||
// SocketDefs.h | // SocketDefs.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#6 $ | // $Id: //poco/1.4/Net/include/Poco/Net/SocketDefs.h#7 $ | |||
// | // | |||
// 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 239 | skipping to change at line 239 | |||
#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 && !defined(POCO_NET_NO_ADDRINFO) | #if POCO_OS != POCO_OS_VXWORKS && !defined(POCO_NET_NO_ADDRINFO) | |||
#define POCO_HAVE_ADDRINFO 1 | #define POCO_HAVE_ADDRINFO 1 | |||
#endif | #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) || (POCO_OS == POCO_OS_CYGWIN) | |||
#define POCO_BROKEN_TIMEOUTS 1 | #define POCO_BROKEN_TIMEOUTS 1 | |||
#endif | #endif | |||
#if defined(POCO_HAVE_ADDRINFO) | #if defined(POCO_HAVE_ADDRINFO) | |||
#if !defined(AI_ADDRCONFIG) | #if !defined(AI_ADDRCONFIG) | |||
#define AI_ADDRCONFIG 0 | #define AI_ADDRCONFIG 0 | |||
#endif | #endif | |||
#endif | #endif | |||
#if defined(POCO_HAVE_SALEN) | #if defined(POCO_HAVE_SALEN) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
Stopwatch.h | Stopwatch.h | |||
---|---|---|---|---|
// | // | |||
// Stopwatch.h | // Stopwatch.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Stopwatch.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Stopwatch.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: DateTime | // Package: DateTime | |||
// Module: Stopwatch | // Module: Stopwatch | |||
// | // | |||
// Definition of the Stopwatch class. | // Definition of the Stopwatch 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 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_Stopwatch_INCLUDED | #ifndef Foundation_Stopwatch_INCLUDED | |||
#define Foundation_Stopwatch_INCLUDED | #define Foundation_Stopwatch_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Timestamp.h" | #include "Poco/Clock.h" | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API Stopwatch | class Foundation_API Stopwatch | |||
/// A simple facility to measure time intervals | /// A simple facility to measure time intervals | |||
/// with microsecond resolution. | /// with microsecond resolution. | |||
/// | ||||
/// Note that Stopwatch is based on the Timestamp | ||||
/// class. Therefore, if during a Stopwatch run, | ||||
/// the system time is changed, the measured time | ||||
/// will not be correct. | ||||
{ | { | |||
public: | public: | |||
Stopwatch(); | Stopwatch(); | |||
~Stopwatch(); | ~Stopwatch(); | |||
void start(); | void start(); | |||
/// Starts (or restarts) the stopwatch. | /// Starts (or restarts) the stopwatch. | |||
void stop(); | void stop(); | |||
/// Stops or pauses the stopwatch. | /// Stops or pauses the stopwatch. | |||
void reset(); | void reset(); | |||
/// Resets the stopwatch. | /// Resets the stopwatch. | |||
void restart(); | void restart(); | |||
/// Resets and starts the stopwatch. | /// Resets and starts the stopwatch. | |||
Timestamp::TimeDiff elapsed() const; | Clock::ClockDiff elapsed() const; | |||
/// Returns the elapsed time in microseconds | /// Returns the elapsed time in microseconds | |||
/// since the stopwatch started. | /// since the stopwatch started. | |||
int elapsedSeconds() const; | int elapsedSeconds() const; | |||
/// Returns the number of seconds elapsed | /// Returns the number of seconds elapsed | |||
/// since the stopwatch started. | /// since the stopwatch started. | |||
static Timestamp::TimeVal resolution(); | static Clock::ClockVal resolution(); | |||
/// Returns the resolution of the stopwatch. | /// Returns the resolution of the stopwatch. | |||
private: | private: | |||
Stopwatch(const Stopwatch&); | Stopwatch(const Stopwatch&); | |||
Stopwatch& operator = (const Stopwatch&); | Stopwatch& operator = (const Stopwatch&); | |||
Timestamp _start; | Clock _start; | |||
Timestamp::TimeDiff _elapsed; | Clock::ClockDiff _elapsed; | |||
bool _running; | bool _running; | |||
}; | }; | |||
// | // | |||
// inlines | // inlines | |||
// | // | |||
inline void Stopwatch::start() | inline void Stopwatch::start() | |||
{ | { | |||
if (!_running) | if (!_running) | |||
{ | { | |||
_start.update(); | _start.update(); | |||
_running = true; | _running = true; | |||
} | } | |||
} | } | |||
inline void Stopwatch::stop() | inline void Stopwatch::stop() | |||
{ | { | |||
if (_running) | if (_running) | |||
{ | { | |||
Timestamp current; | Clock current; | |||
_elapsed += current - _start; | _elapsed += current - _start; | |||
_running = false; | _running = false; | |||
} | } | |||
} | } | |||
inline int Stopwatch::elapsedSeconds() const | inline int Stopwatch::elapsedSeconds() const | |||
{ | { | |||
return int(elapsed()/resolution()); | return int(elapsed()/resolution()); | |||
} | } | |||
inline Timestamp::TimeVal Stopwatch::resolution() | inline Clock::ClockVal Stopwatch::resolution() | |||
{ | { | |||
return Timestamp::resolution(); | return Clock::resolution(); | |||
} | } | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_Stopwatch_INCLUDED | #endif // Foundation_Stopwatch_INCLUDED | |||
End of changes. 9 change blocks. | ||||
15 lines changed or deleted | 10 lines changed or added | |||
Thread.h | Thread.h | |||
---|---|---|---|---|
// | // | |||
// Thread.h | // Thread.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Thread.h#5 $ | // $Id: //poco/1.4/Foundation/include/Poco/Thread.h#6 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Thread | // Module: Thread | |||
// | // | |||
// Definition of the Thread class. | // Definition of the Thread 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 157 | skipping to change at line 157 | |||
/// Setting the stack size to 0 will use the default stack s ize. | /// Setting the stack size to 0 will use the default stack s ize. | |||
/// Typically, the real stack size is rounded up to the near est | /// Typically, the real stack size is rounded up to the near est | |||
/// page size multiple. | /// page size multiple. | |||
int getStackSize() const; | int getStackSize() const; | |||
/// Returns the thread's stack size in bytes. | /// Returns the thread's stack size in bytes. | |||
/// If the default stack size is used, 0 is returned. | /// If the default stack size is used, 0 is returned. | |||
void start(Runnable& target); | void start(Runnable& target); | |||
/// Starts the thread with the given target. | /// Starts the thread with the given target. | |||
/// | ||||
/// Note that the given Runnable object must be | ||||
/// valid during the entire lifetime of the thread, as | ||||
/// only a reference to it is stored internally. | ||||
void start(Callable target, void* pData = 0); | void start(Callable target, void* pData = 0); | |||
/// Starts the thread with the given target and parameter. | /// Starts the thread with the given target and parameter. | |||
void join(); | void join(); | |||
/// Waits until the thread completes execution. | /// Waits until the thread completes execution. | |||
/// If multiple threads try to join the same | /// If multiple threads try to join the same | |||
/// thread, the result is undefined. | /// thread, the result is undefined. | |||
void join(long milliseconds); | void join(long milliseconds); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
TimedNotificationQueue.h | TimedNotificationQueue.h | |||
---|---|---|---|---|
// | // | |||
// TimedNotificationQueue.h | // TimedNotificationQueue.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/TimedNotificationQueue.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/TimedNotificationQueue.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Notifications | // Package: Notifications | |||
// Module: TimedNotificationQueue | // Module: TimedNotificationQueue | |||
// | // | |||
// Definition of the TimedNotificationQueue class. | // Definition of the TimedNotificationQueue 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_TimedNotificationQueue_INCLUDED | #ifndef Foundation_TimedNotificationQueue_INCLUDED | |||
#define Foundation_TimedNotificationQueue_INCLUDED | #define Foundation_TimedNotificationQueue_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Notification.h" | #include "Poco/Notification.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#include "Poco/Timestamp.h" | #include "Poco/Timestamp.h" | |||
#include "Poco/Clock.h" | ||||
#include <map> | #include <map> | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API TimedNotificationQueue | class Foundation_API TimedNotificationQueue | |||
/// A TimedNotificationQueue object provides a way to implement time d, asynchronous | /// A TimedNotificationQueue object provides a way to implement time d, asynchronous | |||
/// notifications. This is especially useful for sending notificatio ns | /// notifications. This is especially useful for sending notificatio ns | |||
/// from one thread to another, for example from a background thread to | /// from one thread to another, for example from a background thread to | |||
/// the main (user interface) thread. | /// the main (user interface) thread. | |||
/// | /// | |||
skipping to change at line 86 | skipping to change at line 87 | |||
/// Destroys the TimedNotificationQueue. | /// Destroys the TimedNotificationQueue. | |||
void enqueueNotification(Notification::Ptr pNotification, Timestamp timestamp); | void enqueueNotification(Notification::Ptr pNotification, Timestamp timestamp); | |||
/// Enqueues the given notification by adding it to | /// Enqueues the given notification by adding it to | |||
/// the queue according to the given timestamp. | /// the queue according to the given timestamp. | |||
/// Lower timestamp values are inserted before higher ones. | /// Lower timestamp values are inserted before higher ones. | |||
/// The queue takes ownership of the notification, thus | /// The queue takes ownership of the notification, thus | |||
/// a call like | /// a call like | |||
/// notificationQueue.enqueueNotification(new MyNotifica tion, someTime); | /// notificationQueue.enqueueNotification(new MyNotifica tion, someTime); | |||
/// does not result in a memory leak. | /// does not result in a memory leak. | |||
/// | ||||
/// The Timestamp is converted to an equivalent Clock value. | ||||
void enqueueNotification(Notification::Ptr pNotification, Clock cloc | ||||
k); | ||||
/// Enqueues the given notification by adding it to | ||||
/// the queue according to the given clock value. | ||||
/// Lower clock values are inserted before higher ones. | ||||
/// The queue takes ownership of the notification, thus | ||||
/// a call like | ||||
/// notificationQueue.enqueueNotification(new MyNotifica | ||||
tion, someTime); | ||||
/// does not result in a memory leak. | ||||
Notification* dequeueNotification(); | Notification* dequeueNotification(); | |||
/// Dequeues the next pending notification with a timestamp | /// Dequeues the next pending notification with a timestamp | |||
/// less than or equal to the current time. | /// less than or equal to the current time. | |||
/// Returns 0 (null) if no notification is available. | /// Returns 0 (null) if no notification is available. | |||
/// The caller gains ownership of the notification and | /// The caller gains ownership of the notification and | |||
/// is expected to release it when done with it. | /// is expected to release it when done with it. | |||
/// | /// | |||
/// It is highly recommended that the result is immediately | /// It is highly recommended that the result is immediately | |||
/// assigned to a Notification::Ptr, to avoid potential | /// assigned to a Notification::Ptr, to avoid potential | |||
skipping to change at line 135 | skipping to change at line 147 | |||
/// Returns the number of notifications in the queue. | /// Returns the number of notifications in the queue. | |||
void clear(); | void clear(); | |||
/// Removes all notifications from the queue. | /// Removes all notifications from the queue. | |||
/// | /// | |||
/// Calling clear() while another thread executes one of | /// Calling clear() while another thread executes one of | |||
/// the dequeue member functions will result in undefined | /// the dequeue member functions will result in undefined | |||
/// behavior. | /// behavior. | |||
protected: | protected: | |||
typedef std::multimap<Timestamp, Notification::Ptr> NfQueue; | typedef std::multimap<Clock, Notification::Ptr> NfQueue; | |||
Notification::Ptr dequeueOne(NfQueue::iterator& it); | Notification::Ptr dequeueOne(NfQueue::iterator& it); | |||
bool wait(Timestamp::TimeDiff interval); | bool wait(Clock::ClockDiff interval); | |||
private: | private: | |||
NfQueue _nfQueue; | NfQueue _nfQueue; | |||
Event _nfAvailable; | Event _nfAvailable; | |||
mutable FastMutex _mutex; | mutable FastMutex _mutex; | |||
}; | }; | |||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_TimedNotificationQueue_INCLUDED | #endif // Foundation_TimedNotificationQueue_INCLUDED | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 17 lines changed or added | |||
Timer.h | Timer.h | |||
---|---|---|---|---|
// | // | |||
// Timer.h | // Timer.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Timer.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/Timer.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Threading | // Package: Threading | |||
// Module: Timer | // Module: Timer | |||
// | // | |||
// Definition of the Timer and related classes. | // Definition of the Timer and related classes. | |||
// | // | |||
// 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 46 | skipping to change at line 46 | |||
// | // | |||
#ifndef Foundation_Timer_INCLUDED | #ifndef Foundation_Timer_INCLUDED | |||
#define Foundation_Timer_INCLUDED | #define Foundation_Timer_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include "Poco/Runnable.h" | #include "Poco/Runnable.h" | |||
#include "Poco/Mutex.h" | #include "Poco/Mutex.h" | |||
#include "Poco/Event.h" | #include "Poco/Event.h" | |||
#include "Poco/Thread.h" | #include "Poco/Thread.h" | |||
#include "Poco/Timestamp.h" | #include "Poco/Clock.h" | |||
namespace Poco { | namespace Poco { | |||
class AbstractTimerCallback; | class AbstractTimerCallback; | |||
class ThreadPool; | class ThreadPool; | |||
class Foundation_API Timer: protected Runnable | class Foundation_API Timer: protected Runnable | |||
/// This class implements a thread-based timer. | /// This class implements a thread-based timer. | |||
/// A timer starts a thread that first waits for a given start inter val. | /// A timer starts a thread that first waits for a given start inter val. | |||
/// Once that interval expires, the timer callback is called repeate dly | /// Once that interval expires, the timer callback is called repeate dly | |||
skipping to change at line 167 | skipping to change at line 167 | |||
protected: | protected: | |||
void run(); | void run(); | |||
private: | private: | |||
volatile long _startInterval; | volatile long _startInterval; | |||
volatile long _periodicInterval; | volatile long _periodicInterval; | |||
Event _wakeUp; | Event _wakeUp; | |||
Event _done; | Event _done; | |||
long _skipped; | long _skipped; | |||
AbstractTimerCallback* _pCallback; | AbstractTimerCallback* _pCallback; | |||
Timestamp _nextInvocation; | Clock _nextInvocation; | |||
mutable FastMutex _mutex; | mutable FastMutex _mutex; | |||
Timer(const Timer&); | Timer(const Timer&); | |||
Timer& operator = (const Timer&); | Timer& operator = (const Timer&); | |||
}; | }; | |||
class Foundation_API AbstractTimerCallback | class Foundation_API AbstractTimerCallback | |||
/// This is the base class for all instantiations of | /// This is the base class for all instantiations of | |||
/// the TimerCallback template. | /// the TimerCallback template. | |||
{ | { | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
Types.h | Types.h | |||
---|---|---|---|---|
// | // | |||
// Types.h | // Types.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Types.h#2 $ | // $Id: //poco/1.4/Foundation/include/Poco/Types.h#3 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Core | // Package: Core | |||
// Module: Types | // Module: Types | |||
// | // | |||
// Definitions of fixed-size integer types for various platforms | // Definitions of fixed-size integer types for various platforms | |||
// | // | |||
// 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 68 | skipping to change at line 68 | |||
#define POCO_PTR_IS_64_BIT 1 | #define POCO_PTR_IS_64_BIT 1 | |||
typedef signed __int64 IntPtr; | typedef signed __int64 IntPtr; | |||
typedef unsigned __int64 UIntPtr; | typedef unsigned __int64 UIntPtr; | |||
#else | #else | |||
typedef signed long IntPtr; | typedef signed long IntPtr; | |||
typedef unsigned long UIntPtr; | typedef unsigned long UIntPtr; | |||
#endif | #endif | |||
#define POCO_HAVE_INT64 1 | #define POCO_HAVE_INT64 1 | |||
#elif defined(__GNUC__) || defined(__clang__) | #elif defined(__GNUC__) || defined(__clang__) | |||
// | // | |||
// Unix/GCC | // Unix/GCC/Clang | |||
// | // | |||
typedef signed char Int8; | typedef signed char Int8; | |||
typedef unsigned char UInt8; | typedef unsigned char UInt8; | |||
typedef signed short Int16; | typedef signed short Int16; | |||
typedef unsigned short UInt16; | typedef unsigned short UInt16; | |||
typedef signed int Int32; | typedef signed int Int32; | |||
typedef unsigned int UInt32; | typedef unsigned int UInt32; | |||
typedef signed long IntPtr; | typedef signed long IntPtr; | |||
typedef unsigned long UIntPtr; | typedef unsigned long UIntPtr; | |||
#if defined(__LP64__) | #if defined(__LP64__) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
URI.h | URI.h | |||
---|---|---|---|---|
// | // | |||
// URI.h | // URI.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/URI.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/URI.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: URI | // Package: URI | |||
// Module: URI | // Module: URI | |||
// | // | |||
// Definition of the URI class. | // Definition of the URI 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 46 | skipping to change at line 46 | |||
// | // | |||
#ifndef Foundation_URI_INCLUDED | #ifndef Foundation_URI_INCLUDED | |||
#define Foundation_URI_INCLUDED | #define Foundation_URI_INCLUDED | |||
#include "Poco/Foundation.h" | #include "Poco/Foundation.h" | |||
#include <vector> | #include <vector> | |||
namespace Poco { | namespace Poco { | |||
class Path; | ||||
class Foundation_API URI | class Foundation_API URI | |||
/// A Uniform Resource Identifier, as specified in RFC 3986. | /// A Uniform Resource Identifier, as specified in RFC 3986. | |||
/// | /// | |||
/// The URI class provides methods for building URIs from their | /// The URI class provides methods for building URIs from their | |||
/// parts, as well as for splitting URIs into their parts. | /// parts, as well as for splitting URIs into their parts. | |||
/// Furthermore, the class provides methods for resolving | /// Furthermore, the class provides methods for resolving | |||
/// relative URIs against base URIs. | /// relative URIs against base URIs. | |||
/// | /// | |||
/// The class automatically performs a few normalizations on | /// The class automatically performs a few normalizations on | |||
/// all URIs and URI parts passed to it: | /// all URIs and URI parts passed to it: | |||
skipping to change at line 91 | skipping to change at line 93 | |||
URI(const std::string& scheme, const std::string& authority, const s td::string& path, const std::string& query, const std::string& fragment); | URI(const std::string& scheme, const std::string& authority, const s td::string& path, const std::string& query, const std::string& fragment); | |||
/// Creates an URI from its parts. | /// Creates an URI from its parts. | |||
URI(const URI& uri); | URI(const URI& uri); | |||
/// Copy constructor. Creates an URI from another one. | /// Copy constructor. Creates an URI from another one. | |||
URI(const URI& baseURI, const std::string& relativeURI); | URI(const URI& baseURI, const std::string& relativeURI); | |||
/// Creates an URI from a base URI and a relative URI, accor ding to | /// Creates an URI from a base URI and a relative URI, accor ding to | |||
/// the algorithm in section 5.2 of RFC 3986. | /// the algorithm in section 5.2 of RFC 3986. | |||
explicit URI(const Path& path); | ||||
/// Creates a URI from a path. | ||||
/// | ||||
/// The path will be made absolute, and a file:// URI | ||||
/// will be built from it. | ||||
~URI(); | ~URI(); | |||
/// Destroys the URI. | /// Destroys the URI. | |||
URI& operator = (const URI& uri); | URI& operator = (const URI& uri); | |||
/// Assignment operator. | /// Assignment operator. | |||
URI& operator = (const std::string& uri); | URI& operator = (const std::string& uri); | |||
/// Parses and assigns an URI from the given string. Throws a | /// Parses and assigns an URI from the given string. Throws a | |||
/// SyntaxException if the uri is not valid. | /// SyntaxException if the uri is not valid. | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 9 lines changed or added | |||
UUID.h | UUID.h | |||
---|---|---|---|---|
// | // | |||
// UUID.h | // UUID.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/UUID.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/UUID.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: UUID | // Package: UUID | |||
// Module: UUID | // Module: UUID | |||
// | // | |||
// Definition of the UUID class. | // Definition of the UUID 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 53 | skipping to change at line 53 | |||
namespace Poco { | namespace Poco { | |||
class Foundation_API UUID | class Foundation_API UUID | |||
/// A UUID is an identifier that is unique across both space and tim e, | /// A UUID is an identifier that is unique across both space and tim e, | |||
/// with respect to the space of all UUIDs. Since a UUID is a fixed | /// with respect to the space of all UUIDs. Since a UUID is a fixed | |||
/// size and contains a time field, it is possible for values to | /// size and contains a time field, it is possible for values to | |||
/// rollover (around A.D. 3400, depending on the specific algorithm | /// rollover (around A.D. 3400, depending on the specific algorithm | |||
/// used). A UUID can be used for multiple purposes, from tagging | /// used). A UUID can be used for multiple purposes, from tagging | |||
/// objects with an extremely short lifetime, to reliably identifyin g | /// objects with an extremely short lifetime, to reliably identifyin g | |||
/// very persistent objects across a network. | /// very persistent objects across a network. | |||
/// | ||||
/// This class implements a Universal Unique Identifier, | /// This class implements a Universal Unique Identifier, | |||
/// as specified in Appendix A of the DCE 1.1 Remote Procedure | /// as specified in Appendix A of the DCE 1.1 Remote Procedure | |||
/// Call Specification (http://www.opengroup.org/onlinepubs/9629399/ ), | /// Call Specification (http://www.opengroup.org/onlinepubs/9629399/ ), | |||
/// RFC 2518 (WebDAV), section 6.4.1 and the UUIDs and GUIDs interne t | /// RFC 2518 (WebDAV), section 6.4.1 and the UUIDs and GUIDs interne t | |||
/// draft by Leach/Salz from February, 1998 | /// draft by Leach/Salz from February, 1998 | |||
/// (http://ftp.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uu | /// (http://www.ics.uci.edu/~ejw/authoring/uuid-guid/draft-leach-uui | |||
ids-guids-01.txt) | ds-guids-01.txt) | |||
/// and also | /// and also http://tools.ietf.org/html/draft-mealling-uuid-urn-05 | |||
/// http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.t | ||||
xt | ||||
{ | { | |||
public: | public: | |||
enum Version | enum Version | |||
{ | { | |||
UUID_TIME_BASED = 0x01, | UUID_TIME_BASED = 0x01, | |||
UUID_DCE_UID = 0x02, | UUID_DCE_UID = 0x02, | |||
UUID_NAME_BASED = 0x03, | UUID_NAME_BASED = 0x03, | |||
UUID_RANDOM = 0x04 | UUID_RANDOM = 0x04 | |||
}; | }; | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 5 lines changed or added | |||
Version.h | Version.h | |||
---|---|---|---|---|
// | // | |||
// Version.h | // Version.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/Version.h#13 $ | // $Id: //poco/1.4/Foundation/include/Poco/Version.h#20 $ | |||
// | // | |||
// 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-2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2004-2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
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 0x01040600 | #define POCO_VERSION 0x01040700 | |||
#endif // Foundation_Version_INCLUDED | #endif // Foundation_Version_INCLUDED | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
WebSocket.h | WebSocket.h | |||
---|---|---|---|---|
// | // | |||
// WebSocket.h | // WebSocket.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/WebSocket.h#1 $ | // $Id: //poco/1.4/Net/include/Poco/Net/WebSocket.h#5 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: WebSocket | // Package: WebSocket | |||
// Module: WebSocket | // Module: WebSocket | |||
// | // | |||
// Definition of the WebSocket class. | // Definition of the WebSocket class. | |||
// | // | |||
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 94 | skipping to change at line 94 | |||
enum FrameOpcodes | enum FrameOpcodes | |||
/// Frame header opcodes. | /// Frame header opcodes. | |||
{ | { | |||
FRAME_OP_CONT = 0x00, /// Continuation frame. | FRAME_OP_CONT = 0x00, /// Continuation frame. | |||
FRAME_OP_TEXT = 0x01, /// Text frame. | FRAME_OP_TEXT = 0x01, /// Text frame. | |||
FRAME_OP_BINARY = 0x02, /// Binary frame. | FRAME_OP_BINARY = 0x02, /// Binary frame. | |||
FRAME_OP_CLOSE = 0x08, /// Close connection. | FRAME_OP_CLOSE = 0x08, /// Close connection. | |||
FRAME_OP_PING = 0x09, /// Ping frame. | FRAME_OP_PING = 0x09, /// Ping frame. | |||
FRAME_OP_PONG = 0x0a, /// Pong frame. | FRAME_OP_PONG = 0x0a, /// Pong frame. | |||
FRAME_OP_BITMASK = 0x0f /// Bit mask for opcodes. | FRAME_OP_BITMASK = 0x0f, /// Bit mask for opcodes. | |||
FRAME_OP_SETRAW = 0x100 /// Set raw flags (for use with sen | ||||
dBytes() and FRAME_OP_CONT). | ||||
}; | }; | |||
enum SendFlags | enum SendFlags | |||
/// Combined header flags and opcodes for use with sendFrame (). | /// Combined header flags and opcodes for use with sendFrame (). | |||
{ | { | |||
FRAME_TEXT = FRAME_FLAG_FIN | FRAME_OP_TEXT, | FRAME_TEXT = FRAME_FLAG_FIN | FRAME_OP_TEXT, | |||
/// Use this for sending a single text (UTF-8) paylo ad frame. | /// Use this for sending a single text (UTF-8) paylo ad frame. | |||
FRAME_BINARY = FRAME_FLAG_FIN | FRAME_OP_BINARY | FRAME_BINARY = FRAME_FLAG_FIN | FRAME_OP_BINARY | |||
/// Use this for sending a single binary payload fra me. | /// Use this for sending a single binary payload fra me. | |||
}; | }; | |||
skipping to change at line 184 | skipping to change at line 185 | |||
/// The given credentials are used for authentication | /// The given credentials are used for authentication | |||
/// if requested by the server. | /// if requested by the server. | |||
/// | /// | |||
/// Additional HTTP headers for the initial handshake reques t | /// Additional HTTP headers for the initial handshake reques t | |||
/// (such as Origin or Sec-WebSocket-Protocol) can be given | /// (such as Origin or Sec-WebSocket-Protocol) can be given | |||
/// in the request object. | /// in the request object. | |||
/// | /// | |||
/// The result of the handshake can be obtained from the res ponse | /// The result of the handshake can be obtained from the res ponse | |||
/// object. | /// object. | |||
WebSocket(const Socket& socket); | ||||
/// Creates a WebSocket from another Socket, which must be a | ||||
WebSocket, | ||||
/// otherwise a Poco::InvalidArgumentException will be throw | ||||
n. | ||||
virtual ~WebSocket(); | virtual ~WebSocket(); | |||
/// Destroys the StreamSocket. | /// Destroys the StreamSocket. | |||
WebSocket& operator = (const Socket& socket); | WebSocket& operator = (const Socket& socket); | |||
/// Assignment operator. | /// Assignment operator. | |||
/// | /// | |||
/// Releases the socket's SocketImpl and | /// The other socket must be a WebSocket, otherwise a Poco:: | |||
/// attaches the SocketImpl from the other socket and | InvalidArgumentException | |||
/// increments the reference count of the SocketImpl. | /// will be thrown. | |||
void shutdown(); | void shutdown(); | |||
/// Sends a Close control frame to the server end of | /// Sends a Close control frame to the server end of | |||
/// the connection to initiate an orderly shutdown | /// the connection to initiate an orderly shutdown | |||
/// of the connection. | /// of the connection. | |||
void shutdown(Poco::UInt16 statusCode, const std::string& statusMess age = ""); | void shutdown(Poco::UInt16 statusCode, const std::string& statusMess age = ""); | |||
/// Sends a Close control frame to the server end of | /// Sends a Close control frame to the server end of | |||
/// the connection to initiate an orderly shutdown | /// the connection to initiate an orderly shutdown | |||
/// of the connection. | /// of the connection. | |||
skipping to change at line 225 | skipping to change at line 229 | |||
/// value denoting a certain condition. | /// value denoting a certain condition. | |||
int receiveFrame(void* buffer, int length, int& flags); | int receiveFrame(void* buffer, int length, int& flags); | |||
/// Receives a frame from the socket and stores it | /// Receives a frame from the socket and stores it | |||
/// in buffer. Up to length bytes are received. If | /// in buffer. Up to length bytes are received. If | |||
/// the frame's payload is larger, a WebSocketException | /// the frame's payload is larger, a WebSocketException | |||
/// is thrown and the WebSocket connection must be | /// is thrown and the WebSocket connection must be | |||
/// terminated. | /// terminated. | |||
/// | /// | |||
/// Returns the number of bytes received. | /// Returns the number of bytes received. | |||
/// A return value of 0 means a graceful shutdown | /// A return value of 0 means that the peer has | |||
/// of the connection from the peer. | /// shut down or closed the connection. | |||
/// | /// | |||
/// Throws a TimeoutException if a receive timeout has | /// Throws a TimeoutException if a receive timeout has | |||
/// been set and nothing is received within that interval. | /// been set and nothing is received within that interval. | |||
/// Throws a NetException (or a subclass) in case of other e rrors. | /// Throws a NetException (or a subclass) in case of other e rrors. | |||
/// | /// | |||
/// The frame flags and opcode (FrameFlags and FrameOpcodes) | /// The frame flags and opcode (FrameFlags and FrameOpcodes) | |||
/// is stored in flags. | /// is stored in flags. | |||
Mode mode() const; | Mode mode() const; | |||
/// Returns WS_SERVER if the WebSocket is a server-side | /// Returns WS_SERVER if the WebSocket is a server-side | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 15 lines changed or added | |||
WebSocketImpl.h | WebSocketImpl.h | |||
---|---|---|---|---|
// | // | |||
// WebSocketImpl.h | // WebSocketImpl.h | |||
// | // | |||
// $Id: //poco/1.4/Net/include/Poco/Net/WebSocketImpl.h#5 $ | // $Id: //poco/1.4/Net/include/Poco/Net/WebSocketImpl.h#6 $ | |||
// | // | |||
// Library: Net | // Library: Net | |||
// Package: WebSocket | // Package: WebSocket | |||
// Module: WebSocketImpl | // Module: WebSocketImpl | |||
// | // | |||
// Definition of the StreamSocketImpl class. | // Definition of the StreamSocketImpl class. | |||
// | // | |||
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 77 | skipping to change at line 77 | |||
virtual void bind6(const SocketAddress& address, bool reuseAddress = false, bool ipV6Only = false); | virtual void bind6(const SocketAddress& address, bool reuseAddress = false, bool ipV6Only = false); | |||
virtual void listen(int backlog = 64); | virtual void listen(int backlog = 64); | |||
virtual void close(); | virtual void close(); | |||
virtual void shutdownReceive(); | virtual void shutdownReceive(); | |||
virtual void shutdownSend(); | virtual void shutdownSend(); | |||
virtual void shutdown(); | virtual void shutdown(); | |||
virtual int sendTo(const void* buffer, int length, const SocketAddre ss& address, int flags = 0); | virtual int sendTo(const void* buffer, int length, const SocketAddre ss& address, int flags = 0); | |||
virtual int receiveFrom(void* buffer, int length, SocketAddress& add ress, int flags = 0); | virtual int receiveFrom(void* buffer, int length, SocketAddress& add ress, int flags = 0); | |||
virtual void sendUrgent(unsigned char data); | virtual void sendUrgent(unsigned char data); | |||
virtual bool secure() const; | virtual bool secure() const; | |||
virtual void setSendTimeout(const Poco::Timespan& timeout); | ||||
virtual Poco::Timespan getSendTimeout(); | ||||
virtual void setReceiveTimeout(const Poco::Timespan& timeout); | ||||
virtual Poco::Timespan getReceiveTimeout(); | ||||
// Internal | // Internal | |||
int frameFlags() const; | int frameFlags() const; | |||
/// Returns the frame flags of the most recently received fr ame. | /// Returns the frame flags of the most recently received fr ame. | |||
bool mustMaskPayload() const; | bool mustMaskPayload() const; | |||
/// Returns true if the payload must be masked. | /// Returns true if the payload must be masked. | |||
protected: | protected: | |||
enum | enum | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
WindowsConsoleChannel.h | WindowsConsoleChannel.h | |||
---|---|---|---|---|
// | // | |||
// WindowsConsoleChannel.h | // WindowsConsoleChannel.h | |||
// | // | |||
// $Id: //poco/1.4/Foundation/include/Poco/WindowsConsoleChannel.h#1 $ | // $Id: //poco/1.4/Foundation/include/Poco/WindowsConsoleChannel.h#2 $ | |||
// | // | |||
// Library: Foundation | // Library: Foundation | |||
// Package: Logging | // Package: Logging | |||
// Module: WindowsConsoleChannel | // Module: WindowsConsoleChannel | |||
// | // | |||
// Definition of the WindowsConsoleChannel class. | // Definition of the WindowsConsoleChannel class. | |||
// | // | |||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. | |||
// and Contributors. | // and Contributors. | |||
// | // | |||
skipping to change at line 81 | skipping to change at line 81 | |||
/// Logs the given message to the channel's stream. | /// Logs the given message to the channel's stream. | |||
protected: | protected: | |||
~WindowsConsoleChannel(); | ~WindowsConsoleChannel(); | |||
private: | private: | |||
HANDLE _hConsole; | HANDLE _hConsole; | |||
bool _isFile; | bool _isFile; | |||
}; | }; | |||
class Foundation_API WindowsColorConsoleChannel: public Channel | ||||
/// A channel that writes to the Windows console. | ||||
/// | ||||
/// Only the message's text is written, followed | ||||
/// by a newline. | ||||
/// | ||||
/// If POCO has been compiled with POCO_WIN32_UTF8, | ||||
/// log messages are assumed to be UTF-8 encoded, and | ||||
/// are converted to UTF-16 prior to writing them to the | ||||
/// console. This is the main difference to the ConsoleChannel | ||||
/// class, which cannot handle UTF-8 encoded messages on Windows. | ||||
/// | ||||
/// Messages can be colored depending on priority. | ||||
/// | ||||
/// To enable message coloring, set the "enableColors" | ||||
/// property to true (default). Furthermore, colors can be | ||||
/// configured by setting the following properties | ||||
/// (default values are given in parenthesis): | ||||
/// | ||||
/// * traceColor (gray) | ||||
/// * debugColor (gray) | ||||
/// * informationColor (default) | ||||
/// * noticeColor (default) | ||||
/// * warningColor (yellow) | ||||
/// * errorColor (lightRed) | ||||
/// * criticalColor (lightRed) | ||||
/// * fatalColor (lightRed) | ||||
/// | ||||
/// The following color values are supported: | ||||
/// | ||||
/// * default | ||||
/// * black | ||||
/// * red | ||||
/// * green | ||||
/// * brown | ||||
/// * blue | ||||
/// * magenta | ||||
/// * cyan | ||||
/// * gray | ||||
/// * darkgray | ||||
/// * lightRed | ||||
/// * lightGreen | ||||
/// * yellow | ||||
/// * lightBlue | ||||
/// * lightMagenta | ||||
/// * lightCyan | ||||
/// * white | ||||
/// | ||||
/// Chain this channel to a FormattingChannel with an | ||||
/// appropriate Formatter to control what is contained | ||||
/// in the text. | ||||
/// | ||||
/// Only available on Windows platforms. | ||||
{ | ||||
public: | ||||
WindowsColorConsoleChannel(); | ||||
/// Creates the WindowsConsoleChannel. | ||||
void log(const Message& msg); | ||||
/// Logs the given message to the channel's stream. | ||||
void setProperty(const std::string& name, const std::string& value); | ||||
/// Sets the property with the given name. | ||||
/// | ||||
/// The following properties are supported: | ||||
/// * enableColors: Enable or disable colors. | ||||
/// * traceColor: Specify color for trace messages. | ||||
/// * debugColor: Specify color for debug messages. | ||||
/// * informationColor: Specify color for information mes | ||||
sages. | ||||
/// * noticeColor: Specify color for notice messages | ||||
. | ||||
/// * warningColor: Specify color for warning message | ||||
s. | ||||
/// * errorColor: Specify color for error messages. | ||||
/// * criticalColor: Specify color for critical messag | ||||
es. | ||||
/// * fatalColor: Specify color for fatal messages. | ||||
/// | ||||
/// See the class documentation for a list of supported colo | ||||
r values. | ||||
std::string getProperty(const std::string& name) const; | ||||
/// Returns the value of the property with the given name. | ||||
/// See setProperty() for a description of the supported | ||||
/// properties. | ||||
protected: | ||||
enum Color | ||||
{ | ||||
CC_BLACK = 0x0000, | ||||
CC_RED = 0x0004, | ||||
CC_GREEN = 0x0002, | ||||
CC_BROWN = 0x0006, | ||||
CC_BLUE = 0x0001, | ||||
CC_MAGENTA = 0x0005, | ||||
CC_CYAN = 0x0003, | ||||
CC_GRAY = 0x0007, | ||||
CC_DARKGRAY = 0x0008, | ||||
CC_LIGHTRED = 0x000C, | ||||
CC_LIGHTGREEN = 0x000A, | ||||
CC_YELLOW = 0x000E, | ||||
CC_LIGHTBLUE = 0x0009, | ||||
CC_LIGHTMAGENTA = 0x000D, | ||||
CC_LIGHTCYAN = 0x000B, | ||||
CC_WHITE = 0x000F | ||||
}; | ||||
~WindowsColorConsoleChannel(); | ||||
WORD parseColor(const std::string& color) const; | ||||
std::string formatColor(WORD color) const; | ||||
void initColors(); | ||||
private: | ||||
bool _enableColors; | ||||
HANDLE _hConsole; | ||||
bool _isFile; | ||||
WORD _colors[9]; | ||||
}; | ||||
} // namespace Poco | } // namespace Poco | |||
#endif // Foundation_WindowsConsoleChannel_INCLUDED | #endif // Foundation_WindowsConsoleChannel_INCLUDED | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 121 lines changed or added | |||
XMLWriter.h | XMLWriter.h | |||
---|---|---|---|---|
// | // | |||
// XMLWriter.h | // XMLWriter.h | |||
// | // | |||
// $Id: //poco/1.4/XML/include/Poco/XML/XMLWriter.h#3 $ | // $Id: //poco/1.4/XML/include/Poco/XML/XMLWriter.h#5 $ | |||
// | // | |||
// Library: XML | // Library: XML | |||
// Package: XML | // Package: XML | |||
// Module: XMLWriter | // Module: XMLWriter | |||
// | // | |||
// Definition of the XMLWriter class. | // Definition of the XMLWriter 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 282 | skipping to change at line 282 | |||
static const std::string NEWLINE_DEFAULT; | static const std::string NEWLINE_DEFAULT; | |||
static const std::string NEWLINE_CR; | static const std::string NEWLINE_CR; | |||
static const std::string NEWLINE_CRLF; | static const std::string NEWLINE_CRLF; | |||
static const std::string NEWLINE_LF; | static const std::string NEWLINE_LF; | |||
// Namespace support. | // Namespace support. | |||
XMLString uniquePrefix(); | XMLString uniquePrefix(); | |||
/// Creates and returns a unique namespace prefix that | /// Creates and returns a unique namespace prefix that | |||
/// can be used with startPrefixMapping(). | /// can be used with startPrefixMapping(). | |||
bool isNamespaceMapped(const std::string& namespc) const; | bool isNamespaceMapped(const XMLString& namespc) const; | |||
/// Returns true if the given namespace has been mapped | /// Returns true if the given namespace has been mapped | |||
/// to a prefix in the current element or its ancestors. | /// to a prefix in the current element or its ancestors. | |||
// Misc. | // Misc. | |||
int depth() const; | int depth() const; | |||
/// Return the number of nested XML elements. | /// Return the number of nested XML elements. | |||
/// | /// | |||
/// Will be -1 if no document or fragment has been started, | /// Will be -1 if no document or fragment has been started, | |||
/// 0 if the document or fragment has been started, | /// 0 if the document or fragment has been started, | |||
/// 1 if the document element has been written and | /// 1 if the document element has been written and | |||
skipping to change at line 351 | skipping to change at line 351 | |||
bool _inInternalDTD; | bool _inInternalDTD; | |||
bool _contentWritten; | bool _contentWritten; | |||
bool _unclosedStartTag; | bool _unclosedStartTag; | |||
ElementStack _elementStack; | ElementStack _elementStack; | |||
NamespaceSupport _namespaces; | NamespaceSupport _namespaces; | |||
int _prefix; | int _prefix; | |||
bool _nsContextPushed; | bool _nsContextPushed; | |||
std::string _indent; | std::string _indent; | |||
static const std::string MARKUP_QUOTENC; | static const std::string MARKUP_QUOTENC; | |||
static const std::string MARKUP_APOSENC; | ||||
static const std::string MARKUP_AMPENC; | static const std::string MARKUP_AMPENC; | |||
static const std::string MARKUP_LTENC; | static const std::string MARKUP_LTENC; | |||
static const std::string MARKUP_GTENC; | static const std::string MARKUP_GTENC; | |||
static const std::string MARKUP_TABENC; | static const std::string MARKUP_TABENC; | |||
static const std::string MARKUP_CRENC; | static const std::string MARKUP_CRENC; | |||
static const std::string MARKUP_LFENC; | static const std::string MARKUP_LFENC; | |||
static const std::string MARKUP_LT; | static const std::string MARKUP_LT; | |||
static const std::string MARKUP_GT; | static const std::string MARKUP_GT; | |||
static const std::string MARKUP_SLASHGT; | static const std::string MARKUP_SLASHGT; | |||
static const std::string MARKUP_LTSLASH; | static const std::string MARKUP_LTSLASH; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added | |||
expat.h | expat.h | |||
---|---|---|---|---|
skipping to change at line 740 | skipping to change at line 740 | |||
XML_GetSpecifiedAttributeCount(XML_Parser parser); | XML_GetSpecifiedAttributeCount(XML_Parser parser); | |||
/* Returns the index of the ID attribute passed in the last call to | /* Returns the index of the ID attribute passed in the last call to | |||
XML_StartElementHandler, or -1 if there is no ID attribute. Each | XML_StartElementHandler, or -1 if there is no ID attribute. Each | |||
attribute/value pair counts as 2; thus this correspondds to an | attribute/value pair counts as 2; thus this correspondds to an | |||
index into the atts array passed to the XML_StartElementHandler. | index into the atts array passed to the XML_StartElementHandler. | |||
*/ | */ | |||
XMLPARSEAPI(int) | XMLPARSEAPI(int) | |||
XML_GetIdAttributeIndex(XML_Parser parser); | XML_GetIdAttributeIndex(XML_Parser parser); | |||
#ifdef XML_ATTR_INFO | ||||
/* Source file byte offsets for the start and end of attribute names and va | ||||
lues. | ||||
The value indices are exclusive of surrounding quotes; thus in a UTF-8 s | ||||
ource | ||||
file an attribute value of "blah" will yield: | ||||
info->valueEnd - info->valueStart = 4 bytes. | ||||
*/ | ||||
typedef struct { | ||||
XML_Index nameStart; /* Offset to beginning of the attribute name. */ | ||||
XML_Index nameEnd; /* Offset after the attribute name's last byte. */ | ||||
XML_Index valueStart; /* Offset to beginning of the attribute value. */ | ||||
XML_Index valueEnd; /* Offset after the attribute value's last byte. * | ||||
/ | ||||
} XML_AttrInfo; | ||||
/* Returns an array of XML_AttrInfo structures for the attribute/value pair | ||||
s | ||||
passed in last call to the XML_StartElementHandler that were specified | ||||
in the start-tag rather than defaulted. Each attribute/value pair counts | ||||
as 1; thus the number of entries in the array is | ||||
XML_GetSpecifiedAttributeCount(parser) / 2. | ||||
*/ | ||||
XMLPARSEAPI(const XML_AttrInfo *) | ||||
XML_GetAttributeInfo(XML_Parser parser); | ||||
#endif | ||||
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is | /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is | |||
detected. The last call to XML_Parse must have isFinal true; len | detected. The last call to XML_Parse must have isFinal true; len | |||
may be zero for this call (or any other). | may be zero for this call (or any other). | |||
Though the return values for these functions has always been | Though the return values for these functions has always been | |||
described as a Boolean value, the implementation, at least for the | described as a Boolean value, the implementation, at least for the | |||
1.95.x series, has always returned exactly one of the XML_Status | 1.95.x series, has always returned exactly one of the XML_Status | |||
values. | values. | |||
*/ | */ | |||
XMLPARSEAPI(enum XML_Status) | XMLPARSEAPI(enum XML_Status) | |||
skipping to change at line 881 | skipping to change at line 904 | |||
entity parsing (ie without XML_DTD being defined), then | entity parsing (ie without XML_DTD being defined), then | |||
XML_SetParamEntityParsing will return 0 if parsing of parameter | XML_SetParamEntityParsing will return 0 if parsing of parameter | |||
entities is requested; otherwise it will return non-zero. | entities is requested; otherwise it will return non-zero. | |||
Note: If XML_SetParamEntityParsing is called after XML_Parse or | Note: If XML_SetParamEntityParsing is called after XML_Parse or | |||
XML_ParseBuffer, then it has no effect and will always return 0. | XML_ParseBuffer, then it has no effect and will always return 0. | |||
*/ | */ | |||
XMLPARSEAPI(int) | XMLPARSEAPI(int) | |||
XML_SetParamEntityParsing(XML_Parser parser, | XML_SetParamEntityParsing(XML_Parser parser, | |||
enum XML_ParamEntityParsing parsing); | enum XML_ParamEntityParsing parsing); | |||
/* Sets the hash salt to use for internal hash calculations. | ||||
Helps in preventing DoS attacks based on predicting hash | ||||
function behavior. This must be called before parsing is started. | ||||
Returns 1 if successful, 0 when called after parsing has started. | ||||
*/ | ||||
XMLPARSEAPI(int) | ||||
XML_SetHashSalt(XML_Parser parser, | ||||
unsigned long hash_salt); | ||||
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then | /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then | |||
XML_GetErrorCode returns information about the error. | XML_GetErrorCode returns information about the error. | |||
*/ | */ | |||
XMLPARSEAPI(enum XML_Error) | XMLPARSEAPI(enum XML_Error) | |||
XML_GetErrorCode(XML_Parser parser); | XML_GetErrorCode(XML_Parser parser); | |||
/* These functions return information about the current parse | /* These functions return information about the current parse | |||
location. They may be called from any callback called to report | location. They may be called from any callback called to report | |||
some parse event; in this case the location is the location of the | some parse event; in this case the location is the location of the | |||
first of the sequence of characters that generated the event. When | first of the sequence of characters that generated the event. When | |||
skipping to change at line 982 | skipping to change at line 1014 | |||
enum XML_FeatureEnum { | enum XML_FeatureEnum { | |||
XML_FEATURE_END = 0, | XML_FEATURE_END = 0, | |||
XML_FEATURE_UNICODE, | XML_FEATURE_UNICODE, | |||
XML_FEATURE_UNICODE_WCHAR_T, | XML_FEATURE_UNICODE_WCHAR_T, | |||
XML_FEATURE_DTD, | XML_FEATURE_DTD, | |||
XML_FEATURE_CONTEXT_BYTES, | XML_FEATURE_CONTEXT_BYTES, | |||
XML_FEATURE_MIN_SIZE, | XML_FEATURE_MIN_SIZE, | |||
XML_FEATURE_SIZEOF_XML_CHAR, | XML_FEATURE_SIZEOF_XML_CHAR, | |||
XML_FEATURE_SIZEOF_XML_LCHAR, | XML_FEATURE_SIZEOF_XML_LCHAR, | |||
XML_FEATURE_NS, | XML_FEATURE_NS, | |||
XML_FEATURE_LARGE_SIZE | XML_FEATURE_LARGE_SIZE, | |||
XML_FEATURE_ATTR_INFO | ||||
/* Additional features must be added to the end of this enum. */ | /* Additional features must be added to the end of this enum. */ | |||
}; | }; | |||
typedef struct { | typedef struct { | |||
enum XML_FeatureEnum feature; | enum XML_FeatureEnum feature; | |||
const XML_LChar *name; | const XML_LChar *name; | |||
long int value; | long int value; | |||
} XML_Feature; | } XML_Feature; | |||
XMLPARSEAPI(const XML_Feature *) | XMLPARSEAPI(const XML_Feature *) | |||
XML_GetFeatureList(void); | XML_GetFeatureList(void); | |||
/* Expat follows the GNU/Linux convention of odd number minor version for | /* Expat follows the GNU/Linux convention of odd number minor version for | |||
beta/development releases and even number minor version for stable | beta/development releases and even number minor version for stable | |||
releases. Micro is bumped with each release, and set to 0 with each | releases. Micro is bumped with each release, and set to 0 with each | |||
change to major or minor version. | change to major or minor version. | |||
*/ | */ | |||
#define XML_MAJOR_VERSION 2 | #define XML_MAJOR_VERSION 2 | |||
#define XML_MINOR_VERSION 0 | #define XML_MINOR_VERSION 1 | |||
#define XML_MICRO_VERSION 1 | #define XML_MICRO_VERSION 0 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* not Expat_INCLUDED */ | #endif /* not Expat_INCLUDED */ | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 40 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-2010 Jean-loup Gailly. | * Copyright (C) 1995-2013 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#3 $ */ | /* @(#) $Id: //poco/1.4/Foundation/include/Poco/zconf.h#5 $ */ | |||
#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 | * Even better than compiling with -DZ_PREFIX would be to use configure to set | |||
* this permanently in zconf.h using "./configure --zprefix". | * this permanently in zconf.h using "./configure --zprefix". | |||
*/ | */ | |||
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | |||
# define Z_PREFIX_SET | ||||
/* all linked symbols */ | /* all linked symbols */ | |||
# define _dist_code z__dist_code | # define _dist_code z__dist_code | |||
# define _length_code z__length_code | # define _length_code z__length_code | |||
# define _tr_align z__tr_align | # define _tr_align z__tr_align | |||
# define _tr_flush_bits z__tr_flush_bits | ||||
# define _tr_flush_block z__tr_flush_block | # define _tr_flush_block z__tr_flush_block | |||
# define _tr_init z__tr_init | # define _tr_init z__tr_init | |||
# define _tr_stored_block z__tr_stored_block | # define _tr_stored_block z__tr_stored_block | |||
# define _tr_tally z__tr_tally | # define _tr_tally z__tr_tally | |||
# define adler32 z_adler32 | # define adler32 z_adler32 | |||
# define adler32_combine z_adler32_combine | # define adler32_combine z_adler32_combine | |||
# define adler32_combine64 z_adler32_combine64 | # define adler32_combine64 z_adler32_combine64 | |||
# define compress z_compress | # ifndef Z_SOLO | |||
# define compress2 z_compress2 | # define compress z_compress | |||
# define compressBound z_compressBound | # define compress2 z_compress2 | |||
# define compressBound z_compressBound | ||||
# endif | ||||
# define crc32 z_crc32 | # define crc32 z_crc32 | |||
# define crc32_combine z_crc32_combine | # define crc32_combine z_crc32_combine | |||
# define crc32_combine64 z_crc32_combine64 | # define crc32_combine64 z_crc32_combine64 | |||
# define deflate z_deflate | # define deflate z_deflate | |||
# define deflateBound z_deflateBound | # define deflateBound z_deflateBound | |||
# define deflateCopy z_deflateCopy | # define deflateCopy z_deflateCopy | |||
# define deflateEnd z_deflateEnd | # define deflateEnd z_deflateEnd | |||
# define deflateInit2_ z_deflateInit2_ | # define deflateInit2_ z_deflateInit2_ | |||
# define deflateInit_ z_deflateInit_ | # define deflateInit_ z_deflateInit_ | |||
# define deflateParams z_deflateParams | # define deflateParams z_deflateParams | |||
# define deflatePending z_deflatePending | ||||
# define deflatePrime z_deflatePrime | # define deflatePrime z_deflatePrime | |||
# define deflateReset z_deflateReset | # define deflateReset z_deflateReset | |||
# define deflateResetKeep z_deflateResetKeep | ||||
# define deflateSetDictionary z_deflateSetDictionary | # define deflateSetDictionary z_deflateSetDictionary | |||
# define deflateSetHeader z_deflateSetHeader | # define deflateSetHeader z_deflateSetHeader | |||
# define deflateTune z_deflateTune | # define deflateTune z_deflateTune | |||
# define deflate_copyright z_deflate_copyright | # define deflate_copyright z_deflate_copyright | |||
# define get_crc_table z_get_crc_table | # define get_crc_table z_get_crc_table | |||
# define gz_error z_gz_error | # ifndef Z_SOLO | |||
# define gz_intmax z_gz_intmax | # define gz_error z_gz_error | |||
# define gz_strwinerror z_gz_strwinerror | # define gz_intmax z_gz_intmax | |||
# define gzbuffer z_gzbuffer | # define gz_strwinerror z_gz_strwinerror | |||
# define gzclearerr z_gzclearerr | # define gzbuffer z_gzbuffer | |||
# define gzclose z_gzclose | # define gzclearerr z_gzclearerr | |||
# define gzclose_r z_gzclose_r | # define gzclose z_gzclose | |||
# define gzclose_w z_gzclose_w | # define gzclose_r z_gzclose_r | |||
# define gzdirect z_gzdirect | # define gzclose_w z_gzclose_w | |||
# define gzdopen z_gzdopen | # define gzdirect z_gzdirect | |||
# define gzeof z_gzeof | # define gzdopen z_gzdopen | |||
# define gzerror z_gzerror | # define gzeof z_gzeof | |||
# define gzflush z_gzflush | # define gzerror z_gzerror | |||
# define gzgetc z_gzgetc | # define gzflush z_gzflush | |||
# define gzgets z_gzgets | # define gzgetc z_gzgetc | |||
# define gzoffset z_gzoffset | # define gzgetc_ z_gzgetc_ | |||
# define gzoffset64 z_gzoffset64 | # define gzgets z_gzgets | |||
# define gzopen z_gzopen | # define gzoffset z_gzoffset | |||
# define gzopen64 z_gzopen64 | # define gzoffset64 z_gzoffset64 | |||
# define gzprintf z_gzprintf | # define gzopen z_gzopen | |||
# define gzputc z_gzputc | # define gzopen64 z_gzopen64 | |||
# define gzputs z_gzputs | # ifdef _WIN32 | |||
# define gzread z_gzread | # define gzopen_w z_gzopen_w | |||
# define gzrewind z_gzrewind | # endif | |||
# define gzseek z_gzseek | # define gzprintf z_gzprintf | |||
# define gzseek64 z_gzseek64 | # define gzvprintf z_gzvprintf | |||
# define gzsetparams z_gzsetparams | # define gzputc z_gzputc | |||
# define gztell z_gztell | # define gzputs z_gzputs | |||
# define gztell64 z_gztell64 | # define gzread z_gzread | |||
# define gzungetc z_gzungetc | # define gzrewind z_gzrewind | |||
# define gzwrite z_gzwrite | # 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 | ||||
# endif | ||||
# define inflate z_inflate | # define inflate z_inflate | |||
# define inflateBack z_inflateBack | # define inflateBack z_inflateBack | |||
# define inflateBackEnd z_inflateBackEnd | # define inflateBackEnd z_inflateBackEnd | |||
# define inflateBackInit_ z_inflateBackInit_ | # define inflateBackInit_ z_inflateBackInit_ | |||
# define inflateCopy z_inflateCopy | # define inflateCopy z_inflateCopy | |||
# define inflateEnd z_inflateEnd | # define inflateEnd z_inflateEnd | |||
# define inflateGetHeader z_inflateGetHeader | # define inflateGetHeader z_inflateGetHeader | |||
# define inflateInit2_ z_inflateInit2_ | # define inflateInit2_ z_inflateInit2_ | |||
# define inflateInit_ z_inflateInit_ | # define inflateInit_ z_inflateInit_ | |||
# define inflateMark z_inflateMark | # define inflateMark z_inflateMark | |||
# define inflatePrime z_inflatePrime | # define inflatePrime z_inflatePrime | |||
# define inflateReset z_inflateReset | # define inflateReset z_inflateReset | |||
# define inflateReset2 z_inflateReset2 | # define inflateReset2 z_inflateReset2 | |||
# define inflateSetDictionary z_inflateSetDictionary | # define inflateSetDictionary z_inflateSetDictionary | |||
# define inflateGetDictionary z_inflateGetDictionary | ||||
# define inflateSync z_inflateSync | # define inflateSync z_inflateSync | |||
# define inflateSyncPoint z_inflateSyncPoint | # define inflateSyncPoint z_inflateSyncPoint | |||
# define inflateUndermine z_inflateUndermine | # define inflateUndermine z_inflateUndermine | |||
# define inflateResetKeep z_inflateResetKeep | ||||
# define inflate_copyright z_inflate_copyright | # define inflate_copyright z_inflate_copyright | |||
# define inflate_fast z_inflate_fast | # define inflate_fast z_inflate_fast | |||
# define inflate_table z_inflate_table | # define inflate_table z_inflate_table | |||
# define uncompress z_uncompress | # ifndef Z_SOLO | |||
# define uncompress z_uncompress | ||||
# endif | ||||
# define zError z_zError | # define zError z_zError | |||
# define zcalloc z_zcalloc | # ifndef Z_SOLO | |||
# define zcfree z_zcfree | # define zcalloc z_zcalloc | |||
# define zcfree z_zcfree | ||||
# endif | ||||
# define zlibCompileFlags z_zlibCompileFlags | # define zlibCompileFlags z_zlibCompileFlags | |||
# define zlibVersion z_zlibVersion | # define zlibVersion z_zlibVersion | |||
/* all zlib typedefs in zlib.h and zconf.h */ | /* all zlib typedefs in zlib.h and zconf.h */ | |||
# define Byte z_Byte | # define Byte z_Byte | |||
# define Bytef z_Bytef | # define Bytef z_Bytef | |||
# define alloc_func z_alloc_func | # define alloc_func z_alloc_func | |||
# define charf z_charf | # define charf z_charf | |||
# define free_func z_free_func | # define free_func z_free_func | |||
# define gzFile z_gzFile | # ifndef Z_SOLO | |||
# define gzFile z_gzFile | ||||
# endif | ||||
# define gz_header z_gz_header | # define gz_header z_gz_header | |||
# define gz_headerp z_gz_headerp | # define gz_headerp z_gz_headerp | |||
# define in_func z_in_func | # define in_func z_in_func | |||
# define intf z_intf | # define intf z_intf | |||
# define out_func z_out_func | # define out_func z_out_func | |||
# define uInt z_uInt | # define uInt z_uInt | |||
# define uIntf z_uIntf | # define uIntf z_uIntf | |||
# define uLong z_uLong | # define uLong z_uLong | |||
# define uLongf z_uLongf | # define uLongf z_uLongf | |||
# define voidp z_voidp | # define voidp z_voidp | |||
skipping to change at line 200 | skipping to change at line 221 | |||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). * / | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). * / | |||
# define STDC | # define STDC | |||
#endif | #endif | |||
#ifndef STDC | #ifndef STDC | |||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | |||
# define const /* note: need a more gentle solution here */ | # define const /* note: need a more gentle solution here */ | |||
# endif | # endif | |||
#endif | #endif | |||
#if defined(ZLIB_CONST) && !defined(z_const) | ||||
# define z_const const | ||||
#else | ||||
# define z_const | ||||
#endif | ||||
/* Some Mac compilers merge all .h files incorrectly: */ | /* Some Mac compilers merge all .h files incorrectly: */ | |||
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) | #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) | |||
# define NO_DUMMY_DECL | # define NO_DUMMY_DECL | |||
#endif | #endif | |||
/* Maximum value for memLevel in deflateInit2 */ | /* Maximum value for memLevel in deflateInit2 */ | |||
#ifndef MAX_MEM_LEVEL | #ifndef MAX_MEM_LEVEL | |||
# ifdef MAXSEG_64K | # ifdef MAXSEG_64K | |||
# define MAX_MEM_LEVEL 8 | # define MAX_MEM_LEVEL 8 | |||
# else | # else | |||
skipping to change at line 246 | skipping to change at line 273 | |||
/* Type declarations */ | /* Type declarations */ | |||
#ifndef OF /* function prototypes */ | #ifndef OF /* function prototypes */ | |||
# ifdef STDC | # ifdef STDC | |||
# define OF(args) args | # define OF(args) args | |||
# else | # else | |||
# define OF(args) () | # define OF(args) () | |||
# endif | # endif | |||
#endif | #endif | |||
#ifndef Z_ARG /* function prototypes for stdarg */ | ||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||||
# define Z_ARG(args) args | ||||
# else | ||||
# define Z_ARG(args) () | ||||
# endif | ||||
#endif | ||||
/* The following definitions for FAR are needed only for MSDOS mixed | /* The following definitions for FAR are needed only for MSDOS mixed | |||
* model programming (small or medium model with some far allocations). | * model programming (small or medium model with some far allocations). | |||
* This was tested only with MSC; for other MSDOS compilers you may have | * This was tested only with MSC; for other MSDOS compilers you may have | |||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | |||
* just define FAR to be empty. | * just define FAR to be empty. | |||
*/ | */ | |||
#ifdef SYS16BIT | #ifdef SYS16BIT | |||
# if defined(M_I86SM) || defined(M_I86MM) | # if defined(M_I86SM) || defined(M_I86MM) | |||
/* MSC small or medium model */ | /* MSC small or medium model */ | |||
# define SMALL_MEDIUM | # define SMALL_MEDIUM | |||
skipping to change at line 359 | skipping to change at line 394 | |||
#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 !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | ||||
# include <limits.h> | ||||
# if (UINT_MAX == 0xffffffffUL) | ||||
# define Z_U4 unsigned | ||||
# elif (ULONG_MAX == 0xffffffffUL) | ||||
# define Z_U4 unsigned long | ||||
# elif (USHRT_MAX == 0xffffffffUL) | ||||
# define Z_U4 unsigned short | ||||
# endif | ||||
#endif | ||||
#ifdef Z_U4 | ||||
typedef Z_U4 z_crc_t; | ||||
#else | ||||
typedef unsigned long z_crc_t; | ||||
#endif | ||||
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | |||
# define Z_HAVE_UNISTD_H | # define Z_HAVE_UNISTD_H | |||
#endif | #endif | |||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ | ||||
# define Z_HAVE_STDARG_H | ||||
#endif | ||||
#ifndef _WIN32_WCE | #ifndef _WIN32_WCE | |||
#ifdef STDC | #ifdef STDC | |||
# include <sys/types.h> /* for off_t */ | # ifndef Z_SOLO | |||
# include <sys/types.h> /* for off_t */ | ||||
# endif | ||||
#endif | ||||
#endif | #endif | |||
#if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||||
# ifndef Z_SOLO | ||||
# include <stdarg.h> /* for va_list */ | ||||
# endif | ||||
#endif | ||||
#ifdef _WIN32 | ||||
# ifndef Z_SOLO | ||||
# include <stddef.h> /* for wchar_t */ | ||||
# endif | ||||
#endif | #endif | |||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | |||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | |||
* though the former does not conform to the LFS document), but considering | * though the former does not conform to the LFS document), but considering | |||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | |||
* equivalently requesting no 64-bit operations | * equivalently requesting no 64-bit operations | |||
*/ | */ | |||
#if -_LARGEFILE64_SOURCE - -1 == 1 | #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 | |||
# undef _LARGEFILE64_SOURCE | # undef _LARGEFILE64_SOURCE | |||
#endif | #endif | |||
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) | #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) | |||
# include <unistd.h> /* for SEEK_* and off_t */ | # define Z_HAVE_UNISTD_H | |||
# ifdef VMS | #endif | |||
# include <unixio.h> /* for off_t */ | #ifndef Z_SOLO | |||
# endif | # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) | |||
# ifndef z_off_t | # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE | |||
# define z_off_t off_t | */ | |||
# ifdef VMS | ||||
# include <unixio.h> /* for off_t */ | ||||
# endif | ||||
# ifndef z_off_t | ||||
# define z_off_t off_t | ||||
# endif | ||||
# endif | # endif | |||
#endif | #endif | |||
#ifndef SEEK_SET | #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 | |||
# define Z_LFS64 | ||||
#endif | ||||
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) | ||||
# define Z_LARGE64 | ||||
#endif | ||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LF | ||||
S64) | ||||
# define Z_WANT64 | ||||
#endif | ||||
#if !defined(SEEK_SET) && !defined(Z_SOLO) | ||||
# 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 | #if !defined(_WIN32) && defined(Z_LARGE64) | |||
# define z_off64_t off64_t | # define z_off64_t off64_t | |||
#else | #else | |||
# define z_off64_t z_off_t | # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) | |||
#endif | # define z_off64_t __int64 | |||
# else | ||||
#if defined(__OS400__) | # define z_off64_t z_off_t | |||
# define NO_vsnprintf | # endif | |||
#endif | ||||
#if defined(__MVS__) | ||||
# define NO_vsnprintf | ||||
#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") | |||
End of changes. 24 change blocks. | ||||
60 lines changed or deleted | 145 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.5, April 19th, 2010 | version 1.2.8, April 28th, 2013 | |||
Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler | Copyright (C) 1995-2013 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 26 | skipping to change at line 26 | |||
in a product, an acknowledgment in the product documentation would be | in a product, an acknowledgment in the product documentation would be | |||
appreciated but is not required. | appreciated but is not required. | |||
2. Altered source versions must be plainly marked as such, and must not b e | 2. Altered source versions must be plainly marked as such, and must not b e | |||
misrepresented as being the original software. | misrepresented as being the original software. | |||
3. This notice may not be removed or altered from any source distribution . | 3. This notice may not be removed or altered from any source distribution . | |||
Jean-loup Gailly Mark Adler | Jean-loup Gailly Mark Adler | |||
jloup@gzip.org madler@alumni.caltech.edu | jloup@gzip.org madler@alumni.caltech.edu | |||
The data format used by the zlib library is described by RFCs (Request fo r | The data format used by the zlib library is described by RFCs (Request fo r | |||
Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt | Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 | |||
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format) | (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). | |||
. | ||||
*/ | */ | |||
#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.5" | #define ZLIB_VERSION "1.2.8" | |||
#define ZLIB_VERNUM 0x1250 | #define ZLIB_VERNUM 0x1280 | |||
#define ZLIB_VER_MAJOR 1 | #define ZLIB_VER_MAJOR 1 | |||
#define ZLIB_VER_MINOR 2 | #define ZLIB_VER_MINOR 2 | |||
#define ZLIB_VER_REVISION 5 | #define ZLIB_VER_REVISION 8 | |||
#define ZLIB_VER_SUBREVISION 0 | #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 d ata. | decompression functions, including integrity checks of the uncompressed d ata. | |||
This version of the library supports only one compression method (deflati on) | This version of the library supports only one compression method (deflati on) | |||
but other algorithms will be added later and will have the same stream | but other algorithms will be added later and will have the same stream | |||
interface. | interface. | |||
Compression can be done in a single step if the buffers are large enoug h, | Compression can be done in a single step if the buffers are large enoug h, | |||
skipping to change at line 85 | skipping to change at line 85 | |||
the consistency of the compressed data, so the library should never crash | the consistency of the compressed data, so the library should never 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 */ | z_const 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 */ | |||
uLong total_in; /* total nb of input bytes read so far */ | uLong total_in; /* total number of input bytes read so far */ | |||
Bytef *next_out; /* next output byte should be put there */ | Bytef *next_out; /* next output byte should be put there */ | |||
uInt avail_out; /* remaining free space at next_out */ | uInt avail_out; /* remaining free space at next_out */ | |||
uLong total_out; /* total nb of bytes output so far */ | uLong total_out; /* total number of bytes output so far */ | |||
char *msg; /* last error message, NULL if no error */ | z_const char *msg; /* last error message, NULL if no error */ | |||
struct internal_state FAR *state; /* not visible by applications */ | struct internal_state FAR *state; /* not visible by applications */ | |||
alloc_func zalloc; /* used to allocate the internal state */ | alloc_func zalloc; /* used to allocate the internal state */ | |||
free_func zfree; /* used to free the internal state */ | free_func zfree; /* used to free the internal state */ | |||
voidpf opaque; /* private data object passed to zalloc and zfree * / | voidpf opaque; /* private data object passed to zalloc and zfree * / | |||
int data_type; /* best guess about the data type: binary or text * / | int data_type; /* best guess about the data type: binary or text * / | |||
uLong adler; /* adler32 value of the uncompressed data */ | uLong adler; /* adler32 value of the uncompressed data */ | |||
uLong reserved; /* reserved for future use */ | uLong reserved; /* reserved for future use */ | |||
} z_stream; | } z_stream; | |||
skipping to change at line 327 | skipping to change at line 327 | |||
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 was | 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 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 st ream | deflate has returned Z_STREAM_END, the only possible operations on the st ream | |||
are deflateReset or deflateEnd. | 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 the | 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 return | value returned by deflateBound (see below). Then deflate is guaranteed t | |||
Z_STREAM_END, then it must be called again as described above. | o | |||
return Z_STREAM_END. If not enough output space is provided, deflate wil | ||||
l | ||||
not return Z_STREAM_END, and 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 consider ed | the input data type (Z_BINARY or Z_TEXT). In doubt, the data is consider ed | |||
binary. This field is only for information purposes and does not affect the | binary. This field is only for information purposes and does not affect the | |||
compression algorithm in any manner. | 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 | |||
skipping to change at line 448 | skipping to change at line 449 | |||
end of each deflate block header is reached, before any actual data in th at | 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 | 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. | 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 | 256 is added to the value of strm->data_type when inflate() returns | |||
immediately after reaching the end of the deflate block header. | 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 (a | 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 Z_FINISH. In | single call of inflate), the parameter flush should be set to Z_FINISH. In | |||
this case all pending input is processed and all pending output is flushe d; | this case all pending input is processed and all pending output is flushe d; | |||
avail_out must be large enough to hold all the uncompressed data. (The s | avail_out must be large enough to hold all of the uncompressed data for t | |||
ize | he | |||
of the uncompressed data may have been saved by the compressor for this | operation to complete. (The size of the uncompressed data may have been | |||
purpose.) The next operation on this stream must be inflateEnd to dealloc | saved by the compressor for this purpose.) The use of Z_FINISH is not | |||
ate | required to perform an inflation in one step. However it may be used to | |||
the decompression state. The use of Z_FINISH is never required, but can | inform inflate that a faster approach can be used for the single inflate( | |||
be | ) | |||
used to inform inflate that a faster approach may be used for the single | call. Z_FINISH also informs inflate to not maintain a sliding window if | |||
inflate() call. | the | |||
stream completes, which reduces inflate's memory footprint. If the strea | ||||
m | ||||
does not complete, either because not all of the stream is provided or no | ||||
t | ||||
enough output space is provided, then a sliding window will be allocated | ||||
and | ||||
inflate() can be called again to continue the operation as if Z_NO_FLUSH | ||||
had | ||||
been used. | ||||
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 implementa | first call. So the effects of the flush parameter in this implementation | |||
tion | are | |||
is on the return value of inflate(), as noted below, or when it returns e | on the return value of inflate() as noted below, when inflate() returns e | |||
arly | arly | |||
because Z_BLOCK or Z_TREES is used. | when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation | |||
of | ||||
memory for a sliding window when Z_FINISH 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 Adler-32 checksum of the dictiona ry | |||
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 Adler-32 checksum of all output produced so far (that is, | |||
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 adle r32 | 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() can 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, if requested wh en | deflate data. The header type is detected automatically, if requested wh en | |||
initializing with inflateInit2(). Any information contained in the gzip | initializing with inflateInit2(). Any information contained in the gzip | |||
header is not retained, so applications that need that information should | header is not retained, so applications that need that information should | |||
instead use raw inflate, see inflateInit2() below, or inflateBack() and | instead use raw inflate, see inflateInit2() below, or inflateBack() and | |||
perform their own processing of the gzip header and trailer. | perform their own processing of the gzip header and trailer. When proces | |||
sing | ||||
gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the outp | ||||
ut | ||||
producted so far. The CRC-32 is checked against the gzip 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 | |||
next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memo ry, | 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 | |||
skipping to change at line 575 | skipping to change at line 584 | |||
incompatible with the version assumed by the caller (ZLIB_VERSION). msg is | 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 | set to null if there is no error message. deflateInit2 does not perform any | |||
compression: this will be done by deflate(). | 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. When using the zlib format, th | |||
immediately after deflateInit, deflateInit2 or deflateReset, before any | is | |||
call | function must be called immediately after deflateInit, deflateInit2 or | |||
of deflate. The compressor and decompressor must use exactly the same | deflateReset, and before any call of deflate. When doing raw deflate, t | |||
dictionary (see inflateSetDictionary). | his | |||
function must be called either before any call of deflate, or immediatel | ||||
y | ||||
after the completion of a deflate block, i.e. after all input has been | ||||
consumed and all output has been delivered when using any of the flush | ||||
options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The | ||||
compressor and decompressor must use exactly the same 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 | |||
skipping to change at line 605 | skipping to change at line 619 | |||
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 (e.g. dictionary being Z_NULL) 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 not at a block boundary for raw deflate). deflateSetDictionary do | |||
perform any compression: this will be done by deflate(). | es | |||
not 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 f reed | data with a filter. The streams that will be discarded should then be f reed | |||
skipping to change at line 683 | skipping to change at line 697 | |||
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() or | deflation of sourceLen bytes. It must be called after deflateInit() or | |||
deflateInit2(), and after deflateSetHeader(), if used. This would be us ed | deflateInit2(), and after deflateSetHeader(), if used. This would be us ed | |||
to allocate an output buffer for deflation in a single pass, and so woul d be | to allocate an output buffer for deflation in a single pass, and so woul d be | |||
called before deflate(). | called before deflate(). If that first deflate() call is provided the | |||
*/ | sourceLen input bytes, an output buffer allocated to the size returned b | |||
y | ||||
deflateBound(), and the flush value Z_FINISH, then deflate() is guarante | ||||
ed | ||||
to return Z_STREAM_END. Note that it is possible for the compressed siz | ||||
e to | ||||
be larger than the value returned by deflateBound() if flush options oth | ||||
er | ||||
than Z_FINISH or Z_NO_FLUSH are used. | ||||
*/ | ||||
ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, | ||||
unsigned *pending, | ||||
int *bits)); | ||||
/* | ||||
deflatePending() returns the number of bytes and bits of output that h | ||||
ave | ||||
been generated, but not yet provided in the available output. The bytes | ||||
not | ||||
provided would be due to the available output space having being consume | ||||
d. | ||||
The number of bits of output not provided are between 0 and 7, where the | ||||
y | ||||
await more bits to join them in order to fill out a full byte. If pendi | ||||
ng | ||||
or bits are Z_NULL, then those values are not set. | ||||
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the sourc | ||||
e | ||||
stream state was inconsistent. | ||||
*/ | ||||
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 b its | is that this function is used to start off the deflate output with the b its | |||
leftover from a previous deflate stream when appending to it. As such, this | 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 the f irst | function can only be used for raw deflate, and must be used before the f irst | |||
deflate() call after a deflateInit2() or deflateReset(). bits must be l ess | deflate() call after a deflateInit2() or deflateReset(). bits must be l ess | |||
than or equal to 16, and that many of the least significant bits of valu e | than or equal to 16, and that many of the least significant bits of valu e | |||
will be inserted in the output. | 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, Z_BUF_ERROR if there was not eno | |||
stream state was inconsistent. | ugh | |||
room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the | ||||
source 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 | |||
skipping to change at line 785 | skipping to change at line 820 | |||
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 infl ate, | sequence. This function must be called immediately after a call of infl ate, | |||
if that call returned Z_NEED_DICT. The dictionary chosen by the compres sor | if that call returned Z_NEED_DICT. The dictionary chosen by the compres 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 at | |||
immediately after inflateInit2() or inflateReset() and before any call o | any | |||
f | time to set the dictionary. If the provided dictionary is smaller than | |||
inflate() to set the dictionary. The application must insure that the | the | |||
dictionary that was used for compression is provided. | window and there is already data in the window, then the provided dictio | |||
nary | ||||
will amend what's there. The application must insure that the dictionar | ||||
y | ||||
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 (e.g. dictionary being Z_NULL) 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 inflateGetDictionary OF((z_streamp strm, | ||||
Bytef *dictionary, | ||||
uInt *dictLength)); | ||||
/* | ||||
Returns the sliding dictionary being maintained by inflate. dictLengt | ||||
h is | ||||
set to the number of bytes in the dictionary, and that many bytes are co | ||||
pied | ||||
to dictionary. dictionary must have enough space, where 32768 bytes is | ||||
always enough. If inflateGetDictionary() is called with dictionary equa | ||||
l to | ||||
Z_NULL, then only the dictionary length is returned, and nothing is copi | ||||
ed. | ||||
Similary, if dictLength is Z_NULL, then it is not set. | ||||
inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the | ||||
stream state is inconsistent. | ||||
*/ | ||||
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 possible full flush point (see a | |||
description of deflate with Z_FULL_FLUSH) can be found, or until all | bove | |||
for the 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_E | inflateSync searches for a 00 00 FF FF pattern in the compressed data. | |||
RROR | All full flush points have this pattern, but not all occurrences of this | |||
if no more input was provided, Z_DATA_ERROR if no flush point has been | pattern are full flush points. | |||
found, or Z_STREAM_ERROR if the stream structure was inconsistent. In t | ||||
he | inflateSync returns Z_OK if a possible full flush point has been found | |||
success case, the application may save the current current value of tota | , | |||
l_in | Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush poin | |||
which indicates where valid compressed data was found. In the error cas | t | |||
e, | has been found, or Z_STREAM_ERROR if the stream structure was inconsiste | |||
the application may repeatedly call inflateSync, providing more input ea | nt. | |||
ch | In the success case, the application may save the current current value | |||
time, until success or end of the input data. | of | |||
total_in which indicates where valid compressed data was found. In the | ||||
error case, the application may repeatedly call inflateSync, providing m | ||||
ore | ||||
input each 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 | |||
skipping to change at line 957 | skipping to change at line 1012 | |||
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 be | the parameters 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 mat ch | allocated, or Z_VERSION_ERROR if the version of the library does not mat ch | |||
the version of the header file. | the version of the header file. | |||
*/ | */ | |||
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); | typedef unsigned (*in_func) OF((void FAR *, | |||
z_const 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 | interface for input and output. This is potentially more efficient than | |||
or | inflate() for file i/o applications, in that it avoids copying between t | |||
file i/o applications in that it avoids copying between the output and t | he | |||
he | output and the sliding window by simply making the window itself the out | |||
sliding window by simply making the window itself the output buffer. Th | put | |||
is | buffer. inflate() can be faster on modern CPUs when used with large | |||
function trusts the application to not change the output buffer passed b | buffers. inflateBack() trusts the application to not change the output | |||
y | buffer passed by the output function, at least until inflateBack() retur | |||
the output function, at least until inflateBack() returns. | ns. | |||
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 the | deflate stream with each call. inflateBackEnd() is then called to free the | |||
allocated state. | 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 | |||
skipping to change at line 1083 | skipping to change at line 1140 | |||
The sprintf variant used by gzprintf (zero is best): | The sprintf variant used by gzprintf (zero is best): | |||
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the forma t | 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the forma t | |||
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) | |||
*/ | */ | |||
#ifndef Z_SOLO | ||||
/* utility functions */ | /* utility functions */ | |||
/* | /* | |||
The following utility functions are implemented on top of the basic | The following utility functions are implemented on top of the basic | |||
stream-oriented functions. To simplify the interface, some default opti ons | stream-oriented functions. To simplify the interface, some default opti ons | |||
are assumed (compression level and memory usage, standard memory allocat ion | are assumed (compression level and memory usage, standard memory allocat ion | |||
functions). The source code of these utility functions can be modified if | functions). The source code of these utility functions can be modified if | |||
you need special options. | you need special options. | |||
*/ | */ | |||
skipping to change at line 1143 | skipping to change at line 1202 | |||
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 size | 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 entire | of the destination buffer, which must be large enough to hold the entire | |||
uncompressed data. (The size of the uncompressed data must have been sa ved | uncompressed data. (The size of the uncompressed data must have been sa ved | |||
previously by the compressor and transmitted to the decompressor by some | previously by the compressor and transmitted to the decompressor by some | |||
mechanism outside the scope of this compression library.) Upon exit, des tLen | mechanism outside the scope of this compression library.) Upon exit, des tLen | |||
is the actual size of the uncompressed buffer. | 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. | |||
In | ||||
the case where there is not enough room, uncompress() will fill the outp | ||||
ut | ||||
buffer with the uncompressed data up to that point. | ||||
*/ | */ | |||
/* gzip file access functions */ | /* gzip file access functions */ | |||
/* | /* | |||
This library supports reading and writing files in gzip (.gz) format w ith | This library supports reading and writing files in gzip (.gz) format w ith | |||
an interface similar to that of stdio, using the functions that start wi th | an interface similar to that of stdio, using the functions that start wi th | |||
"gz". The gzip format is different from the zlib format. gzip is a gzi p | "gz". The gzip format is different from the zlib format. gzip is a gzi p | |||
wrapper, documented in RFC 1952, wrapped around a deflate stream. | wrapper, documented in RFC 1952, wrapped around a deflate stream. | |||
*/ | */ | |||
typedef voidp gzFile; /* opaque gzip file descriptor */ | typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ | |||
/* | /* | |||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | 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 | 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 | 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 | 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' | 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 | for fixed code compression as in "wb9F". (See the description of | |||
deflateInit2 for more information about the strategy parameter.) Also "a | deflateInit2 for more information about the strategy parameter.) 'T' wi | |||
" | ll | |||
can be used instead of "w" to request that the gzip stream that will be | request transparent writing or appending with no compression and not usi | |||
written be appended to the file. "+" will result in an error, since rea | ng | |||
ding | the gzip format. | |||
and writing to the same gzip file is not supported. | ||||
"a" can be used instead of "w" to request that the gzip stream that wi | ||||
ll | ||||
be written be appended to the file. "+" will result in an error, since | ||||
reading and writing to the same gzip file is not supported. The additio | ||||
n of | ||||
"x" when writing will create the file exclusively, which fails if the fi | ||||
le | ||||
already exists. On systems that support it, the addition of "e" when | ||||
reading or writing will set the flag to close the file on an execve() ca | ||||
ll. | ||||
These functions, as well as gzip, will read and decode a sequence of g | ||||
zip | ||||
streams in a file. The append function of gzopen() can be used to creat | ||||
e | ||||
such a file. (Also see gzflush() for another way to do this.) When | ||||
appending, gzopen does not test whether the file begins with a gzip stre | ||||
am, | ||||
nor does it look for the end of the gzip streams to begin appending. gz | ||||
open | ||||
will simply append a gzip stream to the existing file. | ||||
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. Whe | |||
n | ||||
reading, this will be detected automatically by looking for the magic tw | ||||
o- | ||||
byte gzip header. | ||||
gzopen returns NULL if the file could not be opened, if there was | gzopen returns NULL if the file could not be opened, if there was | |||
insufficient memory to allocate the gzFile state, or if an invalid mode was | insufficient memory to allocate the gzFile state, or if an invalid mode was | |||
specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). | 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 | errno can be checked to determine if the reason gzopen failed was that t he | |||
file could not be opened. | 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 descrip tors | gzdopen associates a gzFile with the file descriptor fd. File descrip tors | |||
are obtained from calls like open, dup, creat, pipe or fileno (if the fi le | are obtained from calls like open, dup, creat, pipe or fileno (if the fi le | |||
has been previously opened with fopen). The mode parameter is as in gzo pen. | has been previously opened with fopen). The mode parameter is as in gzo pen. | |||
The next call of gzclose on the returned gzFile will also close the fi le | The next call of gzclose on the returned gzFile will also close the fi le | |||
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descri ptor | 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 , | 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 | mode);. The duplicated descriptor should be saved to avoid a leak, sinc e | |||
gzdopen does not close fd if it fails. | gzdopen does not close fd if it fails. If you are using fileno() to get | |||
the | ||||
file descriptor from a FILE *, then you will have to use dup() to avoid | ||||
double-close()ing the file descriptor. Both gzclose() and fclose() will | ||||
close the associated file descriptor, so they need to have different fil | ||||
e | ||||
descriptors. | ||||
gzdopen returns NULL if there was insufficient memory to allocate the | 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 | 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 | 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 | 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). | will not detect if fd is invalid (unless fd is -1). | |||
*/ | */ | |||
ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); | ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); | |||
/* | /* | |||
skipping to change at line 1228 | skipping to change at line 1308 | |||
Dynamically update the compression level or strategy. See the descrip tion | 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. If | 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 of | the input file is not in gzip format, gzread copies the given number of | |||
bytes into the buffer. | bytes into the buffer directly from the file. | |||
After reaching the end of a gzip stream in the input, gzread will cont inue | After reaching the end of a gzip stream in the input, gzread will cont inue | |||
to read, looking for another gzip stream, or failing that, reading the r | to read, looking for another gzip stream. Any number of gzip streams ma | |||
est | y be | |||
of the input file directly without decompression. The entire input file | concatenated in the input file, and will all be decompressed by gzread() | |||
will be read if gzread is called until it returns less than the requeste | . | |||
d | If something other than a gzip stream is encountered after a gzip stream | |||
len. | , | |||
that remaining trailing garbage is ignored (and no error is returned). | ||||
gzread can be used to read a gzip file that is being concurrently writ | ||||
ten. | ||||
Upon reaching the end of the input, gzread will return with the availabl | ||||
e | ||||
data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, the | ||||
n | ||||
gzclearerr can be used to clear the end of file indicator in order to pe | ||||
rmit | ||||
gzread to be tried again. Z_OK indicates that a gzip stream was complet | ||||
ed | ||||
on the last gzread. Z_BUF_ERROR indicates that the input file ended in | ||||
the | ||||
middle of a gzip stream. Note that gzread does not return -1 in the eve | ||||
nt | ||||
of an incomplete gzip stream. This error is deferred until gzclose(), w | ||||
hich | ||||
will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip | ||||
stream. Alternatively, gzerror can be used before gzclose to detect thi | ||||
s | ||||
case. | ||||
gzread returns the number of uncompressed bytes actually read, less th an | gzread returns the number of uncompressed bytes actually read, less th an | |||
len for end of file, or -1 for error. | len for end of file, or -1 for error. | |||
*/ | */ | |||
ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | |||
voidpc buf, unsigned len)); | 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 written or 0 in case of | gzwrite returns the number of uncompressed bytes written or 0 in case of | |||
error. | error. | |||
*/ | */ | |||
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); | ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...) ); | |||
/* | /* | |||
Converts, formats, and writes the arguments to the compressed file und er | Converts, formats, and writes the arguments to the compressed file und er | |||
control of the format string, as in fprintf. gzprintf returns the numbe r of | control of the format string, as in fprintf. gzprintf returns the numbe r of | |||
uncompressed bytes actually written, or 0 in case of error. The number of | uncompressed bytes actually written, or 0 in case of error. The number of | |||
uncompressed bytes written is limited to 8191, or one less than the buff er | uncompressed bytes written is limited to 8191, or one less than the buff er | |||
size given to gzbuffer(). The caller should assure that this limit is n ot | size given to gzbuffer(). The caller should assure that this limit is n ot | |||
exceeded. If it is exceeded, then gzprintf() will return an error (0) w ith | exceeded. If it is exceeded, then gzprintf() will return an error (0) w ith | |||
nothing written. In this case, there may also be a buffer overflow with | nothing written. In this case, there may also be a buffer overflow with | |||
unpredictable consequences, which is possible only if zlib was compiled with | unpredictable consequences, which is possible only if zlib was compiled with | |||
the insecure functions sprintf() or vsprintf() because the secure snprin tf() | the insecure functions sprintf() or vsprintf() because the secure snprin tf() | |||
skipping to change at line 1294 | skipping to change at line 1386 | |||
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. gz putc | Writes c, converted to an unsigned char, into the compressed file. gz putc | |||
returns the value that was written, or -1 in case of error. | 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 or -1 | Reads one byte from the compressed file. gzgetc returns this byte or -1 | |||
in case of end of file or error. | in case of end of file or error. This is implemented as a macro for spe | |||
ed. | ||||
As such, it does not do all of the checking the other functions do. I.e | ||||
. | ||||
it does not check to see if file is NULL, nor whether the structure file | ||||
points to has been clobbered or not. | ||||
*/ | */ | |||
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 as the first charac ter | Push one character back onto the stream to be read as the first charac ter | |||
on the next read. At least one character of push-back is allowed. | on the next read. At least one character of push-back is allowed. | |||
gzungetc() returns the character pushed, or -1 on failure. gzungetc() w ill | gzungetc() returns the character pushed, or -1 on failure. gzungetc() w ill | |||
fail if c is -1, and may fail if a character has been pushed but not rea d | 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 | yet. If gzungetc is used immediately after gzopen or gzdopen, at least the | |||
output buffer size of pushed characters is allowed. (See gzbuffer above .) | output buffer size of pushed characters is allowed. (See gzbuffer above .) | |||
skipping to change at line 1390 | skipping to change at line 1485 | |||
is an exact multiple of the buffer size. | is an exact multiple of the buffer size. | |||
If gzeof() returns true, then the read functions will return no more d ata, | 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 | unless the end-of-file indicator is reset by gzclearerr() and the input file | |||
has grown since the previous end of file was detected. | 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 true (1) if file is being copied directly while reading, or fa lse | Returns true (1) if file is being copied directly while reading, or fa lse | |||
(0) if file is a gzip stream being decompressed. This state can change | (0) if file is a gzip stream being decompressed. | |||
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 | If the input file is empty, gzdirect() will return true, since the inp ut | |||
does not contain a gzip stream. | does not contain a gzip stream. | |||
If gzdirect() is used immediately after gzopen() or gzdopen() it will | 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 | 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 | is a gzip file. Therefore if gzbuffer() is used, it should be called be fore | |||
gzdirect(). | gzdirect(). | |||
When writing, gzdirect() returns true (1) if transparent writing was | ||||
requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: | ||||
gzdirect() is not needed when writing. Transparent writing must be | ||||
explicitly requested, so the application already knows the answer. When | ||||
linking statically, using gzdirect() will include all of the zlib code f | ||||
or | ||||
gzip file reading and decompression, which may not be desired.) | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | |||
/* | /* | |||
Flushes all pending output if necessary, closes the compressed file an d | Flushes all pending output if necessary, closes the compressed file an d | |||
deallocates the (de)compression state. Note that once file is closed, y ou | deallocates the (de)compression state. Note that once file is closed, y ou | |||
cannot call gzerror with file, since its structures have been deallocate d. | 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 | 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. | 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 | gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a | |||
file operation error, or Z_OK on success. | file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the | |||
last read ended in the middle of a gzip stream, or Z_OK on success. | ||||
*/ | */ | |||
ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); | ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); | |||
ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); | ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); | |||
/* | /* | |||
Same as gzclose(), but gzclose_r() is only for use when reading, and | 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 | 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 | 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 | compression or decompression code that is not used when only reading or only | |||
writing respectively. If gzclose() is used, then both compression and | writing respectively. If gzclose() is used, then both compression and | |||
skipping to change at line 1450 | skipping to change at line 1551 | |||
functions above that do not distinguish those cases in their return valu es. | 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 the | Clears the error and end-of-file flags for file. This is analogous to the | |||
clearerr() function in stdio. This is useful for continuing to read a g zip | clearerr() function in stdio. This is useful for continuing to read a g zip | |||
file that is being written concurrently. | file that is being written concurrently. | |||
*/ | */ | |||
#endif /* !Z_SOLO */ | ||||
/* 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 compressio n | anyway because they might be useful in applications using the compressio n | |||
library. | 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)) ; | |||
/* | /* | |||
skipping to change at line 1484 | skipping to change at line 1587 | |||
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. No | |||
te | ||||
that the z_off_t type (like off_t) is a signed integer. If len2 is | ||||
negative, the result has no meaning or utility. | ||||
*/ | */ | |||
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 Z_NULL, this function returns the required | updated CRC-32. If buf is Z_NULL, this function returns the required | |||
initial value for the for the crc. Pre- and post-conditioning (one's | initial value 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(); | |||
*/ | */ | |||
skipping to change at line 1535 | skipping to change at line 1639 | |||
int windowBits, int memLevel, | int windowBits, int memLevel, | |||
int strategy, const char *version, | int strategy, const char *version, | |||
int stream_size)); | int stream_size)); | |||
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | |||
const char *version, int stream_size) ); | const char *version, int stream_size) ); | |||
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, | |||
const char *version, | const char *version, | |||
int stream_size)); | int stream_size)); | |||
#define deflateInit(strm, level) \ | #define deflateInit(strm, level) \ | |||
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) | deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) | |||
#define inflateInit(strm) \ | #define inflateInit(strm) \ | |||
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) | inflateInit_((strm), ZLIB_VERSION, (int)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, (int)sizeof(z_stream)) | |||
#define inflateInit2(strm, windowBits) \ | #define inflateInit2(strm, windowBits) \ | |||
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) | inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ | |||
(int)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, (int)sizeof(z_stream)) | |||
#ifndef Z_SOLO | ||||
/* gzgetc() macro and its supporting function and exposed data structure. | ||||
Note | ||||
* that the real internal state is much larger than the exposed structure. | ||||
* This abbreviated structure exposes just enough for the gzgetc() macro. | ||||
The | ||||
* user should not mess with these exposed elements, since their names or | ||||
* behavior could change in the future, perhaps even capriciously. They ca | ||||
n | ||||
* only be used by the gzgetc() macro. You have been warned. | ||||
*/ | ||||
struct gzFile_s { | ||||
unsigned have; | ||||
unsigned char *next; | ||||
z_off64_t pos; | ||||
}; | ||||
ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility * | ||||
/ | ||||
#ifdef Z_PREFIX_SET | ||||
# undef z_gzgetc | ||||
# define z_gzgetc(g) \ | ||||
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g | ||||
)) | ||||
#else | ||||
# define gzgetc(g) \ | ||||
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g | ||||
)) | ||||
#endif | ||||
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or | /* 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 | * 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 | * 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 | * functions are changed to 64 bits) -- in case these are set on systems | |||
* without large file support, _LFS64_LARGEFILE must also be true | * without large file support, _LFS64_LARGEFILE must also be true | |||
*/ | */ | |||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 | #ifdef Z_LARGE64 | |||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | 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 gzseek64 OF((gzFile, z_off64_t, int)); | |||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); | |||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | |||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); | |||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); | |||
#endif | #endif | |||
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFIL | #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) | |||
E-0 | # ifdef Z_PREFIX_SET | |||
# define gzopen gzopen64 | # define z_gzopen z_gzopen64 | |||
# define gzseek gzseek64 | # define z_gzseek z_gzseek64 | |||
# define gztell gztell64 | # define z_gztell z_gztell64 | |||
# define gzoffset gzoffset64 | # define z_gzoffset z_gzoffset64 | |||
# define adler32_combine adler32_combine64 | # define z_adler32_combine z_adler32_combine64 | |||
# define crc32_combine crc32_combine64 | # define z_crc32_combine z_crc32_combine64 | |||
# ifdef _LARGEFILE64_SOURCE | # else | |||
# define gzopen gzopen64 | ||||
# define gzseek gzseek64 | ||||
# define gztell gztell64 | ||||
# define gzoffset gzoffset64 | ||||
# define adler32_combine adler32_combine64 | ||||
# define crc32_combine crc32_combine64 | ||||
# endif | ||||
# ifndef Z_LARGE64 | ||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | 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 gzseek64 OF((gzFile, z_off_t, int)); | |||
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); | ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); | |||
ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); | ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); | |||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); | |||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); | |||
# endif | # endif | |||
#else | #else | |||
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | 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 gzseek OF((gzFile, z_off_t, int)); | |||
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | |||
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); | ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); | |||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | |||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | |||
#endif | #endif | |||
#else /* Z_SOLO */ | ||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | ||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | ||||
#endif /* !Z_SOLO */ | ||||
/* hack for buggy compilers */ | /* 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;}; | struct internal_state {int dummy;}; | |||
#endif | #endif | |||
/* undocumented functions */ | /* undocumented functions */ | |||
ZEXTERN const char * ZEXPORT zError OF((int)); | ZEXTERN const char * ZEXPORT zError OF((int)); | |||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | |||
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); | ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); | |||
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | |||
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | ||||
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | ||||
#if defined(_WIN32) && !defined(Z_SOLO) | ||||
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, | ||||
const char *mode)); | ||||
#endif | ||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||||
# ifndef Z_SOLO | ||||
ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, | ||||
const char *format, | ||||
va_list va)); | ||||
# endif | ||||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* ZLIB_H */ | #endif /* ZLIB_H */ | |||
End of changes. 52 change blocks. | ||||
119 lines changed or deleted | 339 lines changed or added | |||