Changeset 561 for trunk/src/dbus/qdbusmarshaller.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/dbus/qdbusmarshaller.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 122 122 QByteArray data = arg.path().toUtf8(); 123 123 if (!ba && data.isEmpty()) 124 error( );124 error(QLatin1String("Invalid object path passed in arguments")); 125 125 const char *cdata = data.constData(); 126 126 qIterAppend(&iterator, ba, DBUS_TYPE_OBJECT_PATH, &cdata); … … 131 131 QByteArray data = arg.signature().toUtf8(); 132 132 if (!ba && data.isEmpty()) 133 error( );133 error(QLatin1String("Invalid signature passed in arguments")); 134 134 const char *cdata = data.constData(); 135 135 qIterAppend(&iterator, ba, DBUS_TYPE_SIGNATURE, &cdata); … … 162 162 if (id == QVariant::Invalid) { 163 163 qWarning("QDBusMarshaller: cannot add a null QDBusVariant"); 164 error( );164 error(QLatin1String("Variant containing QVariant::Invalid passed in arguments")); 165 165 return false; 166 166 } … … 181 181 "Use qDBusRegisterMetaType to register it", 182 182 QVariant::typeToName( id ), id); 183 error(); 183 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 184 .arg(QLatin1String(QVariant::typeToName(id)))); 184 185 return false; 185 186 } … … 221 222 "Use qDBusRegisterMetaType to register it", 222 223 QVariant::typeToName( QVariant::Type(id) ), id); 223 error(); 224 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 225 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id))))); 224 226 return this; 225 227 } … … 235 237 "Use qDBusRegisterMetaType to register it", 236 238 QVariant::typeToName( QVariant::Type(kid) ), kid); 237 error(); 239 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 240 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid))))); 238 241 return this; 239 242 } … … 241 244 qWarning("QDBusMarshaller: type '%s' (%d) cannot be used as the key type in a D-BUS map.", 242 245 QVariant::typeToName( QVariant::Type(kid) ), kid); 243 error(); 246 error(QString::fromLatin1("Type %1 passed in arguments cannot be used as a key in a map") 247 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid))))); 244 248 return this; 245 249 } … … 247 251 const char *vsignature = QDBusMetaType::typeToSignature( QVariant::Type(vid) ); 248 252 if (!vsignature) { 253 const char *typeName = QVariant::typeToName(QVariant::Type(vid)); 249 254 qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. " 250 255 "Use qDBusRegisterMetaType to register it", 251 QVariant::typeToName( QVariant::Type(vid) ), vid); 252 error(); 256 typeName, vid); 257 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 258 .arg(QLatin1String(typeName))); 253 259 return this; 254 260 } … … 329 335 } 330 336 331 void QDBusMarshaller::error( )337 void QDBusMarshaller::error(const QString &msg) 332 338 { 333 339 ok = false; 334 340 if (parent) 335 parent->error(); 341 parent->error(msg); 342 else 343 errorString = msg; 336 344 } 337 345 … … 341 349 if (id == QVariant::Invalid) { 342 350 qWarning("QDBusMarshaller: cannot add an invalid QVariant"); 343 error( );351 error(QLatin1String("Variant containing QVariant::Invalid passed in arguments")); 344 352 return false; 345 353 } … … 372 380 "Use qDBusRegisterMetaType to register it", 373 381 QVariant::typeToName( QVariant::Type(id) ), id); 374 error(); 382 error(QString::fromLatin1("Unregistered type %1 passed in arguments") 383 .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id))))); 375 384 return false; 376 385 } … … 379 388 #ifdef __OPTIMIZE__ 380 389 case DBUS_TYPE_BYTE: 381 case DBUS_TYPE_BOOLEAN:382 390 case DBUS_TYPE_INT16: 383 391 case DBUS_TYPE_UINT16: … … 389 397 qIterAppend(&iterator, ba, *signature, arg.constData()); 390 398 return true; 391 392 case DBUS_TYPE_STRING: 393 case DBUS_TYPE_OBJECT_PATH: 394 case DBUS_TYPE_SIGNATURE: { 395 const QByteArray data = 396 reinterpret_cast<const QString *>(arg.constData())->toUtf8(); 397 const char *rawData = data.constData(); 398 qIterAppend(&iterator, ba, *signature, &rawData); 399 return true; 400 } 399 case DBUS_TYPE_BOOLEAN: 400 append( arg.toBool() ); 401 return true; 401 402 #else 402 403 case DBUS_TYPE_BYTE: … … 427 428 append( arg.toDouble() ); 428 429 return true; 430 #endif 431 429 432 case DBUS_TYPE_STRING: 430 433 append( arg.toString() ); … … 436 439 append( qvariant_cast<QDBusSignature>(arg) ); 437 440 return true; 438 #endif439 441 440 442 // compound types:
Note:
See TracChangeset
for help on using the changeset viewer.