diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index fcf49df1..119e3a43 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1680,10 +1680,10 @@ func C_HandShake(r *C_RTMP, FP9HandShake int32) int { } if debugMode { - log.Println("C_HandShake: Type answer: %v", typ) + log.Printf("C_HandShake: Type answer: %v\n", typ) } if typ != clientbuf[0] { - log.Println("C_HandShake: type mismatch: client sent %v, server sent: %v", + log.Printf("C_HandShake: type mismatch: client sent %v, server sent: %v\n", clientbuf[0], typ) } if C_ReadN(r, (*byte)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE { @@ -2248,11 +2248,6 @@ func bToUP(b *byte) unsafe.Pointer { return unsafe.Pointer(b) } -// wrapper for converting slice to unsafe.pointer -func sToUP(b []byte) unsafe.Pointer { - return unsafe.Pointer(&b[0]) -} - // Creates a new C style string from a go string func goStrToCStr(str string) *byte { l := len(str) @@ -2364,34 +2359,12 @@ func indxBytePtr(ptr unsafe.Pointer, inc int) *byte { return (*byte)(incPtr(ptr, inc, 1)) } -// indxInt32Ptr returns an int32 at the indx inc given a ptr -func indxInt32Ptr(ptr unsafe.Pointer, inc int) *int32 { - return (*int32)(incPtr(ptr, inc, 4)) -} - -// indxInt64Ptr returns an int64 at the indx inc given a ptr -func indxInt64Ptr(ptr unsafe.Pointer, inc int) *int64 { - return (*int64)(incPtr(ptr, inc, 8)) -} - // incBytePtr returns an unsafe.Pointer to a byte that is inc positive positions // from the passed ptr func incBytePtr(ptr unsafe.Pointer, inc int) unsafe.Pointer { return incPtr(ptr, inc, 1) } -// incInt32Ptr returns an unsafe.Pointer to an int32 that is inc positive -// positions from the passed ptr -func incInt32Ptr(ptr unsafe.Pointer, inc int) unsafe.Pointer { - return incPtr(ptr, inc, 4) -} - -// incInt64Ptr returns an unsafe.Pointer to an int64 that is inc positive -// positions from the passed ptr -func incInt64Ptr(ptr unsafe.Pointer, inc int) unsafe.Pointer { - return incPtr(ptr, inc, 8) -} - // incPtr attempts to replicate C like pointer arithmatic functionality func incPtr(ptr unsafe.Pointer, inc, typeSize int) unsafe.Pointer { return unsafe.Pointer(uintptr(ptr) + uintptr(inc*typeSize)) @@ -2408,18 +2381,6 @@ func decBytePtr(ptr unsafe.Pointer, dec int) unsafe.Pointer { return decPtr(ptr, dec, 1) } -// decBytePtr returns an unsafe.Pointer to a int32 that is dec negative positions -// from ptr -func decInt32Ptr(ptr unsafe.Pointer, dec int) unsafe.Pointer { - return decPtr(ptr, dec, 4) -} - -// decBytePtr returns an unsafe.Pointer to a int64 that is dec negative positions -// from ptr -func decInt64Ptr(ptr unsafe.Pointer, dec int) unsafe.Pointer { - return decPtr(ptr, dec, 8) -} - // sliceToPtr get's the address of the first data element and returns as unsafe // pointer func sliceToPtr(data []byte) unsafe.Pointer { diff --git a/rtmp/rtmp_test.go b/rtmp/rtmp_test.go index 4cd24a56..2cc7dff6 100644 --- a/rtmp/rtmp_test.go +++ b/rtmp/rtmp_test.go @@ -200,26 +200,3 @@ func TestIndxBytePtr(t *testing.T) { t.Errorf(errMsg, valueByte, byteArr[inc]) } } - -func TestIndxInt32Ptr(t *testing.T) { - // Test how it deals with int32s - int32Ptr := unsafe.Pointer(&int32Arr[arrStart]) - valueInt32 := indxInt32Ptr(int32Ptr, inc) - if *valueInt32 != int32Arr[inc] { - t.Errorf(errMsg, valueInt32, int32Arr[inc]) - } -} - -func TestIndxInt64Ptr(t *testing.T) { - // Test how it deals with int64 - int64Ptr := unsafe.Pointer(&int64Arr[arrStart]) - valueInt64 := indxInt64Ptr(int64Ptr, inc) - if *valueInt64 != int64Arr[inc] { - t.Errorf(errMsg, valueInt64, int64Arr[inc]) - } -} - -/* -func TestPtrToSlice(t *testing.T){ -} -*/