FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix build errors when targeting the Android API 14 or older by augustofg · Pull Request #107 · docopt/docopt.cpp · GitHub

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (1) .h  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 5 additions & 3 deletions docopt.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <unordered_map>
#include <map>
#include <string>
#include <sstream>
#include <iostream>
#include <cassert>
#include <cstddef>
Expand Down Expand Up @@ -305,9 +306,10 @@ static PatternList parse_short(Tokens& tokens, std::vector<Option>& options)
}

if (similar.size() > 1) {
std::string error = shortOpt + " is specified ambiguously "
+ std::to_string(similar.size()) + " times";
throw Tokens::OptionError(std::move(error));
std::stringstream error;
error << shortOpt << " is specified ambiguously "
<< similar.size() << " times";
throw Tokens::OptionError(std::move(error.str()));
} else if (similar.empty()) {
options.emplace_back(shortOpt, "", 0);

Expand Down
7 changes: 4 additions & 3 deletions docopt_value.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <vector>
#include <functional> // std::hash
#include <iosfwd>
#include <cstdlib>

namespace docopt {

Expand Down Expand Up @@ -280,9 +281,9 @@ namespace docopt {
// Attempt to convert a string to a long
if (kind == Kind::String) {
const std::string& str = variant.strValue;
std::size_t pos;
const long ret = stol(str, &pos); // Throws if it can't convert
if (pos != str.length()) {
char* pos;
const long ret = std::strtol(str.c_str(), &pos, 10);
if (*pos != 0) {
// The string ended in non-digits.
throw std::runtime_error( str + " contains non-numeric characters.");
}
Expand Down

Back | FazBrowse Home | New Git URL