Use nullptr instead lf C-styled NULL

This commit is contained in:
Kirill Bobyrev 2018-03-07 22:21:28 +03:00
parent 24634f2d15
commit 5cdbe6d019
No known key found for this signature in database
GPG key ID: C473398631E27767
22 changed files with 56 additions and 56 deletions

View file

@ -122,12 +122,12 @@ int CmdCalendar::execute (std::string& output)
// YYYY.
else if (Lexer::isAllDigits (arg) && arg.length () == 4)
argYear = strtol (arg.c_str (), NULL, 10);
argYear = strtol (arg.c_str (), nullptr, 10);
// MM.
else if (Lexer::isAllDigits (arg) && arg.length () <= 2)
{
argMonth = strtol (arg.c_str (), NULL, 10);
argMonth = strtol (arg.c_str (), nullptr, 10);
if (argMonth < 1 || argMonth > 12)
throw format ("Argument '{1}' is not a valid month.", arg);
}
@ -565,7 +565,7 @@ std::string CmdCalendar::renderMonths (
task.has ("due"))
{
std::string due = task.get ("due");
Datetime duedmy (strtol (due.c_str(), NULL, 10));
Datetime duedmy (strtol (due.c_str(), nullptr, 10));
if (duedmy.day () == d &&
duedmy.month () == months[mpl] &&

View file

@ -211,9 +211,9 @@ int CmdDiagnostics::execute (std::string& output)
char* peditor;
if (Context::getContext ().config.get ("editor") != "")
out << " rc.editor: " << Context::getContext ().config.get ("editor") << '\n';
else if ((peditor = getenv ("VISUAL")) != NULL)
else if ((peditor = getenv ("VISUAL")) != nullptr)
out << " $VISUAL: " << peditor << '\n';
else if ((peditor = getenv ("EDITOR")) != NULL)
else if ((peditor = getenv ("EDITOR")) != nullptr)
out << " $EDITOR: " << peditor << '\n';
out << " Server: "

View file

@ -250,7 +250,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
for (auto& anno : task.getAnnotations ())
{
Datetime dt (strtol (anno.first.substr (11).c_str (), NULL, 10));
Datetime dt (strtol (anno.first.substr (11).c_str (), nullptr, 10));
before << " Annotation: " << dt.toString (dateformat)
<< " -- " << json::encode (anno.second) << '\n';
}
@ -653,7 +653,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
if (dep.length () >= 7)
task.addDependency (dep);
else
task.addDependency ((int) strtol (dep.c_str (), NULL, 10));
task.addDependency ((int) strtol (dep.c_str (), nullptr, 10));
}
// UDAs

View file

@ -244,7 +244,7 @@ int CmdInfo::execute (std::string& output)
auto created = task.get ("entry");
if (created.length ())
{
Datetime dt (strtol (created.c_str (), NULL, 10));
Datetime dt (strtol (created.c_str (), nullptr, 10));
age = Duration (now - dt).formatVague ();
}
@ -560,7 +560,7 @@ int CmdInfo::execute (std::string& output)
{
int row = journal.addRow ();
Datetime timestamp (strtol (undo[when].substr (5).c_str (), NULL, 10));
Datetime timestamp (strtol (undo[when].substr (5).c_str (), nullptr, 10));
journal.set (row, 0, timestamp.toString (dateformat));
Task before (undo[previous].substr (4));

View file

@ -37,11 +37,11 @@ public:
int execute (std::string&);
void checkConsistency (Task &before, Task &after);
int modifyAndUpdate (Task &before, Task &after,
std::map <std::string, std::string> *projectChanges = NULL);
std::map <std::string, std::string> *projectChanges = nullptr);
int modifyRecurrenceSiblings (Task &task,
std::map <std::string, std::string> *projectChanges = NULL);
std::map <std::string, std::string> *projectChanges = nullptr);
int modifyRecurrenceParent (Task &task,
std::map <std::string, std::string> *projectChanges = NULL);
std::map <std::string, std::string> *projectChanges = nullptr);
};
#endif

View file

@ -89,7 +89,7 @@ int CmdStats::execute (std::string& output)
filter.subset (all, filtered);
Datetime now;
time_t earliest = time (NULL);
time_t earliest = time (nullptr);
time_t latest = 1;
int totalT = 0;
int deletedT = 0;
@ -123,13 +123,13 @@ int CmdStats::execute (std::string& output)
if (task.is_blocked) ++blockedT;
if (task.is_blocking) ++blockingT;
time_t entry = strtol (task.get ("entry").c_str (), NULL, 10);
time_t entry = strtol (task.get ("entry").c_str (), nullptr, 10);
if (entry < earliest) earliest = entry;
if (entry > latest) latest = entry;
if (status == Task::completed)
{
time_t end = strtol (task.get ("end").c_str (), NULL, 10);
time_t end = strtol (task.get ("end").c_str (), nullptr, 10);
daysPending += (end - entry) / 86400.0;
}

View file

@ -80,7 +80,7 @@ int CmdSummary::execute (std::string& output)
std::map <std::string, int> countCompleted;
std::map <std::string, double> sumEntry;
std::map <std::string, int> counter;
time_t now = time (NULL);
time_t now = time (nullptr);
// Initialize counters.
for (auto& project : allProjects)
@ -108,7 +108,7 @@ int CmdSummary::execute (std::string& output)
{
++countPending[parent];
time_t entry = strtol (task.get ("entry").c_str (), NULL, 10);
time_t entry = strtol (task.get ("entry").c_str (), nullptr, 10);
if (entry)
sumEntry[parent] = sumEntry[parent] + (double) (now - entry);
}
@ -120,8 +120,8 @@ int CmdSummary::execute (std::string& output)
{
++countCompleted[parent];
time_t entry = strtol (task.get ("entry").c_str (), NULL, 10);
time_t end = strtol (task.get ("end").c_str (), NULL, 10);
time_t entry = strtol (task.get ("entry").c_str (), nullptr, 10);
time_t end = strtol (task.get ("end").c_str (), nullptr, 10);
if (entry && end)
sumEntry[parent] = sumEntry[parent] + (double) (end - entry);
}