return fromLatin1_helper(str, size);
}
-/*!
+/*! \fn QString QString::fromLatin1(const char *str, int size)
Returns a QString initialized with the first \a size characters
of the Latin-1 string \a str.
\sa toLatin1(), fromAscii(), fromUtf8(), fromLocal8Bit()
*/
-QString QString::fromLatin1(const char *str, int size)
-{
- return QString(fromLatin1_helper(str, size), 0);
-}
/*!
QVector<uint> toUcs4() const Q_REQUIRED_RESULT;
static QString fromAscii(const char *, int size = -1);
- static QString fromLatin1(const char *, int size = -1);
+ static inline QString fromLatin1(const char *str, int size = -1)
+ {
+ // make this inline so we can benefit from strlen() compile time optimization
+ return QString(fromLatin1_helper(str, (str && size == -1) ? int(strlen(str)) : size), 0);
+ }
static QString fromUtf8(const char *, int size = -1);
static QString fromLocal8Bit(const char *, int size = -1);
static QString fromUtf16(const ushort *, int size = -1);