diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2022-05-03 07:57:47 +0900 |
---|---|---|
committer | 坂本 貴史 <o-takashi@sakamocchi.jp> | 2022-05-03 08:31:29 +0900 |
commit | 7276ab04eed297b99e7957e3eba1c6e8956abe52 (patch) | |
tree | 95745b250d4d69a440cc31feab96eb11004ca385 | |
parent | 323dd3eb7bfdb2bd4683213723349dbbe023fcc1 (diff) | |
download | libhinoko-7276ab04eed297b99e7957e3eba1c6e8956abe52.tar.gz |
fw_iso_resource_auto: fix name conflict between 'allocated' property and signal
The same name between property and signal brings some trouble.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rwxr-xr-x | samples/iso-resource | 2 | ||||
-rw-r--r-- | src/fw_iso_resource_auto.c | 20 | ||||
-rw-r--r-- | tests/fw-iso-resource-auto | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/samples/iso-resource b/samples/iso-resource index ce4c266..0a415c2 100755 --- a/samples/iso-resource +++ b/samples/iso-resource @@ -73,7 +73,7 @@ src = res.create_source() src.attach(ctx) def print_props(res): - for prop in ('allocated', 'channel', 'bandwidth'): + for prop in ('is-allocated', 'channel', 'bandwidth'): print(' {}: {}'.format(prop, res.get_property(prop))) for i in range(2): diff --git a/src/fw_iso_resource_auto.c b/src/fw_iso_resource_auto.c index c1ffa98..57502b0 100644 --- a/src/fw_iso_resource_auto.c +++ b/src/fw_iso_resource_auto.c @@ -10,7 +10,7 @@ * updates. The maintenance of allocated isochronous resource is done by Linux FireWire subsystem. */ typedef struct { - gboolean allocated; + gboolean is_allocated; guint channel; guint bandwidth; @@ -41,7 +41,7 @@ static const char *const err_msgs[] = { g_set_error_literal(error, HINOKO_FW_ISO_RESOURCE_AUTO_ERROR, code, err_msgs[code]) enum fw_iso_resource_auto_prop_type { - FW_ISO_RESOURCE_AUTO_PROP_ALLOCATED = 1, + FW_ISO_RESOURCE_AUTO_PROP_IS_ALLOCATED = 1, FW_ISO_RESOURCE_AUTO_PROP_CHANNEL, FW_ISO_RESOURCE_AUTO_PROP_BANDWIDTH, FW_ISO_RESOURCE_AUTO_PROP_COUNT, @@ -58,8 +58,8 @@ static void fw_iso_resource_auto_get_property(GObject *obj, guint id, g_mutex_lock(&priv->mutex); switch (id) { - case FW_ISO_RESOURCE_AUTO_PROP_ALLOCATED: - g_value_set_boolean(val, priv->allocated); + case FW_ISO_RESOURCE_AUTO_PROP_IS_ALLOCATED: + g_value_set_boolean(val, priv->is_allocated); break; case FW_ISO_RESOURCE_AUTO_PROP_CHANNEL: g_value_set_uint(val, priv->channel); @@ -81,8 +81,8 @@ static void hinoko_fw_iso_resource_auto_class_init(HinokoFwIsoResourceAutoClass gobject_class->get_property = fw_iso_resource_auto_get_property; - fw_iso_resource_auto_props[FW_ISO_RESOURCE_AUTO_PROP_ALLOCATED] = - g_param_spec_boolean("allocated", "allocated", + fw_iso_resource_auto_props[FW_ISO_RESOURCE_AUTO_PROP_IS_ALLOCATED] = + g_param_spec_boolean("is-allocated", "is-allocated", "Whether to allocated or not.", FALSE, G_PARAM_READABLE); @@ -158,7 +158,7 @@ void hinoko_fw_iso_resource_auto_allocate_async(HinokoFwIsoResourceAuto *self, g_mutex_lock(&priv->mutex); - if (priv->allocated) { + if (priv->is_allocated) { generate_local_error(error, HINOKO_FW_ISO_RESOURCE_AUTO_ERROR_ALLOCATED); goto end; } @@ -200,7 +200,7 @@ void hinoko_fw_iso_resource_auto_deallocate_async(HinokoFwIsoResourceAuto *self, g_mutex_lock(&priv->mutex); - if (!priv->allocated) { + if (!priv->is_allocated) { generate_local_error(error, HINOKO_FW_ISO_RESOURCE_AUTO_ERROR_NOT_ALLOCATED); goto end; } @@ -290,7 +290,7 @@ void hinoko_fw_iso_resource_auto_handle_event(HinokoFwIsoResourceAuto *self, gui g_mutex_lock(&priv->mutex); priv->channel = channel; priv->bandwidth = bandwidth; - priv->allocated = TRUE; + priv->is_allocated = TRUE; g_mutex_unlock(&priv->mutex); } } else if (!strcmp(signal_name, "deallocated")) { @@ -298,7 +298,7 @@ void hinoko_fw_iso_resource_auto_handle_event(HinokoFwIsoResourceAuto *self, gui g_mutex_lock(&priv->mutex); priv->channel = 0; priv->bandwidth -= bandwidth; - priv->allocated = FALSE; + priv->is_allocated = FALSE; g_mutex_unlock(&priv->mutex); } } diff --git a/tests/fw-iso-resource-auto b/tests/fw-iso-resource-auto index 853b67e..6201e06 100644 --- a/tests/fw-iso-resource-auto +++ b/tests/fw-iso-resource-auto @@ -11,7 +11,7 @@ from gi.repository import Hinoko target = Hinoko.FwIsoResourceAuto() props = ( - 'allocated', + 'is-allocated', 'channel', 'bandwidth', ) |