Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
552af545
Commit
552af545
authored
Jul 09, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsdlib: use decoder_skip()
Reduce duplicate code.
parent
8759bc1b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
25 deletions
+5
-25
DsdLib.cxx
src/decoder/plugins/DsdLib.cxx
+5
-25
No files found.
src/decoder/plugins/DsdLib.cxx
View file @
552af545
...
@@ -66,19 +66,7 @@ dsdlib_skip_to(Decoder *decoder, InputStream &is,
...
@@ -66,19 +66,7 @@ dsdlib_skip_to(Decoder *decoder, InputStream &is,
if
(
uint64_t
(
is
.
GetOffset
())
>
offset
)
if
(
uint64_t
(
is
.
GetOffset
())
>
offset
)
return
false
;
return
false
;
char
buffer
[
8192
];
return
dsdlib_skip
(
decoder
,
is
,
offset
-
is
.
GetOffset
());
while
(
uint64_t
(
is
.
GetOffset
())
<
offset
)
{
size_t
length
=
sizeof
(
buffer
);
if
(
offset
-
is
.
GetOffset
()
<
(
uint64_t
)
length
)
length
=
offset
-
is
.
GetOffset
();
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
buffer
,
length
);
if
(
nbytes
==
0
)
return
false
;
}
assert
(
uint64_t
(
is
.
GetOffset
())
==
offset
);
return
true
;
}
}
/**
/**
...
@@ -94,20 +82,12 @@ dsdlib_skip(Decoder *decoder, InputStream &is,
...
@@ -94,20 +82,12 @@ dsdlib_skip(Decoder *decoder, InputStream &is,
if
(
is
.
IsSeekable
())
if
(
is
.
IsSeekable
())
return
is
.
Seek
(
is
.
GetOffset
()
+
delta
,
IgnoreError
());
return
is
.
Seek
(
is
.
GetOffset
()
+
delta
,
IgnoreError
());
char
buffer
[
8192
];
if
(
delta
>
1024
*
1024
)
while
(
delta
>
0
)
{
/* don't skip more than one megabyte; it would be too
size_t
length
=
sizeof
(
buffer
);
expensive */
if
((
uint64_t
)
length
>
delta
)
length
=
delta
;
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
buffer
,
length
);
if
(
nbytes
==
0
)
return
false
;
return
false
;
delta
-=
nbytes
;
return
decoder_skip
(
decoder
,
is
,
delta
);
}
return
true
;
}
}
#ifdef HAVE_ID3TAG
#ifdef HAVE_ID3TAG
...
...
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