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
ecb67a1e
Commit
ecb67a1e
authored
Jul 11, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/sndfile: use decoder_read_full()
Replaces the loop in sndfile_vio_read(), eliminating duplicate and fragile code.
parent
0ef843f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
SndfileDecoderPlugin.cxx
src/decoder/SndfileDecoderPlugin.cxx
+6
-16
No files found.
src/decoder/SndfileDecoderPlugin.cxx
View file @
ecb67a1e
...
...
@@ -36,7 +36,11 @@ struct SndfileInputStream {
InputStream
&
is
;
size_t
Read
(
void
*
buffer
,
size_t
size
)
{
return
decoder_read
(
decoder
,
is
,
buffer
,
size
);
/* libsndfile chokes on partial reads; therefore
always force full reads */
return
decoder_read_full
(
decoder
,
is
,
buffer
,
size
)
?
size
:
0
;
}
};
...
...
@@ -69,21 +73,7 @@ sndfile_vio_read(void *ptr, sf_count_t count, void *user_data)
{
SndfileInputStream
&
sis
=
*
(
SndfileInputStream
*
)
user_data
;
sf_count_t
total_bytes
=
0
;
/* this loop is necessary because libsndfile chokes on partial
reads */
do
{
size_t
nbytes
=
sis
.
Read
((
char
*
)
ptr
+
total_bytes
,
count
-
total_bytes
);
if
(
nbytes
==
0
)
return
-
1
;
total_bytes
+=
nbytes
;
}
while
(
total_bytes
<
count
);
return
total_bytes
;
return
sis
.
Read
(
ptr
,
count
);
}
static
sf_count_t
...
...
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