mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-21 15:51:43 +02:00
SF Bug 599
SF Bug #599 JSON::Array and JSON::Object size() member can implicitly lose precision https://sourceforge.net/p/poco/patches/120/
This commit is contained in:
@@ -57,7 +57,7 @@ class Object;
|
|||||||
class JSON_API Array
|
class JSON_API Array
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<Dynamic::Var> ValueVector;
|
typedef std::vector<Dynamic::Var> ValueVec;
|
||||||
typedef SharedPtr<Array> Ptr;
|
typedef SharedPtr<Array> Ptr;
|
||||||
|
|
||||||
Array();
|
Array();
|
||||||
@@ -69,10 +69,10 @@ public:
|
|||||||
virtual ~Array();
|
virtual ~Array();
|
||||||
/// Destructor
|
/// Destructor
|
||||||
|
|
||||||
ValueVector::const_iterator begin() const;
|
ValueVec::const_iterator begin() const;
|
||||||
/// Returns iterator
|
/// Returns iterator
|
||||||
|
|
||||||
ValueVector::const_iterator end() const;
|
ValueVec::const_iterator end() const;
|
||||||
/// Returns iterator
|
/// Returns iterator
|
||||||
|
|
||||||
Dynamic::Var get(unsigned int index) const;
|
Dynamic::Var get(unsigned int index) const;
|
||||||
@@ -148,26 +148,26 @@ public:
|
|||||||
/// Removes the element on the given index.
|
/// Removes the element on the given index.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ValueVector _values;
|
ValueVec _values;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline Array::ValueVector::const_iterator Array::begin() const
|
inline Array::ValueVec::const_iterator Array::begin() const
|
||||||
{
|
{
|
||||||
return _values.begin();
|
return _values.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Array::ValueVector::const_iterator Array::end() const
|
inline Array::ValueVec::const_iterator Array::end() const
|
||||||
|
|
||||||
{
|
{
|
||||||
return _values.end();
|
return _values.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline unsigned int Array::size() const
|
inline std::size_t Array::size() const
|
||||||
{
|
{
|
||||||
return _values.size();
|
return static_cast<std::size_t>(_values.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -186,9 +186,9 @@ inline void Object::set(const std::string& key, const Dynamic::Var& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline unsigned int Object::size() const
|
inline std::size_t Object::size() const
|
||||||
{
|
{
|
||||||
return _values.size();
|
return static_cast<std::size_t>(_values.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -115,7 +115,7 @@ void Array::stringify(std::ostream& out, unsigned int indent) const
|
|||||||
if ( indent > 0 )
|
if ( indent > 0 )
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
|
|
||||||
for(ValueVector::const_iterator it = _values.begin(); it != _values.end();)
|
for(ValueVec::const_iterator it = _values.begin(); it != _values.end();)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < indent; i++)
|
for(int i = 0; i < indent; i++)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user