From 74e468dfb362463dfc7766013747c5806101c7a9 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Sat, 1 Sep 2018 23:22:25 +0930 Subject: [PATCH] rtmp: remove unnecessary type conversions with unconvert --- rtmp/parseurl.go | 10 +++++----- rtmp/rtmp_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rtmp/parseurl.go b/rtmp/parseurl.go index fef192aa..7af55ebb 100644 --- a/rtmp/parseurl.go +++ b/rtmp/parseurl.go @@ -120,7 +120,7 @@ func C_RTMP_ParseURL(url *byte, protocol *int32, host *C_AVal, port *uint32, if hostlen < 256 { host.av_val = (*byte)(unsafe.Pointer(p)) - host.av_len = int32(hostlen) + host.av_len = hostlen // TODO: use new logger with this //RTMP_Log(RTMP_LOGDEBUG, "Parsed host : %.*s", hostlen, host.av_val); } else { @@ -204,7 +204,7 @@ func C_RTMP_ParseURL(url *byte, protocol *int32, host *C_AVal, port *uint32, } app.av_val = (*byte)(unsafe.Pointer(p)) - app.av_len = int32(applen) + app.av_len = applen // TODO: use new logging here // RTMP_Log(RTMP_LOGDEBUG, "Parsed app : %.*s", applen, p); @@ -240,7 +240,7 @@ func C_RTMP_ParsePlaypath(in, out *C_AVal) { ppstart := (*byte)(unsafe.Pointer(playpath)) var streamname, destptr, p *byte - pplen := int32(in.av_len) + pplen := in.av_len out.av_val = nil out.av_len = 0 @@ -248,7 +248,7 @@ func C_RTMP_ParsePlaypath(in, out *C_AVal) { temp = strstr((*byte)(unsafe.Pointer(ppstart)), goStrToCStr("slist=")) if *ppstart == '?' && temp != nil { ppstart = (*byte)(incBytePtr(unsafe.Pointer(temp), 6)) - pplen = int32(strlen(ppstart)) + pplen = strlen(ppstart) temp = strchr(ppstart, '&') @@ -305,7 +305,7 @@ func C_RTMP_ParsePlaypath(in, out *C_AVal) { } } - p = (*byte)(ppstart) + p = ppstart for pplen > 0 { if subExt != 0 && p == ext { p = (*byte)(incBytePtr(unsafe.Pointer(p), 4)) diff --git a/rtmp/rtmp_test.go b/rtmp/rtmp_test.go index f3252ce3..b33417cc 100644 --- a/rtmp/rtmp_test.go +++ b/rtmp/rtmp_test.go @@ -81,7 +81,7 @@ func TestMemset(t *testing.T) { if i > setNum-1 { testVal = byte(0) } - if (*[_Gi]byte)(unsafe.Pointer(mem))[i] != testVal { + if (*[_Gi]byte)(mem)[i] != testVal { t.Errorf("mem doesn't match expected values at: %v", i) } }