{
const uchar *s = (const uchar *)str.latin1();
if (s) {
- int len = qstrlen((char *)s);
+ int len = str.size();
- if (d->ref != 1 || d->size + len > int(d->alloc))
+ if (d->ref.isShared() || d->size + len > int(d->alloc))
realloc(grow(d->size + len));
ushort *i = d->data() + d->size;
while ((*i++ = *s++))
inline const QChar *QString::constData() const
{ return reinterpret_cast<const QChar*>(d->data()); }
inline void QString::detach()
-{ if (d->ref != 1 || d->offset) realloc(); }
+{ if (d->ref.isShared() || d->offset) realloc(); }
inline bool QString::isDetached() const
-{ return d->ref == 1; }
+{ return !d->ref.isShared(); }
inline QString &QString::operator=(const QLatin1String &s)
{
- *this = fromLatin1(s.latin1());
+ *this = fromLatin1(s.latin1(), s.size());
return *this;
}
inline void QString::clear()