[vlc-devel] [GCI] last.fm access module

Tobias Güntner fatbull at web.de
Sun Jan 2 01:51:47 CET 2011


Am 02.01.2011 00:04, schrieb Jakub Wieczorek:
> +static int Open( vlc_object_t *p_this )
...
> +    curl_global_init( CURL_GLOBAL_ALL );
...
> +static void Close( vlc_object_t *p_this )
...
> +    curl_global_cleanup();

I think it is a bad idea to call global init/cleanup here. This might
fail mysteriously if another module ever uses libcurl. Furthermore, the
man page says those functions are unsafe if more than one thread is
running (even if only one thread actually uses libcurl).

> +static int Control( access_t *p_access, int i_query, va_list args )
...
> +            pb_bool = ( bool * )va_arg( args, bool* );
...
> +            pb_bool = ( bool * )va_arg( args, bool* );
...
> +            pi_64 = ( int64_t * )va_arg( args, int64_t * );

Type casts are not necessary here.

> +static inline uint64_t NextPowerOfTwo( uint64_t i_value )
> +{

--i_value;

> +    i_value = (i_value >> 1) | i_value;
> +    i_value = (i_value >> 2) | i_value;
> +    i_value = (i_value >> 4) | i_value;
> +    i_value = (i_value >> 8) | i_value;
> +    i_value = (i_value >> 16) | i_value;
> +    i_value = (i_value >> 32) | i_value;

++i_value;

> +    return i_value;
> +}

-- 
Regards,
Tobias



More information about the vlc-devel mailing list