diff options
| author | Yang Tse <yangsita@gmail.com> | 2010-02-03 06:49:27 +0000 | 
|---|---|---|
| committer | Yang Tse <yangsita@gmail.com> | 2010-02-03 06:49:27 +0000 | 
| commit | 381a4d6efec42db823cbd5946514c275bca7d2d1 (patch) | |
| tree | 061eb754d2156ea5b143b79eb9e3f843684961bd /lib | |
| parent | f6d288a39740136c59ee14937f994ca5e1555016 (diff) | |
Fix portability issue related with unaligned memory access
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/rtsp.c | 11 | 
1 files changed, 7 insertions, 4 deletions
| diff --git a/lib/rtsp.c b/lib/rtsp.c index 873b15f5f..efbdf5d7a 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -54,6 +54,11 @@   */ +#define RTP_PKT_CHANNEL(p)   ((int)((unsigned char)((p)[1]))) + +#define RTP_PKT_LENGTH(p)  ((((int)((unsigned char)((p)[2]))) << 8) | \ +                             ((int)((unsigned char)((p)[3])))) +  static int rtsp_getsock_do(struct connectdata *conn,                             curl_socket_t *socks,                             int numsocks); @@ -544,16 +549,14 @@ CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data,    while((rtp_dataleft > 0) &&          (rtp[0] == '$')) {      if(rtp_dataleft > 4) { -      char channel;        int rtp_length;        /* Parse the header */        /* The channel identifier immediately follows and is 1 byte */ -      channel = rtp[1]; -      rtspc->rtp_channel = (int) channel; +      rtspc->rtp_channel = RTP_PKT_CHANNEL(rtp);        /* The length is two bytes */ -      rtp_length = ntohs( *((unsigned short *)(&rtp[2])) ); +      rtp_length = RTP_PKT_LENGTH(rtp);        if(rtp_dataleft < rtp_length + 4) {          /* Need more - incomplete payload*/ | 
