Commit b82db8eb authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Update for weekly 23/6.

parent 00bf79b1
......@@ -155,8 +155,8 @@ func MyPID() string {
}
// Thanks to Andrew Gerrand for this hack.
func asSlice(ptr unsafe.Pointer, byteCount int) []byte {
h := &reflect.SliceHeader{uintptr(ptr), byteCount, byteCount}
func asSlice(ptr unsafe.Pointer, byteCount uintptr) []byte {
h := &reflect.SliceHeader{uintptr(ptr), int(byteCount), int(byteCount)}
return *(*[]byte)(unsafe.Pointer(h))
}
......
......@@ -298,8 +298,8 @@ type castPointerFunc func(unsafe.Pointer) interface{}
type operationHandler struct {
Name string
Func operationFunc
InputSize int
OutputSize int
InputSize uintptr
OutputSize uintptr
DecodeIn castPointerFunc
DecodeOut castPointerFunc
FileNames int
......@@ -332,7 +332,7 @@ func init() {
operationHandlers[i] = &operationHandler{Name: "UNKNOWN"}
}
for op, sz := range map[opcode]int{
for op, sz := range map[opcode]uintptr{
_OP_FORGET: unsafe.Sizeof(ForgetIn{}),
_OP_GETATTR: unsafe.Sizeof(GetAttrIn{}),
_OP_SETATTR: unsafe.Sizeof(SetAttrIn{}),
......@@ -364,7 +364,7 @@ func init() {
operationHandlers[op].InputSize = sz
}
for op, sz := range map[opcode]int{
for op, sz := range map[opcode]uintptr{
_OP_LOOKUP: unsafe.Sizeof(EntryOut{}),
_OP_GETATTR: unsafe.Sizeof(AttrOut{}),
_OP_SETATTR: unsafe.Sizeof(AttrOut{}),
......
......@@ -78,7 +78,7 @@ func (me *request) OutputDebug() string {
}
func (me *request) parse() {
inHSize := unsafe.Sizeof(InHeader{})
inHSize := int(unsafe.Sizeof(InHeader{}))
if len(me.inputBuf) < inHSize {
log.Printf("Short read for input header: %v", me.inputBuf)
return
......@@ -94,7 +94,7 @@ func (me *request) parse() {
return
}
if len(me.arg) < me.handler.InputSize {
if len(me.arg) < int(me.handler.InputSize) {
log.Printf("Short read for %v: %v", me.inHeader.opcode, me.arg)
me.status = EIO
return
......@@ -135,7 +135,8 @@ func (me *request) serialize() {
outHeader := (*OutHeader)(unsafe.Pointer(&me.outHeaderBytes[0]))
outHeader.Unique = me.inHeader.Unique
outHeader.Status = -me.status
outHeader.Length = uint32(sizeOfOutHeader + dataLength + len(me.flatData))
outHeader.Length = uint32(
int(sizeOfOutHeader) + int(dataLength) + int(len(me.flatData)))
copy(me.outHeaderBytes[sizeOfOutHeader:], asSlice(me.outData, dataLength))
}
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