[pulseaudio-commits] 2 commits - src/modules src/pulsecore

Peter Meerwald pmeerw at kemper.freedesktop.org
Thu Feb 18 13:09:19 UTC 2016


 src/modules/module-stream-restore.c |    2 +-
 src/pulsecore/macro.h               |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 93822f98f46425e4667e1c032e9ada166ef2d9a7
Author: Peter Meerwald <pmeerw at pmeerw.net>
Date:   Mon Feb 15 23:05:03 2016 +0100

    core: Fix GCC 6 compiler warning regarding left shift of negative value
    
    In file included from pulse/timeval.c:32:0:
    pulse/timeval.c: In function 'pa_timeval_add':
    ./pulsecore/macro.h:303:28: warning: left shift of negative value [-Wshift-negative-value]
                  ? ~(~(type) 0 << (8*sizeof(type)-1))
    
    reported by Ubuntu gcc-6
    
    gcc-6 adds -Wshift-negative-value (enabled by -Wextra) which warns
    about left shifting a negative value. Such shifts are undefined
    because they depend on the representation of negative values.
    
    also works with -Wshift-overflow=2
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index 1716f81..1e15f4f 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -298,14 +298,16 @@ static inline size_t PA_PAGE_ALIGN(size_t l) {
 
 #define PA_INT_TYPE_SIGNED(type) (!!((type) 0 > (type) -1))
 
+#define PA_INT_TYPE_HALF(type) ((type) 1 << (sizeof(type)*8 - 2))
+
 #define PA_INT_TYPE_MAX(type)                                          \
     ((type) (PA_INT_TYPE_SIGNED(type)                                  \
-             ? ~(~(type) 0 << (8*sizeof(type)-1))                      \
+             ? (PA_INT_TYPE_HALF(type) - 1 + PA_INT_TYPE_HALF(type))   \
              : (type) -1))
 
 #define PA_INT_TYPE_MIN(type)                                          \
     ((type) (PA_INT_TYPE_SIGNED(type)                                  \
-             ? (~(type) 0 << (8*sizeof(type)-1))                       \
+             ? (-1 - PA_INT_TYPE_MAX(type))                            \
              : (type) 0))
 
 /* We include this at the very last place */

commit 571aadfe3be797bd9e918df54042fe821cf9b213
Author: Peter Meerwald <pmeerw at pmeerw.net>
Date:   Wed Jan 13 23:52:11 2016 +0100

    modules: Fix compiler warning comparing 0 with bool
    
    modules/module-stream-restore.c: In function 'clean_up_db':
    modules/module-stream-restore.c:2344:74: warning: comparison of constant '0' with boolean expression is always true [-Wbool-compare]
             pa_assert_se(entry_write(u, item->entry_name, item->entry, true) >= 0);
    
    reported by Ubuntu gcc-6
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index ac51ff3..37555a8 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -2341,7 +2341,7 @@ static void clean_up_db(struct userdata *u) {
     PA_LLIST_FOREACH_SAFE(item, next, to_be_converted) {
         pa_log_debug("Upgrading a legacy entry to the current format: %s", item->entry_name);
 
-        pa_assert_se(entry_write(u, item->entry_name, item->entry, true) >= 0);
+        pa_assert_se(entry_write(u, item->entry_name, item->entry, true));
         trigger_save(u);
 
         PA_LLIST_REMOVE(struct clean_up_item, to_be_converted, item);



More information about the pulseaudio-commits mailing list