mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
GH #1050 Foundation: fix gcc -Wshadow warnings
This commit is contained in:
@@ -162,17 +162,17 @@ class BasicMemoryBinaryReader : public BinaryReader
|
||||
/// A convenient wrapper for using Buffer and MemoryStream with BinaryReader.
|
||||
{
|
||||
public:
|
||||
BasicMemoryBinaryReader(const Buffer<T>& data, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
|
||||
BinaryReader(_istr, byteOrder),
|
||||
_data(data),
|
||||
_istr(data.begin(), data.capacity())
|
||||
BasicMemoryBinaryReader(const Buffer<T>& dataBuffer, StreamByteOrder order = NATIVE_BYTE_ORDER):
|
||||
BinaryReader(_istr, order),
|
||||
_data(dataBuffer),
|
||||
_istr(dataBuffer.begin(), dataBuffer.capacity())
|
||||
{
|
||||
}
|
||||
|
||||
BasicMemoryBinaryReader(const Buffer<T>& data, TextEncoding& encoding, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
|
||||
BinaryReader(_istr, encoding, byteOrder),
|
||||
_data(data),
|
||||
_istr(data.begin(), data.capacity())
|
||||
BasicMemoryBinaryReader(const Buffer<T>& dataBuffer, TextEncoding& encoding, StreamByteOrder order = NATIVE_BYTE_ORDER):
|
||||
BinaryReader(_istr, encoding, order),
|
||||
_data(dataBuffer),
|
||||
_istr(dataBuffer.begin(), dataBuffer.capacity())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ public:
|
||||
LITTLE_ENDIAN_BYTE_ORDER = 3 /// little-endian byte-order
|
||||
};
|
||||
|
||||
BinaryWriter(std::ostream& ostr, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER);
|
||||
BinaryWriter(std::ostream& ostr, StreamByteOrder order = NATIVE_BYTE_ORDER);
|
||||
/// Creates the BinaryWriter.
|
||||
|
||||
BinaryWriter(std::ostream& ostr, TextEncoding& encoding, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER);
|
||||
BinaryWriter(std::ostream& ostr, TextEncoding& encoding, StreamByteOrder order = NATIVE_BYTE_ORDER);
|
||||
/// Creates the BinaryWriter using the given TextEncoding.
|
||||
///
|
||||
/// Strings will be converted from the currently set global encoding
|
||||
@@ -171,17 +171,17 @@ class BasicMemoryBinaryWriter: public BinaryWriter
|
||||
/// A convenient wrapper for using Buffer and MemoryStream with BinarWriter.
|
||||
{
|
||||
public:
|
||||
BasicMemoryBinaryWriter(Buffer<T>& data, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
|
||||
BinaryWriter(_ostr, byteOrder),
|
||||
_data(data),
|
||||
_ostr(data.begin(), data.capacity())
|
||||
BasicMemoryBinaryWriter(Buffer<T>& dataBuffer, StreamByteOrder order = NATIVE_BYTE_ORDER):
|
||||
BinaryWriter(_ostr, order),
|
||||
_data(dataBuffer),
|
||||
_ostr(dataBuffer.begin(), dataBuffer.capacity())
|
||||
{
|
||||
}
|
||||
|
||||
BasicMemoryBinaryWriter(Buffer<T>& data, TextEncoding& encoding, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
|
||||
BinaryWriter(_ostr, encoding, byteOrder),
|
||||
_data(data),
|
||||
_ostr(data.begin(), data.capacity())
|
||||
BasicMemoryBinaryWriter(Buffer<T>& dataBuffer, TextEncoding& encoding, StreamByteOrder order = NATIVE_BYTE_ORDER):
|
||||
BinaryWriter(_ostr, encoding, order),
|
||||
_data(dataBuffer),
|
||||
_ostr(dataBuffer.begin(), dataBuffer.capacity())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -38,16 +38,16 @@ class Buffer
|
||||
/// is needed.
|
||||
{
|
||||
public:
|
||||
Buffer(std::size_t capacity):
|
||||
_capacity(capacity),
|
||||
_used(capacity),
|
||||
Buffer(std::size_t length):
|
||||
_capacity(length),
|
||||
_used(length),
|
||||
_ptr(0),
|
||||
_ownMem(true)
|
||||
/// Creates and allocates the Buffer.
|
||||
{
|
||||
if (capacity > 0)
|
||||
if (length > 0)
|
||||
{
|
||||
_ptr = new T[capacity];
|
||||
_ptr = new T[length];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ public:
|
||||
typedef typename std::map<K, T>::const_iterator MapConstIterator;
|
||||
|
||||
MapConstIterator it = val.begin();
|
||||
MapConstIterator end = val.end();
|
||||
for (; it != end; ++it) _data.insert(ValueType(it->first, Var(it->second)));
|
||||
MapConstIterator itEnd = val.end();
|
||||
for (; it != itEnd; ++it) _data.insert(ValueType(it->first, Var(it->second)));
|
||||
}
|
||||
|
||||
virtual ~Struct()
|
||||
|
||||
@@ -160,16 +160,16 @@ inline int Exception::code() const
|
||||
POCO_DECLARE_EXCEPTION_CODE(API, CLS, BASE, 0)
|
||||
|
||||
#define POCO_IMPLEMENT_EXCEPTION(CLS, BASE, NAME) \
|
||||
CLS::CLS(int code): BASE(code) \
|
||||
CLS::CLS(int otherCode): BASE(otherCode) \
|
||||
{ \
|
||||
} \
|
||||
CLS::CLS(const std::string& msg, int code): BASE(msg, code) \
|
||||
CLS::CLS(const std::string& msg, int otherCode): BASE(msg, otherCode) \
|
||||
{ \
|
||||
} \
|
||||
CLS::CLS(const std::string& msg, const std::string& arg, int code): BASE(msg, arg, code) \
|
||||
CLS::CLS(const std::string& msg, const std::string& arg, int otherCode): BASE(msg, arg, otherCode) \
|
||||
{ \
|
||||
} \
|
||||
CLS::CLS(const std::string& msg, const Poco::Exception& exc, int code): BASE(msg, exc, code) \
|
||||
CLS::CLS(const std::string& msg, const Poco::Exception& exc, int otherCode): BASE(msg, exc, otherCode) \
|
||||
{ \
|
||||
} \
|
||||
CLS::CLS(const CLS& exc): BASE(exc) \
|
||||
|
||||
@@ -77,33 +77,33 @@ public:
|
||||
/// Readable event observers are notified, with true value
|
||||
/// as the argument
|
||||
|
||||
BasicFIFOBuffer(std::size_t size, bool notify = false):
|
||||
_buffer(size),
|
||||
BasicFIFOBuffer(std::size_t bufferSize, bool bufferNotify = false):
|
||||
_buffer(bufferSize),
|
||||
_begin(0),
|
||||
_used(0),
|
||||
_notify(notify),
|
||||
_notify(bufferNotify),
|
||||
_eof(false),
|
||||
_error(false)
|
||||
/// Creates the FIFOBuffer.
|
||||
{
|
||||
}
|
||||
|
||||
BasicFIFOBuffer(T* pBuffer, std::size_t size, bool notify = false):
|
||||
_buffer(pBuffer, size),
|
||||
BasicFIFOBuffer(T* pBuffer, std::size_t bufferSize, bool bufferNotify = false):
|
||||
_buffer(pBuffer, bufferSize),
|
||||
_begin(0),
|
||||
_used(0),
|
||||
_notify(notify),
|
||||
_notify(bufferNotify),
|
||||
_eof(false),
|
||||
_error(false)
|
||||
/// Creates the FIFOBuffer.
|
||||
{
|
||||
}
|
||||
|
||||
BasicFIFOBuffer(const T* pBuffer, std::size_t size, bool notify = false):
|
||||
_buffer(pBuffer, size),
|
||||
BasicFIFOBuffer(const T* pBuffer, std::size_t bufferSize, bool bufferNotify = false):
|
||||
_buffer(pBuffer, bufferSize),
|
||||
_begin(0),
|
||||
_used(size),
|
||||
_notify(notify),
|
||||
_used(bufferSize),
|
||||
_notify(bufferNotify),
|
||||
_eof(false),
|
||||
_error(false)
|
||||
/// Creates the FIFOBuffer.
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
return length;
|
||||
}
|
||||
|
||||
std::size_t peek(Poco::Buffer<T>& buffer, std::size_t length = 0) const
|
||||
std::size_t peek(Poco::Buffer<T>& rBuffer, std::size_t length = 0) const
|
||||
/// Peeks into the data currently in the FIFO
|
||||
/// without actually extracting it.
|
||||
/// Resizes the supplied buffer to the size of
|
||||
@@ -169,8 +169,8 @@ public:
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (!isReadable()) return 0;
|
||||
if (0 == length || length > _used) length = _used;
|
||||
buffer.resize(length);
|
||||
return peek(buffer.begin(), length);
|
||||
rBuffer.resize(length);
|
||||
return peek(rBuffer.begin(), length);
|
||||
}
|
||||
|
||||
std::size_t read(T* pBuffer, std::size_t length)
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
return readLen;
|
||||
}
|
||||
|
||||
std::size_t read(Poco::Buffer<T>& buffer, std::size_t length = 0)
|
||||
std::size_t read(Poco::Buffer<T>& rBuffer, std::size_t length = 0)
|
||||
/// Copies the data currently in the FIFO
|
||||
/// into the supplied buffer.
|
||||
/// Resizes the supplied buffer to the size of
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (!isReadable()) return 0;
|
||||
std::size_t usedBefore = _used;
|
||||
std::size_t readLen = peek(buffer, length);
|
||||
std::size_t readLen = peek(rBuffer, length);
|
||||
poco_assert (_used >= readLen);
|
||||
_used -= readLen;
|
||||
if (0 == _used) _begin = 0;
|
||||
@@ -242,8 +242,8 @@ public:
|
||||
}
|
||||
|
||||
std::size_t usedBefore = _used;
|
||||
std::size_t available = _buffer.size() - _used - _begin;
|
||||
std::size_t len = length > available ? available : length;
|
||||
std::size_t availableBefore = _buffer.size() - _used - _begin;
|
||||
std::size_t len = length > availableBefore ? availableBefore : length;
|
||||
std::memcpy(begin() + _used, pBuffer, len * sizeof(T));
|
||||
_used += len;
|
||||
poco_assert (_used <= _buffer.size());
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
return len;
|
||||
}
|
||||
|
||||
std::size_t write(const Buffer<T>& buffer, std::size_t length = 0)
|
||||
std::size_t write(const Buffer<T>& rBuffer, std::size_t length = 0)
|
||||
/// Writes data from supplied buffer to the FIFO buffer.
|
||||
/// If there is no sufficient space for the whole
|
||||
/// buffer to be written, data up to available
|
||||
@@ -263,10 +263,10 @@ public:
|
||||
///
|
||||
/// Returns the length of data written.
|
||||
{
|
||||
if (length == 0 || length > buffer.size())
|
||||
length = buffer.size();
|
||||
if (length == 0 || length > rBuffer.size())
|
||||
length = rBuffer.size();
|
||||
|
||||
return write(buffer.begin(), length);
|
||||
return write(rBuffer.begin(), length);
|
||||
}
|
||||
|
||||
std::size_t size() const
|
||||
@@ -499,10 +499,10 @@ public:
|
||||
return !isFull() && isValid() && !_eof;
|
||||
}
|
||||
|
||||
void setNotify(bool notify = true)
|
||||
void setNotify(bool bufferNotify = true)
|
||||
/// Enables/disables notifications.
|
||||
{
|
||||
_notify = notify;
|
||||
_notify = bufferNotify;
|
||||
}
|
||||
|
||||
bool getNotify() const
|
||||
|
||||
@@ -118,12 +118,12 @@ public:
|
||||
clear();
|
||||
}
|
||||
|
||||
Iterator find(const std::string& className) const
|
||||
Iterator find(const std::string& rClassName) const
|
||||
/// Returns an iterator pointing to the MetaObject
|
||||
/// for the given class. If the MetaObject cannot
|
||||
/// be found, the iterator points to end().
|
||||
{
|
||||
return Iterator(_metaMap.find(className));
|
||||
return Iterator(_metaMap.find(rClassName));
|
||||
}
|
||||
|
||||
Iterator begin() const
|
||||
|
||||
@@ -40,7 +40,7 @@ class AbstractMetaObject
|
||||
/// factory for its class.
|
||||
{
|
||||
public:
|
||||
AbstractMetaObject(const char* name): _name(name)
|
||||
AbstractMetaObject(const char* pName): _name(pName)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,9 @@ class TaskCustomNotification: public TaskNotification
|
||||
/// mechanism between the task and its observer(s).
|
||||
{
|
||||
public:
|
||||
TaskCustomNotification(Task* pTask, const C& custom):
|
||||
TaskCustomNotification(Task* pTask, const C& rCustom):
|
||||
TaskNotification(pTask),
|
||||
_custom(custom)
|
||||
_custom(rCustom)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user