minor changes to IP6Address>>fromString:
This commit is contained in:
parent
9a2de69aae
commit
15f27702f1
@ -100,13 +100,14 @@ class(#byte) IP6Address(IPAddress)
|
|||||||
|
|
||||||
method __fromString: str
|
method __fromString: str
|
||||||
{
|
{
|
||||||
| pos size ch tgpos v1 val curtok saw_xdigit colonpos |
|
| pos size mysize ch tgpos v1 val curtok saw_xdigit colonpos |
|
||||||
|
|
||||||
pos := 0.
|
pos := 0.
|
||||||
size := str size.
|
size := str size.
|
||||||
|
mysize := self basicSize.
|
||||||
|
|
||||||
## handle leading :: specially
|
## handle leading :: specially
|
||||||
if (size > 0 and: [ (str at: pos) == $: ])
|
if (size > 0 and: [(str at: pos) == $:])
|
||||||
{
|
{
|
||||||
pos := pos + 1.
|
pos := pos + 1.
|
||||||
if (pos >= size or: [ (str at: pos) ~~ $:]) { ^Error.Code.EINVAL }.
|
if (pos >= size or: [ (str at: pos) ~~ $:]) { ^Error.Code.EINVAL }.
|
||||||
@ -161,11 +162,12 @@ class(#byte) IP6Address(IPAddress)
|
|||||||
continue.
|
continue.
|
||||||
}.
|
}.
|
||||||
|
|
||||||
(*if (ch == $. and: [])
|
if (ch == $. and: [tgpos + 4 <= mysize]
|
||||||
{
|
{
|
||||||
saw_xdigit := true.
|
tgpos := tgpos + 4.
|
||||||
|
saw_xdigit := false.
|
||||||
break.
|
break.
|
||||||
}.*)
|
}.
|
||||||
|
|
||||||
|
|
||||||
## invalid character in the address
|
## invalid character in the address
|
||||||
@ -183,10 +185,10 @@ class(#byte) IP6Address(IPAddress)
|
|||||||
if (colonpos >= 0)
|
if (colonpos >= 0)
|
||||||
{
|
{
|
||||||
## double colon position
|
## double colon position
|
||||||
self basicShiftFrom: colonpos to: (colonpos + (self basicSize - tgpos)) count: (tgpos - colonpos).
|
self basicShiftFrom: colonpos to: (colonpos + (mysize - tgpos)) count: (tgpos - colonpos).
|
||||||
##tgpos := tgpos + (self basicSize - tgpos).
|
##tgpos := tgpos + (mysize - tgpos).
|
||||||
}
|
}
|
||||||
elsif (tgpos ~~ (self basicSize))
|
elsif (tgpos ~~ mysize)
|
||||||
{
|
{
|
||||||
^Error.Code.EINVAL
|
^Error.Code.EINVAL
|
||||||
}.
|
}.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user