mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
Initialize pointer to a default value
This commit is contained in:
@@ -48,7 +48,7 @@ namespace
|
||||
unsigned char octetIndex = 0;
|
||||
|
||||
const char *octetStart = str;
|
||||
char *endptr;
|
||||
char *endptr = nullptr;
|
||||
for (; *str; ++str)
|
||||
{
|
||||
if (*str == '.')
|
||||
|
||||
@@ -58,6 +58,6 @@ private:
|
||||
void stop();
|
||||
|
||||
CachedSettingValue<bool> m_storeActive;
|
||||
lt::session *m_provider;
|
||||
lt::session *m_provider = nullptr;
|
||||
QHash<quint16, std::vector<lt::port_mapping_t>> m_mappedPorts;
|
||||
};
|
||||
|
||||
@@ -288,8 +288,8 @@ namespace BitTorrent
|
||||
|
||||
nonstd::expected<lt::entry, QString> exportTorrent() const;
|
||||
|
||||
Session *const m_session;
|
||||
lt::session *m_nativeSession;
|
||||
Session *const m_session = nullptr;
|
||||
lt::session *m_nativeSession = nullptr;
|
||||
lt::torrent_handle m_nativeHandle;
|
||||
mutable lt::torrent_status m_nativeStatus;
|
||||
TorrentState m_state = TorrentState::Unknown;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace BitTorrent
|
||||
void unregisterPeer(const TrackerAnnounceRequest &announceReq);
|
||||
void prepareAnnounceResponse(const TrackerAnnounceRequest &announceReq);
|
||||
|
||||
Http::Server *m_server;
|
||||
Http::Server *m_server = nullptr;
|
||||
Http::Request m_request;
|
||||
Http::Environment m_env;
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace Http
|
||||
void read();
|
||||
void sendResponse(const Response &response) const;
|
||||
|
||||
QTcpSocket *m_socket;
|
||||
IRequestHandler *m_requestHandler;
|
||||
QTcpSocket *m_socket = nullptr;
|
||||
IRequestHandler *m_requestHandler = nullptr;
|
||||
QByteArray m_receivedData;
|
||||
QElapsedTimer m_idleTimer;
|
||||
};
|
||||
|
||||
@@ -74,7 +74,6 @@ using namespace Http;
|
||||
Server::Server(IRequestHandler *requestHandler, QObject *parent)
|
||||
: QTcpServer(parent)
|
||||
, m_requestHandler(requestHandler)
|
||||
, m_https(false)
|
||||
{
|
||||
setProxy(QNetworkProxy::NoProxy);
|
||||
|
||||
@@ -91,7 +90,7 @@ void Server::incomingConnection(const qintptr socketDescriptor)
|
||||
{
|
||||
if (m_connections.size() >= CONNECTIONS_LIMIT) return;
|
||||
|
||||
QTcpSocket *serverSocket;
|
||||
QTcpSocket *serverSocket = nullptr;
|
||||
if (m_https)
|
||||
serverSocket = new QSslSocket(this);
|
||||
else
|
||||
|
||||
@@ -58,10 +58,10 @@ namespace Http
|
||||
void incomingConnection(qintptr socketDescriptor) override;
|
||||
void removeConnection(Connection *connection);
|
||||
|
||||
IRequestHandler *m_requestHandler;
|
||||
IRequestHandler *m_requestHandler = nullptr;
|
||||
QSet<Connection *> m_connections; // for tracking persistent connections
|
||||
|
||||
bool m_https;
|
||||
bool m_https = false;
|
||||
QList<QSslCertificate> m_certificates;
|
||||
QSslKey m_key;
|
||||
};
|
||||
|
||||
@@ -76,13 +76,7 @@ struct DataFieldDescriptor
|
||||
};
|
||||
|
||||
GeoIPDatabase::GeoIPDatabase(const quint32 size)
|
||||
: m_ipVersion(0)
|
||||
, m_recordSize(0)
|
||||
, m_nodeCount(0)
|
||||
, m_nodeSize(0)
|
||||
, m_indexSize(0)
|
||||
, m_recordBytes(0)
|
||||
, m_size(size)
|
||||
: m_size(size)
|
||||
, m_data(new uchar[size])
|
||||
{
|
||||
}
|
||||
|
||||
@@ -73,16 +73,16 @@ private:
|
||||
template <typename T> QVariant readPlainValue(quint32 &offset, quint8 len) const;
|
||||
|
||||
// Metadata
|
||||
quint16 m_ipVersion;
|
||||
quint16 m_recordSize;
|
||||
quint32 m_nodeCount;
|
||||
int m_nodeSize;
|
||||
int m_indexSize;
|
||||
int m_recordBytes;
|
||||
quint16 m_ipVersion = 0;
|
||||
quint16 m_recordSize = 0;
|
||||
quint32 m_nodeCount = 0;
|
||||
int m_nodeSize = 0;
|
||||
int m_indexSize = 0;
|
||||
int m_recordBytes = 0;
|
||||
QDateTime m_buildEpoch;
|
||||
QString m_dbType;
|
||||
// Search data
|
||||
mutable QHash<quint32, QString> m_countries;
|
||||
quint32 m_size;
|
||||
uchar *m_data;
|
||||
quint32 m_size = 0;
|
||||
uchar *m_data = nullptr;
|
||||
};
|
||||
|
||||
@@ -54,8 +54,6 @@ using namespace Net;
|
||||
GeoIPManager *GeoIPManager::m_instance = nullptr;
|
||||
|
||||
GeoIPManager::GeoIPManager()
|
||||
: m_enabled(false)
|
||||
, m_geoIPDatabase(nullptr)
|
||||
{
|
||||
configure();
|
||||
connect(Preferences::instance(), &Preferences::changed, this, &GeoIPManager::configure);
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace Net
|
||||
void manageDatabaseUpdate();
|
||||
void downloadDatabaseFile();
|
||||
|
||||
bool m_enabled;
|
||||
GeoIPDatabase *m_geoIPDatabase;
|
||||
bool m_enabled = false;
|
||||
GeoIPDatabase *m_geoIPDatabase = nullptr;
|
||||
|
||||
static GeoIPManager *m_instance;
|
||||
};
|
||||
|
||||
@@ -103,9 +103,6 @@ using namespace Net;
|
||||
|
||||
Smtp::Smtp(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_state(Init)
|
||||
, m_useSsl(false)
|
||||
, m_authType(AuthPlain)
|
||||
{
|
||||
static bool needToRegisterMetaType = true;
|
||||
|
||||
|
||||
@@ -103,18 +103,18 @@ namespace Net
|
||||
|
||||
QByteArray m_message;
|
||||
#ifndef QT_NO_OPENSSL
|
||||
QSslSocket *m_socket;
|
||||
QSslSocket *m_socket = nullptr;
|
||||
#else
|
||||
QTcpSocket *m_socket;
|
||||
QTcpSocket *m_socket = nullptr;
|
||||
#endif
|
||||
QString m_from;
|
||||
QString m_rcpt;
|
||||
QString m_response;
|
||||
int m_state;
|
||||
int m_state = Init;
|
||||
QHash<QString, QString> m_extensions;
|
||||
QByteArray m_buffer;
|
||||
bool m_useSsl;
|
||||
AuthType m_authType;
|
||||
bool m_useSsl = false;
|
||||
AuthType m_authType = AuthPlain;
|
||||
QString m_username;
|
||||
QString m_password;
|
||||
};
|
||||
|
||||
@@ -136,9 +136,9 @@ namespace RSS
|
||||
SettingValue<QVariant> m_storeSmartEpisodeFilter;
|
||||
SettingValue<bool> m_storeDownloadRepacks;
|
||||
|
||||
QTimer *m_processingTimer;
|
||||
QThread *m_ioThread;
|
||||
AsyncFileStorage *m_fileStorage;
|
||||
QTimer *m_processingTimer = nullptr;
|
||||
QThread *m_ioThread = nullptr;
|
||||
AsyncFileStorage *m_fileStorage = nullptr;
|
||||
QHash<QString, AutoDownloadRule> m_rules;
|
||||
QList<QSharedPointer<ProcessingJob>> m_processingQueue;
|
||||
QHash<QString, QSharedPointer<ProcessingJob>> m_waitingJobs;
|
||||
|
||||
@@ -158,9 +158,9 @@ namespace RSS
|
||||
CachedSettingValue<bool> m_storeProcessingEnabled;
|
||||
CachedSettingValue<int> m_storeRefreshInterval;
|
||||
CachedSettingValue<int> m_storeMaxArticlesPerFeed;
|
||||
QThread *m_workingThread;
|
||||
AsyncFileStorage *m_confFileStorage;
|
||||
AsyncFileStorage *m_dataFileStorage;
|
||||
QThread *m_workingThread = nullptr;
|
||||
AsyncFileStorage *m_confFileStorage = nullptr;
|
||||
AsyncFileStorage *m_dataFileStorage = nullptr;
|
||||
QTimer m_refreshTimer;
|
||||
QHash<QString, Item *> m_itemsByPath;
|
||||
QHash<QUuid, Feed *> m_feedsByUID;
|
||||
|
||||
@@ -49,6 +49,6 @@ signals:
|
||||
private:
|
||||
void downloadProcessFinished(int exitcode);
|
||||
|
||||
SearchPluginManager *m_manager;
|
||||
QProcess *m_downloadProcess;
|
||||
SearchPluginManager *m_manager = nullptr;
|
||||
QProcess *m_downloadProcess = nullptr;
|
||||
};
|
||||
|
||||
@@ -83,9 +83,9 @@ private:
|
||||
const QString m_pattern;
|
||||
const QString m_category;
|
||||
const QStringList m_usedPlugins;
|
||||
SearchPluginManager *m_manager;
|
||||
QProcess *m_searchProcess;
|
||||
QTimer *m_searchTimeout;
|
||||
SearchPluginManager *m_manager = nullptr;
|
||||
QProcess *m_searchProcess = nullptr;
|
||||
QTimer *m_searchTimeout = nullptr;
|
||||
QByteArray m_searchResultLineTruncated;
|
||||
bool m_searchCancelled = false;
|
||||
QList<SearchResult> m_results;
|
||||
|
||||
@@ -76,9 +76,9 @@ namespace Utils::IO
|
||||
}
|
||||
|
||||
private:
|
||||
QFileDevice *m_device;
|
||||
QFileDevice *m_device = nullptr;
|
||||
std::shared_ptr<QByteArray> m_buffer;
|
||||
int m_bufferSize;
|
||||
int m_bufferSize = 0;
|
||||
};
|
||||
|
||||
nonstd::expected<void, QString> saveToFile(const Path &path, const QByteArray &data);
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace
|
||||
}
|
||||
|
||||
private:
|
||||
FILE *m_randDev;
|
||||
FILE *m_randDev = nullptr;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user