Commit 9914cd55 authored by Ilkka Ollakka's avatar Ilkka Ollakka

dvb: do decode_BCD without asprintf

parent 6f4e5ac6
...@@ -150,15 +150,12 @@ static void scan_service_Delete( scan_service_t *p_srv ) ...@@ -150,15 +150,12 @@ static void scan_service_Delete( scan_service_t *p_srv )
static int decode_BCD( uint32_t input, uint32_t *output ) static int decode_BCD( uint32_t input, uint32_t *output )
{ {
char *psz_decoded=""; *output = 0;
do for( short index=28; index >= 0 ; index -= 4 )
{ {
if(asprintf( &psz_decoded, "%1d%1d%s", ( input & 0xf0 ) >> 4, input & 0x0f, psz_decoded ? psz_decoded : "" ) < 0 ) *output *= 10;
return VLC_ENOMEM; *output += ((input >> index) & 0x0f);
input >>= 8; };
} while( input );
*output = atol( psz_decoded );
free( psz_decoded );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment