mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 01:25:10 +00:00
Change to use strtoul instead of strtoll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cerrno>
|
||||||
|
|
||||||
using namespace cl;
|
using namespace cl;
|
||||||
|
|
||||||
@@ -682,9 +684,12 @@ bool parser<int>::parse(Option &O, const char *ArgName,
|
|||||||
bool parser<unsigned>::parse(Option &O, const char *ArgName,
|
bool parser<unsigned>::parse(Option &O, const char *ArgName,
|
||||||
const std::string &Arg, unsigned &Value) {
|
const std::string &Arg, unsigned &Value) {
|
||||||
char *End;
|
char *End;
|
||||||
long long int V = strtoll(Arg.c_str(), &End, 0);
|
errno = 0;
|
||||||
|
unsigned long V = strtoul(Arg.c_str(), &End, 0);
|
||||||
Value = (unsigned)V;
|
Value = (unsigned)V;
|
||||||
if (*End != 0 || V < 0 || Value != V)
|
if (((V == ULONG_MAX) && (errno == ERANGE))
|
||||||
|
|| (*End != 0)
|
||||||
|
|| (Value != V))
|
||||||
return O.error(": '" + Arg + "' value invalid for uint argument!");
|
return O.error(": '" + Arg + "' value invalid for uint argument!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user