[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v1.0-dev-225-g77da2c4

Colin Guthrie gitmailer-noreply at 0pointer.de
Mon Mar 28 01:53:55 PDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  a1bbe214386e9823906059d8c1a9801115ca7f20 (commit)

- Log -----------------------------------------------------------------
77da2c4 alsa-mixer: Get rid of a compiler warning.
60f1919 .gitignore: Add ChangeLog to the ignore list.
-----------------------------------------------------------------------

Summary of changes:
 .gitignore                    |    1 +
 src/modules/alsa/alsa-mixer.c |    4 ++--
 src/pulsecore/core-util.c     |   31 +++++++++++++++++++++++--------
 src/pulsecore/core-util.h     |    1 +
 4 files changed, 27 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------

commit 60f191941b628947398207a26a2f6a3c463db7bb
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sun Mar 27 19:14:54 2011 +0300

    .gitignore: Add ChangeLog to the ignore list.

diff --git a/.gitignore b/.gitignore
index 85c0fe5..3a840d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@ libtool
 ltmain.sh
 missing
 stamp-*
+ChangeLog

commit 77da2c4bcf843980fe27d4878a468741bdad3a38
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sun Mar 27 21:35:03 2011 +0300

    alsa-mixer: Get rid of a compiler warning.
    
    On 64-bit systems LONG_MAX is greater than the largest possible value of a
    uint32_t variable, which caused the compiler to warn about a comparison that is
    always false. On 32-bit systems pa_atou() can return a value that will overflow
    when assigned to e->volume_limit, which has type long, so the comparison was
    necessary.
    
    This dilemma is resolved by using pa_atol() instead of pa_atou().

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 286931f..3b13879 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1920,14 +1920,14 @@ static int element_parse_volume_limit(
 
     pa_alsa_path *p = userdata;
     pa_alsa_element *e;
-    uint32_t volume_limit;
+    long volume_limit;
 
     if (!(e = element_get(p, section, TRUE))) {
         pa_log("[%s:%u] volume-limit makes no sense in '%s'", filename, line, section);
         return -1;
     }
 
-    if (pa_atou(rvalue, &volume_limit) < 0 || volume_limit > LONG_MAX) {
+    if (pa_atol(rvalue, &volume_limit) < 0 || volume_limit < 0) {
         pa_log("[%s:%u] Invalid value for volume-limit", filename, line);
         return -1;
     }
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 4823198..f769b32 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2012,20 +2012,13 @@ char *pa_state_path(const char *fn, pa_bool_t appendmid) {
 
 /* Convert the string s to a signed integer in *ret_i */
 int pa_atoi(const char *s, int32_t *ret_i) {
-    char *x = NULL;
     long l;
 
     pa_assert(s);
     pa_assert(ret_i);
 
-    errno = 0;
-    l = strtol(s, &x, 0);
-
-    if (!x || *x || errno) {
-        if (!errno)
-            errno = EINVAL;
+    if (pa_atol(s, &l) < 0)
         return -1;
-    }
 
     if ((int32_t) l != l) {
         errno = ERANGE;
@@ -2064,6 +2057,28 @@ int pa_atou(const char *s, uint32_t *ret_u) {
     return 0;
 }
 
+/* Convert the string s to a signed long integer in *ret_l. */
+int pa_atol(const char *s, long *ret_l) {
+    char *x = NULL;
+    long l;
+
+    pa_assert(s);
+    pa_assert(ret_l);
+
+    errno = 0;
+    l = strtol(s, &x, 0);
+
+    if (!x || *x || errno) {
+        if (!errno)
+            errno = EINVAL;
+        return -1;
+    }
+
+    *ret_l = l;
+
+    return 0;
+}
+
 #ifdef HAVE_STRTOF_L
 static locale_t c_locale = NULL;
 
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index 32641a3..0b34a18 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -135,6 +135,7 @@ char *pa_state_path(const char *fn, pa_bool_t prepend_machine_id);
 
 int pa_atoi(const char *s, int32_t *ret_i);
 int pa_atou(const char *s, uint32_t *ret_u);
+int pa_atol(const char *s, long *ret_l);
 int pa_atod(const char *s, double *ret_d);
 
 size_t pa_snprintf(char *str, size_t size, const char *format, ...);

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list