Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
de004670
Commit
de004670
authored
Dec 01, 2015
by
Joseph Wallace
Browse files
Be clearer about ebml_parse_sized_int's sign & endian behavior.
parent
e6cb7e26
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/format_ebml.c
View file @
de004670
...
...
@@ -959,19 +959,23 @@ static ssize_t ebml_parse_var_int(unsigned char *buffer,
return
size
;
}
/* Parse a
normal
int that may be from 1-8 bytes long.
/* Parse a
big-endian
int that may be from 1-8 bytes long.
* Returns 0 if there's not enough space to read the number;
* Returns -1 if the number is mis-sized.
* Else, returns the length of the number in bytes and writes the
* value to *out_value.
* If is_signed is true, then the int is assumed to be two's complement
* signed, negative values will be correctly promoted, and the returned
* long long can be safely cast to a signed number on systems using
* two's complement arithmatic.
*/
static
ssize_t
ebml_parse_sized_int
(
unsigned
char
*
buffer
,
unsigned
char
*
buffer_end
,
size_t
len
,
int
is_signed
,
unsigned
long
long
*
out_value
)
unsigned
char
*
buffer_end
,
size_t
len
,
int
is_signed
,
unsigned
long
long
*
out_value
)
{
long
long
value
;
unsigned
long
long
value
;
size_t
i
;
if
(
len
<
1
||
len
>
8
)
{
...
...
Write
Preview
Supports
Markdown
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