# HG changeset patch # User reimar # Date 1198236655 0 # Node ID 25fc785eab224e7514c3a6ebcd8c000f6df666c6 # Parent bc4355ca432620f5fdbd14d3f8df1a631d642722 Reduce some extreme parsing ugliness (mostly cosmetic) diff -r bc4355ca4326 -r 25fc785eab22 stream/asf_streaming.c --- a/stream/asf_streaming.c Fri Dec 21 10:53:32 2007 +0000 +++ b/stream/asf_streaming.c Fri Dec 21 11:30:55 2007 +0000 @@ -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 @@ // 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 &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,