Fix clang-tidy warnings in executables#7591
Conversation
Cleanup memory, use strlcpy
|
Starting build on |
main/src/nbmain.cxx
Outdated
| #ifdef WIN32 | ||
| #include <process.h> | ||
| static string pathsep("\\"); | ||
| std::string pathsep = "\\"; |
There was a problem hiding this comment.
Why remote the static keyword? ... humm right it has no practical consequence until the .o file is put in a library.
main/src/nbmain.cxx
Outdated
| #ifdef WIN32 | ||
| #include <process.h> | ||
| static string pathsep("\\"); | ||
| std::string pathsep = "\\"; |
There was a problem hiding this comment.
| std::string pathsep = "\\"; | |
| constexpr const char* pathsep = "\\"; |
| strcpy(name, pwd->pw_gecos); | ||
| size_t sz = strlen(pwd->pw_gecos)+1; | ||
| char *name = new char [sz]; | ||
| strlcpy(name, pwd->pw_gecos, sz); |
There was a problem hiding this comment.
Funnily, I find no practical difference between the old and new code ... because sz is anyway th result of strlen ...
Humm ... I guess it would make a difference if the input can be changed between the strlen and the strcpy ...
|
Starting build on |
|
Build failed on mac11.0/cxx17. Errors:
|
|
Build failed on windows10/cxx14. Errors:
|
Fixes #7527