mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-22 20:23:09 +02:00
Code Cleanup
- Used the shorter form of std::string::substr that defaults the second argument to std::string::npos.
This commit is contained in:
parent
75e738a9c9
commit
2cf25b7c35
14 changed files with 41 additions and 43 deletions
|
@ -137,7 +137,7 @@ Color::Color (const std::string& spec)
|
|||
else if (word.substr (0, 4) == "grey" ||
|
||||
word.substr (0, 4) == "gray")
|
||||
{
|
||||
index = atoi (word.substr (4, std::string::npos).c_str ());
|
||||
index = atoi (word.substr (4).c_str ());
|
||||
if (index < 0 || index > 23)
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
|
||||
|
@ -160,7 +160,7 @@ Color::Color (const std::string& spec)
|
|||
// rgbRGB, where 0 <= R,G,B <= 5.
|
||||
else if (word.substr (0, 3) == "rgb")
|
||||
{
|
||||
index = atoi (word.substr (3, std::string::npos).c_str ());
|
||||
index = atoi (word.substr (3).c_str ());
|
||||
if (word.length () != 6 ||
|
||||
index < 0 || index > 555)
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
|
@ -194,7 +194,7 @@ Color::Color (const std::string& spec)
|
|||
// colorN, where 0 <= N <= 255.
|
||||
else if (word.substr (0, 5) == "color")
|
||||
{
|
||||
index = atoi (word.substr (5, std::string::npos).c_str ());
|
||||
index = atoi (word.substr (5).c_str ());
|
||||
if (index < 0 || index > 255)
|
||||
throw std::string ("The color '") + *it + "' is not recognized.";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue