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

@ -1 +1 @@
Subproject commit d7376b73049f45b5894c10f263b81a140775de57
Subproject commit 3d9fab3aaf1e52c2481a445255841675e75def0c

@ -1 +1 @@
Subproject commit 4cb36762b0549b041ee17e66bbe6de947c47960d
Subproject commit a4593a0d96757cb2362f9c02abdcd55f7206967d

@ -1 +1 @@
Subproject commit 9062145e138171034884ed3b8368a4863ae0cdbe
Subproject commit 89fb73a949d4ceb1c4d41269e29ffade8bc3e386

View file

@ -53,7 +53,7 @@ static inline int spa_buffer_alloc_fill_info(struct spa_buffer_alloc_info *info,
uint32_t data_aligns[n_datas])
{
size_t size;
int i;
uint32_t i;
info->n_metas = n_metas;
info->metas = metas;
@ -93,7 +93,7 @@ spa_buffer_alloc_layout(struct spa_buffer_alloc_info *info,
{
struct spa_buffer *b = skel_mem;
size_t size;
int i;
uint32_t i;
void **dp, *skel, *data;
struct spa_chunk *cp;
@ -151,7 +151,7 @@ spa_buffer_alloc_layout_array(struct spa_buffer_alloc_info *info,
uint32_t n_buffers, struct spa_buffer *buffers[n_buffers],
void *skel_mem, void *data_mem)
{
int i;
uint32_t i;
size_t data_size = info->data_size + info->meta_size + info->chunk_size;
for (i = 0; i < n_buffers; i++) {
buffers[i] = spa_buffer_alloc_layout(info, skel_mem, data_mem, i);

View file

@ -114,7 +114,6 @@ spa_debug_format_value(const struct spa_type_info *info,
static inline int spa_debug_format(int indent,
const struct spa_type_info *info, const struct spa_pod *format)
{
int i;
const char *media_type;
const char *media_subtype;
struct spa_pod_prop *prop;
@ -160,7 +159,7 @@ static inline int spa_debug_format(int indent,
SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, prop) {
const char *key;
const struct spa_type_info *ti;
uint32_t type, size, n_vals, choice;
uint32_t i, type, size, n_vals, choice;
const struct spa_pod *val;
void *vals;

View file

@ -39,7 +39,8 @@ static inline int spa_debug_mem(int indent, const void *data, size_t size)
{
const uint8_t *t = data;
char buffer[512];
int i, pos = 0;
size_t i;
int pos = 0;
for (i = 0; i < size; i++) {
if (i % 16 == 0)

View file

@ -31,7 +31,7 @@ extern "C" {
#include <endian.h>
#define SPA_AUDIO_MAX_CHANNELS 64
#define SPA_AUDIO_MAX_CHANNELS 64u
enum spa_audio_format {
SPA_AUDIO_FORMAT_UNKNOWN,

View file

@ -93,10 +93,9 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
{
const struct spa_pod *v1, *v2;
struct spa_pod_choice *nc;
uint32_t nalt1, nalt2;
uint32_t j, k, nalt1, nalt2;
void *alt1, *alt2, *a1, *a2;
uint32_t type, size, p1c, p2c;
int j, k;
v1 = spa_pod_get_values(&p1->value, &nalt1, &p1c);
alt1 = SPA_POD_BODY(v1);

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;

View file

@ -453,6 +453,9 @@ typedef void (*channelmix_func_t) (void *data, int n_dst, void *dst[n_dst],
void *matrix, float v, int n_bytes);
#define ANY ((uint32_t)-1)
#define EQ ((uint32_t)-2)
static const struct channelmix_info {
uint32_t src_chan;
uint64_t src_mask;
@ -467,11 +470,11 @@ static const struct channelmix_info {
#if defined (__SSE__)
{ 2, MASK_MONO, 2, MASK_MONO, channelmix_copy_sse, FEATURE_SSE },
{ 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_sse, FEATURE_SSE },
{ -2, 0, -2, 0, channelmix_copy_sse, FEATURE_SSE },
{ EQ, 0, EQ, 0, channelmix_copy_sse, FEATURE_SSE },
#endif
{ 2, MASK_MONO, 2, MASK_MONO, channelmix_copy, 0 },
{ 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy, 0 },
{ -2, 0, -2, 0, channelmix_copy, 0 },
{ EQ, 0, EQ, 0, channelmix_copy, 0 },
{ 1, MASK_MONO, 2, MASK_STEREO, channelmix_f32_1_2, 0 },
{ 2, MASK_STEREO, 1, MASK_MONO, channelmix_f32_2_1, 0 },
@ -501,17 +504,17 @@ static const struct channelmix_info {
{ 8, MASK_7_1, 4, MASK_QUAD, channelmix_f32_7p1_4, 0 },
{ 8, MASK_7_1, 4, MASK_3_1, channelmix_f32_7p1_3p1, 0 },
{ -1, 0, -1, 0, channelmix_f32_n_m, 0 },
{ ANY, 0, ANY, 0, channelmix_f32_n_m, 0 },
};
#define MATCH_CHAN(a,b) ((a) == -1 || (a) == (b))
#define MATCH_CHAN(a,b) ((a) == ANY || (a) == (b))
#define MATCH_FEATURES(a,b) ((a) == 0 || ((a) & (b)) != 0)
#define MATCH_MASK(a,b) ((a) == 0 || ((a) & (b)) == (b))
static const struct channelmix_info *find_channelmix_info(uint32_t src_chan, uint64_t src_mask,
uint32_t dst_chan, uint64_t dst_mask, uint32_t features)
{
int i;
size_t i;
for (i = 0; i < SPA_N_ELEMENTS(channelmix_table); i++) {
if (!MATCH_FEATURES(channelmix_table[i].features, features))
continue;

View file

@ -188,7 +188,7 @@ static int make_matrix(struct impl *this,
{
float matrix[NUM_CHAN][NUM_CHAN] = {{ 0.0f }};
uint64_t unassigned;
int i, j, matrix_encoding = MATRIX_NORMAL, c;
uint32_t i, j, matrix_encoding = MATRIX_NORMAL, c;
float clev = SQRT1_2;
float slev = SQRT1_2;
float llev = 0.5f;
@ -379,10 +379,9 @@ static int setup_convert(struct impl *this,
const struct spa_audio_info *info)
{
const struct spa_audio_info *src_info, *dst_info;
uint32_t src_chan, dst_chan;
uint32_t i, src_chan, dst_chan;
const struct channelmix_info *chanmix_info;
uint64_t src_mask, dst_mask;
int i;
if (direction == SPA_DIRECTION_INPUT) {
src_info = info;
@ -1142,7 +1141,7 @@ static int impl_node_process(struct spa_node *node)
sbuf = &inport->buffers[inio->buffer_id];
{
int i, n_bytes;
uint32_t i, n_bytes;
struct spa_buffer *sb = sbuf->outbuf, *db = dbuf->outbuf;
uint32_t n_src_datas = sb->n_datas;
uint32_t n_dst_datas = db->n_datas;

View file

@ -759,7 +759,7 @@ static const struct conv_info {
static const struct conv_info *find_conv_info(uint32_t src_fmt, uint32_t dst_fmt, uint32_t features)
{
int i;
size_t i;
for (i = 0; i < SPA_N_ELEMENTS(conv_table); i++) {
if (conv_table[i].src_fmt == src_fmt &&

View file

@ -138,7 +138,7 @@ static int setup_convert(struct impl *this)
struct spa_audio_info informat, outformat;
struct port *inport, *outport;
const struct conv_info *conv;
int i, j;
uint32_t i, j;
inport = GET_IN_PORT(this, 0);
outport = GET_OUT_PORT(this, 0);
@ -809,9 +809,9 @@ static int impl_node_process(struct spa_node *node)
struct spa_buffer *inb, *outb;
const void **src_datas;
void **dst_datas;
uint32_t n_src_datas, n_dst_datas;
int i, res = 0, n_samples = 0, maxsize;
int size = 0;
uint32_t i, n_src_datas, n_dst_datas;
int res = 0;
uint32_t n_samples, size, maxsize;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -850,7 +850,7 @@ static int impl_node_process(struct spa_node *node)
n_src_datas = inb->n_datas;
src_datas = alloca(sizeof(void*) * n_src_datas);
size = INT_MAX;
size = UINT32_MAX;
for (i = 0; i < n_src_datas; i++) {
size = SPA_MIN(size, inb->datas[0].chunk->size);
src_datas[i] = SPA_MEMBER(inb->datas[i].data, inb->datas[i].chunk->offset, void);

View file

@ -87,10 +87,10 @@ struct impl {
const struct spa_node_callbacks *callbacks;
void *user_data;
int port_count;
uint32_t port_count;
struct port in_ports[MAX_PORTS];
struct port out_ports[MAX_PORTS + 1];
int monitor_count;
uint32_t monitor_count;
bool started;
uint32_t cpu_flags;
@ -205,7 +205,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
struct spa_audio_info info = { 0, };
struct port *port;
struct spa_pod *format;
int i;
uint32_t i;
if (spa_pod_object_parse(param,
":", SPA_PARAM_PROFILE_format, "P", &format,
@ -330,7 +330,7 @@ impl_node_get_port_ids(struct spa_node *node,
uint32_t n_output_ids)
{
struct impl *this;
int i;
uint32_t i;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -923,12 +923,13 @@ static int impl_node_process(struct spa_node *node)
struct impl *this;
struct port *outport;
struct spa_io_buffers *outio;
int i, maxsize, res = 0, n_samples;
uint32_t i, maxsize, n_samples;
struct spa_data *sd, *dd;
struct buffer *sbuf, *dbuf;
uint32_t n_src_datas, n_dst_datas;
const void **src_datas;
void **dst_datas;
int res = 0;
spa_return_val_if_fail(node != NULL, -EINVAL);

View file

@ -40,7 +40,7 @@ static void impl_peaks_process_sse(struct resample *r, int channel,
{
struct peaks_data *pd = r->data;
float *s = src, *d = dst, m;
int i, o, end, chunk, unrolled;
uint32_t i, o, end, chunk, unrolled;
__m128 in, max, mask = _mm_set_ps1(-0.0f);
o = i = 0;

View file

@ -25,8 +25,8 @@
#include <math.h>
struct peaks_data {
unsigned o_count;
unsigned i_count;
uint32_t o_count;
uint32_t i_count;
float max_f[0];
};
@ -49,7 +49,7 @@ static void impl_peaks_process(struct resample *r, int channel,
{
struct peaks_data *pd = r->data;
float *s = src, *d = dst, m;
int i, o, end, chunk;
uint32_t i, o, end, chunk;
o = i = 0;
m = pd->max_f[channel];

View file

@ -90,7 +90,7 @@ struct impl {
struct port in_ports[1];
struct port out_ports[MAX_PORTS];
int port_count;
uint32_t port_count;
bool started;
uint32_t cpu_flags;
@ -199,7 +199,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
struct port *port;
struct spa_audio_info info = { 0, };
struct spa_pod *format;
int i;
uint32_t i;
if (spa_pod_object_parse(param,
":", SPA_PARAM_PROFILE_format, "P", &format,
@ -317,7 +317,7 @@ impl_node_get_port_ids(struct spa_node *node,
uint32_t n_output_ids)
{
struct impl *this;
int i;
uint32_t i;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -841,12 +841,13 @@ static int impl_node_process(struct spa_node *node)
struct impl *this;
struct port *inport;
struct spa_io_buffers *inio;
int i, j, maxsize, res = 0, n_samples;
uint32_t i, j, maxsize, n_samples;
struct spa_data *sd, *dd;
struct buffer *sbuf, *dbuf;
uint32_t n_src_datas, n_dst_datas;
const void **src_datas;
void **dst_datas;
int res = 0;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -997,7 +998,7 @@ impl_init(const struct spa_handle_factory *factory,
{
struct impl *this;
struct port *port;
int i;
uint32_t i;
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);

View file

@ -122,11 +122,11 @@ struct impl {
uint64_t last_error;
struct timespec now;
int64_t start_time;
int64_t sample_count;
int64_t sample_time;
int64_t last_ticks;
int64_t last_monotonic;
uint64_t start_time;
uint64_t sample_count;
uint64_t sample_time;
uint64_t last_ticks;
uint64_t last_monotonic;
uint64_t underrun;
};
@ -457,7 +457,8 @@ static int increase_bitpool(struct impl *this)
static int flush_data(struct impl *this, uint64_t now_time)
{
uint32_t total_frames, written;
int written;
uint32_t total_frames;
uint64_t elapsed;
int64_t queued;
struct itimerspec ts;
@ -465,7 +466,7 @@ static int flush_data(struct impl *this, uint64_t now_time)
total_frames = 0;
while (!spa_list_is_empty(&this->ready)) {
uint8_t *src;
int n_bytes, n_frames;
uint32_t n_bytes, n_frames;
struct buffer *b;
struct spa_data *d;
uint32_t index, offs, avail, l0, l1;
@ -1150,7 +1151,7 @@ impl_node_port_use_buffers(struct spa_node *node,
uint32_t port_id, struct spa_buffer **buffers, uint32_t n_buffers)
{
struct impl *this;
int i;
uint32_t i;
spa_return_val_if_fail(node != NULL, -EINVAL);

View file

@ -157,7 +157,7 @@ static uint8_t a2dp_default_bitpool(struct spa_bt_monitor *monitor, uint8_t freq
return 53;
}
static int select_configuration_sbc(struct spa_bt_monitor *monitor, void *capabilities, int size, void *config)
static int select_configuration_sbc(struct spa_bt_monitor *monitor, void *capabilities, size_t size, void *config)
{
a2dp_sbc_t *cap, conf;
int bitpool;
@ -238,7 +238,7 @@ static int select_configuration_sbc(struct spa_bt_monitor *monitor, void *capabi
return 0;
}
static int select_configuration_aac(struct spa_bt_monitor *monitor, void *capabilities, int size, void *config)
static int select_configuration_aac(struct spa_bt_monitor *monitor, void *capabilities, size_t size, void *config)
{
a2dp_aac_t *cap, conf;
int freq;

View file

@ -30,7 +30,7 @@
#define MAX_FACTORIES 16
static const struct spa_handle_factory *factories[MAX_FACTORIES];
static int n_factories;
static uint32_t n_factories;
int spa_handle_factory_register(const struct spa_handle_factory *factory)
{

View file

@ -131,7 +131,7 @@ static void on_trace_event(struct spa_source *source)
fprintf(impl->file, "failed to read event fd: %s", strerror(errno));
while ((avail = spa_ringbuffer_get_read_index(&impl->trace_rb, &index)) > 0) {
uint32_t offset, first;
int32_t offset, first;
if (avail > TRACE_BUFFER) {
index += avail - TRACE_BUFFER;

View file

@ -198,8 +198,8 @@ loop_invoke(struct spa_loop *loop,
if (in_thread) {
res = func(loop, false, seq, data, size, user_data);
} else {
int32_t filled, avail;
uint32_t idx, offset, l0;
int32_t filled;
uint32_t avail, idx, offset, l0;
filled = spa_ringbuffer_get_write_index(&impl->buffer, &idx);
if (filled < 0 || filled > DATAS_SIZE) {

View file

@ -30,7 +30,7 @@
#define MAX_FACTORIES 16
static const struct spa_handle_factory *factories[MAX_FACTORIES];
static int n_factories;
static uint32_t n_factories;
int spa_handle_factory_register(const struct spa_handle_factory *factory)
{

View file

@ -148,7 +148,7 @@ static int spa_v4l2_clear_buffers(struct impl *this)
{
struct port *port = &this->out_ports[0];
struct v4l2_requestbuffers reqbuf;
int i;
uint32_t i;
if (port->n_buffers == 0)
return 0;
@ -354,7 +354,7 @@ static const struct format_info format_info[] = {
static const struct format_info *fourcc_to_format_info(uint32_t fourcc)
{
int i;
size_t i;
for (i = 0; i < SPA_N_ELEMENTS(format_info); i++) {
if (format_info[i].fourcc == fourcc)
@ -381,7 +381,7 @@ static const struct format_info *find_format_info_by_media_type(uint32_t type,
uint32_t format,
int startidx)
{
int i;
size_t i;
for (i = startidx; i < SPA_N_ELEMENTS(format_info); i++) {
if ((format_info[i].media_type == type) &&
@ -1214,7 +1214,7 @@ static int spa_v4l2_use_buffers(struct impl *this, struct spa_buffer **buffers,
struct port *port = &this->out_ports[0];
struct spa_v4l2_device *dev = &port->dev;
struct v4l2_requestbuffers reqbuf;
int i;
unsigned int i;
struct spa_data *d;
if (n_buffers > 0) {
@ -1311,7 +1311,7 @@ mmap_init(struct impl *this,
struct port *port = &this->out_ports[0];
struct spa_v4l2_device *dev = &port->dev;
struct v4l2_requestbuffers reqbuf;
int i;
unsigned int i;
port->memtype = V4L2_MEMORY_MMAP;
@ -1490,7 +1490,7 @@ static int spa_v4l2_stream_off(struct impl *this)
struct port *port = &this->out_ports[0];
struct spa_v4l2_device *dev = &port->dev;
enum v4l2_buf_type type;
int i;
uint32_t i;
if (dev->fd == -1)
return -EIO;

View file

@ -47,7 +47,7 @@ static void *reader_start(void *arg)
while (1) {
uint32_t index;
if (spa_ringbuffer_get_read_index(&rb, &index) >= ARRAY_SIZE * sizeof(int)) {
if (spa_ringbuffer_get_read_index(&rb, &index) >= (int32_t)(ARRAY_SIZE * sizeof(int))) {
spa_ringbuffer_read_data(&rb, data, size, index & (size - 1), b,
ARRAY_SIZE * sizeof(int));
@ -78,7 +78,7 @@ static void *writer_start(void *arg)
while (1) {
uint32_t index;
if (spa_ringbuffer_get_write_index(&rb, &index) >= ARRAY_SIZE * sizeof(int)) {
if (spa_ringbuffer_get_write_index(&rb, &index) >= (int32_t)(ARRAY_SIZE * sizeof(int))) {
spa_ringbuffer_write_data(&rb, data, size, index & (size - 1), a,
ARRAY_SIZE * sizeof(int));
spa_ringbuffer_write_update(&rb, index + ARRAY_SIZE * sizeof(int));

View file

@ -426,7 +426,8 @@ static void *loop(void *user_data)
printf("enter thread %d\n", data->n_sources);
while (data->running) {
int i, r;
int r;
unsigned int i;
/* rebuild */
if (data->rebuild_fds) {

View file

@ -420,7 +420,7 @@ static int negotiate_buffers(struct data *data)
static void fill_buffer(struct data *data, struct spa_buffer *buffers[], int id)
{
int i;
uint32_t i;
struct spa_buffer *b = buffers[id];
for (i = 0; i < b->datas[0].maxsize; i++) {
@ -432,7 +432,8 @@ static void fill_buffer(struct data *data, struct spa_buffer *buffers[], int id)
static void run_convert(struct data *data)
{
struct spa_buffer *b;
int res, i, j;
int res;
uint32_t i, j;
{
struct spa_command cmd = SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start);

View file

@ -420,7 +420,8 @@ static void *loop(void *user_data)
printf("enter thread %d\n", data->n_sources);
while (data->running) {
int i, r;
int r;
unsigned int i;
/* rebuild */
if (data->rebuild_fds) {

View file

@ -568,7 +568,8 @@ static void *loop(void *user_data)
printf("enter thread %d\n", data->n_sources);
while (data->running) {
int i, r;
int r;
unsigned int i;
/* rebuild */
if (data->rebuild_fds) {

View file

@ -401,7 +401,8 @@ static void *loop(void *user_data)
printf("enter thread %d\n", data->n_sources);
while (data->running) {
int i, r;
int r;
unsigned int i;
/* rebuild */
if (data->rebuild_fds) {

View file

@ -451,7 +451,8 @@ static void *loop(void *user_data)
printf("enter thread\n");
while (data->running) {
int i, r;
int r;
unsigned int i;
/* rebuild */
if (data->rebuild_fds) {

View file

@ -117,7 +117,8 @@ static void handle_monitor(struct data *data, struct spa_monitor *monitor)
spa_monitor_set_callbacks(monitor, &impl_callbacks, data);
while (true) {
int i, r;
int r;
uint32_t i;
/* rebuild */
if (data->rebuild_fds) {

View file

@ -125,7 +125,7 @@ int main(int argc, char *argv[])
pw_stream_connect(data.stream,
PW_DIRECTION_OUTPUT,
argc > 1 ? atoi(argv[1]) : SPA_ID_INVALID,
argc > 1 ? (uint32_t)atoi(argv[1]) : SPA_ID_INVALID,
PW_STREAM_FLAG_AUTOCONNECT |
PW_STREAM_FLAG_MAP_BUFFERS |
PW_STREAM_FLAG_RT_PROCESS,

View file

@ -70,7 +70,7 @@ struct data {
struct spa_audio_info_raw format;
struct buffer buffers[32];
int n_buffers;
uint32_t n_buffers;
struct spa_list empty;
double accumulator;
@ -334,7 +334,7 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
struct spa_buffer **buffers, uint32_t n_buffers)
{
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
int i;
uint32_t i;
for (i = 0; i < n_buffers; i++) {
struct buffer *b = &d->buffers[i];
struct spa_data *datas = buffers[i]->datas;
@ -384,7 +384,8 @@ static void fill_f32(struct data *d, void *dest, int avail)
{
float *dst = dest;
int n_samples = avail / (sizeof(float) * d->format.channels);
int i, c;
int i;
uint32_t c;
for (i = 0; i < n_samples; i++) {
float val;
@ -404,7 +405,8 @@ static void fill_s16(struct data *d, void *dest, int avail)
{
int16_t *dst = dest;
int n_samples = avail / (sizeof(int16_t) * d->format.channels);
int i, c;
int i;
uint32_t c;
for (i = 0; i < n_samples; i++) {
int16_t val;

View file

@ -689,7 +689,7 @@ handle_port(struct impl *impl, uint32_t id, uint32_t parent_id, uint32_t type,
static void client_event_info(void *object, struct pw_client_info *info)
{
struct client *c = object;
int i;
uint32_t i;
pw_log_debug(NAME" %p: info for client %d", c->obj.impl, c->obj.id);
c->info = pw_client_info_update(c->info, info);

View file

@ -100,7 +100,7 @@ static Uint32 id_to_sdl_format(uint32_t id)
static struct spa_pod *sdl_build_formats(SDL_RendererInfo *info, struct spa_pod_builder *b)
{
int i, c;
uint32_t i, c;
spa_pod_builder_push_object(b, SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat);
spa_pod_builder_prop(b, SPA_FORMAT_mediaType, 0);

View file

@ -332,7 +332,7 @@ int main(int argc, char *argv[])
pw_stream_connect(data.stream,
PW_DIRECTION_INPUT,
data.path ? atoi(data.path) : SPA_ID_INVALID,
data.path ? (uint32_t)atoi(data.path) : SPA_ID_INVALID,
PW_STREAM_FLAG_AUTOCONNECT |
PW_STREAM_FLAG_INACTIVE |
PW_STREAM_FLAG_EXCLUSIVE |

View file

@ -86,7 +86,7 @@ static void on_timeout(void *userdata, uint64_t expirations)
struct data *data = userdata;
struct pw_buffer *b;
struct spa_buffer *buf;
int i, j;
uint32_t i, j;
uint8_t *p;
struct spa_meta *m;
struct spa_meta_header *h;

View file

@ -213,7 +213,7 @@ get_nth_string (const GValue *val, int idx)
v = val;
else if (type == GST_TYPE_LIST) {
GArray *array = g_value_peek_pointer (val);
if (idx < array->len + 1) {
if (idx < (int)(array->len + 1)) {
v = &g_array_index (array, GValue, SPA_MAX (idx - 1, 0));
}
}
@ -241,7 +241,7 @@ get_nth_int (const GValue *val, int idx, int *res)
}
} else if (type == GST_TYPE_LIST) {
GArray *array = g_value_peek_pointer (val);
if (idx < array->len + 1) {
if (idx < (int)(array->len + 1)) {
v = &g_array_index (array, GValue, SPA_MAX (idx - 1, 0));
}
}
@ -268,7 +268,7 @@ get_nth_fraction (const GValue *val, int idx, struct spa_fraction *f)
}
} else if (type == GST_TYPE_LIST) {
GArray *array = g_value_peek_pointer (val);
if (idx < array->len + 1) {
if (idx < (int)(array->len + 1)) {
v = &g_array_index (array, GValue, SPA_MAX (idx-1, 0));
}
}
@ -303,9 +303,9 @@ get_nth_rectangle (const GValue *width, const GValue *height, int idx, struct sp
} else if (wt == GST_TYPE_LIST && ht == GST_TYPE_LIST) {
GArray *wa = g_value_peek_pointer (width);
GArray *ha = g_value_peek_pointer (height);
if (idx < wa->len + 1)
if (idx < (int)(wa->len + 1))
w = &g_array_index (wa, GValue, SPA_MAX (idx-1, 0));
if (idx < ha->len + 1)
if (idx < (int)(ha->len + 1))
h = &g_array_index (ha, GValue, SPA_MAX (idx-1, 0));
}
if (w && h) {
@ -316,7 +316,7 @@ get_nth_rectangle (const GValue *width, const GValue *height, int idx, struct sp
return false;
}
static const uint32_t
static uint32_t
get_range_type (const GValue *val)
{
GType type = G_VALUE_TYPE (val);
@ -340,7 +340,7 @@ get_range_type (const GValue *val)
return SPA_CHOICE_None;
}
static const uint32_t
static uint32_t
get_range_type2 (const GValue *v1, const GValue *v2)
{
uint32_t r1, r2;
@ -375,7 +375,7 @@ handle_video_fields (ConvertData *d)
}
idx = gst_video_format_from_string (v);
if (idx < SPA_N_ELEMENTS (video_format_map))
if (idx < (int)SPA_N_ELEMENTS (video_format_map))
spa_pod_builder_id (&d->b, video_format_map[idx]);
}
choice = spa_pod_builder_pop(&d->b);
@ -451,7 +451,7 @@ handle_audio_fields (ConvertData *d)
}
idx = gst_audio_format_from_string (v);
if (idx < SPA_N_ELEMENTS (audio_format_map))
if (idx < (int)SPA_N_ELEMENTS (audio_format_map))
spa_pod_builder_id (&d->b, audio_format_map[idx]);
}
choice = spa_pod_builder_pop(&d->b);

View file

@ -533,7 +533,7 @@ gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
pw_stream_connect (pwsink->stream,
PW_DIRECTION_OUTPUT,
pwsink->path ? atoi(pwsink->path) : SPA_ID_INVALID,
pwsink->path ? (uint32_t)atoi(pwsink->path) : SPA_ID_INVALID,
flags,
(const struct spa_pod **) possible->pdata,
possible->len);

View file

@ -619,7 +619,7 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc)
GST_DEBUG_OBJECT (basesrc, "connect capture with path %s", pwsrc->path);
pw_stream_connect (pwsrc->stream,
PW_DIRECTION_INPUT,
pwsrc->path ? atoi(pwsrc->path) : SPA_ID_INVALID,
pwsrc->path ? (uint32_t)atoi(pwsrc->path) : SPA_ID_INVALID,
PW_STREAM_FLAG_AUTOCONNECT,
(const struct spa_pod **)possible->pdata,
possible->len);

View file

@ -99,8 +99,8 @@ struct impl {
const struct spa_node_callbacks *callbacks;
void *user_data;
int port_count;
int last_port;
uint32_t port_count;
uint32_t last_port;
struct port in_ports[MAX_PORTS];
struct port out_ports[1];
@ -213,7 +213,7 @@ impl_node_get_port_ids(struct spa_node *node,
uint32_t n_output_ids)
{
struct impl *this;
int i, idx;
uint32_t i, idx;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -759,7 +759,7 @@ static int impl_node_process(struct spa_node *node)
struct impl *this;
struct port *outport;
struct spa_io_buffers *outio;
int n_samples, n_buffers, i, maxsize;
uint32_t n_samples, n_buffers, i, maxsize;
struct buffer **buffers;
struct buffer *outb;
@ -801,7 +801,7 @@ static int impl_node_process(struct spa_node *node)
spa_log_trace(this->log, NAME " %p: skip input %d %d %p %d %d %d", this,
i, inport->valid, inio,
inio ? inio->status : -1,
inio ? inio->buffer_id : -1,
inio ? inio->buffer_id : SPA_ID_INVALID,
inport->n_buffers);
continue;
}

View file

@ -482,7 +482,7 @@ impl_node_get_port_ids(struct spa_node *node,
uint32_t n_output_ids)
{
struct node *this;
int c, i;
uint32_t c, i;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -511,7 +511,7 @@ do_update_port(struct node *this,
const struct spa_pod **params,
const struct spa_port_info *info)
{
int i;
uint32_t i;
if (change_mask & PW_CLIENT_NODE_PORT_UPDATE_PARAMS) {
port->have_format = false;
@ -1019,7 +1019,7 @@ client_node_update(void *data,
if (change_mask & PW_CLIENT_NODE_UPDATE_MAX_OUTPUTS)
this->max_outputs = max_output_ports;
if (change_mask & PW_CLIENT_NODE_UPDATE_PARAMS) {
int i;
uint32_t i;
spa_log_debug(this->log, "node %p: update %d params", this, n_params);
for (i = 0; i < this->n_params; i++)

View file

@ -61,7 +61,7 @@ client_node_marshal_update(void *object,
{
struct pw_proxy *proxy = object;
struct spa_pod_builder *b;
int i, n_items;
uint32_t i, n_items;
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_UPDATE);
@ -98,7 +98,7 @@ client_node_marshal_port_update(void *object,
{
struct pw_proxy *proxy = object;
struct spa_pod_builder *b;
int i, n_items;
uint32_t i, n_items;
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_PORT_UPDATE);
@ -326,7 +326,7 @@ static int client_node_demarshal_port_use_buffers(void *object, void *data, size
struct spa_pod_parser prs;
uint32_t seq, direction, port_id, mix_id, n_buffers, data_id;
struct pw_client_node_buffer *buffers;
int i, j;
uint32_t i, j;
spa_pod_parser_init(&prs, data, size, 0);
if (spa_pod_parser_get(&prs,
@ -735,7 +735,7 @@ static int client_node_demarshal_update(void *object, void *data, size_t size)
uint32_t change_mask, max_input_ports, max_output_ports, n_params;
const struct spa_pod **params;
struct spa_dict props;
int i;
uint32_t i;
spa_pod_parser_init(&prs, data, size, 0);
if (spa_pod_parser_get(&prs,

View file

@ -168,7 +168,7 @@ static void *create_object(void *_data,
input_node = pw_global_get_object(global);
if (output_port_id == -1) {
if (output_port_id == SPA_ID_INVALID) {
outport = get_port(output_node, SPA_DIRECTION_OUTPUT);
}
else {
@ -181,7 +181,7 @@ static void *create_object(void *_data,
if (outport == NULL)
goto no_output_port;
if (input_port_id == -1)
if (input_port_id == SPA_ID_INVALID)
inport = get_port(input_node, SPA_DIRECTION_INPUT);
else {
global = pw_core_find_global(core, input_port_id);

View file

@ -510,7 +510,7 @@ on_remote_data(void *data, int fd, enum spa_io mask)
marshal = pw_proxy_get_marshal(proxy);
if (marshal == NULL || opcode >= marshal->n_events) {
pw_log_error("protocol-native %p: invalid method %u for %u (%d %d)", this, opcode,
id, opcode, marshal ? marshal->n_events : -1);
id, opcode, marshal ? marshal->n_events : (uint32_t)-1);
continue;
}

View file

@ -74,7 +74,7 @@ static void core_marshal_permissions(void *object, uint32_t n_permissions,
{
struct pw_proxy *proxy = object;
struct spa_pod_builder *b;
int i;
uint32_t i;
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_PERMISSIONS);
@ -1294,7 +1294,7 @@ static void client_marshal_update_permissions(void *object, uint32_t n_permissio
{
struct pw_proxy *proxy = object;
struct spa_pod_builder *b;
int i;
uint32_t i;
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_PROXY_METHOD_UPDATE_PERMISSIONS);

View file

@ -56,7 +56,7 @@ find_permission(struct pw_client *client, uint32_t id)
return NULL;
p = pw_array_get_unchecked(&impl->permissions, id, struct pw_permission);
if (p->permissions == -1)
if (p->permissions == SPA_ID_INVALID)
return NULL;
else
return p;
@ -77,7 +77,7 @@ static struct pw_permission *ensure_permissions(struct pw_client *client, uint32
return NULL;
for (i = 0; i < diff; i++)
p[i].permissions = -1;
p[i].permissions = SPA_ID_INVALID;
}
p = pw_array_get_unchecked(&impl->permissions, id, struct pw_permission);
return p;
@ -187,7 +187,7 @@ core_global_removed(void *data, struct pw_global *global)
p = find_permission(client, global->id);
pw_log_debug("client %p: global %d removed, %p", client, global->id, p);
if (p != NULL)
p->permissions = -1;
p->permissions = SPA_ID_INVALID;
}
static const struct pw_core_events core_events = {
@ -433,7 +433,7 @@ int pw_client_update_permissions(struct pw_client *client,
{
struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
struct pw_core *core = client->core;
int i;
uint32_t i;
for (i = 0; i < n_permissions; i++) {
struct pw_permission *p;
@ -468,7 +468,7 @@ int pw_client_update_permissions(struct pw_client *client,
continue;
}
p = ensure_permissions(client, global->id);
old_perm = p->permissions == -1 ? impl->permissions_default : p->permissions;
old_perm = p->permissions == SPA_ID_INVALID ? impl->permissions_default : p->permissions;
new_perm = permissions[i].permissions;
if (core->current_client == client)

View file

@ -475,7 +475,7 @@ static int alloc_buffers(struct pw_link *this,
return res;
for (i = 0; i < n_buffers; i++) {
int j;
uint32_t j;
struct spa_buffer *b;
void *p;

View file

@ -45,8 +45,8 @@
#include <spa/graph/graph-scheduler2.h>
#define DEFAULT_QUANTUM 1024
#define MIN_QUANTUM 64
#define DEFAULT_QUANTUM 1024u
#define MIN_QUANTUM 64u
/** \cond */
struct impl {

View file

@ -330,7 +330,7 @@ void *pw_load_spa_interface(const char *lib, const char *factory_name, uint32_t
uint32_t extra_n_support;
struct plugin *plugin;
struct interface *iface;
int i;
uint32_t i;
extra_n_support = sup->n_support;
memcpy(extra_support, sup->support,

View file

@ -216,7 +216,8 @@ void pw_properties_clear(struct pw_properties *properties)
int pw_properties_update(struct pw_properties *props,
const struct spa_dict *dict)
{
int i, changed = 0;
uint32_t i;
int changed = 0;
for (i = 0; i < dict->n_items; i++)
changed += pw_properties_set(props, dict->items[i].key, dict->items[i].value);

View file

@ -952,7 +952,8 @@ static void clear_buffers(struct node_data *data, struct mix *mix)
{
struct pw_port *port = mix->port;
struct buffer *b;
int i, res;
uint32_t i;
int res;
pw_log_debug("port %p: clear buffers %d", port, mix->mix_id);
if ((res = pw_port_use_buffers(port, mix->mix_id, NULL, 0)) < 0) {

View file

@ -120,7 +120,7 @@ struct stream {
struct pw_array params;
struct buffer buffers[MAX_BUFFERS];
int n_buffers;
uint32_t n_buffers;
struct queue dequeued;
struct queue queued;
@ -536,7 +536,7 @@ static int unmap_data(struct stream *impl, struct spa_data *data)
static void clear_buffers(struct pw_stream *stream)
{
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
int i, j;
uint32_t i, j;
pw_log_debug("stream %p: clear buffers %d", stream, impl->n_buffers);
@ -564,8 +564,8 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
{
struct stream *impl = SPA_CONTAINER_OF(node, struct stream, impl_node);
struct pw_stream *stream = &impl->this;
uint32_t flags = impl->flags;
int i, j, prot, res;
uint32_t i, j, flags = impl->flags;
int prot, res;
int size = 0;
prot = PROT_READ | (direction == SPA_DIRECTION_OUTPUT ? PROT_WRITE : 0);
@ -1094,7 +1094,8 @@ pw_stream_connect(struct pw_stream *stream,
{
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
enum pw_remote_state state;
int i, res;
int res;
uint32_t i;
pw_log_debug("stream %p: connect target:%d", stream, target_id);
impl->direction =
@ -1165,7 +1166,7 @@ void pw_stream_finish_format(struct pw_stream *stream,
uint32_t n_params)
{
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
int i;
uint32_t i;
pw_log_debug("stream %p: finish format %d %d", stream, res, impl->pending_seq);

View file

@ -206,7 +206,7 @@ static struct command command_list[] = {
static bool do_help(struct data *data, const char *cmd, char *args, char **error)
{
int i;
size_t i;
fprintf(stdout, "Available commands:\n");
for (i = 0; i < SPA_N_ELEMENTS(command_list); i++) {
@ -1245,7 +1245,8 @@ static bool do_permissions(struct data *data, const char *cmd, char *args, char
static bool parse(struct data *data, char *buf, size_t size, char **error)
{
char *a[2];
int i, n;
int n;
size_t i;
char *p, *cmd, *args;
if ((p = strchr(buf, '#')))

View file

@ -105,7 +105,7 @@ static void on_sync_reply(void *data, uint32_t seq)
static void clear_params(struct proxy_data *data)
{
int i;
uint32_t i;
for (i = 0; i < data->n_params; i++)
free(data->params[i]);
@ -219,7 +219,7 @@ static void print_node(struct proxy_data *data)
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
if (print_all) {
int i;
uint32_t i;
printf("%c\tname: \"%s\"\n", MARK_CHANGE(0), info->name);
printf("%c\tparams:\n", MARK_CHANGE(5));
@ -297,7 +297,7 @@ static void print_port(struct proxy_data *data)
printf("\ttype: %s (version %d)\n",
spa_debug_type_find_name(pw_type_info(), data->type), data->version);
if (print_all) {
int i;
uint32_t i;
printf(" \tdirection: \"%s\"\n", pw_direction_as_string(info->direction));
printf("%c\tparams:\n", MARK_CHANGE(2));
for (i = 0; i < data->n_params; i++) {