From 9becba5540540bc37d4ad5eaaf7e4c1937a6542f Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 10 Nov 2017 00:08:28 +0100 Subject: accounts/abi: fix event tupleUnpack Event.tupleUnpack doesn't handle correctly Indexed arguments, hence it can't unpack an event with indexed arguments. --- accounts/abi/event.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/accounts/abi/event.go b/accounts/abi/event.go index bd1098d87..0d3c3c4fa 100644 --- a/accounts/abi/event.go +++ b/accounts/abi/event.go @@ -65,13 +65,13 @@ func (e Event) tupleUnpack(v interface{}, output []byte) error { return fmt.Errorf("abi: cannot unmarshal tuple in to %v", typ) } - j := 0 - for i := 0; i < len(e.Inputs); i++ { - input := e.Inputs[i] + i, j := -1, 0 + for _, input := range e.Inputs { if input.Indexed { // can't read, continue continue } + i++ marshalledValue, err := toGoType((i+j)*32, input.Type, output) if err != nil { return err @@ -88,22 +88,22 @@ func (e Event) tupleUnpack(v interface{}, output []byte) error { for j := 0; j < typ.NumField(); j++ { field := typ.Field(j) // TODO read tags: `abi:"fieldName"` - if field.Name == strings.ToUpper(e.Inputs[i].Name[:1])+e.Inputs[i].Name[1:] { - if err := set(value.Field(j), reflectValue, e.Inputs[i]); err != nil { + if field.Name == strings.ToUpper(input.Name[:1])+input.Name[1:] { + if err := set(value.Field(j), reflectValue, input); err != nil { return err } } } case reflect.Slice, reflect.Array: if value.Len() < i { - return fmt.Errorf("abi: insufficient number of arguments for unpack, want %d, got %d", len(e.Inputs), value.Len()) + return fmt.Errorf("abi: insufficient number of arguments for unpack, want %d, got %d", i, value.Len()) } v := value.Index(i) if v.Kind() != reflect.Ptr && v.Kind() != reflect.Interface { return fmt.Errorf("abi: cannot unmarshal %v in to %v", v.Type(), reflectValue.Type()) } reflectValue := reflect.ValueOf(marshalledValue) - if err := set(v.Elem(), reflectValue, e.Inputs[i]); err != nil { + if err := set(v.Elem(), reflectValue, input); err != nil { return err } default: -- cgit Q4 FreeBSD Ports (https://github.com/freebsd/freebsd-ports)
aboutsummaryrefslogtreecommitdiffstats
path: root/x11-toolkits/lesstif
Commit message (Expand)AuthorAgeFilesLines
* - Update to 0.93.94dinoex2003-12-056-52/+10
* - update MASTER_SITESdinoex2003-11-121-2/+1
* - add CONFLICTSdinoex2003-10-121-0/+1
* - change ECHO -> ECHO_CMDdinoex2003-09-251-7/+7
* - save lib/X11/config/host.def (which is created empty by imake)dinoex2003-02-222-0/+8
* - retire pkg-commentdinoex2003-02-211-1/+0
* - add COMMENTdinoex2003-02-211-0/+1
* - make portlint happierdinoex2003-01-232-4/+3
* - Add documentationdinoex2003-01-182-7/+148
* - Update to 0.93.36dinoex2003-01-0210-435/+251
* Take maintainership, Update pending:dinoex2002-12-101-1/+1
* o Rollback PORTCOMMENT modifications while this feature's implementationlioux2002-11-112-2/+1
* Use PORTCOMMENT in the Makefile, and whack the pkg-comment.adamw2002-11-072-1/+2
* new MASTER_SITESdinoex2002-09-101-4/+5
* Style police: WWW tags should either end in a file/script or TRAILING /; Fix ...lioux2001-11-211-1/+1
* Unbroke.sobomax2001-06-061-1/+2
* Replace explicit build dependency on automake with USE_AUTOMAKE knobade2001-06-011-2/+1
* Batch of style fixes for x11-toolkits.olgeni2001-02-061-1/+1
* Revert maintainer to ports@freebsd.org.dannyboy2000-12-15