Exemplo n.º 1
0
func (c *CGoSystem) BeginWriteData(producerHandle uint32, flags uint32) (result uint32, buf []byte) {
	var buffer unsafe.Pointer
	var bufferNumBytes C.uint32_t
	r := C.MojoBeginWriteData(C.MojoHandle(producerHandle), &buffer, &bufferNumBytes, C.MojoWriteDataFlags(flags))
	if r != C.MOJO_RESULT_OK {
		return uint32(r), nil
	}
	return uint32(r), unsafeByteSlice(buffer, int(bufferNumBytes))
}
Exemplo n.º 2
0
func (c *CGoSystem) WriteData(producerHandle uint32, buf []byte, flags uint32) (result uint32, bytesWritten uint32) {
	numBytes := C.uint32_t(len(buf))
	r := C.MojoWriteData(C.MojoHandle(producerHandle), unsafe.Pointer(&buf[0]), &numBytes, C.MojoWriteDataFlags(flags))
	return uint32(r), uint32(numBytes)
}