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
15e6f2c9
Commit
15e6f2c9
authored
Jun 01, 2008
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Binary updates: support arbitrarily long descriptions
Note that an upper limit should be set anyway
parent
53c74579
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
19 deletions
+40
-19
src/misc/update.c
src/misc/update.c
+40
-19
No files found.
src/misc/update.c
View file @
15e6f2c9
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
* * e is an OPTIONAL extra letter
* * e is an OPTIONAL extra letter
* * AKA "0.8.6d" or "0.9.0"
* * AKA "0.8.6d" or "0.9.0"
* Second line is an url of the binary for this last version
* Second line is an url of the binary for this last version
*
Third line is a description of the update (it MAY be extended to several lines, but for now it is only one line)
*
Remaining text is a required description of the update
*/
*/
#if defined( UNDER_CE )
#if defined( UNDER_CE )
...
@@ -1104,7 +1104,6 @@ static bool GetUpdateFile( update_t *p_update )
...
@@ -1104,7 +1104,6 @@ static bool GetUpdateFile( update_t *p_update )
int
i_minor
=
0
;
int
i_minor
=
0
;
int
i_revision
=
0
;
int
i_revision
=
0
;
unsigned
char
extra
;
unsigned
char
extra
;
char
*
psz_line
=
NULL
;
char
*
psz_version_line
=
NULL
;
char
*
psz_version_line
=
NULL
;
p_stream
=
stream_UrlNew
(
p_update
->
p_libvlc
,
UPDATE_VLC_STATUS_URL
);
p_stream
=
stream_UrlNew
(
p_update
->
p_libvlc
,
UPDATE_VLC_STATUS_URL
);
...
@@ -1115,18 +1114,18 @@ static bool GetUpdateFile( update_t *p_update )
...
@@ -1115,18 +1114,18 @@ static bool GetUpdateFile( update_t *p_update )
goto
error
;
goto
error
;
}
}
/*
Try to read three lines
*/
/*
Start reading the status file
*/
if
(
!
(
psz_line
=
stream_ReadLine
(
p_stream
)
)
)
if
(
!
(
psz_
version_
line
=
stream_ReadLine
(
p_stream
)
)
)
{
{
msg_Err
(
p_update
->
p_libvlc
,
"Update file %s is corrupted : missing version"
,
msg_Err
(
p_update
->
p_libvlc
,
"Update file %s is corrupted : missing version"
,
UPDATE_VLC_STATUS_URL
);
UPDATE_VLC_STATUS_URL
);
goto
error
;
goto
error
;
}
}
psz_version_line
=
psz_line
;
/* first line : version number */
/* first line : version number */
p_update
->
release
.
extra
=
0
;
p_update
->
release
.
extra
=
0
;
switch
(
sscanf
(
psz_line
,
"%i.%i.%i%c"
,
&
i_major
,
&
i_minor
,
&
i_revision
,
&
extra
)
)
switch
(
sscanf
(
psz_version_line
,
"%i.%i.%i%c"
,
&
i_major
,
&
i_minor
,
&
i_revision
,
&
extra
)
)
{
{
case
4
:
case
4
:
p_update
->
release
.
extra
=
extra
;
p_update
->
release
.
extra
=
extra
;
...
@@ -1140,24 +1139,35 @@ static bool GetUpdateFile( update_t *p_update )
...
@@ -1140,24 +1139,35 @@ static bool GetUpdateFile( update_t *p_update )
goto
error
;
goto
error
;
}
}
/*
S
econd line : URL */
/*
s
econd line : URL */
if
(
!
(
p
sz_line
=
stream_ReadLine
(
p_stream
)
)
)
if
(
!
(
p
_update
->
release
.
psz_url
=
stream_ReadLine
(
p_stream
)
)
)
{
{
msg_Err
(
p_update
->
p_libvlc
,
"Update file %s is corrupted : URL missing"
,
msg_Err
(
p_update
->
p_libvlc
,
"Update file %s is corrupted : URL missing"
,
UPDATE_VLC_STATUS_URL
);
UPDATE_VLC_STATUS_URL
);
goto
error
;
goto
error
;
}
}
p_update
->
release
.
psz_url
=
psz_line
;
/* Remaining data : description */
int
i_read
=
stream_Size
(
p_stream
)
-
stream_Tell
(
p_stream
);
if
(
i_read
<=
0
)
{
msg_Err
(
p_update
->
p_libvlc
,
"Update file %s is corrupted: description missing"
,
UPDATE_VLC_STATUS_URL
);
goto
error
;
}
p_update
->
release
.
psz_desc
=
(
char
*
)
malloc
(
i_read
+
1
);
if
(
!
p_update
->
release
.
psz_desc
)
goto
error
;
/* Third line : description */
if
(
stream_Read
(
p_stream
,
p_update
->
release
.
psz_desc
,
i_read
)
!=
i_read
)
if
(
!
(
psz_line
=
stream_ReadLine
(
p_stream
)
)
)
{
{
msg_Err
(
p_update
->
p_libvlc
,
"
Update file %s is corrupted : description missing
"
,
msg_Err
(
p_update
->
p_libvlc
,
"
Couldn't download update file %s
"
,
UPDATE_VLC_STATUS_URL
);
UPDATE_VLC_STATUS_URL
);
goto
error
;
goto
error
;
}
}
p_update
->
release
.
psz_desc
=
psz_line
;
p_update
->
release
.
psz_desc
[
i_read
]
=
'\0'
;
stream_Delete
(
p_stream
);
stream_Delete
(
p_stream
);
p_stream
=
NULL
;
p_stream
=
NULL
;
...
@@ -1244,12 +1254,23 @@ static bool GetUpdateFile( update_t *p_update )
...
@@ -1244,12 +1254,23 @@ static bool GetUpdateFile( update_t *p_update )
if
(
sign
.
type
==
TEXT_SIGNATURE
)
if
(
sign
.
type
==
TEXT_SIGNATURE
)
gcry_md_putc
(
hd
,
'\r'
);
gcry_md_putc
(
hd
,
'\r'
);
gcry_md_putc
(
hd
,
'\n'
);
gcry_md_putc
(
hd
,
'\n'
);
gcry_md_write
(
hd
,
p_update
->
release
.
psz_desc
,
strlen
(
p_update
->
release
.
psz_desc
)
);
char
*
psz_desc
=
p_update
->
release
.
psz_desc
;
while
(
*
psz_desc
)
{
size_t
i_len
=
strcspn
(
psz_desc
,
"
\r\n
"
);
if
(
!
i_len
)
break
;
gcry_md_write
(
hd
,
psz_desc
,
i_len
);
if
(
sign
.
type
==
TEXT_SIGNATURE
)
if
(
sign
.
type
==
TEXT_SIGNATURE
)
gcry_md_putc
(
hd
,
'\r'
);
gcry_md_putc
(
hd
,
'\r'
);
gcry_md_putc
(
hd
,
'\n'
);
gcry_md_putc
(
hd
,
'\n'
);
psz_desc
+=
i_len
;
while
(
*
psz_desc
==
'\r'
||
*
psz_desc
==
'\n'
)
psz_desc
++
;
}
if
(
sign
.
version
==
3
)
if
(
sign
.
version
==
3
)
{
{
...
...
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