Commit ca017169 authored by Russ Cox's avatar Russ Cox

fix build - broke with uint32 -> int change in reflect SliceHeader

TBR=r
OCL=32225
CL=32225
parent 5aa17455
...@@ -446,8 +446,8 @@ func decodeSlice(atyp *reflect.SliceType, state *decodeState, p uintptr, elemOp ...@@ -446,8 +446,8 @@ func decodeSlice(atyp *reflect.SliceType, state *decodeState, p uintptr, elemOp
// Always write a header at p. // Always write a header at p.
hdrp := (*reflect.SliceHeader)(unsafe.Pointer(p)); hdrp := (*reflect.SliceHeader)(unsafe.Pointer(p));
hdrp.Data = uintptr(unsafe.Pointer(&data[0])); hdrp.Data = uintptr(unsafe.Pointer(&data[0]));
hdrp.Len = uint32(length); hdrp.Len = int(length);
hdrp.Cap = uint32(length); hdrp.Cap = int(length);
return decodeArrayHelper(state, hdrp.Data, elemOp, elemWid, int(length), elemIndir); return decodeArrayHelper(state, hdrp.Data, elemOp, elemWid, int(length), elemIndir);
} }
......
...@@ -559,7 +559,7 @@ func (v *SliceValue) SetLen(n int) { ...@@ -559,7 +559,7 @@ func (v *SliceValue) SetLen(n int) {
if n < 0 || n > int(s.Cap) { if n < 0 || n > int(s.Cap) {
panicln("SetLen", n, "with capacity", s.Cap); panicln("SetLen", n, "with capacity", s.Cap);
} }
s.Len = uint32(n); s.Len = n;
} }
// Set assigns x to v. // Set assigns x to v.
...@@ -581,8 +581,8 @@ func (v *SliceValue) Slice(beg, end int) *SliceValue { ...@@ -581,8 +581,8 @@ func (v *SliceValue) Slice(beg, end int) *SliceValue {
typ := v.typ.(*SliceType); typ := v.typ.(*SliceType);
s := new(SliceHeader); s := new(SliceHeader);
s.Data = uintptr(v.addr()) + uintptr(beg) * typ.Elem().Size(); s.Data = uintptr(v.addr()) + uintptr(beg) * typ.Elem().Size();
s.Len = uint32(end - beg); s.Len = end - beg;
s.Cap = uint32(cap - beg); s.Cap = cap - beg;
return newValue(typ, addr(s), v.canSet).(*SliceValue); return newValue(typ, addr(s), v.canSet).(*SliceValue);
} }
...@@ -607,8 +607,8 @@ func MakeSlice(typ *SliceType, len, cap int) *SliceValue { ...@@ -607,8 +607,8 @@ func MakeSlice(typ *SliceType, len, cap int) *SliceValue {
} }
data := make([]uint8, size); data := make([]uint8, size);
s.Data = uintptr(addr(&data[0])); s.Data = uintptr(addr(&data[0]));
s.Len = uint32(len); s.Len = len;
s.Cap = uint32(cap); s.Cap = cap;
return newValue(typ, addr(s), true).(*SliceValue); return newValue(typ, addr(s), true).(*SliceValue);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment