[Qt-interest] QByteArray bug?
Pascal Patry
iscy at invalidip.com
Fri Jul 10 21:02:27 CEST 2009
On Friday 10 July 2009 14:51:16 Frank Hemer wrote:
> I have a Method:
>
> MyArray::getData (int len) {
> QByteArray arr;
> arr.resize (len);
> arr.data ();
Why are you calling 'arr.data()' if it's to do nothing with the returned ptr?
> return arr;
> }
>
> >From another place, this is called:
>
> MyArray myArray;
> QByteArray arr = myArray.getData (x);
> qDebug ("arr size: %i", arr.size ());
>
> This works for all values of x
> BUT NOT FOR 0??
>
> if x is zero, the array size printed seems to be unpredictable.
>
> Seems like a bug to me?!
>
> Found in qt4.4.2
>
> Frank
I've tried this in Qt 4.5.1:
====
int main(int /*argc*/, char ** /*argv*/)
{
QByteArray a;
a.resize(0);
a.data();
qDebug("size of a: %d", a.size());
return 0;
}
and the result is:
=> size of a: 0
More information about the Qt-interest-old
mailing list