Changeset 12c39680e3b87acf1e9c7f5019598e16b8f9d669

Show
Ignore:
Timestamp:
22/12/07 12:29:57 (1 year ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1198322997 +0000
git-parent:

[9548b1290c630d2e60409f4a678377a07505ffe8]

git-author:
Rafaël Carré <funman@videolan.org> 1198322997 +0000
Message:

update: cosmetics, put the variable creation in libvlc

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/libvlc-common.c

    r3d0196c r12c3968  
    884884    /* Create volume callback system. */ 
    885885    var_Create( p_libvlc, "volume-change", VLC_VAR_BOOL ); 
     886 
     887    /* Notify interfaces that a new VLC version is available */ 
     888#ifdef UPDATE_CHECK 
     889    var_Create( p_libvlc, "update-notify", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); 
     890#endif 
    886891 
    887892    /* 
  • src/misc/update.c

    r9548b12 r12c3968  
    4141#include <assert.h> 
    4242 
    43  
    4443#include <vlc_update.h> 
    45  
    4644#include <vlc_stream.h> 
    4745#include <vlc_interface.h> 
     
    7876#   define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status" 
    7977#endif 
    80  
    81 #define STRDUP( a ) ( a ? strdup( a ) : NULL ) 
    8278 
    8379 
     
    758754{ 
    759755    update_t *p_update; 
    760  
    761     if( p_this == NULL ) return NULL; 
     756    assert( p_this ); 
    762757 
    763758    p_update = (update_t *)malloc( sizeof( update_t ) ); 
     
    771766    p_update->release.psz_desc = NULL; 
    772767 
    773     var_Create( p_this->p_libvlc, "update-notify", VLC_VAR_INTEGER | 
    774                 VLC_VAR_ISCOMMAND ); 
    775  
    776768    return p_update; 
    777769} 
     
    788780 
    789781    vlc_mutex_destroy( &p_update->lock ); 
    790  
    791     var_Destroy( p_update->p_libvlc, "update-notify" ); 
    792782 
    793783    FREENULL( p_update->release.psz_url ); 
     
    881871    p_update->release.psz_desc = psz_line; 
    882872 
    883     error: 
    884         if( p_stream ) 
    885             stream_Delete( p_stream ); 
     873error: 
     874    if( p_stream ) 
     875        stream_Delete( p_stream ); 
    886876} 
    887877 
     
    925915    vlc_mutex_unlock( &p_uct->p_update->lock ); 
    926916 
    927     var_TriggerCallback( p_uct->p_update->p_libvlc, "update-notify" ); 
     917    var_TriggerCallback( p_uct->p_libvlc, "update-notify" ); 
    928918} 
    929919 
     
    10201010 
    10211011    p_udt->p_update = p_update; 
    1022     p_udt->psz_destdir = STRDUP( psz_destdir )
     1012    p_udt->psz_destdir = psz_destdir ? strdup( psz_destdir ) : NULL
    10231013 
    10241014    vlc_thread_create( p_udt, "download update", update_DownloadReal, 
     
    10491039    if( !p_stream ) 
    10501040    { 
    1051         msg_Err( p_update->p_libvlc, "Failed to open %s for reading", p_update->release.psz_url ); 
     1041        msg_Err( p_udt, "Failed to open %s for reading", p_update->release.psz_url ); 
    10521042        goto error; 
    10531043    } 
     
    10601050    if( !psz_tmpdestfile ) 
    10611051    { 
    1062         msg_Err( p_update->p_libvlc, "The URL %s is false formated", p_update->release.psz_url ); 
     1052        msg_Err( p_udt, "The URL %s is false formated", p_update->release.psz_url ); 
    10631053        goto error; 
    10641054    } 
     
    10701060    if( !p_file ) 
    10711061    { 
    1072         msg_Err( p_update->p_libvlc, "Failed to open %s for writing", psz_destfile ); 
     1062        msg_Err( p_udt, "Failed to open %s for writing", psz_destfile ); 
    10731063        goto error; 
    10741064    } 
     
    10821072    if( asprintf( &psz_status, "%s\nDownloading... O.O/%s %.1f%% done",  p_update->release.psz_url, psz_size, 0.0 ) != -1 ) 
    10831073    { 
    1084         i_progress = intf_UserProgress( p_update->p_libvlc, "Downloading ...", psz_status, 0.0, 0 ); 
     1074        i_progress = intf_UserProgress( p_udt, "Downloading ...", psz_status, 0.0, 0 ); 
    10851075        free( psz_status ); 
    10861076    } 
    10871077 
    10881078    while( ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) && 
    1089                                    !intf_ProgressIsCancelled( p_update->p_libvlc, i_progress ) ) 
     1079                                   !intf_ProgressIsCancelled( p_udt, i_progress ) ) 
    10901080    { 
    10911081        fwrite( p_buffer, i_read, 1, p_file ); 
     
    10981088                      psz_size, psz_downloaded, f_progress ) != -1 ) 
    10991089        { 
    1100             intf_ProgressUpdate( p_update->p_libvlc, i_progress, psz_status, f_progress, 0 ); 
     1090            intf_ProgressUpdate( p_udt, i_progress, psz_status, f_progress, 0 ); 
    11011091            free( psz_status ); 
    11021092        } 
     
    11071097    fclose( p_file ); 
    11081098    p_file = NULL; 
    1109     if( !intf_ProgressIsCancelled( p_update->p_libvlc, i_progress ) ) 
     1099    if( !intf_ProgressIsCancelled( p_udt, i_progress ) ) 
    11101100    { 
    11111101        if( asprintf( &psz_status, "%s\nDone %s (100.0%%)", p_update->release.psz_url, psz_size ) != -1 ) 
    11121102        { 
    1113             intf_ProgressUpdate( p_update->p_libvlc, i_progress, psz_status, 100.0, 0 ); 
     1103            intf_ProgressUpdate( p_udt, i_progress, psz_status, 100.0, 0 ); 
    11141104            free( psz_status ); 
    11151105        }