mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
Fix compiler issues with c++
This commit is contained in:
parent
72e98dc74a
commit
f049d3dc7f
8 changed files with 18 additions and 15 deletions
|
|
@ -54,7 +54,7 @@ struct pw_array {
|
|||
#define pw_array_check_index(a,idx,t) pw_array_check_index_s(a,idx,sizeof(t))
|
||||
|
||||
#define pw_array_for_each(pos, array) \
|
||||
for (pos = (array)->data; \
|
||||
for (pos = (__typeof__(pos)) (array)->data; \
|
||||
(const uint8_t *) pos < ((const uint8_t *) (array)->data + (array)->size); \
|
||||
(pos)++)
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ static inline void *pw_array_add(struct pw_array *arr, size_t size)
|
|||
if (!pw_array_ensure_size(arr, size))
|
||||
return NULL;
|
||||
|
||||
p = arr->data + arr->size;
|
||||
p = SPA_MEMBER(arr->data, arr->size, void);
|
||||
arr->size += size;
|
||||
|
||||
return p;
|
||||
|
|
@ -117,7 +117,7 @@ static inline void *pw_array_add_fixed(struct pw_array *arr, size_t size)
|
|||
if (SPA_UNLIKELY(arr->alloc < arr->size + size))
|
||||
return NULL;
|
||||
|
||||
p = arr->data + arr->size;
|
||||
p = SPA_MEMBER(arr->data, arr->size, void);
|
||||
arr->size += size;
|
||||
|
||||
return p;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ pw_log_logv(enum spa_log_level level,
|
|||
#include <stdarg.h>
|
||||
|
||||
#define PW_LOG_FUNC(name,lev) \
|
||||
static inline void pw_log_##name (const char *format, ...) SPA_PRINTF_FUNC(1, 0); \
|
||||
static inline void pw_log_##name (const char *format, ...) \
|
||||
{ \
|
||||
if (SPA_UNLIKELY(pw_log_level_enabled(lev))) { \
|
||||
va_list varargs; \
|
||||
|
|
|
|||
|
|
@ -95,14 +95,14 @@ static inline uint32_t pw_map_insert_new(struct pw_map *map, void *data)
|
|||
uint32_t id;
|
||||
|
||||
if (map->free_list) {
|
||||
start = map->items.data;
|
||||
start = (union pw_map_item *) map->items.data;
|
||||
item = &start[map->free_list >> 1];
|
||||
map->free_list = item->next;
|
||||
} else {
|
||||
item = pw_array_add(&map->items, sizeof(union pw_map_item));
|
||||
item = (union pw_map_item *) pw_array_add(&map->items, sizeof(union pw_map_item));
|
||||
if (!item)
|
||||
return SPA_ID_INVALID;
|
||||
start = map->items.data;
|
||||
start = (union pw_map_item *) map->items.data;
|
||||
}
|
||||
item->data = data;
|
||||
id = (item - start);
|
||||
|
|
@ -124,7 +124,7 @@ static inline bool pw_map_insert_at(struct pw_map *map, uint32_t id, void *data)
|
|||
if (id > size)
|
||||
return false;
|
||||
else if (id == size)
|
||||
item = pw_array_add(&map->items, sizeof(union pw_map_item));
|
||||
item = (union pw_map_item *) pw_array_add(&map->items, sizeof(union pw_map_item));
|
||||
else
|
||||
item = pw_map_get_item(map, id);
|
||||
|
||||
|
|
|
|||
|
|
@ -143,4 +143,5 @@ pw_get_support(uint32_t *n_support);
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PIPEWIRE_H__ */
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define __PIPEWIRE_PROPERTIES_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/dict.h>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ pw_strip(char *str, const char *whitespace);
|
|||
static inline struct spa_pod *
|
||||
pw_spa_pod_copy(const struct spa_pod *pod)
|
||||
{
|
||||
return pod ? memcpy(malloc(SPA_POD_SIZE(pod)), pod, SPA_POD_SIZE(pod)) : NULL;
|
||||
return pod ?
|
||||
(struct spa_pod *) memcpy(malloc(SPA_POD_SIZE(pod)), pod, SPA_POD_SIZE(pod))
|
||||
: NULL;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue