1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

chore(cleanup): don't use 0 as nullptr

Don't add Wzero-as-null-pointer-constant by default, since on older Qt
versions that we stil support and that our CI runs agains, Qt API themselves
cause warnings which lead to build errors all over the place.

Fix #6008
This commit is contained in:
Anthony Bilinski 2020-03-17 03:29:55 -07:00
parent f756dbae2a
commit 70824729ff
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
6 changed files with 15 additions and 10 deletions

View File

@ -113,7 +113,7 @@ void Nexus::start()
#ifdef Q_OS_MAC
// TODO: still needed?
globalMenuBar = new QMenuBar(0);
globalMenuBar = new QMenuBar();
dockMenu = new QMenu(globalMenuBar);
viewMenu = globalMenuBar->addMenu(QString());

View File

@ -738,7 +738,9 @@ void RawDatabase::process()
const QByteArray& blob = query.blobs[curParam + i];
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
// SQLITE_STATIC uses old-style cast and comes from system headers, so can't be fixed by us
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
// SQLITE_STATIC uses old-style cast and 0 as null pointer butcomes from system headers, so can't
// be fixed by us
auto sqliteDataType = SQLITE_STATIC;
#pragma GCC diagnostic pop
if (sqlite3_bind_blob(stmt, i + 1, blob.data(), blob.size(), sqliteDataType)

View File

@ -39,7 +39,10 @@
#define SQLITE_HAS_CODEC
#define SQLITE_TEMP_STORE 2
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#include <sqlite3.h>
#pragma GCC diagnostic pop
using RowId = NamedType<int64_t, struct RowIdTag, Orderable>;
Q_DECLARE_METATYPE(RowId);

View File

@ -57,7 +57,7 @@ inline tstring currentRegistryKeyName()
bool Platform::setAutorun(bool on)
{
HKEY key = 0;
HKEY key = nullptr;
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
0, KEY_ALL_ACCESS, &key)
!= ERROR_SUCCESS)
@ -80,7 +80,7 @@ bool Platform::setAutorun(bool on)
bool Platform::getAutorun()
{
HKEY key = 0;
HKEY key = nullptr;
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
0, KEY_ALL_ACCESS, &key)
!= ERROR_SUCCESS)
@ -93,7 +93,7 @@ bool Platform::getAutorun()
DWORD type = REG_SZ;
bool result = false;
if (RegQueryValueEx(key, keyName.c_str(), 0, &type, const_cast<PBYTE>(reinterpret_cast<const unsigned char*>(path)), &length) == ERROR_SUCCESS
if (RegQueryValueEx(key, keyName.c_str(), nullptr, &type, const_cast<PBYTE>(reinterpret_cast<const unsigned char*>(path)), &length) == ERROR_SUCCESS
&& type == REG_SZ)
result = true;

View File

@ -42,10 +42,10 @@
static char* wcharToUtf8(wchar_t* w)
{
int l = WideCharToMultiByte(CP_UTF8, 0, w, -1, 0, 0, 0, 0);
int l = WideCharToMultiByte(CP_UTF8, 0, w, -1, nullptr, 0, nullptr, nullptr);
char* s = new char[l];
if (s)
WideCharToMultiByte(CP_UTF8, 0, w, -1, s, l, 0, 0);
WideCharToMultiByte(CP_UTF8, 0, w, -1, s, l, nullptr, nullptr);
return s;
}
@ -157,7 +157,7 @@ static IBaseFilter* getDevFilter(QString devName)
if (devName != devIdString)
goto fail;
if (m->BindToObject(0, 0, IID_IBaseFilter, reinterpret_cast<void**>(&devFilter)) != S_OK)
if (m->BindToObject(nullptr, nullptr, IID_IBaseFilter, reinterpret_cast<void**>(&devFilter)) != S_OK)
goto fail;
fail:

View File

@ -55,7 +55,7 @@ class MockGroupQuery : public ICoreGroupQuery
public:
GroupId getGroupPersistentId(uint32_t groupNumber) const override
{
return GroupId(0);
return GroupId();
}
uint32_t getGroupNumberPeers(int groupId) const override
@ -211,7 +211,7 @@ void TestGroupMessageDispatcher::init()
groupQuery = std::unique_ptr<MockGroupQuery>(new MockGroupQuery());
coreIdHandler = std::unique_ptr<MockCoreIdHandler>(new MockCoreIdHandler());
g = std::unique_ptr<Group>(
new Group(0, GroupId(0), "TestGroup", false, "me", *groupQuery, *coreIdHandler));
new Group(0, GroupId(), "TestGroup", false, "me", *groupQuery, *coreIdHandler));
messageSender = std::unique_ptr<MockGroupMessageSender>(new MockGroupMessageSender());
sharedProcessorParams =
std::unique_ptr<MessageProcessor::SharedParams>(new MessageProcessor::SharedParams());