mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
C++11: Converted from strtoimax to std::stoi
This commit is contained in:
parent
5c8b7148b4
commit
36ad7ead41
2 changed files with 6 additions and 8 deletions
|
@ -31,7 +31,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ISO8601.h>
|
#include <ISO8601.h>
|
||||||
|
@ -564,7 +563,7 @@ std::string Config::get (const std::string& key)
|
||||||
int Config::getInteger (const std::string& key)
|
int Config::getInteger (const std::string& key)
|
||||||
{
|
{
|
||||||
if ((*this).find (key) != (*this).end ())
|
if ((*this).find (key) != (*this).end ())
|
||||||
return strtoimax ((*this)[key].c_str (), NULL, 10);
|
return stoi ((*this)[key]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <Nibbler.h>
|
#include <Nibbler.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <Lexer.h>
|
#include <Lexer.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
|
||||||
|
@ -264,7 +263,7 @@ bool Nibbler::getDigit4 (int& result)
|
||||||
Lexer::isDigit ((*_input)[i + 2]) &&
|
Lexer::isDigit ((*_input)[i + 2]) &&
|
||||||
Lexer::isDigit ((*_input)[i + 3]))
|
Lexer::isDigit ((*_input)[i + 3]))
|
||||||
{
|
{
|
||||||
result = strtoimax (_input->substr (_cursor, 4).c_str (), NULL, 10);
|
result = std::stoi (_input->substr (_cursor, 4));
|
||||||
_cursor += 4;
|
_cursor += 4;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +283,7 @@ bool Nibbler::getDigit3 (int& result)
|
||||||
Lexer::isDigit ((*_input)[i + 1]) &&
|
Lexer::isDigit ((*_input)[i + 1]) &&
|
||||||
Lexer::isDigit ((*_input)[i + 2]))
|
Lexer::isDigit ((*_input)[i + 2]))
|
||||||
{
|
{
|
||||||
result = strtoimax (_input->substr (_cursor, 3).c_str (), NULL, 10);
|
result = std::stoi (_input->substr (_cursor, 3));
|
||||||
_cursor += 3;
|
_cursor += 3;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +302,7 @@ bool Nibbler::getDigit2 (int& result)
|
||||||
if (Lexer::isDigit ((*_input)[i + 0]) &&
|
if (Lexer::isDigit ((*_input)[i + 0]) &&
|
||||||
Lexer::isDigit ((*_input)[i + 1]))
|
Lexer::isDigit ((*_input)[i + 1]))
|
||||||
{
|
{
|
||||||
result = strtoimax (_input->substr (_cursor, 2).c_str (), NULL, 10);
|
result = std::stoi (_input->substr (_cursor, 2));
|
||||||
_cursor += 2;
|
_cursor += 2;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +330,7 @@ bool Nibbler::getInt (int& result)
|
||||||
|
|
||||||
if (i > _cursor)
|
if (i > _cursor)
|
||||||
{
|
{
|
||||||
result = strtoimax (_input->substr (_cursor, i - _cursor).c_str (), NULL, 10);
|
result = std::stoi (_input->substr (_cursor, i - _cursor));
|
||||||
_cursor = i;
|
_cursor = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +348,7 @@ bool Nibbler::getUnsignedInt (int& result)
|
||||||
|
|
||||||
if (i > _cursor)
|
if (i > _cursor)
|
||||||
{
|
{
|
||||||
result = strtoimax (_input->substr (_cursor, i - _cursor).c_str (), NULL, 10);
|
result = std::stoi (_input->substr (_cursor, i - _cursor));
|
||||||
_cursor = i;
|
_cursor = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue