diff options
| -rw-r--r-- | example/tests/tests.cpp | 5 | ||||
| -rw-r--r-- | source/xmlrpc.cpp | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/example/tests/tests.cpp b/example/tests/tests.cpp index de48ef62..8e175844 100644 --- a/example/tests/tests.cpp +++ b/example/tests/tests.cpp @@ -352,11 +352,10 @@ void TestXmlRpc::testBase64() void TestXmlRpc::testBool() { - // FIXME : XML-RPC spec says we should write "0" or "1" checkVariant(false, - QByteArray("<value><boolean>false</boolean></value>")); + QByteArray("<value><boolean>0</boolean></value>")); checkVariant(true, - QByteArray("<value><boolean>true</boolean></value>")); + QByteArray("<value><boolean>1</boolean></value>")); } void TestXmlRpc::testDateTime() diff --git a/source/xmlrpc.cpp b/source/xmlrpc.cpp index 59e61a79..20ca2718 100644 --- a/source/xmlrpc.cpp +++ b/source/xmlrpc.cpp @@ -21,7 +21,7 @@ void XMLRPC::marshall( QXmlStreamWriter *writer, const QVariant &value) writer->writeTextElement("double", value.toString()); break; case QVariant::Bool: - writer->writeTextElement("boolean", (value.toBool()?"true":"false") ); + writer->writeTextElement("boolean", value.toBool() ? "1" : "0"); break; case QVariant::Date: writer->writeTextElement("dateTime.iso8601", value.toDate().toString( Qt::ISODate ) ); @@ -120,7 +120,7 @@ QVariant XMLRPC::demarshall(const QDomElement &elem, QStringList &errors) errors << "I was looking for an double but data was corrupt"; } else if( typeName == "boolean" ) - return QVariant( ( typeData.text().toLower() == "true" || typeData.text() == "1")?true:false ); + return QVariant( typeData.text() == "1" || typeData.text().toLower() == "true" ); else if( typeName == "datetime" || typeName == "datetime.iso8601" ) return QVariant( QDateTime::fromString( typeData.text(), Qt::ISODate ) ); else if( typeName == "array" ) |
