diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-02-16 17:23:18 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-02-16 18:10:38 (GMT) |
commit | d590fc729e3afaedf181da58f8b685d7597040da (patch) | |
tree | 446692610d5d85733074042115118a556f39c0e3 /src/multimedia/audio | |
parent | e6b629f3ebc1d530218f01a735275e56bf474a18 (diff) | |
download | Qt-d590fc729e3afaedf181da58f8b685d7597040da.zip Qt-d590fc729e3afaedf181da58f8b685d7597040da.tar.gz Qt-d590fc729e3afaedf181da58f8b685d7597040da.tar.bz2 |
optimization: get rid of QString::fromUtf16() usage, part 2
QString::fromUtf16() is slow - it does a BOM check and optionally byte
swapping, which is utterly irrelevant when converting internal data
structures which are raw utf16 in host byte order. so replace it with
QString::fromUnicode() where possible (which seems to be everywhere).
the reasoning is the same as in commit e0fda52f, so not getting further
reviews.
Reviewed-by: denis
Reviewed-by: joao
Diffstat (limited to 'src/multimedia/audio')
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 8 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 955a880..67dc90c 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -218,7 +218,7 @@ void QAudioDeviceInfoInternal::updateLists() for(i=0;i<iNumDevs;i++) { if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { - tmp = QString::fromUtf16((const unsigned short*)woc.szPname); + tmp = QString((const QChar *)woc.szPname); if(tmp.compare(device) == 0) { match = true; fmt = woc.dwFormats; @@ -238,7 +238,7 @@ void QAudioDeviceInfoInternal::updateLists() for(i=0;i<iNumDevs;i++) { if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { - tmp = QString::fromUtf16((const unsigned short*)woc.szPname); + tmp = QString((const QChar *)woc.szPname); if(tmp.compare(device) == 0) { match = true; fmt = woc.dwFormats; @@ -347,7 +347,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) for(i=0;i<iNumDevs;i++) { if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { - devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData()); + devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); } } } else { @@ -357,7 +357,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) for(i=0;i<iNumDevs;i++) { if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { - devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData()); + devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); } } diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 84fd2a5..cc4fdee 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -255,7 +255,7 @@ bool QAudioInputPrivate::open() if(waveInGetDevCaps(ii, &wic, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { QString tmp; - tmp = QString::fromUtf16((const unsigned short*)wic.szPname); + tmp = QString((const QChar *)wic.szPname); if(tmp.compare(QLatin1String(m_device)) == 0) { devId = ii; break; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index c31e048..bce45c1 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -250,7 +250,7 @@ bool QAudioOutputPrivate::open() if(waveOutGetDevCaps(ii, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { QString tmp; - tmp = QString::fromUtf16((const unsigned short*)woc.szPname); + tmp = QString((const QChar *)woc.szPname); if(tmp.compare(QLatin1String(m_device)) == 0) { devId = ii; break; |