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
81f37d39
Commit
81f37d39
authored
Dec 19, 2007
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better asprintf error handling
parent
c2598291
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
37 deletions
+53
-37
src/misc/update.c
src/misc/update.c
+53
-37
No files found.
src/misc/update.c
View file @
81f37d39
...
...
@@ -1060,9 +1060,16 @@ void update_DownloadReal( update_download_thread_t *p_udt )
l_size
=
stream_Size
(
p_stream
);
psz_tmpdestfile
=
strrchr
(
p_update
->
release
.
psz_url
,
'/'
);
if
(
!
psz_tmpdestfile
)
{
msg_Err
(
p_update
->
p_libvlc
,
"The URL %s is false formated"
,
p_update
->
release
.
psz_url
);
return
;
}
else
{
psz_tmpdestfile
++
;
asprintf
(
&
psz_destfile
,
"%s%s"
,
psz_destdir
,
psz_tmpdestfile
);
if
(
asprintf
(
&
psz_destfile
,
"%s%s"
,
psz_destdir
,
psz_tmpdestfile
)
!=
-
1
)
{
p_file
=
utf8_fopen
(
psz_destfile
,
"w"
);
if
(
!
p_file
)
{
...
...
@@ -1075,9 +1082,11 @@ void update_DownloadReal( update_download_thread_t *p_udt )
if
(
p_buffer
)
{
psz_size
=
size_str
(
l_size
);
asprintf
(
&
psz_status
,
"%s
\n
Downloading... O.O/%s %.1f%% done"
,
p_update
->
release
.
psz_url
,
psz_size
,
0
.
0
);
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_update
->
p_libvlc
,
"Downloading ..."
,
psz_status
,
0
.
0
,
0
);
free
(
psz_status
);
}
while
(
(
i_read
=
stream_Read
(
p_stream
,
p_buffer
,
1
<<
10
)
)
&&
!
intf_ProgressIsCancelled
(
p_update
->
p_libvlc
,
i_progress
)
)
...
...
@@ -1086,30 +1095,37 @@ void update_DownloadReal( update_download_thread_t *p_udt )
l_downloaded
+=
i_read
;
psz_downloaded
=
size_str
(
l_downloaded
);
asprintf
(
&
psz_status
,
"%s
\n
Donwloading... %s/%s %.1f%% done"
,
p_update
->
release
.
psz_url
,
psz_size
,
psz_downloaded
,
100
.
0
*
(
float
)
l_downloaded
/
(
float
)
l_size
);
if
(
asprintf
(
&
psz_status
,
"%s
\n
Donwloading... %s/%s %.1f%% done"
,
p_update
->
release
.
psz_url
,
psz_size
,
psz_downloaded
,
100
.
0
*
(
float
)
l_downloaded
/
(
float
)
l_size
)
!=
-
1
)
{
intf_ProgressUpdate
(
p_update
->
p_libvlc
,
i_progress
,
psz_status
,
10
.
0
,
0
);
free
(
psz_downloaded
);
free
(
psz_status
);
}
free
(
psz_downloaded
);
}
free
(
p_buffer
);
/* If the user cancelled the download */
if
(
!
intf_ProgressIsCancelled
(
p_update
->
p_libvlc
,
i_progress
)
)
{
asprintf
(
&
psz_status
,
"%s
\n
Done %s (100.0%%)"
,
p_update
->
release
.
psz_url
,
psz_size
);
if
(
asprintf
(
&
psz_status
,
"%s
\n
Done %s (100.0%%)"
,
p_update
->
release
.
psz_url
,
psz_size
)
!=
-
1
)
{
intf_ProgressUpdate
(
p_update
->
p_libvlc
,
i_progress
,
psz_status
,
100
.
0
,
0
);
free
(
psz_status
);
}
free
(
p_buffer
);
}
free
(
psz_size
);
}
fclose
(
p_file
);
if
(
intf_ProgressIsCancelled
(
p_update
->
p_libvlc
,
i_progress
)
)
remove
(
psz_destfile
);
}
stream_Delete
(
p_stream
);
free
(
psz_destfile
);
}
}
}
free
(
psz_destdir
);
stream_Delete
(
p_stream
);
}
#endif
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