rtmp: remove unnecessary type conversions with unconvert

This commit is contained in:
Dan Kortschak 2018-09-01 23:22:25 +09:30
parent 40785e7454
commit 74e468dfb3
2 changed files with 6 additions and 6 deletions

View File

@ -120,7 +120,7 @@ func C_RTMP_ParseURL(url *byte, protocol *int32, host *C_AVal, port *uint32,
if hostlen < 256 { if hostlen < 256 {
host.av_val = (*byte)(unsafe.Pointer(p)) host.av_val = (*byte)(unsafe.Pointer(p))
host.av_len = int32(hostlen) host.av_len = hostlen
// TODO: use new logger with this // TODO: use new logger with this
//RTMP_Log(RTMP_LOGDEBUG, "Parsed host : %.*s", hostlen, host.av_val); //RTMP_Log(RTMP_LOGDEBUG, "Parsed host : %.*s", hostlen, host.av_val);
} else { } 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_val = (*byte)(unsafe.Pointer(p))
app.av_len = int32(applen) app.av_len = applen
// TODO: use new logging here // TODO: use new logging here
// RTMP_Log(RTMP_LOGDEBUG, "Parsed app : %.*s", applen, p); // 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)) ppstart := (*byte)(unsafe.Pointer(playpath))
var streamname, destptr, p *byte var streamname, destptr, p *byte
pplen := int32(in.av_len) pplen := in.av_len
out.av_val = nil out.av_val = nil
out.av_len = 0 out.av_len = 0
@ -248,7 +248,7 @@ func C_RTMP_ParsePlaypath(in, out *C_AVal) {
temp = strstr((*byte)(unsafe.Pointer(ppstart)), goStrToCStr("slist=")) temp = strstr((*byte)(unsafe.Pointer(ppstart)), goStrToCStr("slist="))
if *ppstart == '?' && temp != nil { if *ppstart == '?' && temp != nil {
ppstart = (*byte)(incBytePtr(unsafe.Pointer(temp), 6)) ppstart = (*byte)(incBytePtr(unsafe.Pointer(temp), 6))
pplen = int32(strlen(ppstart)) pplen = strlen(ppstart)
temp = strchr(ppstart, '&') temp = strchr(ppstart, '&')
@ -305,7 +305,7 @@ func C_RTMP_ParsePlaypath(in, out *C_AVal) {
} }
} }
p = (*byte)(ppstart) p = ppstart
for pplen > 0 { for pplen > 0 {
if subExt != 0 && p == ext { if subExt != 0 && p == ext {
p = (*byte)(incBytePtr(unsafe.Pointer(p), 4)) p = (*byte)(incBytePtr(unsafe.Pointer(p), 4))

View File

@ -81,7 +81,7 @@ func TestMemset(t *testing.T) {
if i > setNum-1 { if i > setNum-1 {
testVal = byte(0) 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) t.Errorf("mem doesn't match expected values at: %v", i)
} }
} }