summaryrefslogtreecommitdiff
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-10-19 19:51:17 +0200
committerMax Kellermann <max@musicpd.org>2018-10-19 19:51:17 +0200
commit3be8b02cc2c9404b43ad0368563b4d7e7e74de6d (patch)
tree9d9372e9e308d3d82be88d1fc103a57fce0bfc46 /src/decoder
parentbdfaea0c25b8df4b109099905ef797d2821cc8d1 (diff)
decoder/sndfile: make `vio` constexpr
Use `const_cast` to be able to pass it to sf_open_virtual() which has a wrong parameter declaration.
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/plugins/SndfileDecoderPlugin.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/decoder/plugins/SndfileDecoderPlugin.cxx b/src/decoder/plugins/SndfileDecoderPlugin.cxx
index 58714e4c3..465194f13 100644
--- a/src/decoder/plugins/SndfileDecoderPlugin.cxx
+++ b/src/decoder/plugins/SndfileDecoderPlugin.cxx
@@ -130,7 +130,7 @@ sndfile_vio_tell(void *user_data)
* This SF_VIRTUAL_IO implementation wraps MPD's #InputStream to a
* libsndfile stream.
*/
-static SF_VIRTUAL_IO vio = {
+static constexpr SF_VIRTUAL_IO vio = {
sndfile_vio_get_filelen,
sndfile_vio_seek,
sndfile_vio_read,
@@ -202,7 +202,8 @@ sndfile_stream_decode(DecoderClient &client, InputStream &is)
info.format = 0;
SndfileInputStream sis{&client, is};
- SNDFILE *const sf = sf_open_virtual(&vio, SFM_READ, &info, &sis);
+ SNDFILE *const sf = sf_open_virtual(const_cast<SF_VIRTUAL_IO *>(&vio),
+ SFM_READ, &info, &sis);
if (sf == nullptr) {
FormatWarning(sndfile_domain, "sf_open_virtual() failed: %s",
sf_strerror(nullptr));
@@ -274,7 +275,8 @@ sndfile_scan_stream(InputStream &is, TagHandler &handler) noexcept
info.format = 0;
SndfileInputStream sis{nullptr, is};
- SNDFILE *const sf = sf_open_virtual(&vio, SFM_READ, &info, &sis);
+ SNDFILE *const sf = sf_open_virtual(const_cast<SF_VIRTUAL_IO *>(&vio),
+ SFM_READ, &info, &sis);
if (sf == nullptr)
return false;