fix sign confusion

This commit is contained in:
Wim Taymans 2019-01-07 15:52:42 +01:00
parent 74e5f9fbcf
commit e918f9f77c
60 changed files with 164 additions and 146 deletions

View file

@ -58,7 +58,7 @@ struct impl {
struct udev_monitor *umonitor;
uint32_t cards[MAX_CARDS];
int n_cards;
uint32_t n_cards;
struct spa_source source;
};
@ -204,7 +204,7 @@ static int fill_item(struct impl *this, struct udev_device *dev,
static int need_notify(struct impl *this, struct udev_device *dev, uint32_t id, bool enumerated)
{
const char *str;
int idx, i, found = -1;
uint32_t idx, i, found = SPA_ID_INVALID;
if (udev_device_get_property_value(dev, "PULSE_IGNORE"))
return 0;
@ -226,7 +226,7 @@ static int need_notify(struct impl *this, struct udev_device *dev, uint32_t id,
switch (id) {
case SPA_MONITOR_EVENT_Added:
if (found != -1)
if (found != SPA_ID_INVALID)
return 0;
if (this->n_cards >= MAX_CARDS)
return 0;
@ -237,14 +237,14 @@ static int need_notify(struct impl *this, struct udev_device *dev, uint32_t id,
break;
case SPA_MONITOR_EVENT_Changed:
if (found == -1)
if (found == SPA_ID_INVALID)
return 0;
if ((str = udev_device_get_property_value(dev, "SOUND_INITIALIZED")) == NULL)
return 0;
break;
case SPA_MONITOR_EVENT_Removed:
if (found == -1)
if (found == SPA_ID_INVALID)
return 0;
this->cards[found] = this->cards[--this->n_cards];
break;

View file

@ -538,7 +538,7 @@ impl_node_port_use_buffers(struct spa_node *node,
uint32_t port_id, struct spa_buffer **buffers, uint32_t n_buffers)
{
struct state *this;
int i;
uint32_t i;
spa_return_val_if_fail(node != NULL, -EINVAL);

View file

@ -541,7 +541,7 @@ impl_node_port_use_buffers(struct spa_node *node,
{
struct state *this;
int res;
int i;
uint32_t i;
spa_return_val_if_fail(node != NULL, -EINVAL);

View file

@ -92,7 +92,7 @@ static const struct format_info format_info[] = {
static snd_pcm_format_t spa_format_to_alsa(uint32_t format)
{
int i;
size_t i;
for (i = 0; i < SPA_N_ELEMENTS(format_info); i++) {
if (format_info[i].spa_format == format)
@ -174,7 +174,7 @@ static void sanitize_map(snd_pcm_chmap_t* map)
{
uint64_t mask = 0, p, dup = 0;
const struct def_mask *def;
int i, j, pos;
uint32_t i, j, pos;
for (i = 0; i < map->channels; i++) {
if (map->pos[i] < 0 || map->pos[i] > SND_CHMAP_LAST)
@ -227,7 +227,8 @@ spa_alsa_enum_format(struct state *state, uint32_t *index,
snd_pcm_format_mask_t *fmask;
snd_pcm_access_mask_t *amask;
snd_pcm_chmap_query_t **maps;
int err, i, j, dir;
size_t i, j;
int err, dir;
unsigned int min, max;
uint8_t buffer[4096];
struct spa_pod_builder b = { 0 };
@ -324,7 +325,7 @@ spa_alsa_enum_format(struct state *state, uint32_t *index,
spa_pod_builder_prop(&b, SPA_FORMAT_AUDIO_position, 0);
spa_pod_builder_push_array(&b);
for (j = 0; j < map->channels; j++) {
spa_log_debug(state->log, "position %d %d", j, map->pos[j]);
spa_log_debug(state->log, "position %zd %d", j, map->pos[j]);
channel = chmap_position_to_channel(map->pos[j]);
spa_pod_builder_id(&b, channel);
}
@ -943,7 +944,7 @@ next:
static void reset_buffers(struct state *this)
{
int i;
uint32_t i;
spa_list_init(&this->free);
spa_list_init(&this->ready);

View file

@ -43,8 +43,8 @@ extern "C" {
#include <spa/param/param.h>
#include <spa/param/audio/format-utils.h>
#define DEFAULT_RATE 48000
#define DEFAULT_CHANNELS 2
#define DEFAULT_RATE 48000u
#define DEFAULT_CHANNELS 2u
struct props {
char device[64];
@ -127,7 +127,7 @@ struct state {
int timerfd;
bool alsa_started;
bool slaved;
int threshold;
uint32_t threshold;
snd_htimestamp_t now;
int64_t sample_count;