Example #1
0
func (c *CGoSystem) MapBuffer(handle uint32, offset, numBytes uint64, flags uint32) (result uint32, buf []byte) {
	var bufPtr unsafe.Pointer
	r := C.MojoMapBuffer(C.MojoHandle(handle), C.uint64_t(offset), C.uint64_t(numBytes), &bufPtr, C.MojoMapBufferFlags(flags))
	if r != C.MOJO_RESULT_OK {
		return uint32(r), nil
	}
	return uint32(r), unsafeByteSlice(bufPtr, int(numBytes))
}
Example #2
0
func (c *CoreImpl) MapBuffer(handle MojoHandle, offset uint64, numBytes uint64, flags MojoMapBufferFlags) (MojoResult, unsafe.Pointer) {
	var bufPtr unsafe.Pointer
	result := C.MojoMapBuffer(handle.cType(), (C.uint64_t)(offset), (C.uint64_t)(numBytes), &bufPtr, flags.cType())
	if result != C.MOJO_RESULT_OK {
		return (MojoResult)(result), nil
	}
	return MOJO_RESULT_OK, bufPtr
}