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

@ -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++) {