From c86b1dd6a8928bc414849f7e33b733d74da48d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Mon, 1 Jul 2024 10:22:57 +0200 Subject: [PATCH] Replace NULL -> nullptr in *.cpp (#2209) Co-authored-by: Abdoulbari Zaher <32519851+a-zakir@users.noreply.github.com> --- src/analyzer/atsp/cache.cpp | 2 +- src/analyzer/atsp/load.cpp | 6 +-- src/ext/yuni/src/yuni/core/any/any.cpp | 4 +- .../yuni/src/yuni/core/charset/charset.cpp | 2 +- .../src/yuni/core/dynamiclibrary/file.cpp | 2 +- src/ext/yuni/src/yuni/core/getopt/parser.cpp | 4 +- .../yuni/src/yuni/core/system/environment.cpp | 6 +-- .../src/yuni/core/system/gettimeofday.cpp | 4 +- src/ext/yuni/src/yuni/core/system/memory.cpp | 4 +- .../yuni/src/yuni/core/system/username.cpp | 4 +- src/ext/yuni/src/yuni/datetime/timestamp.cpp | 4 +- .../src/yuni/io/directory/info/platform.cpp | 26 +++++------ .../yuni/io/directory/iterator/iterator.cpp | 6 +-- src/ext/yuni/src/yuni/io/directory/remove.cpp | 2 +- src/ext/yuni/src/yuni/io/file/file.cpp | 4 +- src/ext/yuni/src/yuni/io/file/stream.cpp | 4 +- src/ext/yuni/src/yuni/job/job.cpp | 6 +-- src/ext/yuni/src/yuni/job/queue/service.cpp | 6 +-- src/ext/yuni/src/yuni/thread/signal.cpp | 10 ++-- src/ext/yuni/src/yuni/thread/thread.cpp | 4 +- src/ext/yuni/src/yuni/uuid/uuid.cpp | 2 +- src/libs/antares/args/args_to_utf8.cpp | 4 +- src/libs/antares/correlation/correlation.cpp | 4 +- src/libs/antares/locale/locale.cpp | 4 +- src/libs/antares/resources/resources.cpp | 2 +- src/libs/fswalker/fswalker.cpp | 4 +- src/solver/constraints-builder/cbuilder.cpp | 4 +- .../daily/h2o_j_construire_les_variables.cpp | 4 +- .../h2o_j_resoudre_le_probleme_lineaire.cpp | 2 +- .../h2o2_j_resoudre_le_probleme_lineaire.cpp | 2 +- .../h2o_m_resoudre_le_probleme_lineaire.cpp | 2 +- ...ction_variables_optimisees_quadratique.cpp | 2 +- .../opt_gestion_des_bornes_cas_lineaire.cpp | 38 +++++++-------- .../opt_liberation_problemes_simplexe.cpp | 6 +-- src/solver/ts-generator/xcast/math.cpp | 2 +- .../solver/simulation/tests-ts-numbers.cpp | 2 +- src/tools/yby-aggregator/result.cpp | 2 +- .../handler/antares-study/area/create.cpp | 2 +- .../antares-study/constraint/create.cpp | 2 +- .../antares-study/constraint/offsets.cpp | 2 +- .../antares-study/constraint/weights.cpp | 2 +- .../antares-study/thermal-cluster/create.cpp | 2 +- src/ui/common/component/panel/panel.cpp | 6 +-- .../common/component/spotlight/spotlight.cpp | 6 +-- .../main/build/economic-optimization.cpp | 2 +- .../simulator/application/main/build/load.cpp | 2 +- .../application/main/build/notes.cpp | 2 +- .../simulator/application/main/build/sets.cpp | 2 +- .../application/main/build/solar.cpp | 2 +- .../simulator/application/main/build/wind.cpp | 2 +- .../application/main/internal-data.cpp | 2 +- src/ui/simulator/application/main/logs.cpp | 4 +- src/ui/simulator/application/main/notes.cpp | 8 ++-- src/ui/simulator/application/main/options.cpp | 2 +- src/ui/simulator/application/main/refresh.cpp | 2 +- .../toolbox/components/button/button.cpp | 2 +- .../toolbox/components/datagrid/component.cpp | 2 +- .../components/datagrid/filter/operator.cpp | 2 +- .../datagrid/filter/parameter/parameter.cpp | 10 ++-- .../components/datagrid/filter/static.cpp | 2 +- .../components/datagrid/gridhelper.cpp | 2 +- .../components/datagrid/renderer/area/dsm.cpp | 2 +- .../datagrid/renderer/area/misc.cpp | 2 +- .../datagrid/renderer/area/timeseries.cpp | 4 +- .../toolbox/components/map/component.cpp | 4 +- .../toolbox/components/map/nodes/item.cpp | 2 +- .../toolbox/components/map/tools/tool.cpp | 4 +- .../components/notebook/mapnotebook.cpp | 4 +- src/ui/simulator/toolbox/create.cpp | 2 +- src/ui/simulator/toolbox/ext-source/apply.cpp | 4 +- src/ui/simulator/toolbox/input/connection.cpp | 2 +- src/ui/simulator/toolbox/jobs/job.cpp | 46 ++++++++++--------- src/ui/simulator/toolbox/spotlight/area.cpp | 2 +- .../toolbox/spotlight/constraint.cpp | 2 +- .../windows/correlation/correlation.cpp | 2 +- src/ui/simulator/windows/hydro/management.cpp | 2 +- .../adequacy-patch/adequacy-patch-options.cpp | 2 +- .../windows/options/advanced/advanced.cpp | 2 +- .../options/optimization/optimization.cpp | 6 +-- .../options/temp-folder/temp-folder.cpp | 2 +- src/ui/simulator/windows/output/output.cpp | 2 +- .../output/panel/area-link-renderer.cpp | 2 +- .../windows/output/panel/area-link.cpp | 6 +-- src/ui/simulator/windows/simulation/run.cpp | 2 +- 84 files changed, 189 insertions(+), 187 deletions(-) diff --git a/src/analyzer/atsp/cache.cpp b/src/analyzer/atsp/cache.cpp index 312dafe442..07ecd37803 100644 --- a/src/analyzer/atsp/cache.cpp +++ b/src/analyzer/atsp/cache.cpp @@ -37,7 +37,7 @@ void ATSP::cacheCreate() void ATSP::cacheDestroy() { delete[] pCacheMatrix; - pCacheMatrix = NULL; + pCacheMatrix = nullptr; } void ATSP::cacheClear() diff --git a/src/analyzer/atsp/load.cpp b/src/analyzer/atsp/load.cpp index f7a08f4d1a..0f8b92311f 100644 --- a/src/analyzer/atsp/load.cpp +++ b/src/analyzer/atsp/load.cpp @@ -54,12 +54,12 @@ bool ATSP::loadFromINIFile(const String& filename) CString<50, false> key; CString<50, false> value; - for (section = ini.firstSection; section != NULL; section = section->next) + for (section = ini.firstSection; section; section = section->next) { if (section->name == ".general") { IniFile::Property* p = section->firstProperty; - for (; p != NULL; p = p->next) + for (; p ; p = p->next) { key = p->key; key.toLower(); @@ -180,7 +180,7 @@ bool ATSP::loadFromINIFile(const String& filename) info->distribution = Data::XCast::dtBeta; IniFile::Property* p = section->firstProperty; - for (; p != NULL; p = p->next) + for (; p; p = p->next) { key = p->key; key.toLower(); diff --git a/src/ext/yuni/src/yuni/core/any/any.cpp b/src/ext/yuni/src/yuni/core/any/any.cpp index 47017ed8d1..36e2257c32 100644 --- a/src/ext/yuni/src/yuni/core/any/any.cpp +++ b/src/ext/yuni/src/yuni/core/any/any.cpp @@ -16,7 +16,7 @@ namespace Yuni Any::Any() { pTable = Private::Any::Table::Get(); - pObject = NULL; + pObject = nullptr; } Any::Any(const Any& rhs) @@ -59,7 +59,7 @@ void Any::reset() { pTable->staticDelete(&pObject); pTable = Private::Any::Table::Get(); - pObject = NULL; + pObject = nullptr; } } diff --git a/src/ext/yuni/src/yuni/core/charset/charset.cpp b/src/ext/yuni/src/yuni/core/charset/charset.cpp index 2323581439..30c63e0bd2 100644 --- a/src/ext/yuni/src/yuni/core/charset/charset.cpp +++ b/src/ext/yuni/src/yuni/core/charset/charset.cpp @@ -61,7 +61,7 @@ void Converter::reset() { if (!valid()) return; - iconv((iconv_t)pContext, NULL, NULL, NULL, NULL); + iconv((iconv_t)pContext, nullptr, nullptr, nullptr, nullptr); } const char* Converter::Name(Charset::Type type) diff --git a/src/ext/yuni/src/yuni/core/dynamiclibrary/file.cpp b/src/ext/yuni/src/yuni/core/dynamiclibrary/file.cpp index 54f35580a4..0f673490b3 100644 --- a/src/ext/yuni/src/yuni/core/dynamiclibrary/file.cpp +++ b/src/ext/yuni/src/yuni/core/dynamiclibrary/file.cpp @@ -215,7 +215,7 @@ bool File::loadFromRawFilename(const AnyString& filename, File::Relocation r, Fi bool File::hasSymbol(const AnyString& name) const { return NullHandle != pHandle - and NULL != reinterpret_cast(YUNI_DYNLIB_DLSYM(pHandle, name.c_str())); + && reinterpret_cast(YUNI_DYNLIB_DLSYM(pHandle, name.c_str())); } Symbol File::resolve(const AnyString& name) const diff --git a/src/ext/yuni/src/yuni/core/getopt/parser.cpp b/src/ext/yuni/src/yuni/core/getopt/parser.cpp index c34443c470..c3e31f7d72 100644 --- a/src/ext/yuni/src/yuni/core/getopt/parser.cpp +++ b/src/ext/yuni/src/yuni/core/getopt/parser.cpp @@ -118,7 +118,7 @@ inline Context::Context(Parser& parser) : pParser(parser), pTokenIndex(1), pPara bool Context::findNextParameter(IOption* option, int argc, char* argv[]) { - assert(option != NULL); + assert(option); if (not option->requireAdditionalParameter()) { @@ -343,7 +343,7 @@ GetOpt::ReturnCode Parser::operator()(int argc, char* argv[]) void Parser::helpUsage(const char* argv0) { - assert(argv0 != NULL); // just in case + assert(argv0); // just in case// OK std::cout.write("Usage: ", 7); std::cout << ExtractFilenameOnly(argv0); diff --git a/src/ext/yuni/src/yuni/core/system/environment.cpp b/src/ext/yuni/src/yuni/core/system/environment.cpp index 8f278e971e..cb5a5c9800 100644 --- a/src/ext/yuni/src/yuni/core/system/environment.cpp +++ b/src/ext/yuni/src/yuni/core/system/environment.cpp @@ -45,7 +45,7 @@ inline bool ReadImpl(const AnyString& name, StringT& out, bool emptyBefore) if (size != 0) { int sizeRequired - = WideCharToMultiByte(CP_UTF8, 0, buffer, (int)size - 1, NULL, 0, NULL, NULL); + = WideCharToMultiByte(CP_UTF8, 0, buffer, (int)size - 1, nullptr, 0, nullptr, nullptr); if (sizeRequired > 0) { out.reserve(out.size() + sizeRequired); @@ -55,8 +55,8 @@ inline bool ReadImpl(const AnyString& name, StringT& out, bool emptyBefore) (int)size - 1, out.data() + out.size(), size, - NULL, - NULL); + nullptr, + nullptr); ::free(buffer); out.resize(out.size() + (uint)sizeRequired); return true; diff --git a/src/ext/yuni/src/yuni/core/system/gettimeofday.cpp b/src/ext/yuni/src/yuni/core/system/gettimeofday.cpp index a8d3ec2aee..18ff782ed8 100644 --- a/src/ext/yuni/src/yuni/core/system/gettimeofday.cpp +++ b/src/ext/yuni/src/yuni/core/system/gettimeofday.cpp @@ -19,7 +19,7 @@ namespace Yuni { int gettimeofday(struct timeval* tv, struct timezone* tz) { - if (NULL != tv) + if (tv) { struct _timeb timebuffer; _ftime64_s(&timebuffer); @@ -27,7 +27,7 @@ int gettimeofday(struct timeval* tv, struct timezone* tz) tv->tv_usec = (int64_t)(timebuffer.millitm * 1000); } - if (NULL != tz) + if (tz) { static int tzflag = 0; if (!tzflag) diff --git a/src/ext/yuni/src/yuni/core/system/memory.cpp b/src/ext/yuni/src/yuni/core/system/memory.cpp index a872a46b02..4e1bfbce29 100644 --- a/src/ext/yuni/src/yuni/core/system/memory.cpp +++ b/src/ext/yuni/src/yuni/core/system/memory.cpp @@ -268,7 +268,7 @@ uint64_t Total() int mib[2] = {CTL_HW, HW_MEMSIZE}; uint64_t memory; size_t len = sizeof(uint64_t); - return (!sysctl(mib, 2, &memory, &len, NULL, 0)) ? memory : (uint64_t)defaultTotal; + return (!sysctl(mib, 2, &memory, &len, nullptr, 0)) ? memory : (uint64_t)defaultTotal; } uint64_t Available() @@ -298,7 +298,7 @@ bool Usage::update() int mib[2] = {CTL_HW, HW_MEMSIZE}; size_t len = sizeof(uint64_t); size_t sttotal; - if (sysctl(mib, 2, &sttotal, &len, NULL, 0)) + if (sysctl(mib, 2, &sttotal, &len, nullptr, 0)) { total = (uint64_t)defaultTotal; return false; diff --git a/src/ext/yuni/src/yuni/core/system/username.cpp b/src/ext/yuni/src/yuni/core/system/username.cpp index 9e5b57cf7c..1348b2e02c 100644 --- a/src/ext/yuni/src/yuni/core/system/username.cpp +++ b/src/ext/yuni/src/yuni/core/system/username.cpp @@ -37,12 +37,12 @@ uint WindowsUsername(char* cstring, uint size) // The variable `unwsize` contains the final zero --unwsize; // Getting the size of the buffer into UTF8 - int sizeRequired = WideCharToMultiByte(CP_UTF8, 0, unw, unwsize, NULL, 0, NULL, NULL); + int sizeRequired = WideCharToMultiByte(CP_UTF8, 0, unw, unwsize, nullptr, 0, nullptr, nullptr); if (sizeRequired > 0) { if (static_cast(sizeRequired) > size) sizeRequired = size; - WideCharToMultiByte(CP_UTF8, 0, unw, unwsize, cstring, sizeRequired, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, unw, unwsize, cstring, sizeRequired, nullptr, nullptr); return static_cast(sizeRequired); } } diff --git a/src/ext/yuni/src/yuni/datetime/timestamp.cpp b/src/ext/yuni/src/yuni/datetime/timestamp.cpp index 90c1b26496..06c2fa68e9 100644 --- a/src/ext/yuni/src/yuni/datetime/timestamp.cpp +++ b/src/ext/yuni/src/yuni/datetime/timestamp.cpp @@ -97,9 +97,9 @@ char* FormatTimestampToString(const AnyString& format, int64_t timestamp) if (timestamp <= 0) { #ifdef YUNI_OS_MSVC - timestamp = (int64_t)::_time64(NULL); + timestamp = (int64_t)::_time64(nullptr); #else - timestamp = (int64_t)::time(NULL); + timestamp = (int64_t)::time(nullptr); #endif } diff --git a/src/ext/yuni/src/yuni/io/directory/info/platform.cpp b/src/ext/yuni/src/yuni/io/directory/info/platform.cpp index 7a330da911..516a344f41 100644 --- a/src/ext/yuni/src/yuni/io/directory/info/platform.cpp +++ b/src/ext/yuni/src/yuni/io/directory/info/platform.cpp @@ -189,12 +189,12 @@ class DirInfo final : private Yuni::NonCopyable } const int sizeRequired - = WideCharToMultiByte(CP_UTF8, 0, data.name, -1, NULL, 0, NULL, NULL); + = WideCharToMultiByte(CP_UTF8, 0, data.name, -1, nullptr, 0, nullptr, nullptr); if (sizeRequired <= 0) continue; name.reserve((uint)sizeRequired); WideCharToMultiByte( - CP_UTF8, 0, data.name, -1, (char*)name.data(), sizeRequired, NULL, NULL); + CP_UTF8, 0, data.name, -1, (char*)name.data(), sizeRequired, nullptr, nullptr); name.resize(((uint)sizeRequired) - 1); filename.clear(); @@ -341,12 +341,12 @@ IteratorData* IteratorDataCreate(const AnyString& folder, uint flags) data->push(folder); return data; } - return NULL; + return nullptr; } IteratorData* IteratorDataCopy(const IteratorData* data) { - return (data) ? (new IteratorData(*data)) : NULL; + return (data) ? (new IteratorData(*data)) : nullptr; } void IteratorDataFree(const IteratorData* data) @@ -356,52 +356,52 @@ void IteratorDataFree(const IteratorData* data) IteratorData* IteratorDataNext(IteratorData* data) { - assert(data != NULL); + assert(data); if (data->next()) return data; delete data; - return NULL; + return nullptr; } const String& IteratorDataFilename(const IteratorData* data) { - assert(data != NULL); + assert(data); return data->dirinfo.front().filename; } const String& IteratorDataParentName(const IteratorData* data) { - assert(data != NULL); + assert(data); return data->dirinfo.front().parent; } const String& IteratorDataName(const IteratorData* data) { - assert(data != NULL); + assert(data); return data->dirinfo.front().name; } uint64_t IteratorDataSize(const IteratorData* data) { - assert(data != NULL); + assert(data); return data->dirinfo.front().size; } int64_t IteratorDataModified(const IteratorData* data) { - assert(data != NULL); + assert(data); return data->dirinfo.front().modified; } bool IteratorDataIsFolder(const IteratorData* data) { - assert(data != NULL); + assert(data); return data->dirinfo.front().isFolder; } bool IteratorDataIsFile(const IteratorData* data) { - assert(data != NULL); + assert(data); return !data->dirinfo.front().isFolder; } diff --git a/src/ext/yuni/src/yuni/io/directory/iterator/iterator.cpp b/src/ext/yuni/src/yuni/io/directory/iterator/iterator.cpp index 2bcbd5743c..c4ddc8f573 100644 --- a/src/ext/yuni/src/yuni/io/directory/iterator/iterator.cpp +++ b/src/ext/yuni/src/yuni/io/directory/iterator/iterator.cpp @@ -148,7 +148,7 @@ Flow TraverseWindowsFolder(const String& filename, bool files) { // Convertir the filename - assert(opts.wbuffer != NULL); + assert(opts.wbuffer); opts.wbuffer[0] = L'\\'; opts.wbuffer[1] = L'\\'; opts.wbuffer[2] = L'?'; @@ -199,12 +199,12 @@ Flow TraverseWindowsFolder(const String& filename, } const int sizeRequired - = WideCharToMultiByte(CP_UTF8, 0, data.cFileName, -1, NULL, 0, NULL, NULL); + = WideCharToMultiByte(CP_UTF8, 0, data.cFileName, -1, nullptr, 0, nullptr, nullptr); if (sizeRequired <= 0) continue; newName.reserve((uint)sizeRequired); WideCharToMultiByte( - CP_UTF8, 0, data.cFileName, -1, (char*)newName.data(), sizeRequired, NULL, NULL); + CP_UTF8, 0, data.cFileName, -1, (char*)newName.data(), sizeRequired, nullptr, nullptr); newName.resize(((uint)sizeRequired) - 1); newFilename.clear(); diff --git a/src/ext/yuni/src/yuni/io/directory/remove.cpp b/src/ext/yuni/src/yuni/io/directory/remove.cpp index e35f9664f9..e5a936599a 100644 --- a/src/ext/yuni/src/yuni/io/directory/remove.cpp +++ b/src/ext/yuni/src/yuni/io/directory/remove.cpp @@ -73,7 +73,7 @@ static bool RmDirRecursiveInternal(const AnyString& path) buffer.clear() << path << SEP << (const char*)ep->d_name; ::unlink(buffer.c_str()); } - } while (NULL != (ep = ::readdir(dp))); + } while (nullptr != (ep = ::readdir(dp))); } (void)::closedir(dp); } diff --git a/src/ext/yuni/src/yuni/io/file/file.cpp b/src/ext/yuni/src/yuni/io/file/file.cpp index efe0dc80f8..9613b25b1d 100644 --- a/src/ext/yuni/src/yuni/io/file/file.cpp +++ b/src/ext/yuni/src/yuni/io/file/file.cpp @@ -71,7 +71,7 @@ bool Size(const AnyString& filename, uint64_t& value) } HANDLE hndl = CreateFileW( - wstr.c_str(), 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + wstr.c_str(), 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hndl == INVALID_HANDLE_VALUE) { value = 0u; @@ -158,7 +158,7 @@ bool GetLastWriteTime(HANDLE hFile) // Convert the last-write time to local time. if (!FileTimeToSystemTime(&ftWrite, &stUTC)) return false; - if (!SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal)) + if (!SystemTimeToTzSpecificLocalTime(nullptr, &stUTC, &stLocal)) return false; return true; diff --git a/src/ext/yuni/src/yuni/io/file/stream.cpp b/src/ext/yuni/src/yuni/io/file/stream.cpp index 8815990c22..6d5c2cf375 100644 --- a/src/ext/yuni/src/yuni/io/file/stream.cpp +++ b/src/ext/yuni/src/yuni/io/file/stream.cpp @@ -121,7 +121,7 @@ bool Stream::open(const AnyString& filename, int mode) pFd = ::fopen(filename.c_str(), OpenMode::ToCString(mode)); #endif - return (NULL != pFd); + return (pFd); } bool Stream::close() @@ -130,7 +130,7 @@ bool Stream::close() { if (0 == ::fclose(pFd)) { - pFd = NULL; + pFd = nullptr; return true; } return false; diff --git a/src/ext/yuni/src/yuni/job/job.cpp b/src/ext/yuni/src/yuni/job/job.cpp index bef4051930..125bae6f51 100644 --- a/src/ext/yuni/src/yuni/job/job.cpp +++ b/src/ext/yuni/src/yuni/job/job.cpp @@ -21,14 +21,14 @@ IJob::IJob() : pThread(nullptr) IJob::~IJob() { - assert(this != NULL and "IJob: Destructor: Oo `this' is null !?"); - assert(pThread == NULL and "A job can not be attached to a thread when destroyed"); + assert(this && "IJob: Destructor: Oo `this' is null !?"); + assert(!pThread && "A job can not be attached to a thread when destroyed"); } bool IJob::suspend(uint delay) const { // This method must only be called from a thread - assert(pThread and "Job: The pointer to the attached thread must not be NULL"); + assert(pThread and "Job: The pointer to the attached thread must not be nullptr"); // We can suspend the job only if it is running if (pState == stateRunning) diff --git a/src/ext/yuni/src/yuni/job/queue/service.cpp b/src/ext/yuni/src/yuni/job/queue/service.cpp index 775f456cd3..18fe860903 100644 --- a/src/ext/yuni/src/yuni/job/queue/service.cpp +++ b/src/ext/yuni/src/yuni/job/queue/service.cpp @@ -37,14 +37,14 @@ static inline uint OptimalCPUCount() return count; } -QueueService::QueueService() : pStatus(sStopped), pThreads(NULL) +QueueService::QueueService() : pStatus(sStopped), pThreads(nullptr) { uint count = OptimalCPUCount(); pMinimumThreadCount = count; pMaximumThreadCount = count; } -QueueService::QueueService(bool autostart) : pStatus(sStopped), pThreads(NULL) +QueueService::QueueService(bool autostart) : pStatus(sStopped), pThreads(nullptr) { uint count = OptimalCPUCount(); pMinimumThreadCount = count; @@ -172,7 +172,7 @@ void QueueService::stop(uint timeout) return; threads = (ThreadArray*)pThreads; - pThreads = NULL; + pThreads = nullptr; pStatus = sStopping; } diff --git a/src/ext/yuni/src/yuni/thread/signal.cpp b/src/ext/yuni/src/yuni/thread/signal.cpp index 335d61fd20..9da95f2dde 100644 --- a/src/ext/yuni/src/yuni/thread/signal.cpp +++ b/src/ext/yuni/src/yuni/thread/signal.cpp @@ -33,10 +33,10 @@ Signal::Signal() // Making sure that our pseudo HANDLE type is valid assert(sizeof(HANDLE) >= sizeof(void*) and "Invalid type for Signal::pHandle"); - pHandle = (void*)CreateEvent(NULL, // default security attributes + pHandle = (void*)CreateEvent(nullptr, // default security attributes TRUE, // manual-reset event FALSE, // initial state is nonsignaled - NULL); // unamed + nullptr); // unamed #else pSignalled = false; @@ -53,10 +53,10 @@ Signal::Signal(const Signal&) // Making sure that our pseudo HANDLE type is valid assert(sizeof(HANDLE) >= sizeof(void*) and "Invalid type for Signal::pHandle"); - pHandle = (void*)CreateEvent(NULL, // default security attributes + pHandle = (void*)CreateEvent(nullptr, // default security attributes TRUE, // manual-reset event FALSE, // initial state is nonsignaled - NULL); // unamed + nullptr); // unamed #else pSignalled = false; @@ -194,7 +194,7 @@ bool Signal::wait(uint timeout) // Set the timespec t at [timeout] milliseconds in the future. assert(timeout < 2147483648u and "Invalid range for timeout (Signal::wait(timeout))"); - YUNI_SYSTEM_GETTIMEOFDAY(&now, NULL); + YUNI_SYSTEM_GETTIMEOFDAY(&now, nullptr); t.tv_nsec = (long)(now.tv_usec * 1000 + (((int)timeout % 1000) * 1000000)); t.tv_sec = (time_t)(now.tv_sec + timeout / 1000 + (t.tv_nsec / 1000000000L)); t.tv_nsec %= 1000000000L; diff --git a/src/ext/yuni/src/yuni/thread/thread.cpp b/src/ext/yuni/src/yuni/thread/thread.cpp index 048455b281..c8eb06dd9f 100644 --- a/src/ext/yuni/src/yuni/thread/thread.cpp +++ b/src/ext/yuni/src/yuni/thread/thread.cpp @@ -89,8 +89,8 @@ extern "C" YUNI_THREAD_FNC_RETURN threadCallbackExecute(void* arg) #ifndef YUNI_OS_WINDOWS // pthread - Adjust cancellation behaviors - // ::pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - ::pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + // ::pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, nullptr); + ::pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, nullptr); #endif if (thread.onStarting()) diff --git a/src/ext/yuni/src/yuni/uuid/uuid.cpp b/src/ext/yuni/src/yuni/uuid/uuid.cpp index be2e1cc2db..d151ceca1b 100644 --- a/src/ext/yuni/src/yuni/uuid/uuid.cpp +++ b/src/ext/yuni/src/yuni/uuid/uuid.cpp @@ -69,7 +69,7 @@ void UUID::writeToCString(char cstring[42]) const bool UUID::initializeFromCString(const char* cstring) { - assert(cstring != NULL); + assert(cstring != nullptr); #ifndef YUNI_OS_WINDOWS // Why uuid_parse takes a char* and not a const char* ?? diff --git a/src/libs/antares/args/args_to_utf8.cpp b/src/libs/antares/args/args_to_utf8.cpp index 522c176565..15b7db618b 100644 --- a/src/libs/antares/args/args_to_utf8.cpp +++ b/src/libs/antares/args/args_to_utf8.cpp @@ -53,10 +53,10 @@ std::pair IntoUTF8ArgsTranslator::convert() for (int i = 0; i != argc_; ++i) { const uint len = (uint)wcslen(wargv[i]); - const uint newLen = WideCharToMultiByte(CP_UTF8, 0, wargv[i], len, NULL, 0, NULL, NULL); + const uint newLen = WideCharToMultiByte(CP_UTF8, 0, wargv[i], len, nullptr, 0, nullptr, nullptr); argv_[i] = (char*)malloc((newLen + 1) * sizeof(char)); memset(argv_[i], 0, (newLen + 1) * sizeof(char)); - WideCharToMultiByte(CP_UTF8, 0, wargv[i], len, argv_[i], newLen, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, wargv[i], len, argv_[i], newLen, nullptr, nullptr); argv_[i][newLen] = '\0'; } #endif diff --git a/src/libs/antares/correlation/correlation.cpp b/src/libs/antares/correlation/correlation.cpp index 84c39b974f..50b4084bf1 100644 --- a/src/libs/antares/correlation/correlation.cpp +++ b/src/libs/antares/correlation/correlation.cpp @@ -212,13 +212,13 @@ int InterAreaCorrelationLoadFromIniFile(Matrix<>* m, AreaList* l, IniFile* ini, if (ini) { IniFile::Section* s; - for (s = ini->firstSection; s != NULL; s = s->next) /* Each section */ + for (s = ini->firstSection; s; s = s->next) /* Each section */ { Area* from = AreaListLFind(l, s->name.c_str()); if (from) { IniFile::Property* p; - for (p = s->firstProperty; p != NULL; p = p->next) /* Each property*/ + for (p = s->firstProperty; p; p = p->next) /* Each property*/ { Area* to = AreaListLFind(l, p->key.c_str()); if (to and to != from) diff --git a/src/libs/antares/locale/locale.cpp b/src/libs/antares/locale/locale.cpp index 7fcbc420ba..fd74ea2af4 100644 --- a/src/libs/antares/locale/locale.cpp +++ b/src/libs/antares/locale/locale.cpp @@ -31,13 +31,13 @@ namespace Antares void InitializeDefaultLocale() { #ifdef YUNI_OS_WINDOWS - if (NULL == std::setlocale(LC_ALL, "English")) + if (!std::setlocale(LC_ALL, "English")) { std::cerr << "impossible to set locale to English" << std::endl; } #else - if (NULL == std::setlocale(LC_ALL, "en_US.utf8")) + if (! std::setlocale(LC_ALL, "en_US.utf8")) { std::cerr << "impossible to set locale to en_US.utf8" << std::endl; } diff --git a/src/libs/antares/resources/resources.cpp b/src/libs/antares/resources/resources.cpp index cbd3122d18..650d10e99a 100644 --- a/src/libs/antares/resources/resources.cpp +++ b/src/libs/antares/resources/resources.cpp @@ -136,7 +136,7 @@ bool FindExampleFolder(Yuni::String& folder) void Initialize(int argc, char** argv, bool initializeSearchPath) { - if (argc < 1 or argv[0] == NULL) + if (argc < 1 or !argv[0]) { logs.error() << "Impossible to find the root folder"; return; diff --git a/src/libs/fswalker/fswalker.cpp b/src/libs/fswalker/fswalker.cpp index 25a188798e..f1022fe1bd 100644 --- a/src/libs/fswalker/fswalker.cpp +++ b/src/libs/fswalker/fswalker.cpp @@ -267,7 +267,7 @@ bool WalkerThread::triggerFileEvent(const String& filename, int64_t modified, uint64_t size) { - assert(pFileJob != NULL); + assert(pFileJob); // Statistics ++statistics.fileCount; @@ -320,7 +320,7 @@ void WalkerThread::walk(const String& path) do { - assert(pContext.top() != NULL); + assert(pContext.top() ); auto& context = *(pContext.top()); if (pShouldStop) diff --git a/src/solver/constraints-builder/cbuilder.cpp b/src/solver/constraints-builder/cbuilder.cpp index a49806ff16..d713aa7307 100644 --- a/src/solver/constraints-builder/cbuilder.cpp +++ b/src/solver/constraints-builder/cbuilder.cpp @@ -399,12 +399,12 @@ bool CBuilder::completeCBuilderFromFile(const std::string& filename) CString<50, false> key; CString<50, false> value; - for (section = ini.firstSection; section != NULL; section = section->next) + for (section = ini.firstSection; section ; section = section->next) { if (section->name == ".general") { IniFile::Property* p = section->firstProperty; - for (; p != NULL; p = p->next) + for (; p ; p = p->next) { key = p->key; key.toLower(); diff --git a/src/solver/hydro/daily/h2o_j_construire_les_variables.cpp b/src/solver/hydro/daily/h2o_j_construire_les_variables.cpp index 117d8ace5a..98ab62116c 100644 --- a/src/solver/hydro/daily/h2o_j_construire_les_variables.cpp +++ b/src/solver/hydro/daily/h2o_j_construire_les_variables.cpp @@ -57,14 +57,14 @@ void H2O_j_ConstruireLesVariables( Xmin[Var] = 0.0; Xmax[Var] = LINFINI; TypeDeVariable[Var] = VARIABLE_BORNEE_INFERIEUREMENT; - AdresseOuPlacerLaValeurDesVariablesOptimisees[Var] = NULL; + AdresseOuPlacerLaValeurDesVariablesOptimisees[Var] = nullptr; Var++; CorrespondanceDesVariables.NumeroDeLaVariableXi = Var; Xmin[Var] = 0.0; Xmax[Var] = LINFINI; TypeDeVariable[Var] = VARIABLE_BORNEE_INFERIEUREMENT; - AdresseOuPlacerLaValeurDesVariablesOptimisees[Var] = NULL; + AdresseOuPlacerLaValeurDesVariablesOptimisees[Var] = nullptr; Var++; return; diff --git a/src/solver/hydro/daily/h2o_j_resoudre_le_probleme_lineaire.cpp b/src/solver/hydro/daily/h2o_j_resoudre_le_probleme_lineaire.cpp index f4e727adc9..1786428cef 100644 --- a/src/solver/hydro/daily/h2o_j_resoudre_le_probleme_lineaire.cpp +++ b/src/solver/hydro/daily/h2o_j_resoudre_le_probleme_lineaire.cpp @@ -135,7 +135,7 @@ void H2O_J_ResoudreLeProblemeLineaire(DONNEES_MENSUELLES* DonneesMensuelles, int { SPX_LibererProbleme(ProbSpx); - ProbSpx = NULL; + ProbSpx = nullptr; PremierPassage = false; goto RESOLUTION; } diff --git a/src/solver/hydro/daily2/h2o2_j_resoudre_le_probleme_lineaire.cpp b/src/solver/hydro/daily2/h2o2_j_resoudre_le_probleme_lineaire.cpp index e5b4f7411f..a0366dce53 100644 --- a/src/solver/hydro/daily2/h2o2_j_resoudre_le_probleme_lineaire.cpp +++ b/src/solver/hydro/daily2/h2o2_j_resoudre_le_probleme_lineaire.cpp @@ -135,7 +135,7 @@ void H2O2_J_ResoudreLeProblemeLineaire(DONNEES_MENSUELLES_ETENDUES& DonneesMensu { SPX_LibererProbleme(ProbSpx); - ProbSpx = NULL; + ProbSpx = nullptr; premierPassage = false; goto RESOLUTION; } diff --git a/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.cpp b/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.cpp index 75f8178c79..f65ec03e6e 100644 --- a/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.cpp +++ b/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.cpp @@ -132,7 +132,7 @@ void H2O_M_ResoudreLeProblemeLineaire(DONNEES_ANNUELLES& DonneesAnnuelles, int N { SPX_LibererProbleme(ProbSpx); - ProbSpx = NULL; + ProbSpx = nullptr; PremierPassage = false; goto RESOLUTION; } diff --git a/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp b/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp index b067eb6431..e21039e14f 100644 --- a/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp +++ b/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp @@ -31,7 +31,7 @@ void OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeQuadratique(PROBLEME_HEBDO* problemeHebdo) { const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre; - assert(ProblemeAResoudre != NULL); + assert(ProblemeAResoudre ); int nombreDeVariables = 0; auto variableManager = VariableManagerFromProblemHebdo(problemeHebdo); diff --git a/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp b/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp index 5bdbeef705..398af7b814 100644 --- a/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp +++ b/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp @@ -308,8 +308,8 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob TypeDeVariable[var] = VARIABLE_BORNEE_INFERIEUREMENT; } Xmin[var] = 0.0; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; var = variableManager.IntercoIndirectCost(interco, pdtJour); if (CoutDeTransport.IntercoGereeAvecLoopFlow) @@ -329,8 +329,8 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob TypeDeVariable[var] = VARIABLE_BORNEE_INFERIEUREMENT; } Xmin[var] = 0.0; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; } } @@ -382,16 +382,16 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob { Xmin[var] = 0.0; Xmax[var] = LINFINI_ANTARES; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; } var = variableManager.HydProdUp(pays, pdtJour); if (var >= 0 && var < ProblemeAResoudre->NombreDeVariables) { Xmin[var] = 0.0; Xmax[var] = LINFINI_ANTARES; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; } } else if (problemeHebdo->TypeDeLissageHydraulique @@ -404,8 +404,8 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob Xmin[var] = 0.0; Xmax[var] = problemeHebdo->CaracteristiquesHydrauliques[pays] .MaxDesPmaxHydrauliques; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; } var = variableManager.HydProdUp(pays, pdtJour); @@ -414,8 +414,8 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob Xmin[var] = 0.0; Xmax[var] = problemeHebdo->CaracteristiquesHydrauliques[pays] .MaxDesPmaxHydrauliques; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; } } } @@ -440,8 +440,8 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob Xmin[var] = 0.0; Xmax[var] = problemeHebdo->CaracteristiquesHydrauliques[pays] .ApportNaturelHoraire[pdtHebdo]; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; } var = variableManager.HydroLevel(pays, pdtJour); @@ -453,7 +453,7 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob .NiveauHoraireSup[pdtHebdo]; double* adresseDuResultat = &( problemeHebdo->ResultatsHoraires[pays].niveauxHoraires[pdtHebdo]); - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = adresseDuResultat; } @@ -492,14 +492,14 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob Xmin[var] = -(LINFINI_ANTARES); Xmax[var] = LINFINI_ANTARES; - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; // Note: if there were a single optimization run instead of two; the following // could be used: adresseDuResultat = //&(problemeHebdo->CaracteristiquesHydrauliques[pays].LevelForTimeInterval); // AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = adresseDuResultat; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; } for (uint nblayer = 0; nblayer < 100; nblayer++) { @@ -510,8 +510,8 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* prob Xmax[var] = problemeHebdo->CaracteristiquesHydrauliques[pays].TailleReservoir / double(100); - AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = NULL; - AdresseOuPlacerLaValeurDesCoutsReduits[var] = NULL; + AdresseOuPlacerLaValeurDesVariablesOptimisees[var] = nullptr; + AdresseOuPlacerLaValeurDesCoutsReduits[var] = nullptr; } } } diff --git a/src/solver/optimisation/opt_liberation_problemes_simplexe.cpp b/src/solver/optimisation/opt_liberation_problemes_simplexe.cpp index 0ad9462dc4..df0a9b4e37 100644 --- a/src/solver/optimisation/opt_liberation_problemes_simplexe.cpp +++ b/src/solver/optimisation/opt_liberation_problemes_simplexe.cpp @@ -64,12 +64,12 @@ void OPT_LiberationProblemesSimplexe(const OptimizationOptions& options, if (options.ortoolsUsed && solver) { ORTOOLS_LibererProbleme(solver); - solver = NULL; + solver = nullptr; } - else if (ProbSpx != NULL) + else if (ProbSpx) { SPX_LibererProbleme(ProbSpx); - ProbSpx = NULL; + ProbSpx = nullptr; } } } diff --git a/src/solver/ts-generator/xcast/math.cpp b/src/solver/ts-generator/xcast/math.cpp index 0205c170a0..e9d34559ac 100644 --- a/src/solver/ts-generator/xcast/math.cpp +++ b/src/solver/ts-generator/xcast/math.cpp @@ -30,7 +30,7 @@ namespace XCast { void XCast::normal(float& x, float& y) { - assert(random != NULL); + assert(random); double z; double xd; diff --git a/src/tests/src/solver/simulation/tests-ts-numbers.cpp b/src/tests/src/solver/simulation/tests-ts-numbers.cpp index e82d432121..9767cbe525 100644 --- a/src/tests/src/solver/simulation/tests-ts-numbers.cpp +++ b/src/tests/src/solver/simulation/tests-ts-numbers.cpp @@ -55,7 +55,7 @@ void initializeStudy(Study::Ptr study, unsigned int nbYears = 1) Area* addAreaToStudy(Study::Ptr study, const std::string& areaName) { Area* area = study->areaAdd(areaName); - BOOST_CHECK(area != NULL); + BOOST_CHECK(area); return area; } diff --git a/src/tools/yby-aggregator/result.cpp b/src/tools/yby-aggregator/result.cpp index d92dd1c246..fa0fea177a 100644 --- a/src/tools/yby-aggregator/result.cpp +++ b/src/tools/yby-aggregator/result.cpp @@ -61,7 +61,7 @@ ResultMatrix::ResultMatrix(): } ResultMatrix::ResultMatrix(const ResultMatrix&): - columns(NULL), + columns(nullptr), width(0), heightAfterAggregation(0) { diff --git a/src/ui/action/handler/antares-study/area/create.cpp b/src/ui/action/handler/antares-study/area/create.cpp index cc671fec5d..4b9bd41a68 100644 --- a/src/ui/action/handler/antares-study/area/create.cpp +++ b/src/ui/action/handler/antares-study/area/create.cpp @@ -221,7 +221,7 @@ bool Create::performWL(Context& ctx) } } ctx.autoselectAreas.push_back(ctx.area); - return (ctx.area != NULL); + return (ctx.area); } void Create::createActionsForAStandardAreaCopy(Context& ctx, bool copyPosition) diff --git a/src/ui/action/handler/antares-study/constraint/create.cpp b/src/ui/action/handler/antares-study/constraint/create.cpp index 11425b2d51..fe223495e1 100644 --- a/src/ui/action/handler/antares-study/constraint/create.cpp +++ b/src/ui/action/handler/antares-study/constraint/create.cpp @@ -200,7 +200,7 @@ bool Create::performWL(Context& ctx) // ctx.constraint->type(pType); } ctx.autoselectConstraints.push_back(ctx.constraint); - return (ctx.constraint != NULL); + return (ctx.constraint != nullptr); } void Create::createActionsForAStandardConstraintCopy(Context&) diff --git a/src/ui/action/handler/antares-study/constraint/offsets.cpp b/src/ui/action/handler/antares-study/constraint/offsets.cpp index 5ecd0eb35e..8bf90571ec 100644 --- a/src/ui/action/handler/antares-study/constraint/offsets.cpp +++ b/src/ui/action/handler/antares-study/constraint/offsets.cpp @@ -33,7 +33,7 @@ namespace AntaresStudy namespace Constraint { Offsets::Offsets(const AnyString& name, Antares::Data::ConstraintName targetName) : - pOriginalConstraintName(name), targetName(targetName), pCurrentContext(NULL) + pOriginalConstraintName(name), targetName(targetName), pCurrentContext(nullptr) { pInfos.caption << "Offsets"; } diff --git a/src/ui/action/handler/antares-study/constraint/weights.cpp b/src/ui/action/handler/antares-study/constraint/weights.cpp index 865a57ec62..ad9691ace5 100644 --- a/src/ui/action/handler/antares-study/constraint/weights.cpp +++ b/src/ui/action/handler/antares-study/constraint/weights.cpp @@ -33,7 +33,7 @@ namespace AntaresStudy namespace Constraint { Weights::Weights(const AnyString& name, Antares::Data::ConstraintName targetName) : - pOriginalConstraintName(name), targetName(targetName), pCurrentContext(NULL) + pOriginalConstraintName(name), targetName(targetName), pCurrentContext(nullptr) { pInfos.caption << "Weights"; } diff --git a/src/ui/action/handler/antares-study/thermal-cluster/create.cpp b/src/ui/action/handler/antares-study/thermal-cluster/create.cpp index 495d434d5f..6a71b98626 100644 --- a/src/ui/action/handler/antares-study/thermal-cluster/create.cpp +++ b/src/ui/action/handler/antares-study/thermal-cluster/create.cpp @@ -182,7 +182,7 @@ bool Create::performWL(Context& ctx) if (pInfos.behavior == bhOverwrite) (ctx.cluster)->reset(); } - return (ctx.area != NULL); + return (ctx.area != nullptr); } return true; } diff --git a/src/ui/common/component/panel/panel.cpp b/src/ui/common/component/panel/panel.cpp index c2c20c5cf0..03ff527c59 100644 --- a/src/ui/common/component/panel/panel.cpp +++ b/src/ui/common/component/panel/panel.cpp @@ -40,9 +40,9 @@ Panel::Panel(wxWindow* parent) : { assert(parent && "invalid parent"); - Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(Panel::onInternalMotion), NULL, this); - Connect(GetId(), wxEVT_LEFT_DOWN, wxMouseEventHandler(Panel::onInternalMouseDown), NULL, this); - Connect(GetId(), wxEVT_LEFT_UP, wxMouseEventHandler(Panel::onInternalMouseUp), NULL, this); + Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(Panel::onInternalMotion), nullptr, this); + Connect(GetId(), wxEVT_LEFT_DOWN, wxMouseEventHandler(Panel::onInternalMouseDown), nullptr, this); + Connect(GetId(), wxEVT_LEFT_UP, wxMouseEventHandler(Panel::onInternalMouseUp), nullptr, this); } Panel::~Panel() diff --git a/src/ui/common/component/spotlight/spotlight.cpp b/src/ui/common/component/spotlight/spotlight.cpp index 661670dfac..09e381034e 100644 --- a/src/ui/common/component/spotlight/spotlight.cpp +++ b/src/ui/common/component/spotlight/spotlight.cpp @@ -122,7 +122,7 @@ void Spotlight::createComponents(Spotlight* parent, bool input, bool results) wxDefaultPosition, wxDefaultSize, 0, - NULL, + nullptr, wxCB_READONLY); pLayerFilter->SetFont(wxFont(wxFontInfo().Bold())); pLayerFilter->AppendString("All"); @@ -429,9 +429,9 @@ void Spotlight::resizeParentWindow() parent->SetSize(parent->GetSize().GetWidth(), idealH); } - assert(parent->GetSizer() != NULL); + assert(parent->GetSizer()); parent->GetSizer()->Layout(); - assert(GetSizer() != NULL); + assert(GetSizer()); GetSizer()->Layout(); Dispatcher::GUI::Refresh(parent); } diff --git a/src/ui/simulator/application/main/build/economic-optimization.cpp b/src/ui/simulator/application/main/build/economic-optimization.cpp index 7c1ddb66c3..f11c7865e2 100644 --- a/src/ui/simulator/application/main/build/economic-optimization.cpp +++ b/src/ui/simulator/application/main/build/economic-optimization.cpp @@ -34,7 +34,7 @@ namespace Forms { void ApplWnd::createNBNodalOptimization() { - assert(NULL != pNotebook); + assert(pNotebook); // Create a standard page with an input selector std::pair page diff --git a/src/ui/simulator/application/main/build/load.cpp b/src/ui/simulator/application/main/build/load.cpp index 98cdfb69e8..917279955b 100644 --- a/src/ui/simulator/application/main/build/load.cpp +++ b/src/ui/simulator/application/main/build/load.cpp @@ -35,7 +35,7 @@ namespace Forms { void ApplWnd::createNBLoad() { - assert(NULL != pNotebook); + assert(pNotebook); // Create a standard page with an input selector std::pair page diff --git a/src/ui/simulator/application/main/build/notes.cpp b/src/ui/simulator/application/main/build/notes.cpp index 9e9f6fb585..fcca4f545b 100644 --- a/src/ui/simulator/application/main/build/notes.cpp +++ b/src/ui/simulator/application/main/build/notes.cpp @@ -30,7 +30,7 @@ namespace Forms { void ApplWnd::createNBNotes() { - assert(NULL != pNotebook); + assert(pNotebook); pUserNotes = new Window::Notes(pNotebook); pNotebook->add(pUserNotes, wxT("notes"), wxT("User's Notes")); diff --git a/src/ui/simulator/application/main/build/sets.cpp b/src/ui/simulator/application/main/build/sets.cpp index bbd139fba1..c6119f3d93 100644 --- a/src/ui/simulator/application/main/build/sets.cpp +++ b/src/ui/simulator/application/main/build/sets.cpp @@ -30,7 +30,7 @@ namespace Forms { void ApplWnd::createNBSets() { - assert(NULL != pNotebook); + assert(pNotebook); pSets = new Window::Sets(pNotebook); pNotebook->add(pSets, wxT("sets"), wxT("")); diff --git a/src/ui/simulator/application/main/build/solar.cpp b/src/ui/simulator/application/main/build/solar.cpp index a2d6d25657..6c9f29cea1 100644 --- a/src/ui/simulator/application/main/build/solar.cpp +++ b/src/ui/simulator/application/main/build/solar.cpp @@ -35,7 +35,7 @@ namespace Forms { void ApplWnd::createNBSolar() { - assert(NULL != pNotebook); + assert(pNotebook); // Create a standard page with an input selector std::pair page diff --git a/src/ui/simulator/application/main/build/wind.cpp b/src/ui/simulator/application/main/build/wind.cpp index c4f28409b6..73dce91d73 100644 --- a/src/ui/simulator/application/main/build/wind.cpp +++ b/src/ui/simulator/application/main/build/wind.cpp @@ -35,7 +35,7 @@ namespace Forms { void ApplWnd::createNBWind() { - assert(NULL != pNotebook); + assert(pNotebook); // Create a standard page with an input selector std::pair page diff --git a/src/ui/simulator/application/main/internal-data.cpp b/src/ui/simulator/application/main/internal-data.cpp index 36468656c6..07a9788001 100644 --- a/src/ui/simulator/application/main/internal-data.cpp +++ b/src/ui/simulator/application/main/internal-data.cpp @@ -32,7 +32,7 @@ MainFormData::MainFormData(ApplWnd& form) : wipEnabled(false), wipPanel(nullptr) void MainFormData::editCurrentLocation(const wxString& string) { - assert(pEditCurrentLocation != NULL); + assert(pEditCurrentLocation); pEditCurrentLocation->SetItemLabel(wxString(wxT("Current tab : ")) << string); } diff --git a/src/ui/simulator/application/main/logs.cpp b/src/ui/simulator/application/main/logs.cpp index 9be770b174..c2e47bd0a4 100644 --- a/src/ui/simulator/application/main/logs.cpp +++ b/src/ui/simulator/application/main/logs.cpp @@ -172,7 +172,7 @@ void ApplWnd::destroyLogs() if (pLogFlusherTimer) { wxTimer* timer = pLogFlusherTimer; - pLogFlusherTimer = NULL; + pLogFlusherTimer = nullptr; delete timer; } } @@ -196,7 +196,7 @@ void ApplWnd::destroyLogsViewer() if (pWndLogs) { pWndLogs->Destroy(); - pWndLogs = NULL; + pWndLogs = nullptr; } } diff --git a/src/ui/simulator/application/main/notes.cpp b/src/ui/simulator/application/main/notes.cpp index 4c0cbb62d5..60e2c17c08 100644 --- a/src/ui/simulator/application/main/notes.cpp +++ b/src/ui/simulator/application/main/notes.cpp @@ -31,25 +31,25 @@ namespace Forms { void ApplWnd::loadUserNotes() { - assert(NULL != pUserNotes); + assert(pUserNotes); pUserNotes->loadFromStudy(); } void ApplWnd::saveUserNotes() { - assert(NULL != pUserNotes); + assert(pUserNotes); pUserNotes->saveToStudy(); } void ApplWnd::loadSets() { - assert(NULL != pSets); + assert(pSets); pSets->loadFromStudy(); } void ApplWnd::saveSets() { - assert(NULL != pSets); + assert(pSets); pSets->saveToStudy(); } diff --git a/src/ui/simulator/application/main/options.cpp b/src/ui/simulator/application/main/options.cpp index eb8389a229..3b8fc01098 100644 --- a/src/ui/simulator/application/main/options.cpp +++ b/src/ui/simulator/application/main/options.cpp @@ -73,7 +73,7 @@ void ApplWnd::evtOnOptionsDistricts(wxCommandEvent&) Forms::Disabler disabler(*this); if (CurrentStudyIsValid()) { - assert(NULL != pNotebook); + assert(pNotebook); pNotebook->select("sets"); } } diff --git a/src/ui/simulator/application/main/refresh.cpp b/src/ui/simulator/application/main/refresh.cpp index 587c38bdbc..88c36a57cb 100644 --- a/src/ui/simulator/application/main/refresh.cpp +++ b/src/ui/simulator/application/main/refresh.cpp @@ -315,7 +315,7 @@ void ApplWnd::refreshMenuOutput() it->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Forms::ApplWnd::evtOnOpenOutputInExplorer), - NULL, + nullptr, parentForm); } } diff --git a/src/ui/simulator/toolbox/components/button/button.cpp b/src/ui/simulator/toolbox/components/button/button.cpp index 3bdab39981..9fbb2b9118 100644 --- a/src/ui/simulator/toolbox/components/button/button.cpp +++ b/src/ui/simulator/toolbox/components/button/button.cpp @@ -158,7 +158,7 @@ void Button::loadIconFromResource(const char* filename) void Button::precalculateCoordinates() { // Assert - assert(this != NULL && "Button: this must not be null"); + assert(this != nullptr && "Button: this must not be null"); assert(iconMargin <= 128 && "Button: The margin seems suspicious"); if (pCaption.empty()) diff --git a/src/ui/simulator/toolbox/components/datagrid/component.cpp b/src/ui/simulator/toolbox/components/datagrid/component.cpp index e33bb0ea63..75f3196901 100644 --- a/src/ui/simulator/toolbox/components/datagrid/component.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/component.cpp @@ -517,7 +517,7 @@ void InternalState::createAllInternalControls(const CreateOptions& flags) wxDefaultPosition, wxSize(-1, 22), 0, - NULL, + nullptr, wxCB_READONLY); pLayerFilter->SetFont(wxFont(wxFontInfo().Bold())); pLayerFilter->AppendString("All"); diff --git a/src/ui/simulator/toolbox/components/datagrid/filter/operator.cpp b/src/ui/simulator/toolbox/components/datagrid/filter/operator.cpp index d54c277824..ef4d2e1997 100644 --- a/src/ui/simulator/toolbox/components/datagrid/filter/operator.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/filter/operator.cpp @@ -30,7 +30,7 @@ namespace Filter namespace Operator { AOperator::AOperator(AFilterBase* parent, const wxChar* name, const wxChar* caption) : - pParentFilter(parent), pName(name), pCaption(caption), pSizer(NULL) + pParentFilter(parent), pName(name), pCaption(caption), pSizer(nullptr) { parameters.push_back(Parameter(*this).presetInt()); } diff --git a/src/ui/simulator/toolbox/components/datagrid/filter/parameter/parameter.cpp b/src/ui/simulator/toolbox/components/datagrid/filter/parameter/parameter.cpp index 0235fd86fe..1e6711a8ee 100644 --- a/src/ui/simulator/toolbox/components/datagrid/filter/parameter/parameter.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/filter/parameter/parameter.cpp @@ -38,7 +38,7 @@ namespace Filter namespace Operator { Parameter::Parameter(AOperator& parent) : - pOperator(parent), dataType(DataType::dtNone), pSizer(NULL) + pOperator(parent), dataType(DataType::dtNone), pSizer(nullptr) { } @@ -50,7 +50,7 @@ Parameter::Parameter(const Parameter& copy) : dataType(copy.dataType), defaultValues(copy.defaultValues), value(copy.value), - pSizer(NULL) + pSizer(nullptr) { } @@ -70,7 +70,7 @@ Parameter& Parameter::operator=(const Parameter& copy) wxSizer* Parameter::sizer(wxWindow* parent) { - if (NULL == pSizer) + if (nullptr == pSizer) { pSizer = new wxBoxSizer(wxHORIZONTAL); @@ -95,7 +95,7 @@ wxSizer* Parameter::sizer(wxWindow* parent) ch->Connect(ch->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(Parameter::onListChanged), - NULL, + nullptr, this); break; } @@ -125,7 +125,7 @@ wxSizer* Parameter::sizer(wxWindow* parent) edit->Connect(edit->GetId(), wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(Parameter::onChange), - NULL, + nullptr, this); } } diff --git a/src/ui/simulator/toolbox/components/datagrid/filter/static.cpp b/src/ui/simulator/toolbox/components/datagrid/filter/static.cpp index b7d29a319e..b5f055a1ca 100644 --- a/src/ui/simulator/toolbox/components/datagrid/filter/static.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/filter/static.cpp @@ -63,7 +63,7 @@ struct ResultNewInstance using Type = AFilterBase*; static AFilterBase* Default() { - return NULL; + return nullptr; } static T* Value(Input* parent) { diff --git a/src/ui/simulator/toolbox/components/datagrid/gridhelper.cpp b/src/ui/simulator/toolbox/components/datagrid/gridhelper.cpp index 62435e993b..9b6d962f95 100644 --- a/src/ui/simulator/toolbox/components/datagrid/gridhelper.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/gridhelper.cpp @@ -271,7 +271,7 @@ class GridCellAttrProvider final : public wxGridCellAttrProvider attr = pStyles[(uint)style]; } - assert(attr != NULL and "Invalid cell attribute"); + assert(attr &&"Invalid cell attribute"); attr->IncRef(); return attr; } diff --git a/src/ui/simulator/toolbox/components/datagrid/renderer/area/dsm.cpp b/src/ui/simulator/toolbox/components/datagrid/renderer/area/dsm.cpp index e249c43e93..8f7835a381 100644 --- a/src/ui/simulator/toolbox/components/datagrid/renderer/area/dsm.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/renderer/area/dsm.cpp @@ -58,7 +58,7 @@ wxString DSM::columnCaption(int colIndx) const void DSM::internalAreaChanged(Antares::Data::Area* area) { - this->matrix((area) ? &(area->reserves) : NULL); + this->matrix((area) ? &(area->reserves) : nullptr); Renderer::ARendererArea::internalAreaChanged(area); } diff --git a/src/ui/simulator/toolbox/components/datagrid/renderer/area/misc.cpp b/src/ui/simulator/toolbox/components/datagrid/renderer/area/misc.cpp index 180b0424bf..c1749b27ae 100644 --- a/src/ui/simulator/toolbox/components/datagrid/renderer/area/misc.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/renderer/area/misc.cpp @@ -100,7 +100,7 @@ double Misc::cellNumericValue(int x, int y) const void Misc::internalAreaChanged(Antares::Data::Area* area) { - this->matrix((area) ? &(area->miscGen) : NULL); + this->matrix((area) ? &(area->miscGen) : nullptr); Renderer::ARendererArea::internalAreaChanged(area); } diff --git a/src/ui/simulator/toolbox/components/datagrid/renderer/area/timeseries.cpp b/src/ui/simulator/toolbox/components/datagrid/renderer/area/timeseries.cpp index df27cabc7c..a1060c1b70 100644 --- a/src/ui/simulator/toolbox/components/datagrid/renderer/area/timeseries.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/renderer/area/timeseries.cpp @@ -354,7 +354,7 @@ void TimeSeriesThermalClusterFuelCost::onStudyClosed() void TimeSeriesThermalClusterFuelCost::internalThermalClusterChanged( Antares::Data::ThermalCluster* cluster) { - matrix((CurrentStudyIsValid() && cluster) ? &(cluster->ecoInput.fuelcost) : NULL); + matrix((CurrentStudyIsValid() && cluster) ? &(cluster->ecoInput.fuelcost) : nullptr); } // ---------------------- @@ -384,7 +384,7 @@ void TimeSeriesThermalClusterCO2Cost::onStudyClosed() void TimeSeriesThermalClusterCO2Cost::internalThermalClusterChanged( Antares::Data::ThermalCluster* cluster) { - matrix((CurrentStudyIsValid() && cluster) ? &(cluster->ecoInput.co2cost) : NULL); + matrix((CurrentStudyIsValid() && cluster) ? &(cluster->ecoInput.co2cost) : nullptr); } // ---------------------- diff --git a/src/ui/simulator/toolbox/components/map/component.cpp b/src/ui/simulator/toolbox/components/map/component.cpp index 89daf4828a..93de041cb9 100644 --- a/src/ui/simulator/toolbox/components/map/component.cpp +++ b/src/ui/simulator/toolbox/components/map/component.cpp @@ -103,12 +103,12 @@ Component::Component(wxWindow* parent) : pSelectionPopUpMenu->Connect(Antares::Forms::MenusID::mnIDPopupSelectionHide, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Component::evtOnSelectionHide), - NULL, + nullptr, this); pSelectionPopUpMenu->Connect(Antares::Forms::MenusID::mnIDPopupSelectionShow, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Component::evtOnSelectionShow), - NULL, + nullptr, this); mainSizer->Layout(); diff --git a/src/ui/simulator/toolbox/components/map/nodes/item.cpp b/src/ui/simulator/toolbox/components/map/nodes/item.cpp index 4eac0ac92e..cb567af5af 100644 --- a/src/ui/simulator/toolbox/components/map/nodes/item.cpp +++ b/src/ui/simulator/toolbox/components/map/nodes/item.cpp @@ -112,7 +112,7 @@ void Item::internalClearAllLinks() if (pLinks && !pLinks->empty()) { Links* lnks = pLinks; - pLinks = NULL; + pLinks = nullptr; const Links::const_iterator end = lnks->end(); for (Links::const_iterator i = lnks->begin(); i != end; ++i) diff --git a/src/ui/simulator/toolbox/components/map/tools/tool.cpp b/src/ui/simulator/toolbox/components/map/tools/tool.cpp index ac957bb56b..3b244b5869 100644 --- a/src/ui/simulator/toolbox/components/map/tools/tool.cpp +++ b/src/ui/simulator/toolbox/components/map/tools/tool.cpp @@ -32,7 +32,7 @@ namespace Tool Tool::Tool(Manager& manager, const char* icon) : pManager(manager), pX(0), pY(0), pWidth(20), pHeight(20) { - pIcon = (icon && *icon != '\0') ? Resources::BitmapLoadFromFile(icon) : NULL; + pIcon = (icon && *icon != '\0') ? Resources::BitmapLoadFromFile(icon) : nullptr; } Tool::~Tool() @@ -43,7 +43,7 @@ Tool::~Tool() void Tool::icon(const char* filename) { delete pIcon; - pIcon = (filename && *filename != '\0') ? Resources::BitmapLoadFromFile(filename) : NULL; + pIcon = (filename && *filename != '\0') ? Resources::BitmapLoadFromFile(filename) : nullptr; } void Tool::draw(DrawingContext& dc, const bool mouseDown, const wxPoint&, const wxPoint&) const diff --git a/src/ui/simulator/toolbox/components/notebook/mapnotebook.cpp b/src/ui/simulator/toolbox/components/notebook/mapnotebook.cpp index 7b709afbe4..f4bee76ce3 100644 --- a/src/ui/simulator/toolbox/components/notebook/mapnotebook.cpp +++ b/src/ui/simulator/toolbox/components/notebook/mapnotebook.cpp @@ -98,8 +98,8 @@ bool MapNotebook::remove(Page* page) MapNotebook::MapTabs::MapTabs(wxWindow* parent, Notebook& notebook) : Tabs(parent, notebook), undrawnLeftTabs(0), remainingRightTabs(0), pTabNameCtrl(nullptr) { - Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(MapTabs::onMouseMove), NULL, this); - Connect(GetId(), wxEVT_LEAVE_WINDOW, wxMouseEventHandler(MapTabs::onMouseLeave), NULL, this); + Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(MapTabs::onMouseMove), nullptr, this); + Connect(GetId(), wxEVT_LEAVE_WINDOW, wxMouseEventHandler(MapTabs::onMouseLeave), nullptr, this); // add Page button addPageButton = new tabButton( "images/16x16/white_add_18.png", this, tabButton::btnNone, "images/16x16/grey_add_18.png"); diff --git a/src/ui/simulator/toolbox/create.cpp b/src/ui/simulator/toolbox/create.cpp index be3d23e13d..5687a5fc37 100644 --- a/src/ui/simulator/toolbox/create.cpp +++ b/src/ui/simulator/toolbox/create.cpp @@ -38,7 +38,7 @@ CustomWxButton::CustomWxButton(wxWindow* parent, const wxString& title) : wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent( wxCommandEventFunction, &CustomWxButton::evtOnUserClick), - NULL, + nullptr, this); } diff --git a/src/ui/simulator/toolbox/ext-source/apply.cpp b/src/ui/simulator/toolbox/ext-source/apply.cpp index 4e7f690151..13ea0c43a0 100644 --- a/src/ui/simulator/toolbox/ext-source/apply.cpp +++ b/src/ui/simulator/toolbox/ext-source/apply.cpp @@ -40,12 +40,12 @@ void Apply(Antares::Action::Context::Ptr context, if (windowRequired) { - auto* form = new Antares::Window::ApplyActionsDialog(NULL, context, root); + auto* form = new Antares::Window::ApplyActionsDialog(nullptr, context, root); Dispatcher::GUI::ShowModal(form); } else { - auto* form = new Antares::Window::PerformerDialog(NULL, context, root); + auto* form = new Antares::Window::PerformerDialog(nullptr, context, root); Dispatcher::GUI::ShowModal(form); } } diff --git a/src/ui/simulator/toolbox/input/connection.cpp b/src/ui/simulator/toolbox/input/connection.cpp index 7934b663f0..68e6f39f9f 100644 --- a/src/ui/simulator/toolbox/input/connection.cpp +++ b/src/ui/simulator/toolbox/input/connection.cpp @@ -112,7 +112,7 @@ void Connections::internalBuildSubControls() sizer->AddSpacer(1); // Layer filter pLayerFilter = new wxComboBox( - this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); + this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY); pLayerFilter->SetFont(wxFont(wxFontInfo().Bold())); pLayerFilter->AppendString("All"); pLayerFilter->SetValue("All"); diff --git a/src/ui/simulator/toolbox/jobs/job.cpp b/src/ui/simulator/toolbox/jobs/job.cpp index 926764f484..f4c2f4e284 100644 --- a/src/ui/simulator/toolbox/jobs/job.cpp +++ b/src/ui/simulator/toolbox/jobs/job.cpp @@ -1,23 +1,23 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ +/* +** Copyright 2007-2024, RTE (https://www.rte-france.com) +** See AUTHORS.txt +** SPDX-License-Identifier: MPL-2.0 +** This file is part of Antares-Simulator, +** Adequacy and Performance assessment for interconnected energy networks. +** +** Antares_Simulator is free software: you can redistribute it and/or modify +** it under the terms of the Mozilla Public Licence 2.0 as published by +** the Mozilla Foundation, either version 2 of the License, or +** (at your option) any later version. +** +** Antares_Simulator is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** Mozilla Public Licence 2.0 for more details. +** +** You should have received a copy of the Mozilla Public Licence 2.0 +** along with Antares_Simulator. If not, see . +*/ #include #include @@ -478,7 +478,8 @@ class MessageFlusherTimer final : public wxTimer MessageFlusherTimer(const wxString& messageBuffer, wxStaticText* label, std::mutex& mutex) : wxTimer(), pMessageBuffer(messageBuffer), pLabel(label), pMutex(mutex) { - assert(pLabel != NULL); + assert(pLabel); + } virtual ~MessageFlusherTimer() @@ -513,7 +514,8 @@ class ReadWriteStatsFlusherTimer final : public wxTimer public: ReadWriteStatsFlusherTimer(wxStaticText* label) : wxTimer(), pLabel(label) { - assert(pLabel != NULL); + assert(pLabel); + } virtual ~ReadWriteStatsFlusherTimer() diff --git a/src/ui/simulator/toolbox/spotlight/area.cpp b/src/ui/simulator/toolbox/spotlight/area.cpp index 9d0147e104..64a7589a31 100644 --- a/src/ui/simulator/toolbox/spotlight/area.cpp +++ b/src/ui/simulator/toolbox/spotlight/area.cpp @@ -33,7 +33,7 @@ namespace Spotlight { ItemArea::ItemArea(Data::Area* a) : area(a) { - assert(a != NULL); + assert(a); caption(a->name); group("Area"); diff --git a/src/ui/simulator/toolbox/spotlight/constraint.cpp b/src/ui/simulator/toolbox/spotlight/constraint.cpp index 2917526b13..de73cb889d 100644 --- a/src/ui/simulator/toolbox/spotlight/constraint.cpp +++ b/src/ui/simulator/toolbox/spotlight/constraint.cpp @@ -33,7 +33,7 @@ namespace Spotlight { ItemConstraint::ItemConstraint(Data::BindingConstraint* a) : constraint(a) { - assert(a != NULL); + assert(a); caption(a->name()); group("Constraint"); diff --git a/src/ui/simulator/windows/correlation/correlation.cpp b/src/ui/simulator/windows/correlation/correlation.cpp index 6edf4e095c..762479f64e 100644 --- a/src/ui/simulator/windows/correlation/correlation.cpp +++ b/src/ui/simulator/windows/correlation/correlation.cpp @@ -303,7 +303,7 @@ void CorrelationPanel::assignMatrices(Data::Correlation* corr) { if (pData) { - if (corr == NULL) + if (!corr) { for (uint i = 0; i < 12 + 1; ++i) { diff --git a/src/ui/simulator/windows/hydro/management.cpp b/src/ui/simulator/windows/hydro/management.cpp index 625a6e50a8..7822f58544 100644 --- a/src/ui/simulator/windows/hydro/management.cpp +++ b/src/ui/simulator/windows/hydro/management.cpp @@ -956,7 +956,7 @@ void Management::onToggleInitializeReservoirLevelDate(Component::Button&, wxMenu for (int i = 0; i < 12; i++) { - it = Menu::CreateItem(&menu, i, Antares::Date::MonthToString(i, 0), NULL, wxEmptyString); + it = Menu::CreateItem(&menu, i, Antares::Date::MonthToString(i, 0), nullptr, wxEmptyString); menu.Connect(it->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Management::onChangingInitializeReservoirLevelDate), diff --git a/src/ui/simulator/windows/options/adequacy-patch/adequacy-patch-options.cpp b/src/ui/simulator/windows/options/adequacy-patch/adequacy-patch-options.cpp index 344a1acc7a..2368e68d13 100644 --- a/src/ui/simulator/windows/options/adequacy-patch/adequacy-patch-options.cpp +++ b/src/ui/simulator/windows/options/adequacy-patch/adequacy-patch-options.cpp @@ -62,7 +62,7 @@ static void updateButton(Component::Button* button, bool value, std::string_view type = (buttonType == "pto") ? 'P' : 'S'; } - assert(button != NULL); + assert(button); if (value) { switch (type) diff --git a/src/ui/simulator/windows/options/advanced/advanced.cpp b/src/ui/simulator/windows/options/advanced/advanced.cpp index a361fc227b..fa21ca6895 100644 --- a/src/ui/simulator/windows/options/advanced/advanced.cpp +++ b/src/ui/simulator/windows/options/advanced/advanced.cpp @@ -283,7 +283,7 @@ AdvancedParameters::AdvancedParameters(wxWindow* parent) : // refresh Connect( - GetId(), wxEVT_MOTION, wxMouseEventHandler(AdvancedParameters::onInternalMotion), NULL, this); + GetId(), wxEVT_MOTION, wxMouseEventHandler(AdvancedParameters::onInternalMotion), nullptr, this); refresh(); SetSizer(sizer); diff --git a/src/ui/simulator/windows/options/optimization/optimization.cpp b/src/ui/simulator/windows/options/optimization/optimization.cpp index f6a6b5bf2a..7c0b01db29 100644 --- a/src/ui/simulator/windows/options/optimization/optimization.cpp +++ b/src/ui/simulator/windows/options/optimization/optimization.cpp @@ -41,7 +41,7 @@ namespace Options { static void ResetButton(Component::Button* button, bool value) { - assert(button != NULL); + assert(button); if (value) { button->image("images/16x16/light_green.png"); @@ -56,7 +56,7 @@ static void ResetButton(Component::Button* button, bool value) static void ResetButton(Component::Button* button, Data::GlobalTransmissionCapacities value) { - assert(button != NULL); + assert(button); button->image(transmissionCapacityIcon(value)); button->caption(GlobalTransmissionCapacitiesToString_Display(value)); } @@ -349,7 +349,7 @@ Optimization::Optimization(wxWindow* parent) : sizer->Add(panel, 0, wxALL | wxEXPAND); // refresh - Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(Optimization::onInternalMotion), NULL, this); + Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(Optimization::onInternalMotion), nullptr, this); refresh(); SetSizer(sizer); diff --git a/src/ui/simulator/windows/options/temp-folder/temp-folder.cpp b/src/ui/simulator/windows/options/temp-folder/temp-folder.cpp index 246809bc8f..bc82fd78e0 100644 --- a/src/ui/simulator/windows/options/temp-folder/temp-folder.cpp +++ b/src/ui/simulator/windows/options/temp-folder/temp-folder.cpp @@ -63,7 +63,7 @@ ConfigureTempFolder::ConfigureTempFolder(wxWindow* parent) : pDefaults(nullptr), pText(nullptr) { - assert(NULL != parent); + assert(parent); auto* config = new wxConfig(wxT(LOG_APPLICATION_NAME), wxT(LOG_APPLICATION_VENDOR)); // Title of the Form diff --git a/src/ui/simulator/windows/output/output.cpp b/src/ui/simulator/windows/output/output.cpp index 16ef15b100..28be461e76 100644 --- a/src/ui/simulator/windows/output/output.cpp +++ b/src/ui/simulator/windows/output/output.cpp @@ -502,7 +502,7 @@ void Component::createAllControlsIfNeeded() OnStudyClosed.connect(this, &Component::onStudyClosed); // Layout - assert(GetSizer() != NULL); + assert(GetSizer()); GetSizer()->Layout(); pControlsAlreadyCreated = true; diff --git a/src/ui/simulator/windows/output/panel/area-link-renderer.cpp b/src/ui/simulator/windows/output/panel/area-link-renderer.cpp index e9c675082a..0f6373334c 100644 --- a/src/ui/simulator/windows/output/panel/area-link-renderer.cpp +++ b/src/ui/simulator/windows/output/panel/area-link-renderer.cpp @@ -174,7 +174,7 @@ int AreaLinkRenderer::height() const bool AreaLinkRenderer::valid() const { - return (NULL != pMatrix); + return (nullptr != pMatrix); } wxString AreaLinkRenderer::columnCaption(int colIndx) const diff --git a/src/ui/simulator/windows/output/panel/area-link.cpp b/src/ui/simulator/windows/output/panel/area-link.cpp index eecbbc2bf9..d8830b5784 100644 --- a/src/ui/simulator/windows/output/panel/area-link.cpp +++ b/src/ui/simulator/windows/output/panel/area-link.cpp @@ -152,7 +152,7 @@ class JobMatrix : public Yuni::Job::IJob, public Yuni::IEventObserver } // The loading of the matrix had failed. - // The GUI will be updated with NULL + // The GUI will be updated with nullptr callback.bind(&pPanel, &Panel::loadDataFromMatrix, (MatrixType*)nullptr); if (not shouldAbort) Antares::Dispatcher::GUI::Post(callback, 50); @@ -393,7 +393,7 @@ class JobAggregator : public Yuni::Job::IJob, public Yuni::IEventObserverreset(ops.width, ops.height); @@ -464,7 +464,7 @@ class JobAggregator : public Yuni::Job::IJob, public Yuni::IEventObserverStart(150); // Event - Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(Run::onInternalMotion), NULL, this); + Connect(GetId(), wxEVT_MOTION, wxMouseEventHandler(Run::onInternalMotion), nullptr, this); } Run::~Run()