Use nullptr instead of 0

This commit is contained in:
Luis Ángel San Martín
2019-05-31 21:00:19 +02:00
parent bb334cfd50
commit 268bebbddd
81 changed files with 113 additions and 113 deletions

View File

@ -50,8 +50,8 @@ void ComicController::service(HttpRequest &request, HttpResponse &response)
Comic *comicFile = FactoryComic::newComic(libraries.getPath(libraryId) + comic.path);
if (comicFile != NULL) {
QThread *thread = NULL;
if (comicFile != nullptr) {
QThread *thread = nullptr;
thread = new QThread();
@ -65,7 +65,7 @@ void ComicController::service(HttpRequest &request, HttpResponse &response)
comicFile->load(libraries.getPath(libraryId) + comic.path);
if (thread != NULL)
if (thread != nullptr)
thread->start();
if (remoteComic) {

View File

@ -53,8 +53,8 @@ void ComicControllerV2::service(HttpRequest &request, HttpResponse &response)
Comic *comicFile = FactoryComic::newComic(libraries.getPath(libraryId) + comic.path);
if (comicFile != NULL) {
QThread *thread = NULL;
if (comicFile != nullptr) {
QThread *thread = nullptr;
thread = new QThread();
@ -68,7 +68,7 @@ void ComicControllerV2::service(HttpRequest &request, HttpResponse &response)
comicFile->load(libraries.getPath(libraryId) + comic.path);
if (thread != NULL)
if (thread != nullptr)
thread->start();
if (remoteComic) {

View File

@ -9,12 +9,12 @@
HttpConnectionHandler::HttpConnectionHandler(QSettings* settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration)
: QThread()
{
Q_ASSERT(settings!=0);
Q_ASSERT(requestHandler!=0);
Q_ASSERT(settings!=nullptr);
Q_ASSERT(requestHandler!=nullptr);
this->settings=settings;
this->requestHandler=requestHandler;
this->sslConfiguration=sslConfiguration;
currentRequest=0;
currentRequest=nullptr;
busy=false;
// Create TCP or SSL socket
@ -111,7 +111,7 @@ void HttpConnectionHandler::handleConnection(tSocketDescriptor socketDescriptor)
readTimer.start(readTimeout);
// delete previous request
delete currentRequest;
currentRequest=0;
currentRequest=nullptr;
}
@ -136,7 +136,7 @@ void HttpConnectionHandler::readTimeout()
socket->flush();
socket->disconnectFromHost();
delete currentRequest;
currentRequest=0;
currentRequest=nullptr;
}
@ -183,7 +183,7 @@ void HttpConnectionHandler::read()
socket->flush();
socket->disconnectFromHost();
delete currentRequest;
currentRequest=0;
currentRequest=nullptr;
return;
}
@ -269,7 +269,7 @@ void HttpConnectionHandler::read()
readTimer.start(readTimeout);
}
delete currentRequest;
currentRequest=0;
currentRequest=nullptr;
}
}
}

View File

@ -56,7 +56,7 @@ public:
@param requestHandler Handler that will process each incoming HTTP request
@param sslConfiguration SSL (HTTPS) will be used if not NULL
*/
HttpConnectionHandler(QSettings* settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration=NULL);
HttpConnectionHandler(QSettings* settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration=nullptr);
/** Destructor */
virtual ~HttpConnectionHandler();

View File

@ -10,10 +10,10 @@
HttpConnectionHandlerPool::HttpConnectionHandlerPool(QSettings* settings, HttpRequestHandler* requestHandler)
: QObject()
{
Q_ASSERT(settings!=0);
Q_ASSERT(settings!=nullptr);
this->settings=settings;
this->requestHandler=requestHandler;
this->sslConfiguration=NULL;
this->sslConfiguration=nullptr;
loadSslConfig();
cleanupTimer.start(settings->value("cleanupInterval",1000).toInt());
connect(&cleanupTimer, SIGNAL(timeout()), SLOT(cleanup()));
@ -34,7 +34,7 @@ HttpConnectionHandlerPool::~HttpConnectionHandlerPool()
HttpConnectionHandler* HttpConnectionHandlerPool::getConnectionHandler()
{
HttpConnectionHandler* freeHandler=0;
HttpConnectionHandler* freeHandler=nullptr;
mutex.lock();
// find a free handler in pool
foreach(HttpConnectionHandler* handler, pool)

View File

@ -11,9 +11,9 @@
HttpListener::HttpListener(QSettings* settings, HttpRequestHandler* requestHandler, QObject *parent)
: QTcpServer(parent)
{
Q_ASSERT(settings!=0);
Q_ASSERT(requestHandler!=0);
pool=NULL;
Q_ASSERT(settings!=nullptr);
Q_ASSERT(requestHandler!=nullptr);
pool=nullptr;
this->settings=settings;
this->requestHandler=requestHandler;
// Reqister type of socketDescriptor for signal/slot handling
@ -64,7 +64,7 @@ void HttpListener::close() {
qDebug("HttpListener: closed");
if (pool) {
delete pool;
pool=NULL;
pool=nullptr;
}
}
@ -73,7 +73,7 @@ void HttpListener::incomingConnection(tSocketDescriptor socketDescriptor) {
qDebug("HttpListener: New connection");
#endif
HttpConnectionHandler* freeHandler=NULL;
HttpConnectionHandler* freeHandler=nullptr;
if (pool)
{
freeHandler=pool->getConnectionHandler();

View File

@ -52,7 +52,7 @@ public:
@param parent Parent object.
@warning Ensure to close or delete the listener before deleting the request handler.
*/
HttpListener(QSettings* settings, HttpRequestHandler* requestHandler, QObject* parent = NULL);
HttpListener(QSettings* settings, HttpRequestHandler* requestHandler, QObject* parent = nullptr);
/** Destructor */
virtual ~HttpListener();

View File

@ -441,7 +441,7 @@ void HttpRequest::parseMultiPartFile()
#ifdef SUPERVERBOSE
qDebug("HttpRequest: reading multpart data");
#endif
QTemporaryFile* uploadedFile=0;
QTemporaryFile* uploadedFile=nullptr;
QByteArray fieldValue;
while (!tempFile.atEnd() && !finished && !tempFile.error())
{

View File

@ -31,7 +31,7 @@ public:
* Constructor.
* @param parent Parent object.
*/
HttpRequestHandler(QObject* parent=NULL);
HttpRequestHandler(QObject* parent=nullptr);
/** Destructor */
virtual ~HttpRequestHandler();

View File

@ -22,7 +22,7 @@ HttpSession::HttpSession(bool canStore)
}
else
{
dataPtr=0;
dataPtr=nullptr;
}
}
@ -103,7 +103,7 @@ QByteArray HttpSession::getId() const
}
bool HttpSession::isNull() const {
return dataPtr==0;
return dataPtr==nullptr;
}
void HttpSession::set(const QByteArray& key, const QVariant& value)

View File

@ -36,7 +36,7 @@ class DECLSPEC HttpSessionStore : public QObject {
public:
/** Constructor. */
HttpSessionStore(QSettings* settings, QObject* parent=NULL);
HttpSessionStore(QSettings* settings, QObject* parent=nullptr);
/** Destructor */
virtual ~HttpSessionStore();

View File

@ -46,7 +46,7 @@ class DECLSPEC StaticFileController : public HttpRequestHandler {
public:
/** Constructor */
StaticFileController(QSettings* settings, QObject* parent = NULL);
StaticFileController(QSettings* settings, QObject* parent = nullptr);
/** Generates the response */
void service(HttpRequest& request, HttpResponse& response);

View File

@ -49,7 +49,7 @@ public:
@param settings configurations settings
@param parent Parent object
*/
TemplateCache(QSettings* settings, QObject* parent=0);
TemplateCache(QSettings* settings, QObject* parent=nullptr);
protected:

View File

@ -45,7 +45,7 @@ public:
@param settings configurations settings
@param parent parent object
*/
TemplateLoader(QSettings* settings, QObject* parent=0);
TemplateLoader(QSettings* settings, QObject* parent=nullptr);
/** Destructor */
virtual ~TemplateLoader();

View File

@ -14,7 +14,7 @@ class RequestMapper : public HttpRequestHandler
Q_OBJECT
Q_DISABLE_COPY(RequestMapper)
public:
RequestMapper(QObject *parent = 0);
RequestMapper(QObject *parent = nullptr);
void service(HttpRequest &request, HttpResponse &response);
void loadSessionV1(HttpRequest &request, HttpResponse &response);

View File

@ -9,15 +9,15 @@
#include <QFile>
#include <QString>
QString Static::configDir = 0;
QString Static::configDir = nullptr;
TemplateLoader *Static::templateLoader = 0;
TemplateLoader *Static::templateLoader = nullptr;
HttpSessionStore *Static::sessionStore = 0;
HttpSessionStore *Static::sessionStore = nullptr;
StaticFileController *Static::staticFileController = 0;
YACReaderHttpSessionStore *Static::yacreaderSessionStore = 0;
YACReaderHttpSessionStore *Static::yacreaderSessionStore = nullptr;
QString Static::getConfigFileName()
{
@ -62,5 +62,5 @@ QString Static::getConfigDir()
}
qWarning("Cannot find config file %s", qPrintable(configFileName)); //TODO establecer los valores por defecto
return 0;
return nullptr;
}

View File

@ -9,7 +9,7 @@ class YACReaderHttpSession : public QObject
{
Q_OBJECT
public:
explicit YACReaderHttpSession(QObject *parent = 0);
explicit YACReaderHttpSession(QObject *parent = nullptr);
~YACReaderHttpSession();
void setComicsOnDevice(const QSet<QString> &set);

View File

@ -11,7 +11,7 @@ class YACReaderHttpSessionStore : public QObject
{
Q_OBJECT
public:
explicit YACReaderHttpSessionStore(HttpSessionStore *sessionStore, QObject *parent = 0);
explicit YACReaderHttpSessionStore(HttpSessionStore *sessionStore, QObject *parent = nullptr);
void addYACReaderHttpSession(const QByteArray &httpSessionId, YACReaderHttpSession *yacreaderHttpSession);
YACReaderHttpSession *getYACReaderSessionHttpSession(const QByteArray &httpSessionId);