aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-09 01:03:44 +0200
committerMax Kellermann <max@duempel.org>2013-04-09 01:03:44 +0200
commit14df240f5b16822da0901b35f7d0cb053c895129 (patch)
treea7f3be85b1bbf8f98c42ec34cba91c2fad8ccd0d /src/decoder
parent2090911363a131b2a38d39d3b8458eae02889e57 (diff)
downloadmpd-14df240f5b16822da0901b35f7d0cb053c895129.tar.gz
mpd-14df240f5b16822da0901b35f7d0cb053c895129.tar.xz
mpd-14df240f5b16822da0901b35f7d0cb053c895129.zip
OpusReader: don't use strndup()
Eliminate the fallback strndup() and strnlen() implementations.
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/OpusReader.hxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/decoder/OpusReader.hxx b/src/decoder/OpusReader.hxx
index 1fd07b55c..7e161fd0f 100644
--- a/src/decoder/OpusReader.hxx
+++ b/src/decoder/OpusReader.hxx
@@ -21,7 +21,6 @@
#define MPD_OPUS_READER_HXX
#include "check.h"
-#include "string_util.h"
#include <stdint.h>
#include <string.h>
@@ -91,7 +90,10 @@ public:
if (src == nullptr)
return nullptr;
- return strndup(src, length);
+ char *dest = new char[length + 1];
+ memcpy(dest, src, length);
+ dest[length] = 0;
+ return dest;
}
};