Changeset 44de901a6dcdb11f25ab8583738ad0e2ba3c4959

Show
Ignore:
Timestamp:
11/11/07 21:16:51 (1 year ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1194812211 +0000
git-parent:

[7fe8ad1b31a721f9eebe7df825e7e499ea9a9734]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1194812211 +0000
Message:

Fix module_GetModulesNamesForCapability() and make it handle submodules properly (ie: the shoutcasttv submodule is returned as "shoutcasttv" instead of "shout"). This function (or its services_discovery_GetServicesNames(p_this) specialised version) should be used in interfaces, instead of the current code duplication.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/modules.c

    ra9143cd r44de901  
    783783{ 
    784784    vlc_list_t *p_list; 
    785     int i, count = 0; 
     785    int i, j, count = 0; 
    786786    char ** psz_ret; 
    787787 
     
    795795            count++; 
    796796    } 
    797     psz_ret = malloc( sizeof(char**) * (count+1) ); 
     797    psz_ret = malloc( sizeof(char*) * (count+1) ); 
     798    j = 0; 
    798799    for( i = 0 ; i < p_list->i_count; i++) 
    799800    { 
     
    801802        const char *psz_module_capability = p_module->psz_capability; 
    802803        if( psz_module_capability && !strcmp( psz_module_capability, psz_capability ) ) 
    803             psz_ret[i] = strdup( p_module->psz_object_name ); 
     804        { 
     805            int k = -1; /* hack to handle submodules properly */ 
     806            if( p_module->b_submodule ) 
     807            { 
     808                while( p_module->pp_shortcuts[++k] != NULL ); 
     809                k--; 
     810            } 
     811            psz_ret[j] = strdup( k>=0?p_module->pp_shortcuts[k] 
     812                                     :p_module->psz_object_name ); 
     813            j++; 
     814        } 
    804815    } 
    805816    psz_ret[count] = NULL; 
    806817 
    807818    vlc_list_release( p_list ); 
    808   
     819 
    809820    return psz_ret; 
    810821}