Commit 647ff1a2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Interaction: remove (buggy and useless) dialog IDs

parent 14e329dd
...@@ -200,7 +200,6 @@ typedef enum vlc_dialog { ...@@ -200,7 +200,6 @@ typedef enum vlc_dialog {
*/ */
struct interaction_dialog_t struct interaction_dialog_t
{ {
int i_id; ///< Unique ID
int i_type; ///< Type identifier int i_type; ///< Type identifier
char *psz_title; ///< Title char *psz_title; ///< Title
char *psz_description; ///< Descriptor string char *psz_description; ///< Descriptor string
...@@ -294,13 +293,13 @@ VLC_EXPORT( int, __intf_UserStringInput,(vlc_object_t*, const char*, const char* ...@@ -294,13 +293,13 @@ VLC_EXPORT( int, __intf_UserStringInput,(vlc_object_t*, const char*, const char*
#define intf_IntfProgress( a, b, c ) __intf_Progress( VLC_OBJECT(a), NULL, b,c, -1 ) #define intf_IntfProgress( a, b, c ) __intf_Progress( VLC_OBJECT(a), NULL, b,c, -1 )
#define intf_UserProgress( a, b, c, d, e ) __intf_Progress( VLC_OBJECT(a),b,c,d,e ) #define intf_UserProgress( a, b, c, d, e ) __intf_Progress( VLC_OBJECT(a),b,c,d,e )
VLC_EXPORT( int, __intf_Progress,( vlc_object_t*, const char*, const char*, float, int) ); VLC_EXPORT( interaction_dialog_t *, __intf_Progress,( vlc_object_t*, const char*, const char*, float, int) );
#define intf_ProgressUpdate( a, b, c, d, e ) __intf_ProgressUpdate( VLC_OBJECT(a),b,c,d,e ) #define intf_ProgressUpdate( a, b, c, d, e ) __intf_ProgressUpdate( VLC_OBJECT(a),b,c,d,e )
VLC_EXPORT( void, __intf_ProgressUpdate,( vlc_object_t*, int, const char*, float, int) ); VLC_EXPORT( void, __intf_ProgressUpdate,( vlc_object_t*, interaction_dialog_t *, const char*, float, int) );
#define intf_ProgressIsCancelled( a, b ) __intf_UserProgressIsCancelled( VLC_OBJECT(a),b ) #define intf_ProgressIsCancelled( a, b ) __intf_UserProgressIsCancelled( VLC_OBJECT(a),b )
VLC_EXPORT( bool, __intf_UserProgressIsCancelled,( vlc_object_t*, int ) ); VLC_EXPORT( bool, __intf_UserProgressIsCancelled,( vlc_object_t*, interaction_dialog_t * ) );
#define intf_UserHide( a, b ) __intf_UserHide( VLC_OBJECT(a), b ) #define intf_UserHide( a, b ) __intf_UserHide( VLC_OBJECT(a), b )
VLC_EXPORT( void, __intf_UserHide,( vlc_object_t *, int )); VLC_EXPORT( void, __intf_UserHide,( vlc_object_t *, interaction_dialog_t * ));
/** @} */ /** @} */
/** @} */ /** @} */
......
...@@ -126,7 +126,7 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa ...@@ -126,7 +126,7 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa
p_scan->p_obj = VLC_OBJECT(p_obj); p_scan->p_obj = VLC_OBJECT(p_obj);
p_scan->i_index = 0; p_scan->i_index = 0;
p_scan->i_dialog_id = -1; p_scan->p_dialog = NULL;
TAB_INIT( p_scan->i_service, p_scan->pp_service ); TAB_INIT( p_scan->i_service, p_scan->pp_service );
p_scan->parameter = *p_parameter; p_scan->parameter = *p_parameter;
p_scan->i_time_start = mdate(); p_scan->i_time_start = mdate();
...@@ -135,8 +135,8 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa ...@@ -135,8 +135,8 @@ int scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_pa
} }
void scan_Clean( scan_t *p_scan ) void scan_Clean( scan_t *p_scan )
{ {
if( p_scan->i_dialog_id >= 0 ) if( p_scan->p_dialog != NULL )
intf_UserHide( p_scan->p_obj, p_scan->i_dialog_id ); intf_UserHide( p_scan->p_obj, p_scan->p_dialog );
for( int i = 0; i < p_scan->i_service; i++ ) for( int i = 0; i < p_scan->i_service; i++ )
scan_service_Delete( p_scan->pp_service[i] ); scan_service_Delete( p_scan->pp_service[i] );
...@@ -317,10 +317,10 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg ) ...@@ -317,10 +317,10 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
if( i_eta >= 0 ) if( i_eta >= 0 )
msg_Info( p_scan->p_obj, "Scan ETA %s | %f", secstotimestr( psz_eta, i_eta/1000000 ), f_position * 100 ); msg_Info( p_scan->p_obj, "Scan ETA %s | %f", secstotimestr( psz_eta, i_eta/1000000 ), f_position * 100 );
if( p_scan->i_dialog_id < 0 ) if( p_scan->p_dialog == NULL )
p_scan->i_dialog_id = intf_UserProgress( p_scan->p_obj, _("Scanning DVB-T"), psz_text, 100.0 * f_position, -1 ); p_scan->p_dialog = intf_UserProgress( p_scan->p_obj, _("Scanning DVB-T"), psz_text, 100.0 * f_position, -1 );
else else
intf_ProgressUpdate( p_scan->p_obj, p_scan->i_dialog_id, psz_text, 100 * f_position, -1 ); intf_ProgressUpdate( p_scan->p_obj, p_scan->p_dialog, psz_text, 100 * f_position, -1 );
free( psz_text ); free( psz_text );
} }
...@@ -330,7 +330,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg ) ...@@ -330,7 +330,7 @@ int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg )
bool scan_IsCancelled( scan_t *p_scan ) bool scan_IsCancelled( scan_t *p_scan )
{ {
return p_scan->i_dialog_id >= 0 && intf_ProgressIsCancelled( p_scan->p_obj, p_scan->i_dialog_id ); return p_scan->p_dialog && intf_ProgressIsCancelled( p_scan->p_obj, p_scan->p_dialog );
} }
static scan_service_t *ScanFindService( scan_t *p_scan, int i_service_start, int i_program ) static scan_service_t *ScanFindService( scan_t *p_scan, int i_service_start, int i_program )
......
...@@ -127,8 +127,8 @@ typedef struct ...@@ -127,8 +127,8 @@ typedef struct
typedef struct typedef struct
{ {
vlc_object_t *p_obj; vlc_object_t *p_obj;
interaction_dialog_t *p_dialog;
int64_t i_index; int64_t i_index;
int i_dialog_id;
scan_parameter_t parameter; scan_parameter_t parameter;
int64_t i_time_start; int64_t i_time_start;
......
...@@ -2375,7 +2375,7 @@ static void AVI_IndexCreate( demux_t *p_demux ) ...@@ -2375,7 +2375,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
off_t i_movi_end; off_t i_movi_end;
mtime_t i_dialog_update; mtime_t i_dialog_update;
int i_dialog_id; interaction_dialog_t *p_dialog = NULL;
p_riff = AVI_ChunkFind( &p_sys->ck_root, AVIFOURCC_RIFF, 0); p_riff = AVI_ChunkFind( &p_sys->ck_root, AVIFOURCC_RIFF, 0);
p_movi = AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0); p_movi = AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0);
...@@ -2400,10 +2400,9 @@ static void AVI_IndexCreate( demux_t *p_demux ) ...@@ -2400,10 +2400,9 @@ static void AVI_IndexCreate( demux_t *p_demux )
/* Only show dialog if AVI is > 10MB */ /* Only show dialog if AVI is > 10MB */
i_dialog_id = -1;
i_dialog_update = mdate(); i_dialog_update = mdate();
if( stream_Size( p_demux->s ) > 10000000 ) if( stream_Size( p_demux->s ) > 10000000 )
i_dialog_id = intf_IntfProgress( p_demux, _("Fixing AVI Index..."), 0.0 ); p_dialog = intf_IntfProgress( p_demux, _("Fixing AVI Index..."), 0.0 );
for( ;; ) for( ;; )
{ {
...@@ -2413,14 +2412,14 @@ static void AVI_IndexCreate( demux_t *p_demux ) ...@@ -2413,14 +2412,14 @@ static void AVI_IndexCreate( demux_t *p_demux )
break; break;
/* Don't update/check dialog too often */ /* Don't update/check dialog too often */
if( i_dialog_id > 0 && mdate() - i_dialog_update > 100000 ) if( p_dialog && mdate() - i_dialog_update > 100000 )
{ {
if( intf_ProgressIsCancelled( p_demux, i_dialog_id ) ) if( intf_ProgressIsCancelled( p_demux, p_dialog ) )
break; break;
double f_pos = 100.0 * stream_Tell( p_demux->s ) / double f_pos = 100.0 * stream_Tell( p_demux->s ) /
stream_Size( p_demux->s ); stream_Size( p_demux->s );
intf_ProgressUpdate( p_demux, i_dialog_id, intf_ProgressUpdate( p_demux, p_dialog,
_( "Fixing AVI Index..." ), f_pos, -1 ); _( "Fixing AVI Index..." ), f_pos, -1 );
i_dialog_update = mdate(); i_dialog_update = mdate();
...@@ -2484,8 +2483,8 @@ static void AVI_IndexCreate( demux_t *p_demux ) ...@@ -2484,8 +2483,8 @@ static void AVI_IndexCreate( demux_t *p_demux )
} }
print_stat: print_stat:
if( i_dialog_id > 0 ) if( p_dialog != NULL )
intf_UserHide( p_demux, i_dialog_id ); intf_UserHide( p_demux, p_dialog );
for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ ) for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ )
{ {
......
...@@ -69,13 +69,12 @@ static intf_thread_t * SearchInterface( interaction_t * ); ...@@ -69,13 +69,12 @@ static intf_thread_t * SearchInterface( interaction_t * );
static void* InteractionLoop( void * ); static void* InteractionLoop( void * );
static void InteractionManage( interaction_t * ); static void InteractionManage( interaction_t * );
static interaction_dialog_t *DialogGetById( interaction_t* , int );
static void DialogDestroy( interaction_dialog_t * ); static void DialogDestroy( interaction_dialog_t * );
static int DialogSend( vlc_object_t *, interaction_dialog_t * ); static int DialogSend( vlc_object_t *, interaction_dialog_t * );
#define DIALOG_INIT( type ) \ #define DIALOG_INIT( type, err ) \
interaction_dialog_t* p_new = calloc( 1, sizeof( interaction_dialog_t ) ); \ interaction_dialog_t* p_new = calloc( 1, sizeof( interaction_dialog_t ) ); \
if( !p_new ) return VLC_EGENERIC; \ if( !p_new ) return err; \
p_new->b_cancelled = false; \ p_new->b_cancelled = false; \
p_new->i_status = NEW_DIALOG; \ p_new->i_status = NEW_DIALOG; \
p_new->i_flags = 0; \ p_new->i_flags = 0; \
...@@ -103,7 +102,7 @@ int __intf_UserFatal( vlc_object_t *p_this, bool b_blocking, ...@@ -103,7 +102,7 @@ int __intf_UserFatal( vlc_object_t *p_this, bool b_blocking,
const char *psz_format, ... ) const char *psz_format, ... )
{ {
va_list args; va_list args;
DIALOG_INIT( ONEWAY ); DIALOG_INIT( ONEWAY, VLC_EGENERIC );
p_new->psz_title = strdup( psz_title ); p_new->psz_title = strdup( psz_title );
FORMAT_DESC; FORMAT_DESC;
...@@ -129,7 +128,7 @@ int __intf_UserWarn( vlc_object_t *p_this, ...@@ -129,7 +128,7 @@ int __intf_UserWarn( vlc_object_t *p_this,
const char *psz_format, ... ) const char *psz_format, ... )
{ {
va_list args; va_list args;
DIALOG_INIT( ONEWAY ); DIALOG_INIT( ONEWAY, VLC_EGENERIC );
p_new->psz_title = strdup( psz_title ); p_new->psz_title = strdup( psz_title );
FORMAT_DESC; FORMAT_DESC;
...@@ -157,7 +156,7 @@ int __intf_UserYesNo( vlc_object_t *p_this, ...@@ -157,7 +156,7 @@ int __intf_UserYesNo( vlc_object_t *p_this,
const char *psz_alternate, const char *psz_alternate,
const char *psz_other ) const char *psz_other )
{ {
DIALOG_INIT( TWOWAY ); DIALOG_INIT( TWOWAY, VLC_EGENERIC );
p_new->psz_title = strdup( psz_title ); p_new->psz_title = strdup( psz_title );
p_new->psz_description = strdup( psz_description ); p_new->psz_description = strdup( psz_description );
...@@ -178,12 +177,13 @@ int __intf_UserYesNo( vlc_object_t *p_this, ...@@ -178,12 +177,13 @@ int __intf_UserYesNo( vlc_object_t *p_this,
* \param psz_status Current status * \param psz_status Current status
* \param f_position Current position (0.0->100.0) * \param f_position Current position (0.0->100.0)
* \param i_timeToGo Time (in sec) to go until process is finished * \param i_timeToGo Time (in sec) to go until process is finished
* \return Dialog id, to give to UserProgressUpdate * \return Dialog, for use with UserProgressUpdate
*/ */
int __intf_Progress( vlc_object_t *p_this, const char *psz_title, interaction_dialog_t *
__intf_Progress( vlc_object_t *p_this, const char *psz_title,
const char *psz_status, float f_pos, int i_time ) const char *psz_status, float f_pos, int i_time )
{ {
DIALOG_INIT( ONEWAY ); DIALOG_INIT( ONEWAY, NULL );
p_new->psz_description = strdup( psz_status ); p_new->psz_description = strdup( psz_status );
p_new->val.f_float = f_pos; p_new->val.f_float = f_pos;
p_new->i_timeToGo = i_time; p_new->i_timeToGo = i_time;
...@@ -198,37 +198,28 @@ int __intf_Progress( vlc_object_t *p_this, const char *psz_title, ...@@ -198,37 +198,28 @@ int __intf_Progress( vlc_object_t *p_this, const char *psz_title,
p_new->i_flags = DIALOG_INTF_PROGRESS; p_new->i_flags = DIALOG_INTF_PROGRESS;
DialogSend( p_this, p_new ); DialogSend( p_this, p_new );
return p_new->i_id; return p_new;
} }
/** /**
* Update a progress bar in a dialogue * Update a progress bar in a dialogue
* *
* \param p_this Parent vlc_object * \param p_this Parent vlc_object
* \param i_id Identifier of the dialog * \param p_dialog Dialog
* \param psz_status New status * \param psz_status New status
* \param f_position New position (0.0->100.0) * \param f_position New position (0.0->100.0)
* \param i_timeToGo Time (in sec) to go until process is finished * \param i_timeToGo Time (in sec) to go until process is finished
* \return nothing * \return nothing
*/ */
void __intf_ProgressUpdate( vlc_object_t *p_this, int i_id, void __intf_ProgressUpdate( vlc_object_t *p_this,
interaction_dialog_t *p_dialog,
const char *psz_status, float f_pos, int i_time ) const char *psz_status, float f_pos, int i_time )
{ {
interaction_t *p_interaction = InteractionGet( p_this ); interaction_t *p_interaction = InteractionGet( p_this );
interaction_dialog_t *p_dialog;
if( !p_interaction ) return; if( !p_interaction ) return;
vlc_object_lock( p_interaction ); vlc_object_lock( p_interaction );
p_dialog = DialogGetById( p_interaction, i_id );
if( !p_dialog )
{
vlc_object_unlock( p_interaction );
vlc_object_release( p_interaction );
return;
}
free( p_dialog->psz_description ); free( p_dialog->psz_description );
p_dialog->psz_description = strdup( psz_status ); p_dialog->psz_description = strdup( psz_status );
...@@ -247,26 +238,18 @@ void __intf_ProgressUpdate( vlc_object_t *p_this, int i_id, ...@@ -247,26 +238,18 @@ void __intf_ProgressUpdate( vlc_object_t *p_this, int i_id,
* interface module and the caller * interface module and the caller
* *
* \param p_this Parent vlc_object * \param p_this Parent vlc_object
* \param i_id Identifier of the dialogue * \param p_dialog Dialog
* \return Either true or false * \return Either true or false
*/ */
bool __intf_UserProgressIsCancelled( vlc_object_t *p_this, int i_id ) bool __intf_UserProgressIsCancelled( vlc_object_t *p_this,
interaction_dialog_t *p_dialog )
{ {
interaction_t *p_interaction = InteractionGet( p_this ); interaction_t *p_interaction = InteractionGet( p_this );
interaction_dialog_t *p_dialog;
bool b_cancel; bool b_cancel;
if( !p_interaction ) return true; if( !p_interaction ) return true;
vlc_object_lock( p_interaction ); vlc_object_lock( p_interaction );
p_dialog = DialogGetById( p_interaction, i_id );
if( !p_dialog )
{
vlc_object_unlock( p_interaction ) ;
vlc_object_release( p_interaction );
return true;
}
b_cancel = p_dialog->b_cancelled; b_cancel = p_dialog->b_cancelled;
vlc_object_unlock( p_interaction ); vlc_object_unlock( p_interaction );
vlc_object_release( p_interaction ); vlc_object_release( p_interaction );
...@@ -290,7 +273,7 @@ int __intf_UserLoginPassword( vlc_object_t *p_this, ...@@ -290,7 +273,7 @@ int __intf_UserLoginPassword( vlc_object_t *p_this,
char **ppsz_password ) char **ppsz_password )
{ {
int i_ret; int i_ret;
DIALOG_INIT( TWOWAY ); DIALOG_INIT( TWOWAY, VLC_EGENERIC );
p_new->i_type = INTERACT_DIALOG_TWOWAY; p_new->i_type = INTERACT_DIALOG_TWOWAY;
p_new->psz_title = strdup( psz_title ); p_new->psz_title = strdup( psz_title );
p_new->psz_description = strdup( psz_description ); p_new->psz_description = strdup( psz_description );
...@@ -326,7 +309,7 @@ int __intf_UserStringInput( vlc_object_t *p_this, ...@@ -326,7 +309,7 @@ int __intf_UserStringInput( vlc_object_t *p_this,
char **ppsz_usersString ) char **ppsz_usersString )
{ {
int i_ret; int i_ret;
DIALOG_INIT( TWOWAY ); DIALOG_INIT( TWOWAY, VLC_EGENERIC );
p_new->i_type = INTERACT_DIALOG_TWOWAY; p_new->i_type = INTERACT_DIALOG_TWOWAY;
p_new->psz_title = strdup( psz_title ); p_new->psz_title = strdup( psz_title );
p_new->psz_description = strdup( psz_description ); p_new->psz_description = strdup( psz_description );
...@@ -347,25 +330,18 @@ int __intf_UserStringInput( vlc_object_t *p_this, ...@@ -347,25 +330,18 @@ int __intf_UserStringInput( vlc_object_t *p_this,
* Hide an interaction dialog * Hide an interaction dialog
* *
* \param p_this the parent vlc object * \param p_this the parent vlc object
* \param i_id the id of the item to hide * \param p_dialog the dialog to hide
* \return nothing * \return nothing
*/ */
void __intf_UserHide( vlc_object_t *p_this, int i_id ) void __intf_UserHide( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
{ {
interaction_t *p_interaction = InteractionGet( p_this ); interaction_t *p_interaction = InteractionGet( p_this );
interaction_dialog_t *p_dialog;
if( !p_interaction ) return; if( !p_interaction ) return;
vlc_object_lock( p_interaction ); vlc_object_lock( p_interaction );
p_dialog = DialogGetById( p_interaction, i_id );
if( p_dialog )
{
p_dialog->i_status = ANSWERED_DIALOG; p_dialog->i_status = ANSWERED_DIALOG;
vlc_cond_signal( &p_interaction->wait ); vlc_cond_signal( &p_interaction->wait );
}
vlc_object_unlock( p_interaction ); vlc_object_unlock( p_interaction );
vlc_object_release( p_interaction ); vlc_object_release( p_interaction );
} }
...@@ -491,19 +467,6 @@ static intf_thread_t *SearchInterface( interaction_t *p_interaction ) ...@@ -491,19 +467,6 @@ static intf_thread_t *SearchInterface( interaction_t *p_interaction )
return intf; return intf;
} }
/* Find an interaction dialog by its id */
static interaction_dialog_t *DialogGetById( interaction_t *p_interaction,
int i_id )
{
int i;
for( i = 0 ; i< p_interaction->i_dialogs; i++ )
{
if( p_interaction->pp_dialogs[i]->i_id == i_id )
return p_interaction->pp_dialogs[i];
}
return NULL;
}
/* Destroy a dialog */ /* Destroy a dialog */
static void DialogDestroy( interaction_dialog_t *p_dialog ) static void DialogDestroy( interaction_dialog_t *p_dialog )
{ {
...@@ -524,12 +487,6 @@ static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog ) ...@@ -524,12 +487,6 @@ static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
if( !p_interaction ) if( !p_interaction )
return VLC_EGENERIC; return VLC_EGENERIC;
/* Get an id, if we don't already have one */
vlc_object_lock( p_interaction );
if( p_dialog->i_id == 0 )
p_dialog->i_id = ++p_interaction->i_last_id;
vlc_object_unlock( p_interaction );
if( p_this->i_flags & OBJECT_FLAGS_NOINTERACT ) if( p_this->i_flags & OBJECT_FLAGS_NOINTERACT )
{ {
vlc_object_release( p_interaction ); vlc_object_release( p_interaction );
...@@ -549,7 +506,7 @@ static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog ) ...@@ -549,7 +506,7 @@ static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
vlc_object_lock( p_interaction ); vlc_object_lock( p_interaction );
for( i = 0 ; i< p_interaction->i_dialogs; i++ ) for( i = 0 ; i< p_interaction->i_dialogs; i++ )
{ {
if( p_interaction->pp_dialogs[i]->i_id == p_dialog->i_id ) if( p_interaction->pp_dialogs[i] == p_dialog )
b_found = true; b_found = true;
} }
/* Add it to the queue, the main loop will send the orders to the /* Add it to the queue, the main loop will send the orders to the
......
...@@ -1511,7 +1511,7 @@ void update_Download( update_t *p_update, const char *destination ) ...@@ -1511,7 +1511,7 @@ void update_Download( update_t *p_update, const char *destination )
static void* update_DownloadReal( vlc_object_t *p_this ) static void* update_DownloadReal( vlc_object_t *p_this )
{ {
update_download_thread_t *p_udt = (update_download_thread_t *)p_this; update_download_thread_t *p_udt = (update_download_thread_t *)p_this;
int i_progress = 0; interaction_dialog_t *p_progress = 0;
long int l_size; long int l_size;
long int l_downloaded = 0; long int l_downloaded = 0;
float f_progress; float f_progress;
...@@ -1589,7 +1589,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1589,7 +1589,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
if( asprintf( &psz_status, _("%s\nDownloading... %s/%s %.1f%% done"), if( asprintf( &psz_status, _("%s\nDownloading... %s/%s %.1f%% done"),
p_update->release.psz_url, "0.0", psz_size, 0.0 ) != -1 ) p_update->release.psz_url, "0.0", psz_size, 0.0 ) != -1 )
{ {
i_progress = intf_UserProgress( p_udt, _( "Downloading ..."), p_progress = intf_UserProgress( p_udt, _( "Downloading ..."),
psz_status, 0.0, 0 ); psz_status, 0.0, 0 );
free( psz_status ); free( psz_status );
} }
...@@ -1597,7 +1597,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1597,7 +1597,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
vlc_object_lock( p_udt ); vlc_object_lock( p_udt );
while( vlc_object_alive( p_udt ) && while( vlc_object_alive( p_udt ) &&
( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) && ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
!intf_ProgressIsCancelled( p_udt, i_progress ) ) !intf_ProgressIsCancelled( p_udt, p_progress ) )
{ {
vlc_object_unlock( p_udt ); vlc_object_unlock( p_udt );
if( fwrite( p_buffer, i_read, 1, p_file ) < 1 ) if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
...@@ -1614,7 +1614,7 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1614,7 +1614,7 @@ static void* update_DownloadReal( vlc_object_t *p_this )
p_update->release.psz_url, psz_downloaded, psz_size, p_update->release.psz_url, psz_downloaded, psz_size,
f_progress ) != -1 ) f_progress ) != -1 )
{ {
intf_ProgressUpdate( p_udt, i_progress, psz_status, f_progress, 0 ); intf_ProgressUpdate( p_udt, p_progress, psz_status, f_progress, 0 );
free( psz_status ); free( psz_status );
} }
free( psz_downloaded ); free( psz_downloaded );
...@@ -1626,14 +1626,14 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1626,14 +1626,14 @@ static void* update_DownloadReal( vlc_object_t *p_this )
p_file = NULL; p_file = NULL;
if( vlc_object_alive( p_udt ) && if( vlc_object_alive( p_udt ) &&
!intf_ProgressIsCancelled( p_udt, i_progress ) ) !intf_ProgressIsCancelled( p_udt, p_progress ) )
{ {
vlc_object_unlock( p_udt ); vlc_object_unlock( p_udt );
if( asprintf( &psz_status, _("%s\nDone %s (100.0%%)"), if( asprintf( &psz_status, _("%s\nDone %s (100.0%%)"),
p_update->release.psz_url, psz_size ) != -1 ) p_update->release.psz_url, psz_size ) != -1 )
{ {
intf_ProgressUpdate( p_udt, i_progress, psz_status, 100.0, 0 ); intf_ProgressUpdate( p_udt, p_progress, psz_status, 100.0, 0 );
i_progress = 0; p_progress = NULL
free( psz_status ); free( psz_status );
} }
} }
...@@ -1723,9 +1723,9 @@ static void* update_DownloadReal( vlc_object_t *p_this ) ...@@ -1723,9 +1723,9 @@ static void* update_DownloadReal( vlc_object_t *p_this )
free( p_hash ); free( p_hash );
end: end:
if( i_progress ) if( p_progress )
{ {
intf_ProgressUpdate( p_udt, i_progress, _("Cancelled"), 100.0, 0 ); intf_ProgressUpdate( p_udt, p_progress, _("Cancelled"), 100.0, 0 );
} }
if( p_stream ) if( p_stream )
stream_Delete( p_stream ); stream_Delete( p_stream );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment