[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] alsa: Fix compile warnings

Tanu Kaskinen gitlab at gitlab.freedesktop.org
Mon Nov 23 16:23:33 UTC 2020



Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio


Commits:
e99e862a by Pali Rohár at 2020-11-23T16:06:03+00:00
alsa: Fix compile warnings

modules/alsa/alsa-sink.c: In function ‘pa_alsa_sink_new’:
modules/alsa/alsa-sink.c:2603:15: warning: declaration of ‘state’ shadows a previous local [-Wshadow]
         void *state;
               ^~~~~
modules/alsa/alsa-sink.c:2270:11: note: shadowed declaration is here
     void *state = NULL;
           ^~~~~
  CC       modules/alsa/module_alsa_sink_la-module-alsa-sink.lo
modules/alsa/alsa-source.c: In function ‘pa_alsa_source_new’:
modules/alsa/alsa-source.c:2289:15: warning: declaration of ‘state’ shadows a previous local [-Wshadow]
         void *state;
               ^~~~~
modules/alsa/alsa-source.c:1975:11: note: shadowed declaration is here
     void *state = NULL;
           ^~~~~
modules/alsa/module-alsa-card.c: In function ‘prune_singleton_availability_groups’:
modules/alsa/module-alsa-card.c:691:71: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
             pa_hashmap_put(group_counts, p->availability_group, count + 1);
                                                                       ^

- - - - -


3 changed files:

- src/modules/alsa/alsa-sink.c
- src/modules/alsa/alsa-source.c
- src/modules/alsa/module-alsa-card.c


Changes:

=====================================
src/modules/alsa/alsa-sink.c
=====================================
@@ -2267,7 +2267,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     bool volume_is_set;
     bool mute_is_set;
     pa_alsa_profile_set *profile_set = NULL;
-    void *state = NULL;
+    void *state;
 
     pa_assert(m);
     pa_assert(ma);
@@ -2563,6 +2563,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, mapping->name);
         pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, mapping->description);
 
+        state = NULL;
         while ((key = pa_proplist_iterate(mapping->proplist, &state)))
             pa_proplist_sets(data.proplist, key, pa_proplist_gets(mapping->proplist, key));
     }
@@ -2600,7 +2601,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 
     if (u->ucm_context) {
         pa_device_port *port;
-        void *state;
         unsigned h_prio = 0;
         PA_HASHMAP_FOREACH(port, u->sink->ports, state) {
             if (!h_prio || port->priority > h_prio)


=====================================
src/modules/alsa/alsa-source.c
=====================================
@@ -1972,7 +1972,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     bool volume_is_set;
     bool mute_is_set;
     pa_alsa_profile_set *profile_set = NULL;
-    void *state = NULL;
+    void *state;
 
     pa_assert(m);
     pa_assert(ma);
@@ -2250,6 +2250,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
         pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, mapping->name);
         pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, mapping->description);
 
+        state = NULL;
         while ((key = pa_proplist_iterate(mapping->proplist, &state)))
             pa_proplist_sets(data.proplist, key, pa_proplist_gets(mapping->proplist, key));
     }
@@ -2286,7 +2287,6 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 
     if (u->ucm_context) {
         pa_device_port *port;
-        void *state;
         unsigned h_prio = 0;
         PA_HASHMAP_FOREACH(port, u->source->ports, state) {
             if (!h_prio || port->priority > h_prio)


=====================================
src/modules/alsa/module-alsa-card.c
=====================================
@@ -688,7 +688,7 @@ static void prune_singleton_availability_groups(pa_hashmap *ports) {
         if (p->availability_group) {
             count = pa_hashmap_get(group_counts, p->availability_group);
             pa_hashmap_remove(group_counts, p->availability_group);
-            pa_hashmap_put(group_counts, p->availability_group, count + 1);
+            pa_hashmap_put(group_counts, p->availability_group, PA_UINT_TO_PTR(PA_PTR_TO_UINT(count) + 1));
         }
     }
 



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e99e862a3df43c2405dfdf65f30528fc40cf4b93

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e99e862a3df43c2405dfdf65f30528fc40cf4b93
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20201123/6066a9b1/attachment-0001.htm>


More information about the pulseaudio-commits mailing list