Commit 8759bc1b authored by Max Kellermann's avatar Max Kellermann

decoder/dsdlib: pass unsigned offsets to dsdlib_skip*()

parent 56504534
......@@ -58,18 +58,18 @@ dsdlib_read(Decoder *decoder, InputStream &is,
*/
bool
dsdlib_skip_to(Decoder *decoder, InputStream &is,
int64_t offset)
uint64_t offset)
{
if (is.IsSeekable())
return is.Seek(offset, IgnoreError());
if (is.GetOffset() > offset)
if (uint64_t(is.GetOffset()) > offset)
return false;
char buffer[8192];
while (is.GetOffset() < offset) {
while (uint64_t(is.GetOffset()) < offset) {
size_t length = sizeof(buffer);
if (offset - is.GetOffset() < (int64_t)length)
if (offset - is.GetOffset() < (uint64_t)length)
length = offset - is.GetOffset();
size_t nbytes = decoder_read(decoder, is, buffer, length);
......@@ -77,7 +77,7 @@ dsdlib_skip_to(Decoder *decoder, InputStream &is,
return false;
}
assert(is.GetOffset() == offset);
assert(uint64_t(is.GetOffset()) == offset);
return true;
}
......@@ -86,10 +86,8 @@ dsdlib_skip_to(Decoder *decoder, InputStream &is,
*/
bool
dsdlib_skip(Decoder *decoder, InputStream &is,
int64_t delta)
uint64_t delta)
{
assert(delta >= 0);
if (delta == 0)
return true;
......@@ -99,7 +97,7 @@ dsdlib_skip(Decoder *decoder, InputStream &is,
char buffer[8192];
while (delta > 0) {
size_t length = sizeof(buffer);
if ((int64_t)length > delta)
if ((uint64_t)length > delta)
length = delta;
size_t nbytes = decoder_read(decoder, is, buffer, length);
......
......@@ -64,11 +64,11 @@ dsdlib_read(Decoder *decoder, InputStream &is,
bool
dsdlib_skip_to(Decoder *decoder, InputStream &is,
int64_t offset);
uint64_t offset);
bool
dsdlib_skip(Decoder *decoder, InputStream &is,
int64_t delta);
uint64_t delta);
/**
* Add tags from ID3 tag. All tags commonly found in the ID3 tags of
......
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