From e918f9f77c718e0a1d48623cca2b93a3653ee332 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 7 Jan 2019 15:52:42 +0100 Subject: [PATCH] fix sign confusion --- pipewire-alsa | 2 +- pipewire-jack | 2 +- pipewire-pulseaudio | 2 +- spa/include/spa/buffer/alloc.h | 6 +++--- spa/include/spa/debug/format.h | 3 +-- spa/include/spa/debug/mem.h | 3 ++- spa/include/spa/param/audio/raw.h | 2 +- spa/include/spa/pod/filter.h | 3 +-- spa/plugins/alsa/alsa-monitor.c | 10 +++++----- spa/plugins/alsa/alsa-sink.c | 2 +- spa/plugins/alsa/alsa-source.c | 2 +- spa/plugins/alsa/alsa-utils.c | 11 ++++++----- spa/plugins/alsa/alsa-utils.h | 6 +++--- spa/plugins/audioconvert/channelmix-ops.c | 13 ++++++++----- spa/plugins/audioconvert/channelmix.c | 7 +++---- spa/plugins/audioconvert/fmt-ops.c | 2 +- spa/plugins/audioconvert/fmtconvert.c | 10 +++++----- spa/plugins/audioconvert/merger.c | 11 ++++++----- spa/plugins/audioconvert/resample-peaks-sse.h | 2 +- spa/plugins/audioconvert/resample-peaks.h | 6 +++--- spa/plugins/audioconvert/splitter.c | 11 ++++++----- spa/plugins/bluez5/a2dp-sink.c | 17 +++++++++-------- spa/plugins/bluez5/bluez5-monitor.c | 4 ++-- spa/plugins/bluez5/plugin.c | 2 +- spa/plugins/support/logger.c | 2 +- spa/plugins/support/loop.c | 4 ++-- spa/plugins/support/plugin.c | 2 +- spa/plugins/v4l2/v4l2-utils.c | 12 ++++++------ spa/tests/stress-ringbuffer.c | 4 ++-- spa/tests/test-control.c | 3 ++- spa/tests/test-convert2.c | 5 +++-- spa/tests/test-graph.c | 3 ++- spa/tests/test-mixer.c | 3 ++- spa/tests/test-perf.c | 3 ++- spa/tests/test-v4l2.c | 3 ++- spa/tools/spa-monitor.c | 3 ++- src/examples/audio-src.c | 2 +- src/examples/export-source.c | 10 ++++++---- src/examples/media-session.c | 2 +- src/examples/sdl.h | 2 +- src/examples/video-play.c | 2 +- src/examples/video-src.c | 2 +- src/gst/gstpipewireformat.c | 18 +++++++++--------- src/gst/gstpipewiresink.c | 2 +- src/gst/gstpipewiresrc.c | 2 +- src/modules/module-audio-dsp/floatmix.c | 10 +++++----- src/modules/module-client-node/client-node.c | 6 +++--- .../module-client-node/protocol-native.c | 8 ++++---- src/modules/module-link-factory.c | 4 ++-- src/modules/module-protocol-native.c | 2 +- .../module-protocol-native/protocol-native.c | 4 ++-- src/pipewire/client.c | 10 +++++----- src/pipewire/link.c | 2 +- src/pipewire/node.c | 4 ++-- src/pipewire/pipewire.c | 2 +- src/pipewire/properties.c | 3 ++- src/pipewire/remote.c | 3 ++- src/pipewire/stream.c | 13 +++++++------ src/tools/pipewire-cli.c | 5 +++-- src/tools/pipewire-monitor.c | 6 +++--- 60 files changed, 164 insertions(+), 146 deletions(-) diff --git a/pipewire-alsa b/pipewire-alsa index d7376b730..3d9fab3aa 160000 --- a/pipewire-alsa +++ b/pipewire-alsa @@ -1 +1 @@ -Subproject commit d7376b73049f45b5894c10f263b81a140775de57 +Subproject commit 3d9fab3aaf1e52c2481a445255841675e75def0c diff --git a/pipewire-jack b/pipewire-jack index 4cb36762b..a4593a0d9 160000 --- a/pipewire-jack +++ b/pipewire-jack @@ -1 +1 @@ -Subproject commit 4cb36762b0549b041ee17e66bbe6de947c47960d +Subproject commit a4593a0d96757cb2362f9c02abdcd55f7206967d diff --git a/pipewire-pulseaudio b/pipewire-pulseaudio index 9062145e1..89fb73a94 160000 --- a/pipewire-pulseaudio +++ b/pipewire-pulseaudio @@ -1 +1 @@ -Subproject commit 9062145e138171034884ed3b8368a4863ae0cdbe +Subproject commit 89fb73a949d4ceb1c4d41269e29ffade8bc3e386 diff --git a/spa/include/spa/buffer/alloc.h b/spa/include/spa/buffer/alloc.h index ddad22ffa..14e66959d 100644 --- a/spa/include/spa/buffer/alloc.h +++ b/spa/include/spa/buffer/alloc.h @@ -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); diff --git a/spa/include/spa/debug/format.h b/spa/include/spa/debug/format.h index f3e786755..db0bea090 100644 --- a/spa/include/spa/debug/format.h +++ b/spa/include/spa/debug/format.h @@ -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; diff --git a/spa/include/spa/debug/mem.h b/spa/include/spa/debug/mem.h index dfe6a4f5e..aa3564689 100644 --- a/spa/include/spa/debug/mem.h +++ b/spa/include/spa/debug/mem.h @@ -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) diff --git a/spa/include/spa/param/audio/raw.h b/spa/include/spa/param/audio/raw.h index 1e0a35428..1ece306d5 100644 --- a/spa/include/spa/param/audio/raw.h +++ b/spa/include/spa/param/audio/raw.h @@ -31,7 +31,7 @@ extern "C" { #include -#define SPA_AUDIO_MAX_CHANNELS 64 +#define SPA_AUDIO_MAX_CHANNELS 64u enum spa_audio_format { SPA_AUDIO_FORMAT_UNKNOWN, diff --git a/spa/include/spa/pod/filter.h b/spa/include/spa/pod/filter.h index b00e3723f..6a38f372d 100644 --- a/spa/include/spa/pod/filter.h +++ b/spa/include/spa/pod/filter.h @@ -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); diff --git a/spa/plugins/alsa/alsa-monitor.c b/spa/plugins/alsa/alsa-monitor.c index 4d58d43ba..ddbc59a67 100644 --- a/spa/plugins/alsa/alsa-monitor.c +++ b/spa/plugins/alsa/alsa-monitor.c @@ -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; diff --git a/spa/plugins/alsa/alsa-sink.c b/spa/plugins/alsa/alsa-sink.c index cd661b6bc..ce9dfaf3b 100644 --- a/spa/plugins/alsa/alsa-sink.c +++ b/spa/plugins/alsa/alsa-sink.c @@ -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); diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c index 0c109597c..99fddf276 100644 --- a/spa/plugins/alsa/alsa-source.c +++ b/spa/plugins/alsa/alsa-source.c @@ -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); diff --git a/spa/plugins/alsa/alsa-utils.c b/spa/plugins/alsa/alsa-utils.c index 9dc6112d8..9293834ff 100644 --- a/spa/plugins/alsa/alsa-utils.c +++ b/spa/plugins/alsa/alsa-utils.c @@ -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); diff --git a/spa/plugins/alsa/alsa-utils.h b/spa/plugins/alsa/alsa-utils.h index 0303e9f54..37b8c7011 100644 --- a/spa/plugins/alsa/alsa-utils.h +++ b/spa/plugins/alsa/alsa-utils.h @@ -43,8 +43,8 @@ extern "C" { #include #include -#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; diff --git a/spa/plugins/audioconvert/channelmix-ops.c b/spa/plugins/audioconvert/channelmix-ops.c index 2a97963b0..23d69c6d4 100644 --- a/spa/plugins/audioconvert/channelmix-ops.c +++ b/spa/plugins/audioconvert/channelmix-ops.c @@ -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; diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index 4f470b58f..b25f801da 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -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; diff --git a/spa/plugins/audioconvert/fmt-ops.c b/spa/plugins/audioconvert/fmt-ops.c index d404e6b16..1182c7a35 100644 --- a/spa/plugins/audioconvert/fmt-ops.c +++ b/spa/plugins/audioconvert/fmt-ops.c @@ -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 && diff --git a/spa/plugins/audioconvert/fmtconvert.c b/spa/plugins/audioconvert/fmtconvert.c index 80e6320b7..9db39c75f 100644 --- a/spa/plugins/audioconvert/fmtconvert.c +++ b/spa/plugins/audioconvert/fmtconvert.c @@ -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); diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c index 4cdb5cb46..59b3319b6 100644 --- a/spa/plugins/audioconvert/merger.c +++ b/spa/plugins/audioconvert/merger.c @@ -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); diff --git a/spa/plugins/audioconvert/resample-peaks-sse.h b/spa/plugins/audioconvert/resample-peaks-sse.h index 743105616..155d4b5fc 100644 --- a/spa/plugins/audioconvert/resample-peaks-sse.h +++ b/spa/plugins/audioconvert/resample-peaks-sse.h @@ -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; diff --git a/spa/plugins/audioconvert/resample-peaks.h b/spa/plugins/audioconvert/resample-peaks.h index 998db403b..ea5c353e7 100644 --- a/spa/plugins/audioconvert/resample-peaks.h +++ b/spa/plugins/audioconvert/resample-peaks.h @@ -25,8 +25,8 @@ #include 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]; diff --git a/spa/plugins/audioconvert/splitter.c b/spa/plugins/audioconvert/splitter.c index 19ec845ef..62ace5842 100644 --- a/spa/plugins/audioconvert/splitter.c +++ b/spa/plugins/audioconvert/splitter.c @@ -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); diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 30e016797..11b79071e 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -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); diff --git a/spa/plugins/bluez5/bluez5-monitor.c b/spa/plugins/bluez5/bluez5-monitor.c index d7df3bff4..37c7d0e14 100644 --- a/spa/plugins/bluez5/bluez5-monitor.c +++ b/spa/plugins/bluez5/bluez5-monitor.c @@ -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; diff --git a/spa/plugins/bluez5/plugin.c b/spa/plugins/bluez5/plugin.c index 6464be183..52a39cea8 100644 --- a/spa/plugins/bluez5/plugin.c +++ b/spa/plugins/bluez5/plugin.c @@ -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) { diff --git a/spa/plugins/support/logger.c b/spa/plugins/support/logger.c index e6b7a4479..e901952cc 100644 --- a/spa/plugins/support/logger.c +++ b/spa/plugins/support/logger.c @@ -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; diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c index 1a2e8c66e..66453ee58 100644 --- a/spa/plugins/support/loop.c +++ b/spa/plugins/support/loop.c @@ -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) { diff --git a/spa/plugins/support/plugin.c b/spa/plugins/support/plugin.c index 2dc6395f0..86dd42e15 100644 --- a/spa/plugins/support/plugin.c +++ b/spa/plugins/support/plugin.c @@ -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) { diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index e5aa289ad..0f461cd56 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -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; diff --git a/spa/tests/stress-ringbuffer.c b/spa/tests/stress-ringbuffer.c index 02596bbf8..f063aa102 100644 --- a/spa/tests/stress-ringbuffer.c +++ b/spa/tests/stress-ringbuffer.c @@ -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)); diff --git a/spa/tests/test-control.c b/spa/tests/test-control.c index 8c6107273..9a3686703 100644 --- a/spa/tests/test-control.c +++ b/spa/tests/test-control.c @@ -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) { diff --git a/spa/tests/test-convert2.c b/spa/tests/test-convert2.c index 79d1b3b4e..4438d9af7 100644 --- a/spa/tests/test-convert2.c +++ b/spa/tests/test-convert2.c @@ -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); diff --git a/spa/tests/test-graph.c b/spa/tests/test-graph.c index b4d520c79..a5934679b 100644 --- a/spa/tests/test-graph.c +++ b/spa/tests/test-graph.c @@ -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) { diff --git a/spa/tests/test-mixer.c b/spa/tests/test-mixer.c index fd4f43eb2..a5f77cb0e 100644 --- a/spa/tests/test-mixer.c +++ b/spa/tests/test-mixer.c @@ -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) { diff --git a/spa/tests/test-perf.c b/spa/tests/test-perf.c index a6e272f82..8f6b6b8ea 100644 --- a/spa/tests/test-perf.c +++ b/spa/tests/test-perf.c @@ -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) { diff --git a/spa/tests/test-v4l2.c b/spa/tests/test-v4l2.c index 8806275ad..ddb589235 100644 --- a/spa/tests/test-v4l2.c +++ b/spa/tests/test-v4l2.c @@ -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) { diff --git a/spa/tools/spa-monitor.c b/spa/tools/spa-monitor.c index 4fac134cb..9786cb223 100644 --- a/spa/tools/spa-monitor.c +++ b/spa/tools/spa-monitor.c @@ -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) { diff --git a/src/examples/audio-src.c b/src/examples/audio-src.c index a325e4e97..ef8918e7a 100644 --- a/src/examples/audio-src.c +++ b/src/examples/audio-src.c @@ -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, diff --git a/src/examples/export-source.c b/src/examples/export-source.c index 596f1e397..aedcbc66b 100644 --- a/src/examples/export-source.c +++ b/src/examples/export-source.c @@ -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; diff --git a/src/examples/media-session.c b/src/examples/media-session.c index 85c64b077..ac256b31d 100644 --- a/src/examples/media-session.c +++ b/src/examples/media-session.c @@ -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); diff --git a/src/examples/sdl.h b/src/examples/sdl.h index 5f63e8a1c..2d1734d6c 100644 --- a/src/examples/sdl.h +++ b/src/examples/sdl.h @@ -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); diff --git a/src/examples/video-play.c b/src/examples/video-play.c index bebb100d5..5a451c5be 100644 --- a/src/examples/video-play.c +++ b/src/examples/video-play.c @@ -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 | diff --git a/src/examples/video-src.c b/src/examples/video-src.c index e4e129b07..7124054b1 100644 --- a/src/examples/video-src.c +++ b/src/examples/video-src.c @@ -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; diff --git a/src/gst/gstpipewireformat.c b/src/gst/gstpipewireformat.c index 89a3e9af9..8e4439a50 100644 --- a/src/gst/gstpipewireformat.c +++ b/src/gst/gstpipewireformat.c @@ -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); diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index 813857774..66ebc30c4 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -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); diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 6be5ce462..91bdb0d72 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -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); diff --git a/src/modules/module-audio-dsp/floatmix.c b/src/modules/module-audio-dsp/floatmix.c index c8083c641..ad784a386 100644 --- a/src/modules/module-audio-dsp/floatmix.c +++ b/src/modules/module-audio-dsp/floatmix.c @@ -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; } diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index b8a8aa333..ecb6f0692 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -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++) diff --git a/src/modules/module-client-node/protocol-native.c b/src/modules/module-client-node/protocol-native.c index 5efefe024..9ce6cd3df 100644 --- a/src/modules/module-client-node/protocol-native.c +++ b/src/modules/module-client-node/protocol-native.c @@ -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, diff --git a/src/modules/module-link-factory.c b/src/modules/module-link-factory.c index e05f2cce9..0f866ec27 100644 --- a/src/modules/module-link-factory.c +++ b/src/modules/module-link-factory.c @@ -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); diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index a83fbce56..27e8587b8 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -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; } diff --git a/src/modules/module-protocol-native/protocol-native.c b/src/modules/module-protocol-native/protocol-native.c index e42c122fd..a640f5744 100644 --- a/src/modules/module-protocol-native/protocol-native.c +++ b/src/modules/module-protocol-native/protocol-native.c @@ -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); diff --git a/src/pipewire/client.c b/src/pipewire/client.c index 2d39427f3..3ba9fec04 100644 --- a/src/pipewire/client.c +++ b/src/pipewire/client.c @@ -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) diff --git a/src/pipewire/link.c b/src/pipewire/link.c index 20d3328f6..d9c0dfdda 100644 --- a/src/pipewire/link.c +++ b/src/pipewire/link.c @@ -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; diff --git a/src/pipewire/node.c b/src/pipewire/node.c index 06a691a1b..3d5fe0920 100644 --- a/src/pipewire/node.c +++ b/src/pipewire/node.c @@ -45,8 +45,8 @@ #include -#define DEFAULT_QUANTUM 1024 -#define MIN_QUANTUM 64 +#define DEFAULT_QUANTUM 1024u +#define MIN_QUANTUM 64u /** \cond */ struct impl { diff --git a/src/pipewire/pipewire.c b/src/pipewire/pipewire.c index fd344370a..0b300bcc9 100644 --- a/src/pipewire/pipewire.c +++ b/src/pipewire/pipewire.c @@ -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, diff --git a/src/pipewire/properties.c b/src/pipewire/properties.c index 1ccbb7ecd..d4ff85d6d 100644 --- a/src/pipewire/properties.c +++ b/src/pipewire/properties.c @@ -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); diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 0ca5219ac..753cec410 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -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) { diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 9fefa0f6c..9b9329c1d 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -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); diff --git a/src/tools/pipewire-cli.c b/src/tools/pipewire-cli.c index 1fd53c574..ac3a6fb07 100644 --- a/src/tools/pipewire-cli.c +++ b/src/tools/pipewire-cli.c @@ -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, '#'))) diff --git a/src/tools/pipewire-monitor.c b/src/tools/pipewire-monitor.c index 03c50b418..9d75f8176 100644 --- a/src/tools/pipewire-monitor.c +++ b/src/tools/pipewire-monitor.c @@ -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++) {