summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-21 11:30:55 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-21 11:30:55 +0000
commitf00272efea5dddf6c31c7183dbe47586358644a8 (patch)
tree389e1042e5a66e08aae1dc536178aa36e4a3ffac /stream
parentc06c4c637943ef503d91841959a3433670a49f4a (diff)
downloadmpv-f00272efea5dddf6c31c7183dbe47586358644a8.tar.bz2
mpv-f00272efea5dddf6c31c7183dbe47586358644a8.tar.xz
Reduce some extreme parsing ugliness (mostly cosmetic)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25480 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/asf_streaming.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c
index 7a3f0b877c..df5ad2d27a 100644
--- a/stream/asf_streaming.c
+++ b/stream/asf_streaming.c
@@ -25,6 +25,8 @@
#include "network.h"
#include "tcp.h"
+#include "libavutil/intreadwrite.h"
+
#ifdef ARCH_X86
#define ASF_LOAD_GUID_PREFIX(guid) (*(uint32_t *)(guid))
#else
@@ -305,24 +307,24 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
// stream bitrate properties object
int stream_count;
char *ptr = &buffer[pos];
+ char *end = &buffer[size];
mp_msg(MSGT_NETWORK, MSGL_V, "Stream bitrate properties object\n");
- stream_count = le2me_16(*(uint16_t*)ptr);
- ptr += sizeof(uint16_t);
- if (ptr > &buffer[size]) goto len_err_out;
+ stream_count = AV_RL16(ptr);
+ ptr += 2;
+ if (ptr > end) goto len_err_out;
mp_msg(MSGT_NETWORK, MSGL_V, " stream count=[0x%x][%u]\n",
stream_count, stream_count );
for( i=0 ; i<stream_count ; i++ ) {
uint32_t rate;
int id;
int j;
- id = le2me_16(*(uint16_t*)ptr);
- ptr += sizeof(uint16_t);
- if (ptr > &buffer[size]) goto len_err_out;
- memcpy(&rate, ptr, sizeof(uint32_t));// workaround unaligment bug on sparc
- ptr += sizeof(uint32_t);
- if (ptr > &buffer[size]) goto len_err_out;
- rate = le2me_32(rate);
+ id = AV_RL16(ptr);
+ ptr += 2;
+ if (ptr > end) goto len_err_out;
+ rate = AV_RL32(ptr);
+ ptr += 4;
+ if (ptr > end) goto len_err_out;
mp_msg(MSGT_NETWORK, MSGL_V,
" stream id=[0x%x][%u]\n", id, id);
mp_msg(MSGT_NETWORK, MSGL_V,