mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-08 11:02:17 +01:00
Merge remote-tracking branch 'pocoproject@github/develop' into mkrekease-updates
This commit is contained in:
commit
6a390fa3c5
File diff suppressed because it is too large
Load Diff
@ -111,9 +111,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.10.2"
|
||||
#define SQLITE_VERSION_NUMBER 3010002
|
||||
#define SQLITE_SOURCE_ID "2016-01-20 15:27:19 17efb4209f97fb4971656086b138599a91a75ff9"
|
||||
#define SQLITE_VERSION "3.11.1"
|
||||
#define SQLITE_VERSION_NUMBER 3011001
|
||||
#define SQLITE_SOURCE_ID "2016-03-03 16:17:53 f047920ce16971e573bc6ec9a48b118c9de2b3a7"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
@ -347,7 +347,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
||||
** from [sqlite3_malloc()] and passed back through the 5th parameter.
|
||||
** To avoid memory leaks, the application should invoke [sqlite3_free()]
|
||||
** on error message strings returned through the 5th parameter of
|
||||
** of sqlite3_exec() after the error message string is no longer needed.
|
||||
** sqlite3_exec() after the error message string is no longer needed.
|
||||
** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
|
||||
** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
|
||||
** NULL before returning.
|
||||
@ -5697,7 +5697,7 @@ struct sqlite3_index_info {
|
||||
/* Inputs */
|
||||
int nConstraint; /* Number of entries in aConstraint */
|
||||
struct sqlite3_index_constraint {
|
||||
int iColumn; /* Column on left-hand side of constraint */
|
||||
int iColumn; /* Column constrained. -1 for ROWID */
|
||||
unsigned char op; /* Constraint operator */
|
||||
unsigned char usable; /* True if this constraint is usable */
|
||||
int iTermOffset; /* Used internally - xBestIndex should ignore */
|
||||
@ -8193,6 +8193,9 @@ struct Fts5PhraseIter {
|
||||
** an OOM condition or IO error), an appropriate SQLite error code is
|
||||
** returned.
|
||||
**
|
||||
** This function may be quite inefficient if used with an FTS5 table
|
||||
** created with the "columnsize=0" option.
|
||||
**
|
||||
** xColumnText:
|
||||
** This function attempts to retrieve the text of column iCol of the
|
||||
** current document. If successful, (*pz) is set to point to a buffer
|
||||
@ -8213,15 +8216,29 @@ struct Fts5PhraseIter {
|
||||
** the query within the current row. Return SQLITE_OK if successful, or
|
||||
** an error code (i.e. SQLITE_NOMEM) if an error occurs.
|
||||
**
|
||||
** This API can be quite slow if used with an FTS5 table created with the
|
||||
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
||||
** with either "detail=none" or "detail=column" and "content=" option
|
||||
** (i.e. if it is a contentless table), then this API always returns 0.
|
||||
**
|
||||
** xInst:
|
||||
** Query for the details of phrase match iIdx within the current row.
|
||||
** Phrase matches are numbered starting from zero, so the iIdx argument
|
||||
** should be greater than or equal to zero and smaller than the value
|
||||
** output by xInstCount().
|
||||
**
|
||||
** Usually, output parameter *piPhrase is set to the phrase number, *piCol
|
||||
** to the column in which it occurs and *piOff the token offset of the
|
||||
** first token of the phrase. The exception is if the table was created
|
||||
** with the offsets=0 option specified. In this case *piOff is always
|
||||
** set to -1.
|
||||
**
|
||||
** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM)
|
||||
** if an error occurs.
|
||||
**
|
||||
** This API can be quite slow if used with an FTS5 table created with the
|
||||
** "detail=none" or "detail=column" option.
|
||||
**
|
||||
** xRowid:
|
||||
** Returns the rowid of the current row.
|
||||
**
|
||||
@ -8305,7 +8322,7 @@ struct Fts5PhraseIter {
|
||||
** Fts5PhraseIter iter;
|
||||
** int iCol, iOff;
|
||||
** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);
|
||||
** iOff>=0;
|
||||
** iCol>=0;
|
||||
** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
|
||||
** ){
|
||||
** // An instance of phrase iPhrase at offset iOff of column iCol
|
||||
@ -8313,13 +8330,51 @@ struct Fts5PhraseIter {
|
||||
**
|
||||
** The Fts5PhraseIter structure is defined above. Applications should not
|
||||
** modify this structure directly - it should only be used as shown above
|
||||
** with the xPhraseFirst() and xPhraseNext() API methods.
|
||||
** with the xPhraseFirst() and xPhraseNext() API methods (and by
|
||||
** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
|
||||
**
|
||||
** This API can be quite slow if used with an FTS5 table created with the
|
||||
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
||||
** with either "detail=none" or "detail=column" and "content=" option
|
||||
** (i.e. if it is a contentless table), then this API always iterates
|
||||
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
||||
**
|
||||
** xPhraseNext()
|
||||
** See xPhraseFirst above.
|
||||
**
|
||||
** xPhraseFirstColumn()
|
||||
** This function and xPhraseNextColumn() are similar to the xPhraseFirst()
|
||||
** and xPhraseNext() APIs described above. The difference is that instead
|
||||
** of iterating through all instances of a phrase in the current row, these
|
||||
** APIs are used to iterate through the set of columns in the current row
|
||||
** that contain one or more instances of a specified phrase. For example:
|
||||
**
|
||||
** Fts5PhraseIter iter;
|
||||
** int iCol;
|
||||
** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);
|
||||
** iCol>=0;
|
||||
** pApi->xPhraseNextColumn(pFts, &iter, &iCol)
|
||||
** ){
|
||||
** // Column iCol contains at least one instance of phrase iPhrase
|
||||
** }
|
||||
**
|
||||
** This API can be quite slow if used with an FTS5 table created with the
|
||||
** "detail=none" option. If the FTS5 table is created with either
|
||||
** "detail=none" "content=" option (i.e. if it is a contentless table),
|
||||
** then this API always iterates through an empty set (all calls to
|
||||
** xPhraseFirstColumn() set iCol to -1).
|
||||
**
|
||||
** The information accessed using this API and its companion
|
||||
** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
|
||||
** (or xInst/xInstCount). The chief advantage of this API is that it is
|
||||
** significantly more efficient than those alternatives when used with
|
||||
** "detail=column" tables.
|
||||
**
|
||||
** xPhraseNextColumn()
|
||||
** See xPhraseFirstColumn above.
|
||||
*/
|
||||
struct Fts5ExtensionApi {
|
||||
int iVersion; /* Currently always set to 1 */
|
||||
int iVersion; /* Currently always set to 3 */
|
||||
|
||||
void *(*xUserData)(Fts5Context*);
|
||||
|
||||
@ -8349,8 +8404,11 @@ struct Fts5ExtensionApi {
|
||||
int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));
|
||||
void *(*xGetAuxdata)(Fts5Context*, int bClear);
|
||||
|
||||
void (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
|
||||
int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
|
||||
void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);
|
||||
|
||||
int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
|
||||
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/MemoryStream.h"
|
||||
#include "Poco/ByteOrder.h"
|
||||
#include <vector>
|
||||
#include <istream>
|
||||
|
||||
@ -151,6 +152,32 @@ public:
|
||||
/// Returns the number of available bytes in the stream.
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
BinaryReader& read(T& value, bool flipBytes)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (flipBytes) value = ByteOrder::flipBytes(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void read7BitEncoded(T& value)
|
||||
{
|
||||
char c;
|
||||
value = 0;
|
||||
int s = 0;
|
||||
do
|
||||
{
|
||||
c = 0;
|
||||
_istr.read(&c, 1);
|
||||
T x = (c & 0x7F);
|
||||
x <<= s;
|
||||
value += x;
|
||||
s += 7;
|
||||
}
|
||||
while (c & 0x80);
|
||||
}
|
||||
|
||||
std::istream& _istr;
|
||||
bool _flipBytes;
|
||||
TextConverter* _pTextConverter;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/MemoryStream.h"
|
||||
#include "Poco/ByteOrder.h"
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
@ -160,6 +161,36 @@ public:
|
||||
/// either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER.
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
BinaryWriter& write(T value, bool flipBytes)
|
||||
{
|
||||
if (flipBytes)
|
||||
{
|
||||
T fValue = ByteOrder::flipBytes(value);
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void write7BitEncoded(T value)
|
||||
{
|
||||
do
|
||||
{
|
||||
unsigned char c = (unsigned char) (value & 0x7F);
|
||||
value >>= 7;
|
||||
if (value) c |= 0x80;
|
||||
_ostr.write((const char*) &c, 1);
|
||||
}
|
||||
while (value);
|
||||
}
|
||||
|
||||
BinaryWriter& write(const char* value, std::size_t length);
|
||||
|
||||
std::ostream& _ostr;
|
||||
bool _flipBytes;
|
||||
TextConverter* _pTextConverter;
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <stdlib.h> // builtins
|
||||
#endif
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
@ -38,6 +37,8 @@ public:
|
||||
static UInt16 flipBytes(UInt16 value);
|
||||
static Int32 flipBytes(Int32 value);
|
||||
static UInt32 flipBytes(UInt32 value);
|
||||
static float flipBytes(float value);
|
||||
static double flipBytes(double value);
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
static Int64 flipBytes(Int64 value);
|
||||
static UInt64 flipBytes(UInt64 value);
|
||||
@ -96,6 +97,21 @@ public:
|
||||
static Int64 fromNetwork(Int64 value);
|
||||
static UInt64 fromNetwork (UInt64 value);
|
||||
#endif
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
static T flip(T value)
|
||||
{
|
||||
T flip = value;
|
||||
std::size_t halfSize = sizeof(T) / 2;
|
||||
char* flipP = reinterpret_cast<char*>(&flip);
|
||||
|
||||
for (std::size_t i = 0; i < halfSize; i++)
|
||||
{
|
||||
std::swap(flipP[i], flipP[sizeof(T) - i - 1]);
|
||||
}
|
||||
return flip;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -152,6 +168,18 @@ inline Int32 ByteOrder::flipBytes(Int32 value)
|
||||
}
|
||||
|
||||
|
||||
inline float ByteOrder::flipBytes(float value)
|
||||
{
|
||||
return flip(value);
|
||||
}
|
||||
|
||||
|
||||
inline double ByteOrder::flipBytes(double value)
|
||||
{
|
||||
return flip(value);
|
||||
}
|
||||
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
inline UInt64 ByteOrder::flipBytes(UInt64 value)
|
||||
{
|
||||
|
@ -62,9 +62,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Optional(const C& value):
|
||||
Optional(const C& rValue):
|
||||
/// Creates a Optional with the given value.
|
||||
_value(value),
|
||||
_value(rValue),
|
||||
_isSpecified(true)
|
||||
{
|
||||
}
|
||||
@ -81,10 +81,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Optional& assign(const C& value)
|
||||
Optional& assign(const C& rValue)
|
||||
/// Assigns a value to the Optional.
|
||||
{
|
||||
_value = value;
|
||||
_value = rValue;
|
||||
_isSpecified = true;
|
||||
return *this;
|
||||
}
|
||||
@ -97,9 +97,9 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
Optional& operator = (const C& value)
|
||||
Optional& operator = (const C& rValue)
|
||||
{
|
||||
return assign(value);
|
||||
return assign(rValue);
|
||||
}
|
||||
|
||||
Optional& operator = (const Optional& other)
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
|
||||
#include "Poco/BinaryReader.h"
|
||||
#include "Poco/ByteOrder.h"
|
||||
#include "Poco/TextEncoding.h"
|
||||
#include "Poco/TextConverter.h"
|
||||
#include <algorithm>
|
||||
@ -56,119 +55,81 @@ BinaryReader::~BinaryReader()
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (bool& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return read(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (char& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return read(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (unsigned char& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return read(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (signed char& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return read(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (short& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (unsigned short& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (int& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (unsigned int& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (long& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
#if defined(POCO_LONG_IS_64_BIT)
|
||||
if (_flipBytes) value = ByteOrder::flipBytes((Int64) value);
|
||||
return read((Int64&) value, _flipBytes);
|
||||
#else
|
||||
if (_flipBytes) value = ByteOrder::flipBytes((Int32) value);
|
||||
return read((Int32&) value, _flipBytes);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (unsigned long& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
#if defined(POCO_LONG_IS_64_BIT)
|
||||
if (_flipBytes) value = ByteOrder::flipBytes((UInt64) value);
|
||||
return read((UInt64&) value, _flipBytes);
|
||||
#else
|
||||
if (_flipBytes) value = ByteOrder::flipBytes((UInt32) value);
|
||||
return read((UInt32&) value, _flipBytes);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (float& value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
char* ptr = (char*) &value;
|
||||
ptr += sizeof(value);
|
||||
for (unsigned i = 0; i < sizeof(value); ++i)
|
||||
_istr.read(--ptr, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (double& value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
char* ptr = (char*) &value;
|
||||
ptr += sizeof(value);
|
||||
for (unsigned i = 0; i < sizeof(value); ++i)
|
||||
_istr.read(--ptr, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
@ -177,17 +138,13 @@ BinaryReader& BinaryReader::operator >> (double& value)
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (Int64& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (UInt64& value)
|
||||
{
|
||||
_istr.read((char*) &value, sizeof(value));
|
||||
if (_flipBytes) value = ByteOrder::flipBytes(value);
|
||||
return *this;
|
||||
return read(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
@ -196,17 +153,11 @@ BinaryReader& BinaryReader::operator >> (UInt64& value)
|
||||
|
||||
BinaryReader& BinaryReader::operator >> (std::string& value)
|
||||
{
|
||||
if (!_istr.good()) return *this;
|
||||
|
||||
UInt32 size = 0;
|
||||
read7BitEncoded(size);
|
||||
value.clear();
|
||||
if (!_istr.good()) return *this;
|
||||
value.reserve(size);
|
||||
while (size--)
|
||||
{
|
||||
char c;
|
||||
if (!_istr.read(&c, 1).good()) break;
|
||||
value += c;
|
||||
}
|
||||
readRaw(size, value);
|
||||
if (_pTextConverter)
|
||||
{
|
||||
std::string converted;
|
||||
@ -219,19 +170,7 @@ BinaryReader& BinaryReader::operator >> (std::string& value)
|
||||
|
||||
void BinaryReader::read7BitEncoded(UInt32& value)
|
||||
{
|
||||
char c;
|
||||
value = 0;
|
||||
int s = 0;
|
||||
do
|
||||
{
|
||||
c = 0;
|
||||
_istr.read(&c, 1);
|
||||
UInt32 x = (c & 0x7F);
|
||||
x <<= s;
|
||||
value += x;
|
||||
s += 7;
|
||||
}
|
||||
while (c & 0x80);
|
||||
read7BitEncoded<UInt32>(value);
|
||||
}
|
||||
|
||||
|
||||
@ -240,19 +179,7 @@ void BinaryReader::read7BitEncoded(UInt32& value)
|
||||
|
||||
void BinaryReader::read7BitEncoded(UInt64& value)
|
||||
{
|
||||
char c;
|
||||
value = 0;
|
||||
int s = 0;
|
||||
do
|
||||
{
|
||||
c = 0;
|
||||
_istr.read(&c, 1);
|
||||
UInt64 x = (c & 0x7F);
|
||||
x <<= s;
|
||||
value += x;
|
||||
s += 7;
|
||||
}
|
||||
while (c & 0x80);
|
||||
read7BitEncoded<UInt64>(value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
|
||||
#include "Poco/BinaryWriter.h"
|
||||
#include "Poco/ByteOrder.h"
|
||||
#include "Poco/TextEncoding.h"
|
||||
#include "Poco/TextConverter.h"
|
||||
#include <cstring>
|
||||
@ -56,161 +55,81 @@ BinaryWriter::~BinaryWriter()
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (bool value)
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return write(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (char value)
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return write(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (unsigned char value)
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return write(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (signed char value)
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
return *this;
|
||||
return write(value, false);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (short value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
short fValue = ByteOrder::flipBytes(value);
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (unsigned short value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
unsigned short fValue = ByteOrder::flipBytes(value);
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (int value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
int fValue = ByteOrder::flipBytes(value);
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (unsigned int value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
unsigned int fValue = ByteOrder::flipBytes(value);
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (long value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
#if defined(POCO_LONG_IS_64_BIT)
|
||||
long fValue = ByteOrder::flipBytes((Int64) value);
|
||||
return write((Int64) value, _flipBytes);
|
||||
#else
|
||||
long fValue = ByteOrder::flipBytes((Int32) value);
|
||||
return write((Int32) value, _flipBytes);
|
||||
#endif
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (unsigned long value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
#if defined(POCO_LONG_IS_64_BIT)
|
||||
long fValue = ByteOrder::flipBytes((UInt64) value);
|
||||
return write((UInt64) value, _flipBytes);
|
||||
#else
|
||||
long fValue = ByteOrder::flipBytes((UInt32) value);
|
||||
return write((UInt32) value, _flipBytes);
|
||||
#endif
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (float value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
const char* ptr = (const char*) &value;
|
||||
ptr += sizeof(value);
|
||||
for (unsigned i = 0; i < sizeof(value); ++i)
|
||||
_ostr.write(--ptr, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (double value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
const char* ptr = (const char*) &value;
|
||||
ptr += sizeof(value);
|
||||
for (unsigned i = 0; i < sizeof(value); ++i)
|
||||
_ostr.write(--ptr, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
@ -219,31 +138,13 @@ BinaryWriter& BinaryWriter::operator << (double value)
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (Int64 value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
Int64 fValue = ByteOrder::flipBytes(value);
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (UInt64 value)
|
||||
{
|
||||
if (_flipBytes)
|
||||
{
|
||||
UInt64 fValue = ByteOrder::flipBytes(value);
|
||||
_ostr.write((const char*) &fValue, sizeof(fValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ostr.write((const char*) &value, sizeof(value));
|
||||
}
|
||||
return *this;
|
||||
return write(value, _flipBytes);
|
||||
}
|
||||
|
||||
|
||||
@ -252,56 +153,19 @@ BinaryWriter& BinaryWriter::operator << (UInt64 value)
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (const std::string& value)
|
||||
{
|
||||
if (_pTextConverter)
|
||||
{
|
||||
std::string converted;
|
||||
_pTextConverter->convert(value, converted);
|
||||
UInt32 length = (UInt32) converted.size();
|
||||
write7BitEncoded(length);
|
||||
_ostr.write(converted.data(), length);
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 length = (UInt32) value.size();
|
||||
write7BitEncoded(length);
|
||||
_ostr.write(value.data(), length);
|
||||
}
|
||||
return *this;
|
||||
return write(value.c_str(), value.length());
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::operator << (const char* value)
|
||||
{
|
||||
poco_check_ptr (value);
|
||||
|
||||
if (_pTextConverter)
|
||||
{
|
||||
std::string converted;
|
||||
_pTextConverter->convert(value, static_cast<int>(std::strlen(value)), converted);
|
||||
UInt32 length = (UInt32) converted.size();
|
||||
write7BitEncoded(length);
|
||||
_ostr.write(converted.data(), length);
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 length = static_cast<UInt32>(std::strlen(value));
|
||||
write7BitEncoded(length);
|
||||
_ostr.write(value, length);
|
||||
}
|
||||
return *this;
|
||||
return write(value, std::strlen(value));
|
||||
}
|
||||
|
||||
|
||||
void BinaryWriter::write7BitEncoded(UInt32 value)
|
||||
{
|
||||
do
|
||||
{
|
||||
unsigned char c = (unsigned char) (value & 0x7F);
|
||||
value >>= 7;
|
||||
if (value) c |= 0x80;
|
||||
_ostr.write((const char*) &c, 1);
|
||||
}
|
||||
while (value);
|
||||
write7BitEncoded<UInt32>(value);
|
||||
}
|
||||
|
||||
|
||||
@ -310,14 +174,7 @@ void BinaryWriter::write7BitEncoded(UInt32 value)
|
||||
|
||||
void BinaryWriter::write7BitEncoded(UInt64 value)
|
||||
{
|
||||
do
|
||||
{
|
||||
unsigned char c = (unsigned char) (value & 0x7F);
|
||||
value >>= 7;
|
||||
if (value) c |= 0x80;
|
||||
_ostr.write((const char*) &c, 1);
|
||||
}
|
||||
while (value);
|
||||
write7BitEncoded<UInt64>(value);
|
||||
}
|
||||
|
||||
|
||||
@ -350,4 +207,26 @@ void BinaryWriter::flush()
|
||||
}
|
||||
|
||||
|
||||
BinaryWriter& BinaryWriter::write(const char* value, std::size_t length)
|
||||
{
|
||||
poco_check_ptr (value);
|
||||
|
||||
if (_pTextConverter)
|
||||
{
|
||||
std::string converted;
|
||||
_pTextConverter->convert(value, static_cast<int>(length), converted);
|
||||
UInt32 convertedLength = (UInt32) converted.length();
|
||||
write7BitEncoded(convertedLength);
|
||||
_ostr.write(converted.data(), convertedLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 lengthUInt32 = static_cast<UInt32>(length);
|
||||
write7BitEncoded(lengthUInt32);
|
||||
_ostr.write(value, lengthUInt32);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
@ -67,6 +67,46 @@ void ByteOrderTest::testByteOrderFlip()
|
||||
flip = ByteOrder::flipBytes(flip);
|
||||
assert (flip == norm);
|
||||
}
|
||||
{
|
||||
unsigned char c = 0x00;
|
||||
float norm = 0;
|
||||
unsigned char* normP = reinterpret_cast<unsigned char*>(&norm);
|
||||
for (unsigned i = 0; i < sizeof(float); i++)
|
||||
{
|
||||
normP[i] |= c;
|
||||
c += 0x11;
|
||||
}
|
||||
|
||||
float flip = ByteOrder::flipBytes(norm);
|
||||
unsigned char* flipP = reinterpret_cast<unsigned char*>(&flip);
|
||||
for (unsigned i = 0; i < sizeof(float); i++)
|
||||
{
|
||||
assert(normP[i] == flipP[sizeof(float) - 1 - i]);
|
||||
}
|
||||
|
||||
flip = ByteOrder::flipBytes(flip);
|
||||
assert (flip == norm);
|
||||
}
|
||||
{
|
||||
unsigned char c = 0x00;
|
||||
double norm = 0;
|
||||
unsigned char* normP = reinterpret_cast<unsigned char*>(&norm);
|
||||
for (unsigned i = 0; i < sizeof(double); i++)
|
||||
{
|
||||
normP[i] |= c;
|
||||
c += 0x11;
|
||||
}
|
||||
|
||||
double flip = ByteOrder::flipBytes(norm);
|
||||
unsigned char* flipP = reinterpret_cast<unsigned char*>(&flip);
|
||||
for (unsigned i = 0; i < sizeof(double); i++)
|
||||
{
|
||||
assert(normP[i] == flipP[sizeof(double) - 1 - i]);
|
||||
}
|
||||
|
||||
flip = ByteOrder::flipBytes(flip);
|
||||
assert (flip == norm);
|
||||
}
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
{
|
||||
Int64 norm = (Int64(0x8899AABB) << 32) + 0xCCDDEEFF;
|
||||
|
@ -214,9 +214,9 @@ void MailMessage::addRecipient(const MailRecipient& recipient)
|
||||
}
|
||||
|
||||
|
||||
void MailMessage::setRecipients(const Recipients& recipients)
|
||||
void MailMessage::setRecipients(const Recipients& rRecipients)
|
||||
{
|
||||
_recipients.assign(recipients.begin(), recipients.end());
|
||||
_recipients.assign(rRecipients.begin(), rRecipients.end());
|
||||
}
|
||||
|
||||
|
||||
@ -326,12 +326,12 @@ void MailMessage::addAttachment(const std::string& name, PartSource* pSource, Co
|
||||
}
|
||||
|
||||
|
||||
void MailMessage::read(std::istream& istr, PartHandler& handler)
|
||||
void MailMessage::read(std::istream& istr, PartHandler& rHandler)
|
||||
{
|
||||
readHeader(istr);
|
||||
if (isMultipart())
|
||||
{
|
||||
readMultipart(istr, handler);
|
||||
readMultipart(istr, rHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -41,8 +41,8 @@ Context::Params::Params():
|
||||
}
|
||||
|
||||
|
||||
Context::Context(Usage usage, const Params& params):
|
||||
_usage(usage),
|
||||
Context::Context(Usage contextUsage, const Params& params):
|
||||
_usage(contextUsage),
|
||||
_mode(params.verificationMode),
|
||||
_pSSLContext(0),
|
||||
_extendedCertificateVerification(true)
|
||||
@ -52,16 +52,16 @@ Context::Context(Usage usage, const Params& params):
|
||||
|
||||
|
||||
Context::Context(
|
||||
Usage usage,
|
||||
Usage contextUsage,
|
||||
const std::string& privateKeyFile,
|
||||
const std::string& certificateFile,
|
||||
const std::string& caLocation,
|
||||
VerificationMode verificationMode,
|
||||
VerificationMode mode,
|
||||
int verificationDepth,
|
||||
bool loadDefaultCAs,
|
||||
const std::string& cipherList):
|
||||
_usage(usage),
|
||||
_mode(verificationMode),
|
||||
_usage(contextUsage),
|
||||
_mode(mode),
|
||||
_pSSLContext(0),
|
||||
_extendedCertificateVerification(true)
|
||||
{
|
||||
@ -69,7 +69,7 @@ Context::Context(
|
||||
params.privateKeyFile = privateKeyFile;
|
||||
params.certificateFile = certificateFile;
|
||||
params.caLocation = caLocation;
|
||||
params.verificationMode = verificationMode;
|
||||
params.verificationMode = mode;
|
||||
params.verificationDepth = verificationDepth;
|
||||
params.loadDefaultCAs = loadDefaultCAs;
|
||||
params.cipherList = cipherList;
|
||||
@ -78,20 +78,20 @@ Context::Context(
|
||||
|
||||
|
||||
Context::Context(
|
||||
Usage usage,
|
||||
Usage contextUsage,
|
||||
const std::string& caLocation,
|
||||
VerificationMode verificationMode,
|
||||
VerificationMode mode,
|
||||
int verificationDepth,
|
||||
bool loadDefaultCAs,
|
||||
const std::string& cipherList):
|
||||
_usage(usage),
|
||||
_mode(verificationMode),
|
||||
_usage(contextUsage),
|
||||
_mode(mode),
|
||||
_pSSLContext(0),
|
||||
_extendedCertificateVerification(true)
|
||||
{
|
||||
Params params;
|
||||
params.caLocation = caLocation;
|
||||
params.verificationMode = verificationMode;
|
||||
params.verificationMode = mode;
|
||||
params.verificationDepth = verificationDepth;
|
||||
params.loadDefaultCAs = loadDefaultCAs;
|
||||
params.cipherList = cipherList;
|
||||
|
@ -41,17 +41,17 @@ HTTPSClientSession::HTTPSClientSession():
|
||||
}
|
||||
|
||||
|
||||
HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket):
|
||||
HTTPClientSession(socket),
|
||||
_pContext(socket.context())
|
||||
HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& rSocket):
|
||||
HTTPClientSession(rSocket),
|
||||
_pContext(rSocket.context())
|
||||
{
|
||||
setPort(HTTPS_PORT);
|
||||
}
|
||||
|
||||
|
||||
HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket, Session::Ptr pSession):
|
||||
HTTPClientSession(socket),
|
||||
_pContext(socket.context()),
|
||||
HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& rSocket, Session::Ptr pSession):
|
||||
HTTPClientSession(rSocket),
|
||||
_pContext(rSocket.context()),
|
||||
_pSession(pSession)
|
||||
{
|
||||
setPort(HTTPS_PORT);
|
||||
|
@ -24,8 +24,8 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
SecureSMTPClientSession::SecureSMTPClientSession(const StreamSocket& socket):
|
||||
SMTPClientSession(socket)
|
||||
SecureSMTPClientSession::SecureSMTPClientSession(const StreamSocket& rSocket):
|
||||
SMTPClientSession(rSocket)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,18 +48,18 @@ SecureServerSocket::SecureServerSocket(const Socket& socket):
|
||||
}
|
||||
|
||||
|
||||
SecureServerSocket::SecureServerSocket(const SocketAddress& address, int backlog):
|
||||
SecureServerSocket::SecureServerSocket(const SocketAddress& rAddress, int backlog):
|
||||
ServerSocket(new SecureServerSocketImpl(SSLManager::instance().defaultServerContext()), true)
|
||||
{
|
||||
impl()->bind(address, true);
|
||||
impl()->bind(rAddress, true);
|
||||
impl()->listen(backlog);
|
||||
}
|
||||
|
||||
|
||||
SecureServerSocket::SecureServerSocket(const SocketAddress& address, int backlog, Context::Ptr pContext):
|
||||
SecureServerSocket::SecureServerSocket(const SocketAddress& rAddress, int backlog, Context::Ptr pContext):
|
||||
ServerSocket(new SecureServerSocketImpl(pContext), true)
|
||||
{
|
||||
impl()->bind(address, true);
|
||||
impl()->bind(rAddress, true);
|
||||
impl()->listen(backlog);
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ SecureServerSocket::SecureServerSocket(Poco::UInt16 port, int backlog):
|
||||
ServerSocket(new SecureServerSocketImpl(SSLManager::instance().defaultServerContext()), true)
|
||||
{
|
||||
IPAddress wildcardAddr;
|
||||
SocketAddress address(wildcardAddr, port);
|
||||
impl()->bind(address, true);
|
||||
SocketAddress socketAddress(wildcardAddr, port);
|
||||
impl()->bind(socketAddress, true);
|
||||
impl()->listen(backlog);
|
||||
}
|
||||
|
||||
@ -77,8 +77,8 @@ SecureServerSocket::SecureServerSocket(Poco::UInt16 port, int backlog, Context::
|
||||
ServerSocket(new SecureServerSocketImpl(pContext), true)
|
||||
{
|
||||
IPAddress wildcardAddr;
|
||||
SocketAddress address(wildcardAddr, port);
|
||||
impl()->bind(address, true);
|
||||
SocketAddress socketAddress(wildcardAddr, port);
|
||||
impl()->bind(socketAddress, true);
|
||||
impl()->listen(backlog);
|
||||
}
|
||||
|
||||
|
@ -46,27 +46,27 @@ SocketImpl* SecureServerSocketImpl::acceptConnection(SocketAddress& clientAddr)
|
||||
}
|
||||
|
||||
|
||||
void SecureServerSocketImpl::connect(const SocketAddress& address)
|
||||
void SecureServerSocketImpl::connect(const SocketAddress& rAddress)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket");
|
||||
}
|
||||
|
||||
|
||||
void SecureServerSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout)
|
||||
void SecureServerSocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket");
|
||||
}
|
||||
|
||||
|
||||
void SecureServerSocketImpl::connectNB(const SocketAddress& address)
|
||||
void SecureServerSocketImpl::connectNB(const SocketAddress& rAddress)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket");
|
||||
}
|
||||
|
||||
|
||||
void SecureServerSocketImpl::bind(const SocketAddress& address, bool reuseAddress)
|
||||
void SecureServerSocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress)
|
||||
{
|
||||
_impl.bind(address, reuseAddress);
|
||||
_impl.bind(rAddress, reuseAddress);
|
||||
reset(_impl.sockfd());
|
||||
}
|
||||
|
||||
@ -97,13 +97,13 @@ int SecureServerSocketImpl::receiveBytes(void* buffer, int length, int flags)
|
||||
}
|
||||
|
||||
|
||||
int SecureServerSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags)
|
||||
int SecureServerSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot sendTo() on a SecureServerSocket");
|
||||
}
|
||||
|
||||
|
||||
int SecureServerSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags)
|
||||
int SecureServerSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot receiveFrom() on a SecureServerSocket");
|
||||
}
|
||||
|
@ -47,50 +47,50 @@ SecureStreamSocket::SecureStreamSocket(Context::Ptr pContext, Session::Ptr pSess
|
||||
}
|
||||
|
||||
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address):
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress):
|
||||
StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
|
||||
{
|
||||
connect(address);
|
||||
connect(rAddress);
|
||||
}
|
||||
|
||||
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName):
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, const std::string& hostName):
|
||||
StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
|
||||
{
|
||||
static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
|
||||
connect(address);
|
||||
connect(rAddress);
|
||||
}
|
||||
|
||||
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext):
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, Context::Ptr pContext):
|
||||
StreamSocket(new SecureStreamSocketImpl(pContext))
|
||||
{
|
||||
connect(address);
|
||||
connect(rAddress);
|
||||
}
|
||||
|
||||
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext, Session::Ptr pSession):
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, Context::Ptr pContext, Session::Ptr pSession):
|
||||
StreamSocket(new SecureStreamSocketImpl(pContext))
|
||||
{
|
||||
useSession(pSession);
|
||||
connect(address);
|
||||
connect(rAddress);
|
||||
}
|
||||
|
||||
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext):
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, const std::string& hostName, Context::Ptr pContext):
|
||||
StreamSocket(new SecureStreamSocketImpl(pContext))
|
||||
{
|
||||
static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
|
||||
connect(address);
|
||||
connect(rAddress);
|
||||
}
|
||||
|
||||
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession):
|
||||
SecureStreamSocket::SecureStreamSocket(const SocketAddress& rAddress, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession):
|
||||
StreamSocket(new SecureStreamSocketImpl(pContext))
|
||||
{
|
||||
static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
|
||||
useSession(pSession);
|
||||
connect(address);
|
||||
connect(rAddress);
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,23 +64,23 @@ void SecureStreamSocketImpl::acceptSSL()
|
||||
}
|
||||
|
||||
|
||||
void SecureStreamSocketImpl::connect(const SocketAddress& address)
|
||||
void SecureStreamSocketImpl::connect(const SocketAddress& rAddress)
|
||||
{
|
||||
_impl.connect(address, !_lazyHandshake);
|
||||
_impl.connect(rAddress, !_lazyHandshake);
|
||||
reset(_impl.sockfd());
|
||||
}
|
||||
|
||||
|
||||
void SecureStreamSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout)
|
||||
void SecureStreamSocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout)
|
||||
{
|
||||
_impl.connect(address, timeout, !_lazyHandshake);
|
||||
_impl.connect(rAddress, timeout, !_lazyHandshake);
|
||||
reset(_impl.sockfd());
|
||||
}
|
||||
|
||||
|
||||
void SecureStreamSocketImpl::connectNB(const SocketAddress& address)
|
||||
void SecureStreamSocketImpl::connectNB(const SocketAddress& rAddress)
|
||||
{
|
||||
_impl.connectNB(address);
|
||||
_impl.connectNB(rAddress);
|
||||
reset(_impl.sockfd());
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ void SecureStreamSocketImpl::connectSSL()
|
||||
}
|
||||
|
||||
|
||||
void SecureStreamSocketImpl::bind(const SocketAddress& address, bool reuseAddress)
|
||||
void SecureStreamSocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot bind() a SecureStreamSocketImpl");
|
||||
}
|
||||
@ -129,13 +129,13 @@ int SecureStreamSocketImpl::receiveBytes(void* buffer, int length, int flags)
|
||||
}
|
||||
|
||||
|
||||
int SecureStreamSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags)
|
||||
int SecureStreamSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot sendTo() on a SecureStreamSocketImpl");
|
||||
}
|
||||
|
||||
|
||||
int SecureStreamSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags)
|
||||
int SecureStreamSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot receiveFrom() on a SecureStreamSocketImpl");
|
||||
}
|
||||
|
@ -111,11 +111,11 @@ bool X509Certificate::verify(const Poco::Crypto::X509Certificate& certificate, c
|
||||
// compare by IP
|
||||
const HostEntry& heData = DNS::resolve(*it);
|
||||
const HostEntry::AddressList& addr = heData.addresses();
|
||||
HostEntry::AddressList::const_iterator it = addr.begin();
|
||||
HostEntry::AddressList::const_iterator itAddr = addr.begin();
|
||||
HostEntry::AddressList::const_iterator itEnd = addr.end();
|
||||
for (; it != itEnd && !ok; ++it)
|
||||
for (; itAddr != itEnd && !ok; ++itAddr)
|
||||
{
|
||||
ok = (*it == ip);
|
||||
ok = (*itAddr == ip);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -712,14 +712,14 @@ void XMLWriter::declareNamespaces(const XMLString& namespaceURI, const XMLString
|
||||
bool defaultNameSpaceUsed = false;
|
||||
XMLString defaultNamespaceURI = _namespaces.getURI(std::string());
|
||||
XMLString local;
|
||||
XMLString prefix;
|
||||
XMLString prefixString;
|
||||
XMLString elementNamespaceURI = namespaceURI;
|
||||
Name::split(qname, prefix, local);
|
||||
Name::split(qname, prefixString, local);
|
||||
if (elementNamespaceURI.empty())
|
||||
elementNamespaceURI = _namespaces.getURI(prefix);
|
||||
elementNamespaceURI = _namespaces.getURI(prefixString);
|
||||
if (!elementNamespaceURI.empty())
|
||||
{
|
||||
usedNamespaces[prefix].insert(elementNamespaceURI);
|
||||
usedNamespaces[prefixString].insert(elementNamespaceURI);
|
||||
if (!defaultNamespaceURI.empty() && elementNamespaceURI == defaultNamespaceURI)
|
||||
defaultNameSpaceUsed = true;
|
||||
}
|
||||
@ -733,7 +733,7 @@ void XMLWriter::declareNamespaces(const XMLString& namespaceURI, const XMLString
|
||||
XMLString attributeLocal;
|
||||
Name::split(attributeQName, attributePrefix, attributeLocal);
|
||||
if (attributeNamespaceURI.empty())
|
||||
attributeNamespaceURI = _namespaces.getURI(prefix);
|
||||
attributeNamespaceURI = _namespaces.getURI(prefixString);
|
||||
if (!attributeNamespaceURI.empty())
|
||||
{
|
||||
usedNamespaces[attributePrefix].insert(attributeNamespaceURI);
|
||||
|
Loading…
Reference in New Issue
Block a user