Changeset 1c3528868c36e57e12cc0d99722255b261f50c41

Show
Ignore:
Timestamp:
02/13/06 09:30:55 (3 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1139819455 +0000
git-parent:

[8a1c45dff8c198bf15626a10093ce45a7a114c20]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1139819455 +0000
Message:

All Unicode fixes for fopen() (refs #528)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/input/subtitles.c

    r9efc237 r1c35288  
    421421                    asprintf( &psz_path, "%s%s", j < 0 ? f_dir : *subdirs, p_fixed_name ); 
    422422                    msg_Dbg( p_this, "autodetected subtitle: %s with priority %d", p_fixed_name, i_prio ); 
    423            /* FIXME: a portable wrapper for stat() or access() would be more suited */ 
     423                    /* FIXME: a portable wrapper for stat() or access() would be more suited */ 
    424424                    if( ( f = utf8_fopen( psz_path, "rt" ) ) ) 
    425425                    { 
    426426                        fclose( f ); 
    427                     msg_Dbg( p_this, "autodetected subtitle: %s with priority %d", p_fixed_name, i_prio ); 
     427                        msg_Dbg( p_this, "autodetected subtitle: %s with priority %d", p_fixed_name, i_prio ); 
    428428                        result[i_sub_count].priority = i_prio; 
    429429                        result[i_sub_count].psz_fname = psz_path; 
  • src/misc/image.c

    r2cb472d r1c35288  
    3535#include <vlc_filter.h> 
    3636#include <vlc_image.h> 
     37#include <charset.h> 
    3738 
    3839static picture_t *ImageRead( image_handler_t *, block_t *, 
     
    207208    int i_size; 
    208209 
    209     file = fopen( psz_url, "rb" ); 
     210    file = utf8_fopen( psz_url, "rb" ); 
    210211    if( !file ) 
    211212    { 
     
    345346    } 
    346347 
    347     file = fopen( psz_url, "wb" ); 
     348    file = utf8_fopen( psz_url, "wb" ); 
    348349    if( !file ) 
    349350    { 
  • src/misc/modules.c

    rbcf4277 r1c35288  
    16261626    msg_Dbg( p_this, "loading plugins cache file %s", psz_filename ); 
    16271627 
    1628     file = fopen( psz_filename, "rb" ); 
     1628    file = utf8_fopen( psz_filename, "rb" ); 
    16291629    if( !file ) 
    16301630    { 
     
    19481948    strcat( psz_filename, "/CACHEDIR.TAG" ); 
    19491949 
    1950     file = fopen( psz_filename, "wb" ); 
     1950    file = utf8_fopen( psz_filename, "wb" ); 
    19511951    if( file ) 
    19521952    { 
     
    19601960    msg_Dbg( p_this, "saving plugins cache file %s", psz_filename ); 
    19611961 
    1962     file = fopen( psz_filename, "wb" ); 
     1962    file = utf8_fopen( psz_filename, "wb" ); 
    19631963    if( !file ) 
    19641964    { 
  • src/misc/update.c

    r638acbf r1c35288  
    4646#include "vlc_xml.h" 
    4747#include "vlc_interaction.h" 
     48#include "charset.h" 
    4849 
    4950/***************************************************************************** 
     
    12771278    { 
    12781279 
    1279         p_file = fopen( psz_dest, "w" ); 
     1280        p_file = utf8_fopen( psz_dest, "w" ); 
    12801281        if( !p_file ) 
    12811282        { 
  • src/misc/vlm.c

    recf356c r1c35288  
    4444#include "vlc_vlm.h" 
    4545#include "vlc_vod.h" 
     46#include "charset.h" 
    4647 
    4748#define FREE( p ) \ 
     
    195196    if( !p_vlm || !psz_file ) return 1; 
    196197 
    197     file = fopen( psz_file, "wt" ); 
     198    file = utf8_fopen( psz_file, "wt" ); 
    198199    if( file == NULL ) return 1; 
    199200 
     
    222223    if( !p_vlm || !psz_file ) return 1; 
    223224 
    224     file = fopen( psz_file, "r" ); 
     225    file = utf8_fopen( psz_file, "r" ); 
    225226    if( file == NULL ) return 1; 
    226227 
  • src/network/acl.c

    r2cb472d r1c35288  
    3535 
    3636#include "network.h" 
     37#include "charset.h" 
    3738 
    3839/* FIXME: rwlock on acl, but libvlc doesn't implement rwlock */ 
     
    269270        return -1; 
    270271 
    271     file = fopen( psz_path, "r" ); 
     272    file = utf8_fopen( psz_path, "r" ); 
    272273    if( file == NULL ) 
    273274        return -1; 
  • src/osd/osd_parser.c

    rfba7cf5 r1c35288  
    3535#include <vlc_image.h> 
    3636#include <vlc_osd.h> 
     37#include <charset.h> 
    3738 
    3839 
     
    7071        p_pic = image_ReadUrl( p_image, psz_filename, &fmt_in, &fmt_out ); 
    7172        image_HandlerDelete( p_image ); 
    72 #if 0         
     73#if 0 
    7374        p_pic = osd_YuvaYuvp( p_this, p_pic ); 
    7475#endif 
     
    8586{ 
    8687    if( !p_menu ) return NULL; 
    87      
     88 
    8889    p_menu->p_state = (osd_menu_state_t *) malloc( sizeof( osd_menu_state_t ) ); 
    8990    if( !p_menu->p_state ) 
     
    9697    p_menu->i_x = i_x; 
    9798    p_menu->i_y = i_y; 
    98      
    99     return p_menu;  
     99 
     100    return p_menu; 
    100101} 
    101102 
     
    124125    if( !p_button ) 
    125126        return NULL; 
    126      
     127 
    127128    memset( p_button, 0, sizeof(osd_button_t) ); 
    128129    p_button->psz_action = strdup(psz_action); 
     
    131132    p_button->i_x = i_x; 
    132133    p_button->i_y = i_y; 
    133      
     134 
    134135    return p_button; 
    135136} 
     
    137138/***************************************************************************** 
    138139 * Free a button 
    139  *****************************************************************************/  
     140 *****************************************************************************/ 
    140141static void osd_ButtonFree( vlc_object_t *p_this, osd_button_t *p_button ) 
    141142{ 
     
    143144    osd_button_t *p_next = NULL; 
    144145    osd_button_t *p_prev = NULL; 
    145      
     146 
    146147    /* First walk to the end. */ 
    147148    while( p_current->p_next ) 
    148149    { 
    149150        p_next = p_current->p_next; 
    150         p_current = p_next;         
     151        p_current = p_next; 
    151152    } 
    152153    /* Then free end first and walk to the start. */ 
     
    158159        if( p_current->p_next ) 
    159160        { 
    160             if( p_current->p_next->psz_name )  
     161            if( p_current->p_next->psz_name ) 
    161162                free( p_current->p_next->psz_name ); 
    162163            if( p_current->p_next->psz_action ) 
     
    168169            if( p_current->p_feedback ) 
    169170                free( p_current->p_feedback ); 
    170              
     171 
    171172            p_current->p_next->psz_action_down = NULL; 
    172173            p_current->p_next->psz_action = NULL; 
    173174            p_current->p_next->psz_name = NULL; 
    174175            p_current->p_feedback = NULL; 
    175                              
    176             /* Free all states first */             
    177             if( p_current->p_next->p_states )    
     176 
     177            /* Free all states first */ 
     178            if( p_current->p_next->p_states ) 
    178179                osd_StatesFree( p_this, p_current->p_next->p_states ); 
    179             p_current->p_next->p_states = NULL;           
     180            p_current->p_next->p_states = NULL; 
    180181            if( p_current->p_next) free( p_current->p_next ); 
    181             p_current->p_next = NULL;   
    182         }             
    183          
     182            p_current->p_next = NULL; 
     183        } 
     184 
    184185        if( p_current->p_up ) 
    185186        { 
    186             if( p_current->p_up->psz_name )  
     187            if( p_current->p_up->psz_name ) 
    187188                free( p_current->p_up->psz_name ); 
    188189            if( p_current->p_up->psz_action ) 
     
    194195            if( p_current->p_feedback ) 
    195196                free( p_current->p_feedback ); 
    196              
     197 
    197198            p_current->p_up->psz_action_down = NULL; 
    198199            p_current->p_up->psz_action = NULL; 
    199200            p_current->p_up->psz_name = NULL; 
    200201            p_current->p_feedback = NULL; 
    201              
    202             /* Free all states first */             
    203             if( p_current->p_up->p_states )    
     202 
     203            /* Free all states first */ 
     204            if( p_current->p_up->p_states ) 
    204205                osd_StatesFree( p_this, p_current->p_up->p_states ); 
    205             p_current->p_up->p_states = NULL;           
     206            p_current->p_up->p_states = NULL; 
    206207            if( p_current->p_up ) free( p_current->p_up ); 
    207             p_current->p_up = NULL;           
     208            p_current->p_up = NULL; 
    208209        } 
    209     }     
     210    } 
    210211    /* Free the last one. */ 
    211     if( p_button )  
    212     { 
    213         msg_Dbg( p_this, "+ freeing button %s [%p]", p_button->psz_action, p_button );     
     212    if( p_button ) 
     213    { 
     214        msg_Dbg( p_this, "+ freeing button %s [%p]", p_button->psz_action, p_button ); 
    214215        if( p_button->psz_name ) free( p_button->psz_name ); 
    215216        if( p_button->psz_action ) free( p_button->psz_action ); 
    216         if( p_button->psz_action_down ) free( p_button->psz_action_down );    
     217        if( p_button->psz_action_down ) free( p_button->psz_action_down ); 
    217218        if( p_current->p_feedback && p_current->p_feedback->p_data_orig ) 
    218219            free( p_current->p_feedback->p_data_orig ); 
    219220        if( p_current->p_feedback ) 
    220221            free( p_current->p_feedback ); 
    221          
     222 
    222223        p_button->psz_name = NULL; 
    223224        p_button->psz_action = NULL; 
    224225        p_button->psz_action_down = NULL; 
    225226        p_current->p_feedback = NULL; 
    226                  
     227 
    227228        if( p_button->p_states ) 
    228229            osd_StatesFree( p_this, p_button->p_states ); 
    229         p_button->p_states = NULL;           
     230        p_button->p_states = NULL; 
    230231        free( p_button ); 
    231232        p_button = NULL; 
     
    242243    if( !p_state ) 
    243244        return NULL; 
    244          
    245     memset( p_state, 0, sizeof(osd_state_t) );     
     245 
     246    memset( p_state, 0, sizeof(osd_state_t) ); 
    246247    p_state->p_pic = osd_LoadImage( p_this, psz_file ); 
    247248 
     
    267268    osd_state_t *p_next = NULL; 
    268269    osd_state_t *p_prev = NULL; 
    269      
     270 
    270271    while( p_state->p_next ) 
    271272    { 
     
    284285                free( p_state->p_next->p_pic->p_data_orig ); 
    285286            if( p_state->p_next->p_pic ) free( p_state->p_next->p_pic ); 
    286             p_state->p_next->p_pic = NULL;       
     287            p_state->p_next->p_pic = NULL; 
    287288            if( p_state->p_next->psz_state ) free( p_state->p_next->psz_state ); 
    288289            p_state->p_next->psz_state = NULL; 
    289290            free( p_state->p_next ); 
    290             p_state->p_next = NULL;         
     291            p_state->p_next = NULL; 
    291292        } 
    292293    } 
     
    313314{ 
    314315    osd_button_t   *p_current = NULL; /* button currently processed */ 
    315     osd_button_t   *p_prev = NULL;    /* previous processed button */  
    316  
    317 #define MAX_FILE_PATH 256     
     316    osd_button_t   *p_prev = NULL;    /* previous processed button */ 
     317 
     318#define MAX_FILE_PATH 256 
    318319    FILE       *fd = NULL; 
    319320    int        result = 0; 
    320      
     321 
    321322    msg_Dbg( p_this, "opening osd definition file %s", psz_file ); 
    322     fd = fopen( psz_file, "r" ); 
    323     if( !fd )   
     323    fd = utf8_fopen( psz_file, "r" ); 
     324    if( !fd ) 
    324325    { 
    325326        msg_Err( p_this, "failed opening osd definition file %s", psz_file ); 
    326327        return VLC_EGENERIC; 
    327328    } 
    328      
    329     /* Read first line */     
     329 
     330    /* Read first line */ 
    330331    if( !feof( fd ) ) 
    331332    { 
     
    338339        psz_path = config_GetPsz( p_this, "osdmenu-file-path" ); 
    339340        if( psz_path == NULL ) 
    340         {                                     
     341        { 
    341342            result = fscanf(fd, "%24s %255s", &action[0], &path[0] ); 
    342343        } 
    343344        else 
    344345        { 
    345             /* psz_path is not null and therefor &path[0] cannot be NULL  
     346            /* psz_path is not null and therefor &path[0] cannot be NULL 
    346347             * it might be null terminated. 
    347348             */ 
     
    358359        if( (i_len > 0) && path[i_len] != '\\' ) 
    359360            path[i_len] = '\\'; 
    360 #else         
     361#else 
    361362        if( (i_len > 0) && path[i_len] != '/' ) 
    362363            path[i_len] = '/'; 
     
    364365        path[i_len+1] = '\0'; 
    365366        if( result == 0 || result == EOF ) 
    366             goto error;                         
     367            goto error; 
    367368        msg_Dbg( p_this, "%s=%s", &action[0], &path[0] ); 
    368           
     369 
    369370        if( i_len == 0 ) 
    370371            *p_menu = osd_MenuNew( *p_menu, NULL, 0, 0 ); 
     
    372373            *p_menu = osd_MenuNew( *p_menu, &path[0], 0, 0 ); 
    373374    } 
    374      
     375 
    375376    if( !*p_menu ) 
    376377        goto error; 
    377          
     378 
    378379    /* read successive lines */ 
    379380    while( !feof( fd ) ) 
    380     {    
     381    { 
    381382        osd_state_t   *p_state_current = NULL; /* button state currently processed */ 
    382         osd_state_t   *p_state_prev = NULL;    /* previous state processed button */  
    383          
    384         char cmd[25] = "";       
     383        osd_state_t   *p_state_prev = NULL;    /* previous state processed button */ 
     384 
     385        char cmd[25] = ""; 
    385386        char action[25] = ""; 
    386387        char state[25]  = ""; 
    387388        char file[256]  = ""; 
    388         char path[512]  = "";         
     389        char path[512]  = ""; 
    389390        int  i_x = 0; 
    390391        int  i_y = 0; 
     
    392393        result = fscanf( fd, "%24s %24s (%d,%d)", &cmd[0], &action[0], &i_x, &i_y ); 
    393394        if( result == 0 ) 
    394             goto error;               
     395            goto error; 
    395396        if( strncmp( &cmd[0], "action", 6 ) != 0 ) 
    396397            break; 
    397         msg_Dbg( p_this, " + %s hotkey=%s (%d,%d)", &cmd[0], &action[0], i_x, i_y );                     
    398                  
     398        msg_Dbg( p_this, " + %s hotkey=%s (%d,%d)", &cmd[0], &action[0], i_x, i_y ); 
     399 
    399400        p_prev = p_current; 
    400         p_current = osd_ButtonNew( &action[0], i_x, i_y );    
     401        p_current = osd_ButtonNew( &action[0], i_x, i_y ); 
    401402        if( !p_current ) 
    402403            goto error; 
    403          
     404 
    404405        if( p_prev ) 
    405             p_prev->p_next = p_current;             
     406            p_prev->p_next = p_current; 
    406407        else 
    407             (*p_menu)->p_button = p_current;             
     408            (*p_menu)->p_button = p_current; 
    408409        p_current->p_prev = p_prev; 
    409          
     410 
    410411        /* parse all states */ 
    411412        while( !feof( fd ) ) 
    412413        { 
    413414            char type[25] = ""; 
    414              
    415             result = fscanf( fd, "\t%24s", &state[0] );    
     415 
     416            result = fscanf( fd, "\t%24s", &state[0] ); 
    416417            if( result == 0 ) 
    417418                goto error; 
    418              
    419             /* FIXME: We only parse one level deep now */     
     419 
     420            /* FIXME: We only parse one level deep now */ 
    420421            if( strncmp( &state[0], "action", 6 ) == 0 ) 
    421422            { 
    422423                osd_button_t   *p_up = NULL; 
    423                  
     424 
    424425                result = fscanf( fd, "%24s (%d,%d)", &action[0], &i_x, &i_y ); 
    425426                if( result == 0 ) 
    426427                    goto error; 
    427                 /* create new button */                 
    428                 p_up = osd_ButtonNew( &action[0], i_x, i_y );                  
    429                 if( !p_up )  
     428                /* create new button */ 
     429                p_up = osd_ButtonNew( &action[0], i_x, i_y ); 
     430                if( !p_up ) 
    430431                    goto error; 
    431                 /* Link to list */                     
     432                /* Link to list */ 
    432433                p_up->p_down = p_current; 
    433                 p_current->p_up = p_up;                  
     434                p_current->p_up = p_up; 
    434435                msg_Dbg( p_this, " + (menu up) hotkey=%s (%d,%d)", &action[0], i_x, i_y ); 
    435436                /* Parse type state */ 
    436                 result = fscanf( fd, "\t%24s %24s", &cmd[0], &type[0] );    
     437                result = fscanf( fd, "\t%24s %24s", &cmd[0], &type[0] ); 
    437438                if( result == 0 ) 
    438439                    goto error; 
    439440                if( strncmp( &cmd[0], "type", 4 ) == 0 ) 
    440                 {   
     441                { 
    441442                    if( strncmp( &type[0], "volume", 6 ) == 0 ) 
    442443                    { 
     
    446447                } 
    447448                /* Parse range state */ 
    448                 result = fscanf( fd, "\t%24s", &state[0] );    
     449                result = fscanf( fd, "\t%24s", &state[0] ); 
    449450                if( result == 0 ) 
    450451                    goto error; 
    451                 /* Parse the range state */         
     452                /* Parse the range state */ 
    452453                if( strncmp( &state[0], "range", 5 ) == 0 ) 
    453454                { 
    454455                    osd_state_t   *p_range_current = NULL; /* range state currently processed */ 
    455                     osd_state_t   *p_range_prev = NULL;    /* previous state processed range */  
     456                    osd_state_t   *p_range_prev = NULL;    /* previous state processed range */ 
    456457                    int i_index = 0; 
    457                                                              
     458 
    458459                    p_up->b_range = VLC_TRUE; 
    459      
    460                     result = fscanf( fd, "\t%24s", &action[0] );    
     460 
     461                    result = fscanf( fd, "\t%24s", &action[0] ); 
    461462                    if( result == 0 ) 
    462463                        goto error; 
    463                      
    464                     result = fscanf( fd, "\t%d", &i_index );    
     464 
     465                    result = fscanf( fd, "\t%d", &i_index ); 
    465466                    if( result == 0 ) 
    466467                        goto error; 
    467                                                                                              
     468 
    468469                    msg_Dbg( p_this, " + (menu up) hotkey down %s, file=%s%s", &action[0], (*p_menu)->psz_path, &file[0] ); 
    469                      
     470 
    470471                    if( p_up->psz_action_down ) free( p_up->psz_action_down ); 
    471                     p_up->psz_action_down = strdup( &action[0] );                      
    472                      
     472                    p_up->psz_action_down = strdup( &action[0] ); 
     473 
    473474                    /* Parse range contstruction : 
    474                      * range <hotkey>  
     475                     * range <hotkey> 
    475476                     *      <state1> <file1> 
    476477                     * 
    477478                     *      <stateN> <fileN> 
    478                      * end  
    479                      */                 
     479                     * end 
     480                     */ 
    480481                    while( !feof( fd ) ) 
    481482                    { 
    482                         result = fscanf( fd, "\t%255s", &file[0] );    
     483                        result = fscanf( fd, "\t%255s", &file[0] ); 
    483484                        if( result == 0 ) 
    484485                            goto error; 
    485486                        if( strncmp( &file[0], "end", 3 ) == 0 ) 
    486487                            break; 
    487                          
     488 
    488489                        p_range_prev = p_range_current; 
    489              
     490 
    490491                        if( (*p_menu)->psz_path ) 
    491492                        { 
    492493                            size_t i_path_size = strlen( (*p_menu)->psz_path ); 
    493494                            size_t i_file_size = strlen( &file[0] ); 
    494                              
     495 
    495496                            strncpy( &path[0], (*p_menu)->psz_path, i_path_size ); 
    496497                            strncpy( &path[i_path_size], &file[0], 512 - (i_path_size + i_file_size) ); 
    497498                            path[ i_path_size + i_file_size ] = '\0'; 
    498                              
     499 
    499500                            p_range_current = osd_StateNew( p_this, &path[0], "pressed" ); 
    500501                        } 
    501502                        else /* absolute paths are used. */ 
    502503                            p_range_current = osd_StateNew( p_this, &file[0], "pressed" ); 
    503                              
     504 
    504505                        if( !p_range_current || !p_range_current->p_pic ) 
    505506                            goto error; 
    506                              
    507                         /* increment the number of ranges for this button */                 
     507 
     508                        /* increment the number of ranges for this button */ 
    508509                        p_up->i_ranges++; 
    509                          
     510 
    510511                        if( p_range_prev ) 
    511512                            p_range_prev->p_next = p_range_current; 
    512513                        else 
    513                             p_up->p_states = p_range_current;                                 
     514                            p_up->p_states = p_range_current; 
    514515                        p_range_current->p_prev = p_range_prev; 
    515                          
    516                         msg_Dbg( p_this, "  |- range=%d, file=%s%s",  
    517                                 p_up->i_ranges,  
    518                                 (*p_menu)->psz_path, &file[0] );                         
     516 
     517                        msg_Dbg( p_this, "  |- range=%d, file=%s%s", 
     518                                p_up->i_ranges, 
     519                                (*p_menu)->psz_path, &file[0] ); 
    519520                    } 
    520521                    if( i_index > 0 ) 
    521                     {  
     522                    { 
    522523                        osd_state_t *p_range = NULL; 
    523                          
    524                         /* Find the default index for state range */                         
     524 
     525                        /* Find the default index for state range */ 
    525526                        p_range = p_up->p_states; 
    526527                        while( (--i_index > 0) && p_range->p_next ) 
     
    531532                        } 
    532533                        p_up->p_current_state = p_range; 
    533                     }                     
     534                    } 
    534535                    else p_up->p_current_state = p_up->p_states; 
    535                      
    536                 }    
    537                 result = fscanf( fd, "\t%24s", &state[0] );    
     536 
     537                } 
     538                result = fscanf( fd, "\t%24s", &state[0] ); 
    538539                if( result == 0 ) 
    539                     goto error;                     
     540                    goto error; 
    540541                if( strncmp( &state[0], "end", 3 ) != 0 ) 
    541542                    goto error; 
    542                      
     543 
    543544                /* Continue at the beginning of the while() */ 
    544545                continue; 
    545546            } 
    546              
    547             /* Parse the range state */         
     547 
     548            /* Parse the range state */ 
    548549            if( strncmp( &state[0], "range", 5 ) == 0 ) 
    549550            { 
    550551                osd_state_t   *p_range_current = NULL; /* range state currently processed */ 
    551                 osd_state_t   *p_range_prev = NULL;    /* previous state processed range */  
     552                osd_state_t   *p_range_prev = NULL;    /* previous state processed range */ 
    552553                int i_index = 0; 
    553                                                          
     554 
    554555                p_current->b_range = VLC_TRUE; 
    555556 
    556                 result = fscanf( fd, "\t%24s", &action[0] );    
     557                result = fscanf( fd, "\t%24s", &action[0] ); 
    557558                if( result == 0 ) 
    558559                    goto error; 
    559                  
    560                 result = fscanf( fd, "\t%d", &i_index );    
     560 
     561                result = fscanf( fd, "\t%d", &i_index ); 
    561562                if( result == 0 ) 
    562563                    goto error; 
    563                                                                                          
    564                 msg_Dbg( p_this, " + hotkey down %s, file=%s%s", &action[0], (*p_menu)->psz_path, &file[0] );                         
     564 
     565                msg_Dbg( p_this, " + hotkey down %s, file=%s%s", &action[0], (*p_menu)->psz_path, &file[0] ); 
    565566                if( p_current->psz_action_down ) free( p_current->psz_action_down ); 
    566                 p_current->psz_action_down = strdup( &action[0] );                      
    567                  
     567                p_current->psz_action_down = strdup( &action[0] ); 
     568 
    568569                /* Parse range contstruction : 
    569                  * range <hotkey>  
     570                 * range <hotkey> 
    570571                 *      <state1> <file1> 
    571572                 * 
    572573                 *      <stateN> <fileN> 
    573                  * end  
    574                  */                 
     574                 * end 
     575                 */ 
    575576                while( !feof( fd ) ) 
    576577                { 
    577                     result = fscanf( fd, "\t%255s", &file[0] );    
     578                    result = fscanf( fd, "\t%255s", &file[0] ); 
    578579                    if( result == 0 ) 
    579580                        goto error; 
    580581                    if( strncmp( &file[0], "end", 3 ) == 0 ) 
    581582                        break; 
    582                      
     583 
    583584                    p_range_prev = p_range_current; 
    584          
     585 
    585586                    if( (*p_menu)->psz_path ) 
    586587                    { 
    587588                        size_t i_path_size = strlen( (*p_menu)->psz_path ); 
    588589                        size_t i_file_size = strlen( &file[0] ); 
    589                          
     590 
    590591                        strncpy( &path[0], (*p_menu)->psz_path, i_path_size ); 
    591592                        strncpy( &path[i_path_size], &file[0], 512 - (i_path_size + i_file_size) ); 
    592593                        path[ i_path_size + i_file_size ] = '\0'; 
    593                          
     594 
    594595                        p_range_current = osd_StateNew( p_this, &path[0], "pressed" ); 
    595596                    } 
    596597                    else /* absolute paths are used. */ 
    597598                        p_range_current = osd_StateNew( p_this, &file[0], "pressed" ); 
    598                          
     599 
    599600                    if( !p_range_current || !p_range_current->p_pic ) 
    600601                        goto error; 
    601                          
    602                     /* increment the number of ranges for this button */                 
     602 
     603                    /* increment the number of ranges for this button */ 
    603604                    p_current->i_ranges++; 
    604                      
     605 
    605606                    if( p_range_prev ) 
    606607                        p_range_prev->p_next = p_range_current; 
    607608                    else 
    608                         p_current->p_states = p_range_current;                                 
     609                        p_current->p_states = p_range_current; 
    609610                    p_range_current->p_prev = p_range_prev; 
    610                      
    611                     msg_Dbg( p_this, "  |- range=%d, file=%s%s",  
    612                             p_current->i_ranges,  
    613                             (*p_menu)->psz_path, &file[0] );                         
     611 
     612                    msg_Dbg( p_this, "  |- range=%d, file=%s%s", 
     613                            p_current->i_ranges, 
     614                            (*p_menu)->psz_path, &file[0] ); 
    614615                } 
    615616                if( i_index > 0 ) 
    616                 {              
     617                { 
    617618                    osd_state_t *p_range = NULL; 
    618                         
    619                     /* Find the default index for state range */                         
     619 
     620                    /* Find the default index for state range */ 
    620621                    p_range = p_current->p_states; 
    621622                    while( (--i_index > 0) && p_range->p_next ) 
     
    626627                    } 
    627628                    p_current->p_current_state = p_range; 
    628                 }                     
     629                } 
    629630                else p_current->p_current_state = p_current->p_states; 
    630631                /* Continue at the beginning of the while() */ 
    631632                continue; 
    632             }    
     633            } 
    633634            if( strncmp( &state[0], "end", 3 ) == 0 ) 
    634635                break; 
    635                  
    636             result = fscanf( fd, "\t%255s", &file[0] );    
     636 
     637            result = fscanf( fd, "\t%255s", &file[0] ); 
    637638            if( result == 0 ) 
    638                 goto error;                                 
    639              
     639                goto error; 
     640 
    640641            p_state_prev = p_state_current; 
    641642 
     
    648649                goto error; 
    649650            } 
    650              
     651 
    651652            if( (*p_menu)->psz_path ) 
    652653            { 
    653654                size_t i_path_size = strlen( (*p_menu)->psz_path ); 
    654655                size_t i_file_size = strlen( &file[0] ); 
    655                  
     656 
    656657                strncpy( &path[0], (*p_menu)->psz_path, i_path_size ); 
    657658                strncpy( &path[i_path_size], &file[0], 512 - (i_path_size + i_file_size) ); 
    658659                path[ i_path_size + i_file_size ] = '\0'; 
    659                  
     660 
    660661                p_state_current = osd_StateNew( p_this, &path[0], &state[0] ); 
    661662            } 
    662663            else /* absolute paths are used. */ 
    663664                p_state_current = osd_StateNew( p_this, &file[0], &state[0] ); 
    664                  
     665 
    665666            if( !p_state_current || !p_state_current->p_pic ) 
    666667                goto error; 
    667                  
     668 
    668669            if( p_state_prev ) 
    669670                p_state_prev->p_next = p_state_current; 
    670671            else 
    671                 p_current->p_states = p_state_current;                                 
     672                p_current->p_states = p_state_current; 
    672673            p_state_current->p_prev = p_state_prev; 
    673              
     674 
    674675            msg_Dbg( p_this, " |- state=%s, file=%s%s", &state[0], (*p_menu)->psz_path, &file[0] ); 
    675676        } 
     
    677678    } 
    678679 
    679     /* Find the last button and store its pointer.  
     680    /* Find the last button and store its pointer. 
    680681     * The OSD menu behaves like a roundrobin list. 
    681      */         
     682     */ 
    682683    p_current = (*p_menu)->p_button; 
    683684    while( p_current && p_current->p_next ) 
     
    690691    fclose( fd ); 
    691692    return 0; 
    692      
    693 #undef MAX_FILE_PATH  
     693 
     694#undef MAX_FILE_PATH 
    694695error: 
    695696    msg_Err( p_this, "parsing file failed (returned %d)", result ); 
    696697    fclose( fd ); 
    697     return 1;         
     698    return 1; 
    698699} 
    699700&nbs