Fix aarch64 build warnings 74/264574/2
authorSeungbae Shin <seungbae.shin@samsung.com>
Fri, 24 Sep 2021 12:27:12 +0000 (21:27 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 27 Sep 2021 04:25:35 +0000 (13:25 +0900)
Fixes following warnings:

- cast to pointer from integer of different size [-Wint-to-pointer-cast]
- format '%llu' expects argument of type 'long long unsigned int', but argument 9 has type 'pa_usec_t' {aka 'long unsigned int'} [-Wformat=]
- format '%d' expects argument of type 'int', but argument 7 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]

[Version] 13.0.76
[Issue Type] Build

Change-Id: I55a043c48107c3a3c6bf71cbb8b81f54c504180d

packaging/pulseaudio-modules-tizen.spec
src/module-tizenaudio-policy.c
src/module-tizenaudio-sink2.c
src/module-tizenaudio-source2.c
src/stream-manager-dbus.c
src/stream-manager.c

index 137d868..49718ab 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.75
+Version:          13.0.76
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 44b1894..bb331e0 100644 (file)
@@ -468,10 +468,10 @@ static void update_loopback_module_args(struct userdata* u, int32_t parent_id, p
         return;
     }
 
-    loopback = pa_hashmap_get(u->loopback_modules, (const void*)parent_id);
+    loopback = pa_hashmap_get(u->loopback_modules, PA_INT_TO_PTR(parent_id));
     if (!loopback) {
         loopback = pa_xnew0(loopback_module, 1);
-        pa_hashmap_put(u->loopback_modules, (void*)parent_id, loopback);
+        pa_hashmap_put(u->loopback_modules, PA_INT_TO_PTR(parent_id), loopback);
     }
     if (sink)
         loopback->sink = sink;
@@ -495,7 +495,7 @@ static void load_loopback_module_by_parent_id(struct userdata* u, int32_t parent
         return;
     }
 
-    loopback = pa_hashmap_get(u->loopback_modules, (const void*)parent_id);
+    loopback = pa_hashmap_get(u->loopback_modules, PA_INT_TO_PTR(parent_id));
     if (!loopback) {
         pa_log_error("could not find loopback module for parent_id(%d)", parent_id);
         return;
@@ -540,7 +540,7 @@ static void unload_loopback_modules_by_device_disconnect(struct userdata* u, pa_
            ((sink && (loopback->sink == sink)) ||
            (source && (loopback->source == source)))) {
             pa_log_info("  -- unload module-loopback(%p) for parent_id(%d)", loopback->module, parent_id);
-            pa_hashmap_remove_and_free(u->loopback_modules, (const void*)parent_id);
+            pa_hashmap_remove_and_free(u->loopback_modules, PA_INT_TO_PTR(parent_id));
         }
     }
 }
@@ -557,7 +557,7 @@ static void unload_loopback_modules_by_stream_disconnect(struct userdata* u, int
     if (!i && !o)
         return;
 
-    loopback = pa_hashmap_get(u->loopback_modules, (const void*)parent_id);
+    loopback = pa_hashmap_get(u->loopback_modules, PA_INT_TO_PTR(parent_id));
     if (!loopback)
         return;
 
@@ -582,7 +582,7 @@ static void unload_loopback_modules_by_stream_disconnect(struct userdata* u, int
 
 unload:
     pa_log_info("  -- unload module-loopback(%p) for parent_id(%d)", loopback->module, parent_id);
-    pa_hashmap_remove_and_free(u->loopback_modules, (const void*)parent_id);
+    pa_hashmap_remove_and_free(u->loopback_modules, PA_INT_TO_PTR(parent_id));
 }
 
 static pa_sink *load_combine_sink_module(struct userdata *u, const char *combine_sink_name, pa_sink *sink1, pa_sink *sink2, pa_sink_input *stream)
@@ -897,7 +897,7 @@ static void select_device_by_auto_last_connected_routing(struct userdata *u, pa_
             dm_device_direction = pa_tz_device_get_direction(device);
             dm_device_id = pa_tz_device_get_id(device);
             creation_time = pa_tz_device_get_creation_time(device);
-            pa_log_debug("  -- type[%-16s], direction[0x%x], id[%u], creation_time[%llu]",
+            pa_log_debug("  -- type[%-16s], direction[0x%x], id[%u], creation_time[%" PRIu64 "]",
                             dm_device_type, dm_device_direction, dm_device_id, creation_time);
             if (!pa_safe_streq(device_type, dm_device_type) || !IS_AVAILABLE_DIRECTION(data->stream_type, dm_device_direction))
                 continue;
@@ -1567,7 +1567,7 @@ static pa_hook_result_t handle_auto_last_connected_routing(struct userdata *u, p
             dm_device_direction = pa_tz_device_get_direction(*device);
             dm_device_id = pa_tz_device_get_id(*device);
             creation_time = pa_tz_device_get_creation_time(*device);
-            pa_log_debug("  -- type[%-16s], direction[0x%x], id[%u], creation_time[%llu]",
+            pa_log_debug("  -- type[%-16s], direction[0x%x], id[%u], creation_time[%" PRIu64 "]",
                             dm_device_type, dm_device_direction, dm_device_id, creation_time);
             if (!pa_safe_streq(device_type, dm_device_type) || !IS_AVAILABLE_DIRECTION(data->stream_type, dm_device_direction))
                 continue;
index fe064fb..a5a5871 100644 (file)
@@ -320,7 +320,7 @@ static int process_render(struct userdata *u) {
 
     pa_hal_interface_pcm_available(u->hal_interface, u->pcm_handle, &avail);
     if (frames_to_write > avail) {
-        pa_log_debug("not enough avail size. frames_to_write(%d), avail(%d)", frames_to_write, avail);
+        pa_log_debug("not enough avail size. frames_to_write(%zu), avail(%d)", frames_to_write, avail);
         return 0;
     }
 
@@ -328,7 +328,7 @@ static int process_render(struct userdata *u) {
     p = pa_memblock_acquire(chunk.memblock);
 
     if (pa_hal_interface_pcm_write(u->hal_interface, u->pcm_handle, (const char*)p + chunk.index, (uint32_t)frames_to_write)) {
-        pa_log_error("failed to write pcm. p(%p), size(%d)", p, frames_to_write);
+        pa_log_error("failed to write pcm. p(%p), size(%zu)", p, frames_to_write);
         return -1;
     }
 
index 55bc60a..3df3aef 100644 (file)
@@ -285,7 +285,7 @@ static int process_render(struct userdata *u) {
 
     pa_hal_interface_pcm_available(u->hal_interface, u->pcm_handle, &avail);
     if (frames_to_read > avail) {
-        pa_log_debug("not enough avail size. frames_to_read(%d), avail(%d)", frames_to_read, avail);
+        pa_log_debug("not enough avail size. frames_to_read(%zu), avail(%d)", frames_to_read, avail);
         return 0;
     }
 
@@ -294,7 +294,7 @@ static int process_render(struct userdata *u) {
 
     p = pa_memblock_acquire(chunk.memblock);
     if (pa_hal_interface_pcm_read(u->hal_interface, u->pcm_handle, p, (uint32_t)frames_to_read)) {
-        pa_log_error("failed to read pcm. p(%p), size(%d)", p, frames_to_read);
+        pa_log_error("failed to read pcm. p(%p), size(%zu)", p, frames_to_read);
         return -1;
     }
     pa_memblock_release(chunk.memblock);
index f10e221..096ff5c 100644 (file)
@@ -602,7 +602,7 @@ static void handle_set_stream_route_devices(DBusConnection *conn, DBusMessage *m
     pa_log_info("id[%u], in_device_list[%p]:length[%u], out_device_list[%p]:length[%u]",
         id, in_device_list, list_len_in, out_device_list, list_len_out);
 
-    sp = pa_hashmap_get(m->stream_parents, (const void*)id);
+    sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(id));
     if (!sp) {
         pa_log_error("could not find matching client for this parent_id[%u]", id);
         ret = RET_MSG_ERROR_INTERNAL;
@@ -677,7 +677,7 @@ static void handle_set_stream_route_option(DBusConnection *conn, DBusMessage *ms
                                        DBUS_TYPE_INVALID));
     pa_log_info("id[%u], name[%s], value[%d]", id, name, value);
 
-    sp = pa_hashmap_get(m->stream_parents, (const void*)id);
+    sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(id));
     if (sp) {
         if (name) {
             route_option.name = name;
@@ -774,7 +774,7 @@ static void handle_set_stream_preferred_device(DBusConnection *conn, DBusMessage
                                        DBUS_TYPE_INVALID));
     pa_log_info("stream parent id[%u], device direction[%s], device_id[%u]", sp_id, device_direction, device_id);
 
-    if (!(sp = pa_hashmap_get(m->stream_parents, (const void*)sp_id))) {
+    if (!(sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(sp_id)))) {
         pa_log_error("could not find matching client for this parent_id[%u]", sp_id);
         ret = RET_MSG_ERROR_INTERNAL;
         goto finish;
@@ -904,7 +904,7 @@ static void handle_get_stream_preferred_device(DBusConnection *conn, DBusMessage
 
     pa_assert_se((reply = dbus_message_new_method_return(msg)));
 
-    if (!(sp = pa_hashmap_get(m->stream_parents, (const void*)sp_id))) {
+    if (!(sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(sp_id)))) {
         pa_log_error("could not find matching client for this parent_id[%u]", sp_id);
         ret = RET_MSG_ERROR_INTERNAL;
         goto finish;
@@ -1637,7 +1637,7 @@ static void handle_update_focus_status(DBusConnection *conn, DBusMessage *msg, v
                                        DBUS_TYPE_INVALID));
     pa_log_info("id[%u], acquired_focus_status[0x%x]", id, acquired_focus_status);
 
-    if ((sp = pa_hashmap_get(m->stream_parents, (const void*)id))) {
+    if ((sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(id)))) {
         if (sp->focus_status != acquired_focus_status) {
             /* need to update */
             prev_status = sp->focus_status;
@@ -2099,7 +2099,7 @@ static void handle_activate_ducking(DBusConnection *conn, DBusMessage *msg, void
         id, enable, target_stream, duration, ratio);
 
     /* get stream_ducking */
-    sd = pa_hashmap_get(m->stream_duckings, (const void*)id);
+    sd = pa_hashmap_get(m->stream_duckings, PA_UINT_TO_PTR(id));
     if (!sd) {
         pa_log_error("no matched stream ducking for id[%u]", id);
         ret_msg = RET_MSG_ERROR_INTERNAL;
@@ -2219,7 +2219,7 @@ static void handle_get_ducking_state(DBusConnection *conn, DBusMessage *msg, voi
     pa_assert_se((reply = dbus_message_new_method_return(msg)));
 
     /* get stream_ducking */
-    sd = pa_hashmap_get(m->stream_duckings, (const void *)id);
+    sd = pa_hashmap_get(m->stream_duckings, PA_UINT_TO_PTR(id));
     if (!sd) {
         pa_log_error("no matched stream ducking for id[%u]", id);
         ret_msg = RET_MSG_ERROR_INTERNAL;
index fe45e37..cb12cb9 100644 (file)
@@ -376,7 +376,7 @@ static stream_parent* get_stream_parent(pa_stream_manager *m, pa_object *stream)
         return NULL;
     }
 
-    return pa_hashmap_get(m->stream_parents, (const void*)parent_id_u);
+    return pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(parent_id_u));
 }
 
 static pa_idxset* get_route_devices(pa_stream_manager *m, pa_object *stream) {
@@ -1203,7 +1203,7 @@ static bool update_focus_status_of_stream(pa_stream_manager *m, void *stream, st
     else
         p_idx = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_PARENT_ID);
     if (p_idx && !pa_atou(p_idx, &parent_idx)) {
-        if (!(sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx))) {
+        if (!(sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(parent_idx)))) {
             pa_log_error("could not find matching client for this parent_id(%u)", parent_idx);
             return false;
         }
@@ -1233,7 +1233,7 @@ static void update_preferred_device_role(pa_stream_manager *m, void *stream, str
     if (!p_idx_str || pa_atou(p_idx_str, &parent_idx))
         return;
 
-    if (!(sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx))) {
+    if (!(sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(parent_idx)))) {
         pa_log_error("could not find matching client for this parent_id(%u)", parent_idx);
         return;
     }
@@ -1258,7 +1258,7 @@ static void get_preferred_device_type_and_role(pa_stream_manager *m, void *strea
     if (!p_idx_str || pa_atou(p_idx_str, &parent_idx)) {
         return;
     }
-    if (!(sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx))) {
+    if (!(sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(parent_idx)))) {
         pa_log_warn("could not find matching client for this parent_id(%u)", parent_idx);
         return;
     }
@@ -1283,7 +1283,7 @@ static bool update_stream_parent_info(pa_stream_manager *m, process_command_type
     p_idx = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_PARENT_ID);
     if (p_idx && !pa_atou(p_idx, &parent_idx)) {
         pa_log_debug("p_idx(%s), idx(%u)", p_idx, parent_idx);
-        sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx);
+        sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(parent_idx));
         if (sp) {
             uint32_t idx = GET_STREAM_INDEX(stream, type);
             if (command == PROCESS_COMMAND_ADD_STREAM) {
@@ -1662,7 +1662,7 @@ static void fill_device_info_to_hook_data(pa_stream_manager *m, void *hook_data,
             break;
         }
         /* find parent idx, it's device info. and it's stream idxs */
-        if ((sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx))) {
+        if ((sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(parent_idx)))) {
             select_data->idx_manual_devices = (type == STREAM_SINK_INPUT) ? (sp->idx_route_out_devices) : (sp->idx_route_in_devices);
             break;
         }
@@ -1699,7 +1699,7 @@ static void fill_device_info_to_hook_data(pa_stream_manager *m, void *hook_data,
             pa_log_warn("  -- could not get the parent id of this stream, but keep going...");
             break;
         }
-        if (!(sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx))) {
+        if (!(sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(parent_idx)))) {
             pa_log_warn("  -- failed to get the stream parent of idx(%u)", parent_idx);
             break;
         }
@@ -2930,7 +2930,7 @@ static void find_next_device_for_auto_route(pa_stream_manager *m, stream_route_t
             }
         }
         *next_device = latest_device;
-        pa_log_debug("found next device[%p], creation_time[%llu]", *next_device, latest_creation_time);
+        pa_log_debug("found next device[%p], creation_time[%" PRIu64 "]", *next_device, latest_creation_time);
     }
 
     pa_log_debug("next_device is [%p] for stream_role[%s]/route_type[%d]/stream_type[%d]", *next_device, stream_role, route_type, stream_type);
@@ -3427,19 +3427,19 @@ static void mute_sink_inputs_as_device_disconnection(pa_stream_manager *m, uint3
             return;
         }
         apply_volume_factor_to_streams(streams_of_disconnected_device, &applied_streams);
-        pa_hashmap_put(m->muted_streams, (void*)event_id, applied_streams);
+        pa_hashmap_put(m->muted_streams, PA_UINT_TO_PTR(event_id), applied_streams);
 
         /* If PA_COMMUNICATOR_HOOK_EVENT_FULLY_HANDLED is not called for some reason,
         * volume factor should be removed forcedly. */
         if (!m->time_event_for_unmute)
             m->time_event_for_unmute = pa_core_rttime_new(m->core, pa_rtclock_now() + TIMED_UNMUTE_USEC, timed_unmute_cb, m);
     } else {
-        if (!(applied_streams = pa_hashmap_get(m->muted_streams, (void*)event_id))) {
+        if (!(applied_streams = pa_hashmap_get(m->muted_streams, PA_UINT_TO_PTR(event_id)))) {
             pa_log_debug("could not find applied_streams for event_id(%u)", event_id);
             return;
         }
         clear_volume_factor_from_streams(applied_streams);
-        pa_hashmap_remove(m->muted_streams, (void*)event_id);
+        pa_hashmap_remove(m->muted_streams, PA_UINT_TO_PTR(event_id));
     }
 
     return;
@@ -3640,7 +3640,7 @@ static void subscribe_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t
             sp->idx_source_outputs = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
             sp->idx_route_in_devices = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
             sp->idx_route_out_devices = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-            pa_hashmap_put(m->stream_parents, (void*)idx, sp);
+            pa_hashmap_put(m->stream_parents, PA_UINT_TO_PTR(idx), sp);
             pa_log_debug(" - add sp(%p), idx(%u)", sp, idx);
             return;
         } else if (pa_safe_streq(name, STREAM_MANAGER_CLIENT_DUCKING)) {
@@ -3648,16 +3648,16 @@ static void subscribe_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t
             sd = pa_xmalloc0(sizeof(stream_ducking));
             sd->idx_ducking_streams = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
             sd->trigger_index = idx;
-            pa_hashmap_put(m->stream_duckings, (void *)idx, sd);
+            pa_hashmap_put(m->stream_duckings, PA_UINT_TO_PTR(idx), sd);
             pa_log_debug(" - add sd(%p), trigger_index(%u)", sd, idx);
             return;
         }
     } else if (t == (PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE)) {
         /* try to find stream parent with idx */
-        sp = pa_hashmap_get(m->stream_parents, (const void*)idx);
+        sp = pa_hashmap_get(m->stream_parents, PA_UINT_TO_PTR(idx));
         if (sp) {
             pa_log_debug(" - remove sp(%p), idx(%u)", sp, idx);
-            pa_hashmap_remove(m->stream_parents, (const void*)idx);
+            pa_hashmap_remove(m->stream_parents, PA_UINT_TO_PTR(idx));
             pa_idxset_free(sp->idx_sink_inputs, NULL);
             pa_idxset_free(sp->idx_source_outputs, NULL);
             if (sp->idx_route_in_devices)
@@ -3669,7 +3669,7 @@ static void subscribe_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t
         }
 
         /* try to find sd with idx */
-        sd = pa_hashmap_get(m->stream_duckings, (const void*)idx);
+        sd = pa_hashmap_get(m->stream_duckings, PA_UINT_TO_PTR(idx));
         if (sd) {
             uint32_t ducking_idx = 0;
             pa_sink_input *stream = NULL;
@@ -3698,7 +3698,7 @@ static void subscribe_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t
             }
 
             pa_idxset_free(sd->idx_ducking_streams, NULL);
-            pa_hashmap_remove(m->stream_duckings, (const void*)idx);
+            pa_hashmap_remove(m->stream_duckings, PA_UINT_TO_PTR(idx));
             pa_xfree(sd);
             return;
         }