]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: use guint8 for the numerical ID of client
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 19 Jun 2020 05:08:27 +0000 (14:08 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Fri, 19 Jun 2020 08:57:42 +0000 (17:57 +0900)
src/seq/client-info.c
src/seq/client-pool.c
src/seq/query.c
src/seq/query.h
src/seq/queue-info.c

index c99e49a72cc85572cd9afc4c7a1a5c4d6effe28d..d53ce43cb1e1b817289890b12560a209e6603dc6 100644 (file)
@@ -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",
index e39ce8b1147126a27b2a73670151e7bc2851ae18..c3f658f4036df596eec2d3d650c1838dd4213a94 100644 (file)
@@ -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",
index 95a4d58840b3ebb48624567b674e0c02bcaa10a8..524f3a97a0808be9eb32029d855c117ac0859bf7 100644 (file)
@@ -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;
index 57d2a549a1e7d1708435677ba7411350bee58874..46c10ec4136ac0f6c472bd2f787e7e4c484c09ae 100644 (file)
@@ -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,
index 57375d6b57c534183d17597968c38faad4aead66..42f3a506cbf45113ede3dbc17a386fb8b22f2977 100644 (file)
@@ -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",