Use nullptr in C++ code (solves #4348) (#5043)

* chore(CppParser): 0, NULL --> nullptr

* chore(Crypto): 0, NULL --> nullptr

* chore(DNSSD): 0, NULL --> nullptr

* chore(Encodings): 0, NULL --> nullptr

* chore(CppUnit): Correct indentation.

* chore(Foundation): 0, NULL --> nullptr

* chore(CMake): Always warn about wrong nullptr usage when compiling with GCC or CLang

* chore(Net): 0, NULL --> nullptr

* chore(Foundation): 0, NULL --> nullptr

* chore(Data): 0, NULL --> nullptr

* chore(macOS): 0, NULL --> nullptr

* chore(XML): 0, NULL --> nullptr

* chore(Zip): 0, NULL --> nullptr

* chore(Util): 0, NULL --> nullptr

* chore(Net/NetSSL): 0, NULL --> nullptr

* chore(Bonjour): 0, NULL --> nullptr

* chore(MongoDB, Redis): 0, NULL --> nullptr

* chore(Poco): 0, NULL --> nullptr

* chore(Win32): 0, NULL --> nullptr

* chore(CMake): Only warn about nullptr when verbose warnings are enabled.

* Potential fix for code scanning alert no. 1634: Guarded Free

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* chore(Net): Fix warning reported by gitlab.

* chore(gitlab CI): attempt to clean to gain disk space on the runner.

* chore(gitlab CI): Run build with  --parallel 4, correct docker cleanup.

---------

Co-authored-by: Aleksandar Fabijanic <aleks-f@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Matej Kenda
2025-10-30 15:20:53 +01:00
committed by GitHub
parent 3e10fb2b0f
commit 8a4a2955d5
480 changed files with 10963 additions and 10932 deletions

View File

@@ -37,8 +37,8 @@ using Poco::Nullable;
using Poco::Tuple;
using Poco::NamedTuple;
Poco::SharedPtr<Poco::Data::Session> MySQLTest::_pSession = 0;
Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = 0;
Poco::SharedPtr<Poco::Data::Session> MySQLTest::_pSession = nullptr;
Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = nullptr;
//
// Parameters for barebone-test
@@ -936,7 +936,7 @@ CppUnit::Test* MySQLTest::suite()
catch (ConnectionFailedException& ex)
{
std::cout << ex.displayText() << std::endl;
return 0;
return nullptr;
}
}

View File

@@ -158,14 +158,14 @@ SQLExecutor::~SQLExecutor()
void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const char* pwd, const char* db, int port, const char* tableCreateString)
{
int rc;
MYSQL* hsession = mysql_init(0);
assertTrue (hsession != 0);
MYSQL* hsession = mysql_init(nullptr);
assertTrue (hsession != nullptr);
MYSQL* tmp = mysql_real_connect(hsession, host, user, pwd, db, port, 0, 0);
MYSQL* tmp = mysql_real_connect(hsession, host, user, pwd, db, port, nullptr, 0);
assertTrue (tmp == hsession);
MYSQL_STMT* hstmt = mysql_stmt_init(hsession);
assertTrue (hstmt != 0);
assertTrue (hstmt != nullptr);
std::string sql = "DROP TABLE Test";
mysql_real_query(hsession, sql.c_str(), static_cast<unsigned long>(sql.length()));
@@ -185,7 +185,7 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch
int fourth = 4;
float fifth = 1.5;
MYSQL_BIND bind_param[5] = {{0}};
MYSQL_BIND bind_param[5] = {{nullptr}};
bind_param[0].buffer = const_cast<char*>(str[0].c_str());
bind_param[0].buffer_length = static_cast<unsigned long>(str[0].length());
@@ -225,7 +225,7 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch
fourth = 0;
fifth = 0.0f;
MYSQL_BIND bind_result[5] = {{0}};
MYSQL_BIND bind_result[5] = {{nullptr}};
bind_result[0].buffer = chr[0];
bind_result[0].buffer_length = sizeof(chr[0]);