filter/route: use int8_t instead of signed char

This commit is contained in:
Max Kellermann 2013-10-18 11:52:43 +02:00
parent 58fe352fda
commit b5f608d026

View File

@ -54,14 +54,14 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdint.h>
class RouteFilter final : public Filter { class RouteFilter final : public Filter {
/** /**
* The minimum number of channels we need for output * The minimum number of channels we need for output
* to be able to perform all the copies the user has specified * to be able to perform all the copies the user has specified
*/ */
unsigned char min_output_channels; unsigned min_output_channels;
/** /**
* The minimum number of input channels we need to * The minimum number of input channels we need to
@ -69,7 +69,7 @@ class RouteFilter final : public Filter {
* than this many are supplied by the input, undefined * than this many are supplied by the input, undefined
* copy operations are given zeroed sources in stead. * copy operations are given zeroed sources in stead.
*/ */
unsigned char min_input_channels; unsigned min_input_channels;
/** /**
* The set of copy operations to perform on each sample * The set of copy operations to perform on each sample
@ -77,7 +77,7 @@ class RouteFilter final : public Filter {
* a corresponding input channel from which to take the * a corresponding input channel from which to take the
* data. A -1 means "no source" * data. A -1 means "no source"
*/ */
signed char* sources; int8_t *sources;
/** /**
* The actual input format of our signal, once opened * The actual input format of our signal, once opened
@ -155,7 +155,6 @@ RouteFilter::Configure(const config_param &param, Error &error) {
// String and int representations of the source/destination // String and int representations of the source/destination
gchar **sd; gchar **sd;
int source, dest;
// Squeeze whitespace // Squeeze whitespace
g_strstrip(tokens[c]); g_strstrip(tokens[c]);
@ -171,8 +170,8 @@ RouteFilter::Configure(const config_param &param, Error &error) {
return false; return false;
} }
source = strtol(sd[0], NULL, 10); unsigned source = strtoul(sd[0], NULL, 10);
dest = strtol(sd[1], NULL, 10); unsigned dest = strtoul(sd[1], NULL, 10);
// Keep track of the highest channel numbers seen // Keep track of the highest channel numbers seen
// as either in- or outputs // as either in- or outputs
@ -193,10 +192,10 @@ RouteFilter::Configure(const config_param &param, Error &error) {
} }
// Allocate a map of "copy nothing to me" // Allocate a map of "copy nothing to me"
sources = (signed char *) sources = (int8_t *)
g_malloc(min_output_channels * sizeof(signed char)); g_malloc(min_output_channels * sizeof(*sources));
for (int i=0; i<min_output_channels; ++i) for (unsigned i = 0; i < min_output_channels; ++i)
sources[i] = -1; sources[i] = -1;
// Run through the spec again, and save the // Run through the spec again, and save the
@ -205,7 +204,6 @@ RouteFilter::Configure(const config_param &param, Error &error) {
// String and int representations of the source/destination // String and int representations of the source/destination
gchar **sd; gchar **sd;
int source, dest;
// Split the a>b string into source and destination // Split the a>b string into source and destination
sd = g_strsplit(tokens[c], ">", 2); sd = g_strsplit(tokens[c], ">", 2);
@ -218,8 +216,8 @@ RouteFilter::Configure(const config_param &param, Error &error) {
return false; return false;
} }
source = strtol(sd[0], NULL, 10); unsigned source = strtoul(sd[0], NULL, 10);
dest = strtol(sd[1], NULL, 10); unsigned dest = strtoul(sd[1], NULL, 10);
sources[dest] = source; sources[dest] = source;