- Converted more atoi to strtol calls.
This commit is contained in:
Paul Beckingham 2011-06-02 23:20:15 -04:00
parent 223c7b3c56
commit 5732833da2
3 changed files with 8 additions and 5 deletions

View file

@ -26,6 +26,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <sstream> #include <sstream>
#include <algorithm>
#include <Context.h> #include <Context.h>
#include <ViewText.h> #include <ViewText.h>
#include <text.h> #include <text.h>

View file

@ -26,6 +26,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <sstream> #include <sstream>
#include <stdlib.h>
#include <Context.h> #include <Context.h>
#include <ViewText.h> #include <ViewText.h>
#include <Duration.h> #include <Duration.h>
@ -96,7 +97,7 @@ int CmdSummary::execute (const std::string&, std::string& output)
{ {
++countPending[project]; ++countPending[project];
time_t entry = atoi (task->get ("entry").c_str ()); time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
if (entry) if (entry)
sumEntry[project] = sumEntry[project] + (double) (now - entry); sumEntry[project] = sumEntry[project] + (double) (now - entry);
} }
@ -105,8 +106,8 @@ int CmdSummary::execute (const std::string&, std::string& output)
{ {
++countCompleted[project]; ++countCompleted[project];
time_t entry = atoi (task->get ("entry").c_str ()); time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
time_t end = atoi (task->get ("end").c_str ()); time_t end = strtol (task->get ("end").c_str (), NULL, 10);
if (entry && end) if (entry && end)
sumEntry[project] = sumEntry[project] + (double) (end - entry); sumEntry[project] = sumEntry[project] + (double) (end - entry);
} }

View file

@ -26,6 +26,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <sstream> #include <sstream>
#include <stdlib.h>
#include <Context.h> #include <Context.h>
#include <ViewText.h> #include <ViewText.h>
#include <Date.h> #include <Date.h>
@ -109,7 +110,7 @@ int CmdTimesheet::execute (const std::string&, std::string& output)
// If task completed within range. // If task completed within range.
if (task->getStatus () == Task::completed) if (task->getStatus () == Task::completed)
{ {
Date compDate (atoi (task->get ("end").c_str ())); Date compDate (strtol (task->get ("end").c_str (), NULL, 10));
if (compDate >= start && compDate < end) if (compDate >= start && compDate < end)
{ {
Color c (task->get ("fg") + " " + task->get ("bg")); Color c (task->get ("fg") + " " + task->get ("bg"));
@ -147,7 +148,7 @@ int CmdTimesheet::execute (const std::string&, std::string& output)
if (task->getStatus () == Task::pending && if (task->getStatus () == Task::pending &&
task->has ("start")) task->has ("start"))
{ {
Date startDate (atoi (task->get ("start").c_str ())); Date startDate (strtol (task->get ("start").c_str (), NULL, 10));
if (startDate >= start && startDate < end) if (startDate >= start && startDate < end)
{ {
Color c (task->get ("fg") + " " + task->get ("bg")); Color c (task->get ("fg") + " " + task->get ("bg"));