aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm
diff options
context:
space:
mode:
Diffstat (limited to 'src/pcm')
-rw-r--r--src/pcm/PcmBuffer.cxx4
-rw-r--r--src/pcm/PcmBuffer.hxx7
-rw-r--r--src/pcm/PcmChannels.cxx8
-rw-r--r--src/pcm/PcmConvert.cxx52
-rw-r--r--src/pcm/PcmExport.cxx4
-rw-r--r--src/pcm/PcmFormat.cxx8
6 files changed, 42 insertions, 41 deletions
diff --git a/src/pcm/PcmBuffer.cxx b/src/pcm/PcmBuffer.cxx
index 6ace399f3..578c579be 100644
--- a/src/pcm/PcmBuffer.cxx
+++ b/src/pcm/PcmBuffer.cxx
@@ -25,8 +25,8 @@ void *
PcmBuffer::Get(size_t new_size)
{
if (new_size == 0)
- /* never return NULL, because NULL would be assumed to
- be an error condition */
+ /* never return nullptr, because nullptr would be
+ assumed to be an error condition */
new_size = 1;
return buffer.Get(new_size);
diff --git a/src/pcm/PcmBuffer.hxx b/src/pcm/PcmBuffer.hxx
index fa89d7f20..717e24938 100644
--- a/src/pcm/PcmBuffer.hxx
+++ b/src/pcm/PcmBuffer.hxx
@@ -42,9 +42,10 @@ public:
* Get the buffer, and guarantee a minimum size. This buffer becomes
* invalid with the next pcm_buffer_get() call.
*
- * This function will never return NULL, even if size is zero, because
- * the PCM library uses the NULL return value to signal "error". An
- * empty destination buffer is not always an error.
+ * This function will never return nullptr, even if size is
+ * zero, because the PCM library uses the nullptr return value
+ * to signal "error". An empty destination buffer is not
+ * always an error.
*/
gcc_malloc
void *Get(size_t size);
diff --git a/src/pcm/PcmChannels.cxx b/src/pcm/PcmChannels.cxx
index a0791078c..eb69985c1 100644
--- a/src/pcm/PcmChannels.cxx
+++ b/src/pcm/PcmChannels.cxx
@@ -95,7 +95,7 @@ pcm_convert_channels_16(PcmBuffer &buffer,
pcm_convert_channels_16_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
@@ -159,7 +159,7 @@ pcm_convert_channels_24(PcmBuffer &buffer,
pcm_convert_channels_24_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
@@ -222,7 +222,7 @@ pcm_convert_channels_32(PcmBuffer &buffer,
pcm_convert_channels_32_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
@@ -284,7 +284,7 @@ pcm_convert_channels_float(PcmBuffer &buffer,
pcm_convert_channels_float_n_to_2(dest, src_channels, src,
src_end);
else
- return NULL;
+ return nullptr;
return dest;
}
diff --git a/src/pcm/PcmConvert.cxx b/src/pcm/PcmConvert.cxx
index 6061aee88..eeaf99aee 100644
--- a/src/pcm/PcmConvert.cxx
+++ b/src/pcm/PcmConvert.cxx
@@ -60,11 +60,11 @@ PcmConvert::Convert16(const AudioFormat src_format,
src_format.format,
src_buffer, src_size,
&len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to 16 bit is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
if (src_format.channels != dest_format.channels) {
@@ -72,13 +72,13 @@ PcmConvert::Convert16(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buf, len, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -87,8 +87,8 @@ PcmConvert::Convert16(const AudioFormat src_format,
src_format.sample_rate, buf, len,
dest_format.sample_rate, &len,
error);
- if (buf == NULL)
- return NULL;
+ if (buf == nullptr)
+ return nullptr;
}
*dest_size_r = len;
@@ -109,11 +109,11 @@ PcmConvert::Convert24(const AudioFormat src_format,
buf = pcm_convert_to_24(format_buffer,
src_format.format,
src_buffer, src_size, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to 24 bit is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
if (src_format.channels != dest_format.channels) {
@@ -121,13 +121,13 @@ PcmConvert::Convert24(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buf, len, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -136,8 +136,8 @@ PcmConvert::Convert24(const AudioFormat src_format,
src_format.sample_rate, buf, len,
dest_format.sample_rate, &len,
error);
- if (buf == NULL)
- return NULL;
+ if (buf == nullptr)
+ return nullptr;
}
*dest_size_r = len;
@@ -158,11 +158,11 @@ PcmConvert::Convert32(const AudioFormat src_format,
buf = pcm_convert_to_32(format_buffer,
src_format.format,
src_buffer, src_size, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to 32 bit is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
if (src_format.channels != dest_format.channels) {
@@ -170,13 +170,13 @@ PcmConvert::Convert32(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buf, len, &len);
- if (buf == NULL) {
+ if (buf == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -185,7 +185,7 @@ PcmConvert::Convert32(const AudioFormat src_format,
src_format.sample_rate, buf, len,
dest_format.sample_rate, &len,
error);
- if (buf == NULL)
+ if (buf == nullptr)
return buf;
}
@@ -209,11 +209,11 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
buffer = pcm_convert_to_float(format_buffer,
src_format.format,
buffer, size, &size);
- if (buffer == NULL) {
+ if (buffer == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %s to float is not implemented",
sample_format_to_string(src_format.format));
- return NULL;
+ return nullptr;
}
/* convert channels */
@@ -223,13 +223,13 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
dest_format.channels,
src_format.channels,
buffer, size, &size);
- if (buffer == NULL) {
+ if (buffer == nullptr) {
error.Format(pcm_convert_domain,
"Conversion from %u to %u channels "
"is not implemented",
src_format.channels,
dest_format.channels);
- return NULL;
+ return nullptr;
}
}
@@ -242,8 +242,8 @@ PcmConvert::ConvertFloat(const AudioFormat src_format,
buffer, size,
dest_format.sample_rate,
&size, error);
- if (buffer == NULL)
- return NULL;
+ if (buffer == nullptr)
+ return nullptr;
}
*dest_size_r = size;
@@ -263,10 +263,10 @@ PcmConvert::Convert(AudioFormat src_format,
const float *f = dsd.ToFloat(src_format.channels,
false, (const uint8_t *)src,
src_size, &f_size);
- if (f == NULL) {
+ if (f == nullptr) {
error.Set(pcm_convert_domain,
"DSD to PCM conversion failed");
- return NULL;
+ return nullptr;
}
float_format = src_format;
@@ -302,6 +302,6 @@ PcmConvert::Convert(AudioFormat src_format,
error.Format(pcm_convert_domain,
"PCM conversion to %s is not implemented",
sample_format_to_string(dest_format.format));
- return NULL;
+ return nullptr;
}
}
diff --git a/src/pcm/PcmExport.cxx b/src/pcm/PcmExport.cxx
index 74b642569..f6ce1e661 100644
--- a/src/pcm/PcmExport.cxx
+++ b/src/pcm/PcmExport.cxx
@@ -87,7 +87,7 @@ PcmExport::Export(const void *data, size_t size, size_t &dest_size_r)
const uint8_t *src8 = (const uint8_t *)data;
const uint8_t *src_end8 = src8 + size;
uint8_t *dest = (uint8_t *)pack_buffer.Get(dest_size);
- assert(dest != NULL);
+ assert(dest != nullptr);
pcm_pack_24(dest, (const int32_t *)src8,
(const int32_t *)src_end8);
@@ -114,7 +114,7 @@ PcmExport::Export(const void *data, size_t size, size_t &dest_size_r)
assert(reverse_endian >= 2);
uint8_t *dest = (uint8_t *)reverse_buffer.Get(size);
- assert(dest != NULL);
+ assert(dest != nullptr);
const uint8_t *src = (const uint8_t *)data;
const uint8_t *src_end = src + size;
diff --git a/src/pcm/PcmFormat.cxx b/src/pcm/PcmFormat.cxx
index 9df800d44..68ab1f2ec 100644
--- a/src/pcm/PcmFormat.cxx
+++ b/src/pcm/PcmFormat.cxx
@@ -214,7 +214,7 @@ pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither,
dest_size_r);
}
- return NULL;
+ return nullptr;
}
static void
@@ -319,7 +319,7 @@ pcm_convert_to_24(PcmBuffer &buffer,
dest_size_r);
}
- return NULL;
+ return nullptr;
}
static void
@@ -430,7 +430,7 @@ pcm_convert_to_32(PcmBuffer &buffer,
dest_size_r);
}
- return NULL;
+ return nullptr;
}
template<SampleFormat F, class Traits=SampleTraits<F>>
@@ -540,5 +540,5 @@ pcm_convert_to_float(PcmBuffer &buffer,
return (const float *)src;
}
- return NULL;
+ return nullptr;
}