Changes some cast to C.gsize to ensure size_t compatibility

This commit is contained in:
MATONE\SVelosamy
2020-12-28 15:00:39 +08:00
parent df4ff5b93d
commit 66fba2d0f0
5 changed files with 7 additions and 4 deletions

2
go.sum
View File

@@ -1,4 +1,6 @@
github.com/gotk3/gotk3 v0.4.0 h1:TIuhyQitGeRTxOQIV3AJlYtEWWJpC74JHwAIsxlH8MU=
github.com/gotk3/gotk3 v0.4.0/go.mod h1:Eew3QBwAOBTrfFFDmsDE5wZWbcagBL1NUslj1GhRveo=
github.com/gotk3/gotk3 v0.5.1 h1:zIZM2K4gmkGz1idEFVUPTQfAK/pnWoLKrlIjLOc4kzo=
github.com/gotk3/gotk3 v0.5.1/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=

View File

@@ -1,6 +1,7 @@
#ifndef __GST_GO_H__
#define __GST_GO_H__
#include <stdlib.h>
#include <gst/gst.h>
/*

View File

@@ -77,7 +77,7 @@ func NewBufferFromBytes(b []byte) *Buffer {
str := string(b)
p := unsafe.Pointer(C.CString(str))
// memory is freed by gstreamer after building the new buffer
buf := C.gst_buffer_new_wrapped((C.gpointer)(p), C.gulong(len(str)))
buf := C.gst_buffer_new_wrapped((C.gpointer)(p), C.gsize(len(str)))
return wrapBuffer(buf)
}
@@ -355,7 +355,7 @@ func (b *Buffer) CopyRegion(flags BufferCopyFlags, offset, size int64) *Buffer {
// Extract extracts size bytes starting from offset in this buffer. The data extracted may be lower
// than the actual size if the buffer did not contain enough data.
func (b *Buffer) Extract(offset, size int64) []byte {
dest := C.malloc(C.sizeof_char * C.ulong(size))
dest := C.malloc(C.sizeof_char * C.gsize(size))
defer C.free(dest)
C.gst_buffer_extract(b.Instance(), C.gsize(offset), (C.gpointer)(unsafe.Pointer(dest)), C.gsize(size))
return C.GoBytes(dest, C.int(size))

View File

@@ -25,7 +25,7 @@ func NewMiniObject(flags MiniObjectFlags, gtype glib.Type) *MiniObject {
C.gst_mini_object_init(
C.toGstMiniObject(unsafe.Pointer(&cMiniObj)),
C.uint(flags),
C.ulong(gtype),
C.gsize(gtype),
nil, nil, nil,
)
return wrapMiniObject(&cMiniObj)

View File

@@ -43,7 +43,7 @@ func (o *Object) Name() string {
// Interfaces returns the interfaces associated with this object.
func (o *Object) Interfaces() []string {
var size C.guint
ifaces := C.g_type_interfaces(C.ulong(o.TypeFromInstance()), &size)
ifaces := C.g_type_interfaces(C.gsize(o.TypeFromInstance()), &size)
if int(size) == 0 {
return nil
}