[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/scriptengine
From: Nikolaj Hald Nielsen <nhnFreespirit () gmail ! com>
Date: 2009-03-01 16:58:56
Message-ID: 1235926736.127319.2596.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 933806 by nhnielsen:
Don't crash if using an invalid codec name in AmarokLyricsScript::toUtf8, \
AmarokLyricsScript::QStringtoUtf8 or AmarokLyricsScript::fromUtf8 but simply return \
an empty QString or QByteArray respectively.
BUG: 185540
M +10 -0 AmarokLyricsScript.cpp
--- trunk/extragear/multimedia/amarok/src/scriptengine/AmarokLyricsScript.cpp \
#933805:933806 @@ -78,6 +78,9 @@
AmarokLyricsScript::toUtf8( const QByteArray& lyrics, const QString& encoding )
{
QTextCodec* codec = QTextCodec::codecForName( encoding.toUtf8() );
+ if ( !codec )
+ return QString();
+
QTextCodec* utf8codec = QTextCodec::codecForName( "UTF-8" );
QTextCodec::setCodecForCStrings( utf8codec );
return codec->toUnicode( lyrics );
@@ -87,6 +90,9 @@
AmarokLyricsScript::QStringtoUtf8( const QString& lyrics, const QString& encoding )
{
QTextCodec* codec = QTextCodec::codecForName( encoding.toUtf8() );
+ if ( !codec )
+ return QString();
+
QTextCodec* utf8codec = QTextCodec::codecForName( "UTF-8" );
QTextCodec::setCodecForCStrings( utf8codec );
return codec->toUnicode( lyrics.toLatin1() );
@@ -96,7 +102,11 @@
AmarokLyricsScript::fromUtf8( const QString& str, const QString& encoding )
{
QTextCodec* codec = QTextCodec::codecForName( encoding.toUtf8() );
+ if ( !codec )
+ return QByteArray();
+
return codec->fromUnicode( str );
+
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic