mirror of
https://github.com/dlang/phobos.git
synced 2025-05-05 17:42:58 +03:00
let parse() with radix throw on empty input
This commit is contained in:
parent
10d636b7b3
commit
b1c121dbb0
1 changed files with 4 additions and 1 deletions
|
@ -1965,11 +1965,12 @@ body
|
||||||
immutable uint beyond = (radix < 10 ? '0' : 'a'-10) + radix;
|
immutable uint beyond = (radix < 10 ? '0' : 'a'-10) + radix;
|
||||||
|
|
||||||
Target v = 0;
|
Target v = 0;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
if (s.empty)
|
if (s.empty)
|
||||||
goto Lerr;
|
goto Lerr;
|
||||||
|
|
||||||
for (; !s.empty; s.popFront())
|
for (; !s.empty; s.popFront(), ++i)
|
||||||
{
|
{
|
||||||
uint c = s.front;
|
uint c = s.front;
|
||||||
if (c < '0')
|
if (c < '0')
|
||||||
|
@ -1994,6 +1995,8 @@ body
|
||||||
goto Loverflow;
|
goto Loverflow;
|
||||||
v = blah;
|
v = blah;
|
||||||
}
|
}
|
||||||
|
if (!i)
|
||||||
|
goto Lerr;
|
||||||
return v;
|
return v;
|
||||||
|
|
||||||
Loverflow:
|
Loverflow:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue