mirror of https://bitbucket.org/ausocean/av.git
Fixed amfDeocdeInt16 - tested and working
This commit is contained in:
parent
084f7ce52b
commit
c7640ada0e
|
@ -1661,8 +1661,8 @@ func amfEncodeNamedString(output *byte, outend *byte, strName *C.AVal, strValue
|
||||||
// amfDecodeString decodes data into a string inside a AVal
|
// amfDecodeString decodes data into a string inside a AVal
|
||||||
func amfDecodeString(data *byte, bv *C.AVal) {
|
func amfDecodeString(data *byte, bv *C.AVal) {
|
||||||
dataPtr := unsafe.Pointer(data)
|
dataPtr := unsafe.Pointer(data)
|
||||||
bv.av_len = C.int(C.AMF_DecodeInt16((*C.char)(dataPtr)))
|
//bv.av_len = C.int(C.AMF_DecodeInt16((*C.char)(dataPtr)))
|
||||||
//bv.av_len = C.int(amfDecodeInt16((*byte)(dataPtr)))
|
bv.av_len = C.int(amfDecodeInt16((*byte)(dataPtr)))
|
||||||
if bv.av_len > 0 {
|
if bv.av_len > 0 {
|
||||||
bv.av_val = (*C.char)(incBytePtr(dataPtr, 2))
|
bv.av_val = (*C.char)(incBytePtr(dataPtr, 2))
|
||||||
} else {
|
} else {
|
||||||
|
@ -1673,7 +1673,7 @@ func amfDecodeString(data *byte, bv *C.AVal) {
|
||||||
// amfDecodeInt16 decodes data into a 16 bit number
|
// amfDecodeInt16 decodes data into a 16 bit number
|
||||||
func amfDecodeInt16(data *byte) uint16 {
|
func amfDecodeInt16(data *byte) uint16 {
|
||||||
c := unsafe.Pointer(data)
|
c := unsafe.Pointer(data)
|
||||||
return (uint16(*(*uint8)(c)) << 8) | *(*uint16)(incBytePtr(c, 1))
|
return uint16(*(*uint8)(c)<<8 | *(*byte)(incBytePtr(c, 1)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// amfEncodeInt24 encodes a int24 into data
|
// amfEncodeInt24 encodes a int24 into data
|
||||||
|
|
Loading…
Reference in New Issue