static QByteArray toLocal8Bit_helper(const QChar *data, int length)
{
#ifndef QT_NO_TEXTCODEC
- if (QTextCodec::codecForLocale())
- return QTextCodec::codecForLocale()->fromUnicode(data, length);
-#endif // QT_NO_TEXTCODEC
+ return QTextCodec::codecForLocale()->fromUnicode(data, length);
+#else
return toLatin1_helper(data, length);
+#endif // QT_NO_TEXTCODEC
}
/*!
QByteArray QString::toLocal8Bit() const
{
#ifndef QT_NO_TEXTCODEC
- if (QTextCodec::codecForLocale())
- return QTextCodec::codecForLocale()->fromUnicode(*this);
-#endif // QT_NO_TEXTCODEC
+ return QTextCodec::codecForLocale()->fromUnicode(*this);
+#else
return toLatin1();
+#endif // QT_NO_TEXTCODEC
}
/*!
#if !defined(QT_NO_TEXTCODEC)
if (size < 0)
size = qstrlen(str);
- QTextCodec *codec = QTextCodec::codecForLocale();
- if (codec)
- return codec->toUnicode(str, size);
-#endif // !QT_NO_TEXTCODEC
+ return QTextCodec::codecForLocale()->toUnicode(str, size);
+#else
return fromLatin1(str, size);
+#endif // !QT_NO_TEXTCODEC
}
/*!
QByteArray QStringRef::toLocal8Bit() const
{
#ifndef QT_NO_TEXTCODEC
- if (QTextCodec::codecForLocale())
- return QTextCodec::codecForLocale()->fromUnicode(unicode(), length());
-#endif // QT_NO_TEXTCODEC
+ return QTextCodec::codecForLocale()->fromUnicode(unicode(), length());
+#else
return toLatin1();
+#endif // QT_NO_TEXTCODEC
}
/*!
void QFont::initialize()
{
extern int qt_encoding_id_for_mib(int mib); // from qfontdatabase_x11.cpp
- QTextCodec *codec = QTextCodec::codecForLocale();
// determine the default encoding id using the locale, otherwise
- // fallback to latin1 (mib == 4)
- int mib = codec ? codec->mibEnum() : 4;
+ int mib = QTextCodec::codecForLocale()->mibEnum();
// for asian locales, use the mib for the font codec instead of the locale codec
switch (mib) {