summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-06-20 09:29:32 +1000
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-06-20 09:29:32 +1000
commita892a269da3d3d1260683c7fd7d1cb373ddbcbc2 (patch)
treefff11d99a2a7172a98d603a17bc489546940f32f
parentaac281b5dcb120818d276d284f9f6ec26e200259 (diff)
Handle empty extension strings properly.
QString::split() converts an empty string into a QStringList with a single empty string entry. This confuses higher-level code that doesn't expect the empty string as an extension name. Modify the extension handling so that an empty string becomes an empty list.
-rw-r--r--src/opencl/qcldevice.cpp6
-rw-r--r--src/opencl/qclplatform.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/opencl/qcldevice.cpp b/src/opencl/qcldevice.cpp
index a1fc427..528b73c 100644
--- a/src/opencl/qcldevice.cpp
+++ b/src/opencl/qcldevice.cpp
@@ -841,7 +841,11 @@ QStringList QCLDevice::extensions() const
{
if (!m_id)
return QStringList();
- return qt_cl_paramString(m_id, CL_DEVICE_EXTENSIONS).simplified().split(QChar(' '));
+ QString extns = qt_cl_paramString(m_id, CL_DEVICE_EXTENSIONS).simplified();
+ if (!extns.isEmpty())
+ return extns.split(QChar(' '));
+ else
+ return QStringList();
}
bool qt_cl_has_extension(const char *list, size_t listLen, const char *name)
diff --git a/src/opencl/qclplatform.cpp b/src/opencl/qclplatform.cpp
index b5cfee7..8ea4538 100644
--- a/src/opencl/qclplatform.cpp
+++ b/src/opencl/qclplatform.cpp
@@ -213,7 +213,11 @@ QStringList QCLPlatform::extensions() const
{
if (!m_id)
return QStringList();
- return qt_cl_platform_string(m_id, CL_PLATFORM_EXTENSIONS).simplified().split(QChar(' '));
+ QString extns = qt_cl_platform_string(m_id, CL_PLATFORM_EXTENSIONS).simplified();
+ if (!extns.isEmpty())
+ return extns.split(QChar(' '));
+ else
+ return QStringList();
}
// Defined in qcldevice.cpp.