@@ -171,7 +171,7 @@ func TestDecodeErrors(t *testing.T) {
171171 t .Errorf ("Decode(r, new(chan bool)) error mismatch, got %q, want %q" , err , expectErr )
172172 }
173173
174- if err := Decode (r , new (int )); err != io .EOF {
174+ if err := Decode (r , new (uint )); err != io .EOF {
175175 t .Errorf ("Decode(r, new(int)) error mismatch, got %q, want %q" , err , io .EOF )
176176 }
177177}
@@ -184,12 +184,12 @@ type decodeTest struct {
184184}
185185
186186type simplestruct struct {
187- A int
187+ A uint
188188 B string
189189}
190190
191191type recstruct struct {
192- I int
192+ I uint
193193 Child * recstruct
194194}
195195
@@ -202,7 +202,7 @@ var (
202202
203203var (
204204 sharedByteArray [5 ]byte
205- sharedPtr = new (* int )
205+ sharedPtr = new (* uint )
206206)
207207
208208var decodeTests = []decodeTest {
@@ -217,13 +217,13 @@ var decodeTests = []decodeTest{
217217 {input : "C0" , ptr : new (uint32 ), error : ErrExpectedString .Error ()},
218218
219219 // slices
220- {input : "C0" , ptr : new ([]int ), value : []int {}},
221- {input : "C80102030405060708" , ptr : new ([]int ), value : []int {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }},
220+ {input : "C0" , ptr : new ([]uint ), value : []uint {}},
221+ {input : "C80102030405060708" , ptr : new ([]uint ), value : []uint {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }},
222222
223223 // arrays
224- {input : "C0" , ptr : new ([5 ]int ), value : [5 ]int {}},
225- {input : "C50102030405" , ptr : new ([5 ]int ), value : [5 ]int {1 , 2 , 3 , 4 , 5 }},
226- {input : "C6010203040506" , ptr : new ([5 ]int ), error : "rlp: input list has too many elements for [5]int " },
224+ {input : "C0" , ptr : new ([5 ]uint ), value : [5 ]uint {}},
225+ {input : "C50102030405" , ptr : new ([5 ]uint ), value : [5 ]uint {1 , 2 , 3 , 4 , 5 }},
226+ {input : "C6010203040506" , ptr : new ([5 ]uint ), error : "rlp: input list has too many elements for [5]uint " },
227227
228228 // byte slices
229229 {input : "01" , ptr : new ([]byte ), value : []byte {1 }},
@@ -280,17 +280,17 @@ var decodeTests = []decodeTest{
280280 },
281281
282282 // pointers
283- {input : "00" , ptr : new (* int ), value : (* int )(nil )},
284- {input : "80" , ptr : new (* int ), value : (* int )(nil )},
285- {input : "C0" , ptr : new (* int ), value : (* int )(nil )},
286- {input : "07" , ptr : new (* int ), value : intp (7 )},
287- {input : "8108" , ptr : new (* int ), value : intp (8 )},
288- {input : "C109" , ptr : new (* []int ), value : & []int {9 }},
283+ {input : "00" , ptr : new (* uint ), value : (* uint )(nil )},
284+ {input : "80" , ptr : new (* uint ), value : (* uint )(nil )},
285+ {input : "C0" , ptr : new (* uint ), value : (* uint )(nil )},
286+ {input : "07" , ptr : new (* uint ), value : uintp (7 )},
287+ {input : "8108" , ptr : new (* uint ), value : uintp (8 )},
288+ {input : "C109" , ptr : new (* []uint ), value : & []uint {9 }},
289289 {input : "C58403030303" , ptr : new (* [][]byte ), value : & [][]byte {{3 , 3 , 3 , 3 }}},
290290
291291 // pointer should be reset to nil
292- {input : "05" , ptr : sharedPtr , value : intp (5 )},
293- {input : "80" , ptr : sharedPtr , value : (* int )(nil )},
292+ {input : "05" , ptr : sharedPtr , value : uintp (5 )},
293+ {input : "80" , ptr : sharedPtr , value : (* uint )(nil )},
294294
295295 // interface{}
296296 {input : "00" , ptr : new (interface {}), value : []byte {0 }},
@@ -301,7 +301,7 @@ var decodeTests = []decodeTest{
301301 {input : "C50183040404" , ptr : new (interface {}), value : []interface {}{[]byte {1 }, []byte {4 , 4 , 4 }}},
302302}
303303
304- func intp (i int ) * int { return & i }
304+ func uintp (i uint ) * uint { return & i }
305305
306306func runTests (t * testing.T , decode func ([]byte , interface {}) error ) {
307307 for i , test := range decodeTests {
@@ -434,8 +434,8 @@ func ExampleDecode() {
434434 input , _ := hex .DecodeString ("C90A1486666F6F626172" )
435435
436436 type example struct {
437- A , B int
438- private int // private fields are ignored
437+ A , B uint
438+ private uint // private fields are ignored
439439 String string
440440 }
441441
@@ -447,7 +447,7 @@ func ExampleDecode() {
447447 fmt .Printf ("Decoded value: %#v\n " , s )
448448 }
449449 // Output:
450- // Decoded value: rlp.example{A:10 , B:20 , private:0 , String:"foobar"}
450+ // Decoded value: rlp.example{A:0xa , B:0x14 , private:0x0 , String:"foobar"}
451451}
452452
453453func ExampleStream () {
0 commit comments