forked from lix-project/lix
* --max-freed: support values >= 4 GB.
This commit is contained in:
parent
d3aa183beb
commit
5af84139a8
|
@ -58,12 +58,12 @@ static void setLogType(string lt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int getIntArg(const string & opt,
|
unsigned long long getIntArg(const string & opt,
|
||||||
Strings::iterator & i, const Strings::iterator & end)
|
Strings::iterator & i, const Strings::iterator & end)
|
||||||
{
|
{
|
||||||
++i;
|
++i;
|
||||||
if (i == end) throw UsageError(format("`%1%' requires an argument") % opt);
|
if (i == end) throw UsageError(format("`%1%' requires an argument") % opt);
|
||||||
int n;
|
long long n;
|
||||||
if (!string2Int(*i, n) || n < 0)
|
if (!string2Int(*i, n) || n < 0)
|
||||||
throw UsageError(format("`%1%' requires a non-negative integer") % opt);
|
throw UsageError(format("`%1%' requires a non-negative integer") % opt);
|
||||||
return n;
|
return n;
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace nix {
|
||||||
Path makeRootName(const Path & gcRoot, int & counter);
|
Path makeRootName(const Path & gcRoot, int & counter);
|
||||||
void printGCWarning();
|
void printGCWarning();
|
||||||
|
|
||||||
unsigned int getIntArg(const string & opt,
|
unsigned long long getIntArg(const string & opt,
|
||||||
Strings::iterator & i, const Strings::iterator & end);
|
Strings::iterator & i, const Strings::iterator & end);
|
||||||
|
|
||||||
/* Whether we're running setuid. */
|
/* Whether we're running setuid. */
|
||||||
|
|
|
@ -1020,6 +1020,14 @@ bool string2Int(const string & s, int & n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool string2Int(const string & s, long long & n)
|
||||||
|
{
|
||||||
|
std::istringstream str(s);
|
||||||
|
str >> n;
|
||||||
|
return str && str.get() == EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ignoreException()
|
void ignoreException()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -287,6 +287,7 @@ bool statusOk(int status);
|
||||||
/* Parse a string into an integer. */
|
/* Parse a string into an integer. */
|
||||||
string int2String(int n);
|
string int2String(int n);
|
||||||
bool string2Int(const string & s, int & n);
|
bool string2Int(const string & s, int & n);
|
||||||
|
bool string2Int(const string & s, long long & n);
|
||||||
|
|
||||||
|
|
||||||
/* Exception handling in destructors: print an error message, then
|
/* Exception handling in destructors: print an error message, then
|
||||||
|
|
Loading…
Reference in a new issue