wavpack: use assert_static()
This commit is contained in:
parent
457a6f4bee
commit
a493aafe02
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "../decoder_api.h"
|
#include "../decoder_api.h"
|
||||||
#include "../path.h"
|
#include "../path.h"
|
||||||
|
#include "../utils.h"
|
||||||
|
|
||||||
#include <wavpack/wavpack.h>
|
#include <wavpack/wavpack.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
@ -71,7 +72,7 @@ format_samples_int(int bytes_per_sample, void *buffer, uint32_t count)
|
|||||||
* of the output samples never can be greater than the size
|
* of the output samples never can be greater than the size
|
||||||
* of the input ones. Otherwise we would have an overflow.
|
* of the input ones. Otherwise we would have an overflow.
|
||||||
*/
|
*/
|
||||||
assert(sizeof(uchar) <= sizeof(uint32_t));
|
assert_static(sizeof(*dst) <= sizeof(*src));
|
||||||
|
|
||||||
/* pass through and align 8-bit samples */
|
/* pass through and align 8-bit samples */
|
||||||
while (count--) {
|
while (count--) {
|
||||||
@ -81,7 +82,7 @@ format_samples_int(int bytes_per_sample, void *buffer, uint32_t count)
|
|||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
uint16_t *dst = buffer;
|
uint16_t *dst = buffer;
|
||||||
assert(sizeof(uint16_t) <= sizeof(uint32_t));
|
assert_static(sizeof(*dst) <= sizeof(*src));
|
||||||
|
|
||||||
/* pass through and align 16-bit samples */
|
/* pass through and align 16-bit samples */
|
||||||
while (count--) {
|
while (count--) {
|
||||||
@ -94,7 +95,7 @@ format_samples_int(int bytes_per_sample, void *buffer, uint32_t count)
|
|||||||
break;
|
break;
|
||||||
case 4: {
|
case 4: {
|
||||||
uint32_t *dst = buffer;
|
uint32_t *dst = buffer;
|
||||||
assert(sizeof(uint32_t) <= sizeof(uint32_t));
|
assert_static(sizeof(*dst) <= sizeof(*src));
|
||||||
|
|
||||||
/* downsample to 24-bit */
|
/* downsample to 24-bit */
|
||||||
while (count--) {
|
while (count--) {
|
||||||
@ -114,7 +115,7 @@ format_samples_float(mpd_unused int bytes_per_sample, void *buffer,
|
|||||||
{
|
{
|
||||||
int32_t *dst = buffer;
|
int32_t *dst = buffer;
|
||||||
float *src = buffer;
|
float *src = buffer;
|
||||||
assert(sizeof(int32_t) <= sizeof(float));
|
assert_static(sizeof(*dst) <= sizeof(*src));
|
||||||
|
|
||||||
while (count--) {
|
while (count--) {
|
||||||
*dst++ = (int32_t)(*src++ + 0.5f);
|
*dst++ = (int32_t)(*src++ + 0.5f);
|
||||||
|
Loading…
Reference in New Issue
Block a user