From 912236f0a4151ee322f749602890449190f671db Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Fri, 19 Jun 2020 14:08:27 +0900 Subject: [PATCH] seq: use guint8 for the numerical ID of client --- src/seq/client-info.c | 18 +++++++++--------- src/seq/client-pool.c | 16 ++++++++-------- src/seq/query.c | 8 ++++---- src/seq/query.h | 8 ++++---- src/seq/queue-info.c | 16 ++++++++-------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/seq/client-info.c b/src/seq/client-info.c index c99e49a..d53ce43 100644 --- a/src/seq/client-info.c +++ b/src/seq/client-info.c @@ -44,7 +44,7 @@ static void seq_client_info_set_property(GObject *obj, guint id, switch (id) { case SEQ_CLIENT_INFO_PROP_CLIENT_ID: - priv->info.client = g_value_get_int(val); + priv->info.client = (int)g_value_get_uchar(val); break; case SEQ_CLIENT_INFO_PROP_CLIENT_TYPE: priv->info.type = (snd_seq_client_type_t)g_value_get_enum(val); @@ -79,7 +79,7 @@ static void seq_client_info_get_property(GObject *obj, guint id, GValue *val, switch (id) { case SEQ_CLIENT_INFO_PROP_CLIENT_ID: - g_value_set_int(val, priv->info.client); + g_value_set_uchar(val, (guint8)priv->info.client); break; case SEQ_CLIENT_INFO_PROP_CLIENT_TYPE: g_value_set_enum(val, (ALSASeqClientType)priv->info.type); @@ -121,13 +121,13 @@ static void alsaseq_client_info_class_init(ALSASeqClientInfoClass *klass) gobject_class->get_property = seq_client_info_get_property; seq_client_info_props[SEQ_CLIENT_INFO_PROP_CLIENT_ID] = - g_param_spec_int("client-id", "client-id", - "The numerical ID of client. One of " - "ALSASeqSpecificClientId is available as well as " - "any numerical value.", - 0, G_MAXINT, - 0, - G_PARAM_READWRITE); + g_param_spec_uchar("client-id", "client-id", + "The numerical ID of client. One of " + "ALSASeqSpecificClientId is available as well as " + "any numerical value.", + 0, G_MAXUINT8, + 0, + G_PARAM_READWRITE); seq_client_info_props[SEQ_CLIENT_INFO_PROP_CLIENT_TYPE] = g_param_spec_enum("type", "type", diff --git a/src/seq/client-pool.c b/src/seq/client-pool.c index e39ce8b..c3f658f 100644 --- a/src/seq/client-pool.c +++ b/src/seq/client-pool.c @@ -69,7 +69,7 @@ static void seq_client_pool_get_property(GObject *obj, guint id, GValue *val, switch (id) { case SEQ_CLIENT_POOL_PROP_CLIENT_ID: - g_value_set_int(val, priv->pool.client); + g_value_set_uchar(val, (guint8)priv->pool.client); break; case SEQ_CLIENT_POOL_PROP_OUTPUT_POOL: g_value_set_int(val, priv->pool.output_pool); @@ -100,13 +100,13 @@ static void alsaseq_client_pool_class_init(ALSASeqClientPoolClass *klass) gobject_class->get_property = seq_client_pool_get_property; seq_client_pool_props[SEQ_CLIENT_POOL_PROP_CLIENT_ID] = - g_param_spec_int("client-id", "client-id", - "The numerical ID of client. One of " - "ALSASeqSpecificClientId is available as well as " - "any numerical value.", - 0, G_MAXINT, - 0, - G_PARAM_READABLE); + g_param_spec_uchar("client-id", "client-id", + "The numerical ID of client. One of " + "ALSASeqSpecificClientId is available as well as " + "any numerical value.", + 0, G_MAXUINT8, + 0, + G_PARAM_READABLE); seq_client_pool_props[SEQ_CLIENT_POOL_PROP_OUTPUT_POOL] = g_param_spec_int("output-pool", "output-pool", diff --git a/src/seq/query.c b/src/seq/query.c index 95a4d58..524f3a9 100644 --- a/src/seq/query.c +++ b/src/seq/query.c @@ -259,7 +259,7 @@ void alsaseq_get_client_id_list(guint **entries, gsize *entry_count, * with SNDRV_SEQ_IOCTL_GET_CLIENT_INFO command for ALSA sequencer character * device. */ -void alsaseq_get_client_info(guint client_id, ALSASeqClientInfo **client_info, +void alsaseq_get_client_info(guint8 client_id, ALSASeqClientInfo **client_info, GError **error) { char *devnode; @@ -309,7 +309,7 @@ void alsaseq_get_client_info(guint client_id, ALSASeqClientInfo **client_info, * with SNDRV_SEQ_IOCTL_GET_CLIENT_INFO and SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT * commands for ALSA sequencer character device. */ -void alsaseq_get_port_id_list(guint client_id, guint **entries, +void alsaseq_get_port_id_list(guint8 client_id, guint **entries, gsize *entry_count, GError **error) { char *devnode; @@ -385,7 +385,7 @@ void alsaseq_get_port_id_list(guint client_id, guint **entries, * with SNDRV_SEQ_IOCTL_GET_PORT_INFO command for ALSA sequencer character * device. */ -void alsaseq_get_port_info(guint client_id, guint port_id, +void alsaseq_get_port_info(guint8 client_id, guint port_id, ALSASeqPortInfo **port_info, GError **error) { char *devnode; @@ -433,7 +433,7 @@ void alsaseq_get_port_info(guint client_id, guint port_id, * with SNDRV_SEQ_IOCTL_GET_CLIENT_POOL command for ALSA sequencer character * device. */ -void alsaseq_get_client_pool(gint client_id, ALSASeqClientPool **client_pool, +void alsaseq_get_client_pool(guint8 client_id, ALSASeqClientPool **client_pool, GError **error) { char *devnode; diff --git a/src/seq/query.h b/src/seq/query.h index 57d2a54..46c10ec 100644 --- a/src/seq/query.h +++ b/src/seq/query.h @@ -24,16 +24,16 @@ void alsaseq_get_system_info(ALSASeqSystemInfo **system_info, GError **error); void alsaseq_get_client_id_list(guint **entries, gsize *entry_count, GError **error); -void alsaseq_get_client_info(guint client_id, ALSASeqClientInfo **client_info, +void alsaseq_get_client_info(guint8 client_id, ALSASeqClientInfo **client_info, GError **error); -void alsaseq_get_port_id_list(guint client_id, guint **entries, +void alsaseq_get_port_id_list(guint8 client_id, guint **entries, gsize *entry_count, GError **error); -void alsaseq_get_port_info(guint client_id, guint port_id, +void alsaseq_get_port_info(guint8 client_id, guint port_id, ALSASeqPortInfo **port_info, GError **error); -void alsaseq_get_client_pool(gint client_id, ALSASeqClientPool **client_pool, +void alsaseq_get_client_pool(guint8 client_id, ALSASeqClientPool **client_pool, GError **error); void alsaseq_get_subscription_list(const ALSASeqAddr *addr, diff --git a/src/seq/queue-info.c b/src/seq/queue-info.c index 57375d6..42f3a50 100644 --- a/src/seq/queue-info.c +++ b/src/seq/queue-info.c @@ -41,7 +41,7 @@ static void seq_queue_info_set_property(GObject *obj, guint id, priv->info.queue = (int)g_value_get_uchar(val); break; case SEQ_QUEUE_INFO_PROP_CLIENT_ID: - priv->info.owner = g_value_get_int(val); + priv->info.owner = (int)g_value_get_uchar(val); break; case SEQ_QUEUE_INFO_PROP_LOCKED: priv->info.locked = g_value_get_boolean(val); @@ -67,7 +67,7 @@ static void seq_queue_info_get_property(GObject *obj, guint id, GValue *val, g_value_set_uchar(val, (guint8)priv->info.queue); break; case SEQ_QUEUE_INFO_PROP_CLIENT_ID: - g_value_set_int(val, priv->info.owner); + g_value_set_uchar(val, (guint8)priv->info.owner); break; case SEQ_QUEUE_INFO_PROP_LOCKED: g_value_set_boolean(val, priv->info.locked); @@ -97,12 +97,12 @@ static void alsaseq_queue_info_class_init(ALSASeqQueueInfoClass *klass) G_PARAM_READWRITE); seq_queue_info_props[SEQ_QUEUE_INFO_PROP_CLIENT_ID] = - g_param_spec_int("client-id", "client-id", - "The numerical ID of client which owns the queue, " - "except for one of ALSASeqSpecificClientId.", - G_MININT, G_MAXINT, - -1, - G_PARAM_READWRITE); + g_param_spec_uchar("client-id", "client-id", + "The numerical ID of client which owns the queue, " + "except for one of ALSASeqSpecificClientId.", + 0, G_MAXUINT8, + 0, + G_PARAM_READWRITE); seq_queue_info_props[SEQ_QUEUE_INFO_PROP_LOCKED] = g_param_spec_boolean("locked", "locked", -- 2.47.3