Skip to content

Commit

Permalink
Ignore first word when (un)marshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jun 15, 2019
1 parent e62fff9 commit 5460680
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions impl/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ func (p *point) MarshalXML() string {
return string(buf)
case typelabel.Eui48:
buf := []byte{}
for x, b := range p.Eui48() {
// first word is unused - ignore
for x, b := range p.Eui48()[2:] {
if x != 0 {
buf = append(buf, ':')
}
Expand Down Expand Up @@ -635,7 +636,8 @@ func (p *point) UnmarshalXML(s string) error {
}
case typelabel.Eui48:
var buf sunspec.Eui48
if _, err := fmt.Sscanf(s, "%02x:%02x:%02x:%02x:%02x:%02x", &buf[0], &buf[1], &buf[2], &buf[3], &buf[4], &buf[5]); err != nil {
// first word is unused - ignore
if _, err := fmt.Sscanf(s, "%02x:%02x:%02x:%02x:%02x:%02x", &buf[2], &buf[3], &buf[4], &buf[5], &buf[6], &buf[7]); err != nil {
return err
} else {
p.SetEui48(buf)
Expand Down

0 comments on commit 5460680

Please sign in to comment.