Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
12c39680
Commit
12c39680
authored
Dec 22, 2007
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: cosmetics, put the variable creation in libvlc
parent
9548b129
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
24 deletions
+19
-24
src/libvlc-common.c
src/libvlc-common.c
+5
-0
src/misc/update.c
src/misc/update.c
+14
-24
No files found.
src/libvlc-common.c
View file @
12c39680
...
...
@@ -884,6 +884,11 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/* Create volume callback system. */
var_Create
(
p_libvlc
,
"volume-change"
,
VLC_VAR_BOOL
);
/* Notify interfaces that a new VLC version is available */
#ifdef UPDATE_CHECK
var_Create
(
p_libvlc
,
"update-notify"
,
VLC_VAR_INTEGER
|
VLC_VAR_ISCOMMAND
);
#endif
/*
* Get input filenames given as commandline arguments
*/
...
...
src/misc/update.c
View file @
12c39680
...
...
@@ -40,9 +40,7 @@
#include <assert.h>
#include <vlc_update.h>
#include <vlc_stream.h>
#include <vlc_interface.h>
...
...
@@ -78,8 +76,6 @@
# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status"
#endif
#define STRDUP( a ) ( a ? strdup( a ) : NULL )
/*****************************************************************************
* Local Prototypes
...
...
@@ -757,8 +753,7 @@ static uint8_t *key_sign_hash( public_key_t *p_pkey )
update_t
*
__update_New
(
vlc_object_t
*
p_this
)
{
update_t
*
p_update
;
if
(
p_this
==
NULL
)
return
NULL
;
assert
(
p_this
);
p_update
=
(
update_t
*
)
malloc
(
sizeof
(
update_t
)
);
if
(
!
p_update
)
return
NULL
;
...
...
@@ -770,9 +765,6 @@ update_t *__update_New( vlc_object_t *p_this )
p_update
->
release
.
psz_url
=
NULL
;
p_update
->
release
.
psz_desc
=
NULL
;
var_Create
(
p_this
->
p_libvlc
,
"update-notify"
,
VLC_VAR_INTEGER
|
VLC_VAR_ISCOMMAND
);
return
p_update
;
}
...
...
@@ -788,8 +780,6 @@ void update_Delete( update_t *p_update )
vlc_mutex_destroy
(
&
p_update
->
lock
);
var_Destroy
(
p_update
->
p_libvlc
,
"update-notify"
);
FREENULL
(
p_update
->
release
.
psz_url
);
FREENULL
(
p_update
->
release
.
psz_desc
);
...
...
@@ -880,9 +870,9 @@ static void GetUpdateFile( update_t *p_update )
}
p_update
->
release
.
psz_desc
=
psz_line
;
error:
if
(
p_stream
)
stream_Delete
(
p_stream
);
error:
if
(
p_stream
)
stream_Delete
(
p_stream
);
}
...
...
@@ -924,7 +914,7 @@ void update_CheckReal( update_check_thread_t *p_uct )
vlc_mutex_unlock
(
&
p_uct
->
p_update
->
lock
);
var_TriggerCallback
(
p_uct
->
p_
update
->
p_
libvlc
,
"update-notify"
);
var_TriggerCallback
(
p_uct
->
p_libvlc
,
"update-notify"
);
}
/**
...
...
@@ -1019,7 +1009,7 @@ void update_Download( update_t *p_update, char *psz_destdir )
sizeof
(
update_download_thread_t
)
);
p_udt
->
p_update
=
p_update
;
p_udt
->
psz_destdir
=
STRDUP
(
psz_destdir
)
;
p_udt
->
psz_destdir
=
psz_destdir
?
strdup
(
psz_destdir
)
:
NULL
;
vlc_thread_create
(
p_udt
,
"download update"
,
update_DownloadReal
,
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
);
...
...
@@ -1048,7 +1038,7 @@ void update_DownloadReal( update_download_thread_t *p_udt )
p_stream
=
stream_UrlNew
(
p_update
->
p_libvlc
,
p_update
->
release
.
psz_url
);
if
(
!
p_stream
)
{
msg_Err
(
p_u
pdate
->
p_libvlc
,
"Failed to open %s for reading"
,
p_update
->
release
.
psz_url
);
msg_Err
(
p_u
dt
,
"Failed to open %s for reading"
,
p_update
->
release
.
psz_url
);
goto
error
;
}
...
...
@@ -1059,7 +1049,7 @@ void update_DownloadReal( update_download_thread_t *p_udt )
psz_tmpdestfile
=
strrchr
(
p_update
->
release
.
psz_url
,
'/'
);
if
(
!
psz_tmpdestfile
)
{
msg_Err
(
p_u
pdate
->
p_libvlc
,
"The URL %s is false formated"
,
p_update
->
release
.
psz_url
);
msg_Err
(
p_u
dt
,
"The URL %s is false formated"
,
p_update
->
release
.
psz_url
);
goto
error
;
}
psz_tmpdestfile
++
;
...
...
@@ -1069,7 +1059,7 @@ void update_DownloadReal( update_download_thread_t *p_udt )
p_file
=
utf8_fopen
(
psz_destfile
,
"w"
);
if
(
!
p_file
)
{
msg_Err
(
p_u
pdate
->
p_libvlc
,
"Failed to open %s for writing"
,
psz_destfile
);
msg_Err
(
p_u
dt
,
"Failed to open %s for writing"
,
psz_destfile
);
goto
error
;
}
...
...
@@ -1081,12 +1071,12 @@ void update_DownloadReal( update_download_thread_t *p_udt )
psz_size
=
size_str
(
l_size
);
if
(
asprintf
(
&
psz_status
,
"%s
\n
Downloading... O.O/%s %.1f%% done"
,
p_update
->
release
.
psz_url
,
psz_size
,
0
.
0
)
!=
-
1
)
{
i_progress
=
intf_UserProgress
(
p_u
pdate
->
p_libvlc
,
"Downloading ..."
,
psz_status
,
0
.
0
,
0
);
i_progress
=
intf_UserProgress
(
p_u
dt
,
"Downloading ..."
,
psz_status
,
0
.
0
,
0
);
free
(
psz_status
);
}
while
(
(
i_read
=
stream_Read
(
p_stream
,
p_buffer
,
1
<<
10
)
)
&&
!
intf_ProgressIsCancelled
(
p_u
pdate
->
p_libvlc
,
i_progress
)
)
!
intf_ProgressIsCancelled
(
p_u
dt
,
i_progress
)
)
{
fwrite
(
p_buffer
,
i_read
,
1
,
p_file
);
...
...
@@ -1097,7 +1087,7 @@ void update_DownloadReal( update_download_thread_t *p_udt )
if
(
asprintf
(
&
psz_status
,
"%s
\n
Donwloading... %s/%s %.1f%% done"
,
p_update
->
release
.
psz_url
,
psz_size
,
psz_downloaded
,
f_progress
)
!=
-
1
)
{
intf_ProgressUpdate
(
p_u
pdate
->
p_libvlc
,
i_progress
,
psz_status
,
f_progress
,
0
);
intf_ProgressUpdate
(
p_u
dt
,
i_progress
,
psz_status
,
f_progress
,
0
);
free
(
psz_status
);
}
free
(
psz_downloaded
);
...
...
@@ -1106,11 +1096,11 @@ void update_DownloadReal( update_download_thread_t *p_udt )
/* Finish the progress bar or delete the file if the user had canceled */
fclose
(
p_file
);
p_file
=
NULL
;
if
(
!
intf_ProgressIsCancelled
(
p_u
pdate
->
p_libvlc
,
i_progress
)
)
if
(
!
intf_ProgressIsCancelled
(
p_u
dt
,
i_progress
)
)
{
if
(
asprintf
(
&
psz_status
,
"%s
\n
Done %s (100.0%%)"
,
p_update
->
release
.
psz_url
,
psz_size
)
!=
-
1
)
{
intf_ProgressUpdate
(
p_u
pdate
->
p_libvlc
,
i_progress
,
psz_status
,
100
.
0
,
0
);
intf_ProgressUpdate
(
p_u
dt
,
i_progress
,
psz_status
,
100
.
0
,
0
);
free
(
psz_status
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment