[vlc-devel] [PATCH] Make cached module configuration on 64 bits work again

Mario Speiß 1034-135 at online.de
Thu Jan 24 22:15:41 CET 2013


On 24.01.2013 14:27, Rafaël Carré wrote:
> Hello,
>
> Le 24/01/2013 08:19, Mario Speiß a écrit :
>> This patch resolves the problems I encountered after applying the patch
>> for src/modules/cache.c with the 64 bit version of vlc.
>>
>> The structure is 64 bit large but the cached module configuration was
>> fed with the lower 32 bits only.
>
> Why "the lower 32 bits only" ?

The lower 32 bits only are saved to and loaded from plugins.dat from 
src/modules/cache.c with "SAVE/LOAD_IMMEDIATE (cfg->flags);", as 
sizeof(cfg->flags) is four only 32 bits are saved/loaded. That was the 
reason to make cfg->flags large enough on 64 bits to contain the whole 
union.
Another approach could be to name the union and instead 
SAVE/LOAD_IMMEDIATE(cfg->'union').

The patch i think seems least interfering with other vlc api as the 
union/structure in memory is *not* affected. As i wrote before, all the 
"misterious" bugs i mentioned disappeared and i did *not* experience any 
further implications.


>
> It's not explicit in your patch.
>
>> The bit fields containing b->removed
>> etc. where not cached this way. That was also the reason for the qt
>> expert configuration dialog when it came across "removed" configuration
>> items (which where not recognized as removed by parsing plugins.dat).
>>
>> Making the i_flags 64 bits large on 64 bit compilation resolves that.
>
> How can we know on which platforms this happens, only by experimentation?

I don't know, maybe #ifdef _WIN64, if the other 64 bit versions are not 
affected by that problem.

>
>> Regards,
>> Mario
>> ---
>>    include/vlc_configuration.h |    4 ++++
>>    1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
>> index acd1f41..d674ade 100644
>> --- a/include/vlc_configuration.h
>> +++ b/include/vlc_configuration.h
>> @@ -71,7 +71,11 @@ struct module_config_t
>>                unsigned    b_safe:1;       /* Safe in web plugins and
>> playlists */
>>                unsigned    b_removed:1;                           /*
>> Deprecated */
>>            };
>> +#ifdef _AMD64_
>> +        uint64_t flags;
>> +#else
>>            uint32_t flags;
>> +#endif
>>        };
>>        char *psz_type;                                 /* Configuration
>> subtype */
>>        char *psz_name;                                           /*
>> Option name */
>>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list