Commit ef6c1393 authored by SND\ussrhero_cp's avatar SND\ussrhero_cp Committed by Mikhail I. Izmestev

fixed bug #14139 ( printing struct with zero length field raise exception )

git-svn-id: https://kdlibcpp.svn.codeplex.com/svn@91264 9b283d60-5439-405e-af05-b73fd8c4d996
parent 8942206b
......@@ -80,7 +80,7 @@ public:
virtual void readDoubles( std::vector<double>& dataRange, size_t count, size_t pos=0) const = 0;
virtual void writeDoubles( const std::vector<double>& dataRange, size_t pos=0) = 0;
virtual DataAccessorPtr copy( size_t startOffset = 0, size_t length = 0 ) = 0;
virtual DataAccessorPtr copy( size_t startOffset = 0, size_t length = -1 ) = 0;
virtual std::wstring getLocationAsStr() const = 0;
......
......@@ -589,17 +589,17 @@ private:
return sstr.str();
}
DataAccessorPtr copy( size_t startOffset = 0, size_t length = 0 )
DataAccessorPtr copy( size_t startOffset = 0, size_t length = -1 )
{
if ( startOffset >= m_length )
if ( length == -1 )
length = m_length - startOffset;
if ( length > 0 && startOffset >= m_length )
throw DbgException("memory accessor range error");
if ( m_length - startOffset < length )
throw DbgException("memory accessor range error");
if ( length == 0 )
length = m_length - startOffset;
return getMemoryAccessor( m_begin + startOffset, length);
}
......@@ -856,17 +856,18 @@ private:
return m_parentAccessor->getLocationAsStr();
}
DataAccessorPtr copy( size_t startOffset = 0, size_t length = 0 )
DataAccessorPtr copy( size_t startOffset = 0, size_t length = -1 )
{
if ( startOffset >= m_length )
if ( length == -1 )
length = m_length - startOffset;
if ( length > 0 && startOffset >= m_length )
throw DbgException("data accessor range error");
if ( m_length - startOffset < length )
throw DbgException("data accessor range error");
if ( length == 0 )
length = m_length - startOffset;
return DataAccessorPtr( new CopyAccessor( m_parentAccessor, m_pos + startOffset, length) );
}
......@@ -1229,7 +1230,7 @@ private:
return m_location;
}
DataAccessorPtr copy( size_t startOffset = 0, size_t length = 0 )
DataAccessorPtr copy( size_t startOffset = 0, size_t length = -1 )
{
return DataAccessorPtr( new CopyAccessor( shared_from_this(), startOffset, length) );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment