[FFmpeg-devel] Realmedia patch

Benoit Fouet benoit.fouet
Wed Aug 27 09:24:11 CEST 2008


Hi,

Ronald S. Bultje wrote:
> Hi again,
>
> [...]
>
>   
> Index: ffmpeg-svn/libavformat/utils.c
> ===================================================================
> --- ffmpeg-svn.orig/libavformat/utils.c	2008-08-26 20:54:36.000000000 -0400
> +++ ffmpeg-svn/libavformat/utils.c	2008-08-26 21:01:48.000000000 -0400
> @@ -3206,25 +3206,18 @@
>      }
>  }
>  
> -static void digit_to_char(char *dst, uint8_t src)
> -{
> -    if (src < 10) {
> -        *dst = '0' + src;
> -    } else {
> -        *dst = 'A' + src - 10;
> -    }
> -}
> -
>  char *ff_data_to_hex(char *buff, const uint8_t *src, int s)
>  {
>      int i;
> +    const char hex_table[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
> +                                 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
>  
> -    for(i = 0; i < s; i++) {
> -        digit_to_char(buff + 2 * i, src[i] >> 4);
> -        digit_to_char(buff + 2 * i + 1, src[i] & 0xF);
> +    for (i = 0; i < s; i++) {
> +        buff[i * 2]     = hex_table[src[i] >> 4];
> +        buff[i * 2 + 1] = hex_table[src[i] & 0xF];
>   

did you try with *buff++ too ?
and return buff - s * 2 + 1

>      }
>  
> -    return buff;
> +    return buf
>   

oops ? :)

-- 
Benoit Fouet
Purple Labs S.A.
www.purplelabs.com




More information about the ffmpeg-devel mailing list