Fixed amfDeocdeInt16 - tested and working

This commit is contained in:
saxon 2018-07-29 10:55:02 +09:30
parent 084f7ce52b
commit c7640ada0e
1 changed files with 3 additions and 3 deletions

View File

@ -1661,8 +1661,8 @@ func amfEncodeNamedString(output *byte, outend *byte, strName *C.AVal, strValue
// amfDecodeString decodes data into a string inside a AVal
func amfDecodeString(data *byte, bv *C.AVal) {
dataPtr := unsafe.Pointer(data)
bv.av_len = C.int(C.AMF_DecodeInt16((*C.char)(dataPtr)))
//bv.av_len = C.int(amfDecodeInt16((*byte)(dataPtr)))
//bv.av_len = C.int(C.AMF_DecodeInt16((*C.char)(dataPtr)))
bv.av_len = C.int(amfDecodeInt16((*byte)(dataPtr)))
if bv.av_len > 0 {
bv.av_val = (*C.char)(incBytePtr(dataPtr, 2))
} else {
@ -1673,7 +1673,7 @@ func amfDecodeString(data *byte, bv *C.AVal) {
// amfDecodeInt16 decodes data into a 16 bit number
func amfDecodeInt16(data *byte) uint16 {
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