Skip to content

Commit

Permalink
krazy fixes:
Browse files Browse the repository at this point in the history
 - explicit, implicit ctors
 - normalize signals and slots
 - include guards
 - spelling errors
 - file ends-with-newline
also add krazy excludes to shutup false positives

Reviewed-by: Marc and David
  • Loading branch information
Allen Winter committed Aug 24, 2014
1 parent 1b3e623 commit ce2bcd2
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/KDSoapClient/KDDateTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class KDSOAP_EXPORT KDDateTime : public QDateTime
* Implicit constructor from a QDateTime.
* Sets the timeZone to "local", i.e. empty
*/
KDDateTime(const QDateTime &);
/*implicit*/ KDDateTime(const QDateTime &);
KDDateTime &operator=(const KDDateTime &);
~KDDateTime();

Expand Down
4 changes: 4 additions & 0 deletions src/KDSoapClient/KDSoap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
**
**********************************************************************/

#ifndef KDSOAP_H
#define KDSOAP_H

#include "KDSoapClientInterface.h"
#include "KDSoapMessage.h"
#include "KDSoapPendingCall.h"
Expand All @@ -29,3 +32,4 @@
#include "KDSoapAuthentication.h"
#include "KDSoapNamespaceManager.h"

#endif
2 changes: 1 addition & 1 deletion src/KDSoapClient/KDSoapClientInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void KDSoapClientInterface::ignoreSslErrors(const QList<QSslError> &errors)
void KDSoapClientInterfacePrivate::setupReply(QNetworkReply *reply)
{
if (m_ignoreSslErrors) {
QObject::connect(reply, SIGNAL(sslErrors(const QList<QSslError>&)), reply, SLOT(ignoreSslErrors()));
QObject::connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply, SLOT(ignoreSslErrors()));
} else {
#ifndef QT_NO_OPENSSL
reply->ignoreSslErrors(m_ignoreErrorsList);
Expand Down
2 changes: 1 addition & 1 deletion src/KDSoapClient/KDSoapClientThread_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class KDSoapThreadTask : public QObject
{
Q_OBJECT
public:
KDSoapThreadTask(KDSoapThreadTaskData* data)
explicit KDSoapThreadTask(KDSoapThreadTaskData* data)
: m_data(data) {}

void process(QNetworkAccessManager& accessManager);
Expand Down
2 changes: 1 addition & 1 deletion src/KDSoapClient/KDSoapMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class KDSOAP_EXPORT KDSoapMessage : public KDSoapValue
* Set of headers that can be provided when making a SOAP call.
* \see KDSoapClientInterface
*/
class KDSOAP_EXPORT KDSoapHeaders : public QList<KDSoapMessage>
class KDSOAP_EXPORT KDSoapHeaders : public QList<KDSoapMessage> //krazy:exclude=dpointer
{
public:
/**
Expand Down
4 changes: 2 additions & 2 deletions src/KDSoapClient/KDSoapMessageReader_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
**
**********************************************************************/

#ifndef KSOAPMESSAGEREADER_P_H
#define KSOAPMESSAGEREADER_P_H
#ifndef KDSOAPMESSAGEREADER_P_H
#define KDSOAPMESSAGEREADER_P_H

#include "KDSoapMessage.h"

Expand Down
4 changes: 2 additions & 2 deletions src/KDSoapClient/KDSoapNamespaceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* Repository of namespaces
*/
class KDSOAP_EXPORT KDSoapNamespaceManager
class KDSOAP_EXPORT KDSoapNamespaceManager //krazy:exclude=dpointer
{
public:
static QString xmlSchema1999();
Expand All @@ -41,7 +41,7 @@ class KDSOAP_EXPORT KDSoapNamespaceManager
static QString soapEncoding();
static QString soapEncoding200305();

private: // TODO instanciate to handle custom namespaces per clientinterface
private: // TODO instantiate to handle custom namespaces per clientinterface
KDSoapNamespaceManager();
};

Expand Down
2 changes: 1 addition & 1 deletion src/KDSoapClient/KDSoapNamespacePrefixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
** clear to you.
**
**********************************************************************/
#include "KDSoapClientInterface_p.h"
#include "KDSoapNamespacePrefixes_p.h"
#include "KDSoapClientInterface_p.h"
#include "KDSoapNamespaceManager.h"

void KDSoapNamespacePrefixes::writeStandardNamespaces(QXmlStreamWriter& writer,
Expand Down
4 changes: 2 additions & 2 deletions src/KDSoapClient/KDSoapNamespacePrefixes_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
** clear to you.
**
**********************************************************************/
#ifndef KDSOAPNAMESPACESPREFIXES_H
#define KDSOAPNAMESPACESPREFIXES_H
#ifndef KDSOAPNAMESPACEPREFIXES_P_H
#define KDSOAPNAMESPACEPREFIXES_P_H

#include <QtCore/QMap>
#include <QtCore/QXmlStreamWriter>
Expand Down
3 changes: 1 addition & 2 deletions src/KDSoapClient/KDSoapSslHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
**
**********************************************************************/

#include <QNetworkReply>
#include <QNetworkReply> //may define QT_NO_OPENSSL. krazy:exclude=includes

#ifndef QT_NO_OPENSSL
#include "KDSoapSslHandler.h"
#include <QDebug>

KDSoapSslHandler::KDSoapSslHandler(QObject *parent)
: QObject(parent), m_reply(0)
Expand Down
2 changes: 1 addition & 1 deletion src/KDSoapClient/KDSoapSslHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public Q_SLOTS:
explicit KDSoapSslHandler(QObject *parent = 0);
virtual ~KDSoapSslHandler();

QNetworkReply* m_reply; // could be replaced with a d pointer if needed
QNetworkReply* m_reply;
};

#if QT_VERSION < 0x050000
Expand Down
2 changes: 1 addition & 1 deletion src/KDSoapClient/KDSoapValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ namespace std {
* In other words, it corresponds to a list of XML elements in a SOAP
* message. It also supports XML attributes.
*/
class KDSOAP_EXPORT KDSoapValueList : public QList<KDSoapValue>
class KDSOAP_EXPORT KDSoapValueList : public QList<KDSoapValue> //krazy:exclude=dpointer
{
public:
/**
Expand Down
6 changes: 3 additions & 3 deletions src/KDSoapServer/KDSoapServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ void KDSoapServerSocket::slotReadyRead()
// check soap version and extract soapAction header
QByteArray soapAction;
const QByteArray contentType = httpHeaders.value("content-type");
if (contentType.startsWith("text/xml")) {
if (contentType.startsWith("text/xml")) { //krazy:exclude=strings
// SOAP 1.1
soapAction = httpHeaders.value("soapaction");
// The SOAP standard allows quotation marks around the SoapAction, so we have to get rid of these.
if (soapAction.startsWith('\"'))
soapAction = soapAction.mid(1, soapAction.length() - 2);

} else if (contentType.startsWith("application/soap+xml")) {
} else if (contentType.startsWith("application/soap+xml")) { //krazy:exclude=strings
// SOAP 1.2
// Example: application/soap+xml;charset=utf-8;action=ActionHex
const QList<QByteArray> parts = contentType.split(';');
Q_FOREACH(const QByteArray& part, parts) {
if (part.startsWith("action=")) {
if (part.startsWith("action=")) { //krazy:exclude=strings
soapAction = part.mid(strlen("action="));
}
}
Expand Down
2 changes: 1 addition & 1 deletion unittests/builtinhttp/builtinhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private Q_SLOTS:
HttpServerThread server(emptyResponse(), HttpServerThread::Public);
KDSoapClientInterface client(server.endPoint(), countryMessageNamespace());
KDSoapMessage message;
message.setUse(KDSoapMessage::EncodedUse); // write out types explicitely
message.setUse(KDSoapMessage::EncodedUse); // write out types explicitly

// Test simpletype element
message.addArgument(QString::fromLatin1("testString"), QString::fromUtf8("Hello Klarälvdalens"));
Expand Down
4 changes: 2 additions & 2 deletions unittests/specialchars_wsdl/testconversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private slots:

TestConversion::TestConversion()
{

}


Expand All @@ -51,4 +51,4 @@ void TestConversion::test()

QTEST_MAIN(TestConversion)

#include "testconversion.moc"
#include "testconversion.moc"
12 changes: 6 additions & 6 deletions unittests/wsdl_document/test_wsdl_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private Q_SLOTS:
MyWsdlDocument service;
service.setEndPoint(server.endPoint());
QVERIFY(server.endPoint().startsWith(QLatin1String("https")));
QSignalSpy sslErrorsSpy(service.clientInterface()->sslHandler(), SIGNAL(sslErrors(KDSoapSslHandler*, QList<QSslError>)));
QSignalSpy sslErrorsSpy(service.clientInterface()->sslHandler(), SIGNAL(sslErrors(KDSoapSslHandler*,QList<QSslError>)));
// We need to use async API to test sslHandler, see documentation there.
ListEmployeesJob *job = new ListEmployeesJob(&service);
connect(job, SIGNAL(finished(KDSoapJob*)), this, SLOT(slotListEmployeesJobFinished(KDSoapJob*)));
Expand Down Expand Up @@ -252,8 +252,8 @@ private Q_SLOTS:
HttpServerThread server(addEmployeeResponse(), HttpServerThread::Ssl);
MyWsdlDocument service;
service.setEndPoint(server.endPoint());
connect(service.clientInterface()->sslHandler(), SIGNAL(sslErrors(KDSoapSslHandler*, QList<QSslError>)),
this, SLOT(slotSslHandlerErrors(KDSoapSslHandler*, QList<QSslError>)));
connect(service.clientInterface()->sslHandler(), SIGNAL(sslErrors(KDSoapSslHandler*,QList<QSslError>)),
this, SLOT(slotSslHandlerErrors(KDSoapSslHandler*,QList<QSslError>)));
AddEmployeeJob *job = new AddEmployeeJob(&service);
job->setParameters(addEmployeeParameters());
connect(job, SIGNAL(finished(KDSoapJob*)), this, SLOT(slotAddEmployeeJobFinished(KDSoapJob*)));
Expand Down Expand Up @@ -304,7 +304,7 @@ private Q_SLOTS:
HttpServerThread server(addEmployeeResponse(), HttpServerThread::Ssl);
MyWsdlDocument service;
service.setEndPoint(server.endPoint());
QSignalSpy sslErrorsSpy(service.clientInterface()->sslHandler(), SIGNAL(sslErrors(KDSoapSslHandler*, QList<QSslError>)));
QSignalSpy sslErrorsSpy(service.clientInterface()->sslHandler(), SIGNAL(sslErrors(KDSoapSslHandler*,QList<QSslError>)));
QByteArray ret = service.addEmployee(addEmployeeParameters());
QVERIFY(ret.isEmpty());
QVERIFY2(service.lastError().contains(QLatin1String("SSL handshake failed")), qPrintable(service.lastError()));
Expand Down Expand Up @@ -943,10 +943,10 @@ void WsdlDocumentTest::testServerFault() // test the error signals emitted on er
MyWsdlDocument service;
service.setEndPoint(server->endPoint());
QSignalSpy addEmployeeErrorSpy(&service, SIGNAL(addEmployeeError(KDSoapMessage)));
QSignalSpy soapErrorSpy(&service, SIGNAL(soapError(QString, KDSoapMessage)));
QSignalSpy soapErrorSpy(&service, SIGNAL(soapError(QString,KDSoapMessage)));
service.asyncAddEmployee(KDAB__AddEmployee());

connect(&service, SIGNAL(soapError(QString, KDSoapMessage)), &m_eventLoop, SLOT(quit()));
connect(&service, SIGNAL(soapError(QString,KDSoapMessage)), &m_eventLoop, SLOT(quit()));
m_eventLoop.exec();

QCOMPARE(soapErrorSpy.count(), 1);
Expand Down

0 comments on commit ce2bcd2

Please sign in to comment.