From db2f6a475682a68cc9155c812fca239c9d767257 Mon Sep 17 00:00:00 2001 From: saxon Date: Fri, 10 Aug 2018 16:43:19 +0930 Subject: [PATCH] Use len(... instead of sizeof in C_RTMP_SetupUrl --- rtmp/rtmp.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index aff04707..e3215364 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -500,11 +500,11 @@ func C_RTMP_Init(r *C.RTMP) { func C_RTMP_SetupURL(r *C.RTMP, u string) int32 { url := goStrToCStr(u) - var ret, len int32 + var ret, length int32 var port uint32 port = 0 - len = strlen(url) + length = strlen(url) // TODO: port this ret = int32(C.RTMP_ParseURL((*C.char)(unsafe.Pointer(url)), &r.Link.protocol, &r.Link.hostname, (*C.uint)(&port), &r.Link.playpath0, &r.Link.app)) @@ -520,16 +520,16 @@ func C_RTMP_SetupURL(r *C.RTMP, u string) int32 { r.Link.tcUrl.av_val = (*C.char)(unsafe.Pointer(url)) if r.Link.app.av_len != 0 { if int(uintptr(unsafe.Pointer(r.Link.app.av_val))) < - int(uintptr(incBytePtr(unsafe.Pointer(url), int(len)))) { + int(uintptr(incBytePtr(unsafe.Pointer(url), int(length)))) { r.Link.tcUrl.av_len = C.int(int(r.Link.app.av_len) + int(uintptr(decBytePtr(unsafe.Pointer(r.Link.app.av_val), int(uintptr(unsafe.Pointer(url))))))) } else { - len = int32(r.Link.hostname.av_len) + int32(r.Link.app.av_len) + - int32(unsafe.Sizeof("rtmpte://:65535/")) + length = int32(r.Link.hostname.av_len) + int32(r.Link.app.av_len) + + int32(len("rtmpte://:65535/\x00")) - r.Link.tcUrl.av_val = (*C.char)(allocate(uintptr(len))) + r.Link.tcUrl.av_val = (*C.char)(allocate(uintptr(length))) hostname := string(ptrToSlice(unsafe.Pointer(r.Link.hostname.av_val), int(r.Link.hostname.av_len)))