Skip to content

spa: Fix sign conversion in SPA_IS_ALIGNED

Jonas Holmberg requested to merge jij/pipewire:master into master

Fix the following compiler warning:

| In file included from /usr/include/spa-0.2/spa/utils/dict.h:14,
|                  from ../src/util_pipewire_objects.c:15:
| /usr/include/spa-0.2/spa/utils/defs.h: In function 'spa_ptr_inside_and_aligned':
| /usr/include/spa-0.2/spa/utils/defs.h:275:56: error: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Werror=sign-conversion]
|   275 | #define SPA_PTR_ALIGNMENT(p,align)      ((intptr_t)(p) & ((align)-1))
|       |                                                        ^
| /usr/include/spa-0.2/spa/utils/defs.h:276:42: note: in expansion of macro 'SPA_PTR_ALIGNMENT'
|   276 | #define SPA_IS_ALIGNED(p,align)         (SPA_PTR_ALIGNMENT(p,align) == 0)
|       |                                          ^~~~~~~~~~~~~~~~~
| /usr/include/spa-0.2/spa/utils/defs.h:308:13: note: in expansion of macro 'SPA_IS_ALIGNED'
|   308 |         if (SPA_IS_ALIGNED(p2, align)) {
|       |             ^~~~~~~~~~~~~~
Edited by Jonas Holmberg

Merge request reports