From: hyc Date: Tue, 22 Jun 2010 14:19:08 +0000 (+0000) Subject: casting hbuf to unsigned doesn't seem to work, just declare it unsigned X-Git-Tag: v2.4~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=885cd3da7afa5237f7433e267c85652855fdead3;p=rtmpdump casting hbuf to unsigned doesn't seem to work, just declare it unsigned git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@514 400ebc74-4327-4243-bc38-086b20814532 --- diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index 011efe3..b04f2c7 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -2830,13 +2830,14 @@ EncodeInt32LE(char *output, int nVal) int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet) { - char hbuf[RTMP_MAX_HEADER_SIZE] = { 0 }, *header = hbuf; + uint8_t hbuf[RTMP_MAX_HEADER_SIZE] = { 0 }; + char *header = (char *)hbuf; int nSize, hSize, nToRead, nChunk; int didAlloc = FALSE; RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket); - if (ReadN(r, hbuf, 1) == 0) + if (ReadN(r, (char *)hbuf, 1) == 0) { RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header", __FUNCTION__); return FALSE; @@ -2847,26 +2848,26 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet) header++; if (packet->m_nChannel == 0) { - if (ReadN(r, &hbuf[1], 1) != 1) + if (ReadN(r, (char *)&hbuf[1], 1) != 1) { RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header 2nd byte", __FUNCTION__); return FALSE; } - packet->m_nChannel = (unsigned)hbuf[1]; + packet->m_nChannel = hbuf[1]; packet->m_nChannel += 64; header++; } else if (packet->m_nChannel == 1) { int tmp; - if (ReadN(r, &hbuf[1], 2) != 2) + if (ReadN(r, (char *)&hbuf[1], 2) != 2) { RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header 3nd byte", __FUNCTION__); return FALSE; } - tmp = (((unsigned)hbuf[2]) << 8) + (unsigned)hbuf[1]; + tmp = (hbuf[2] << 8) + hbuf[1]; packet->m_nChannel = tmp + 64; RTMP_Log(RTMP_LOGDEBUG, "%s, m_nChannel: %0x", __FUNCTION__, packet->m_nChannel); header += 2; @@ -2893,7 +2894,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet) return FALSE; } - hSize = nSize + (header - hbuf); + hSize = nSize + (header - (char *)hbuf); if (nSize >= 3) {