aboutsummaryrefslogtreecommitdiffstats
path: root/lv2/lv2plug.in/ns/ext
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-01-24 01:49:18 +0000
committerDavid Robillard <d@drobilla.net>2014-01-24 01:49:18 +0000
commit0824237942af542431a8348c55c367242d1bf49a (patch)
treeab9afb3a202b434c2198a071bcb8336f2976f2a3 /lv2/lv2plug.in/ns/ext
parent1cb9f77d07c998108d0ba54811ac4604a2b49725 (diff)
downloadlv2-0824237942af542431a8348c55c367242d1bf49a.tar.xz
Fix -Wconversion warnings in headers.
Diffstat (limited to 'lv2/lv2plug.in/ns/ext')
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/forge.h5
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/util.h8
-rw-r--r--lv2/lv2plug.in/ns/ext/event/event-helpers.h33
3 files changed, 25 insertions, 21 deletions
diff --git a/lv2/lv2plug.in/ns/ext/atom/forge.h b/lv2/lv2plug.in/ns/ext/atom/forge.h
index 5fcfa38..3ee3aa7 100644
--- a/lv2/lv2plug.in/ns/ext/atom/forge.h
+++ b/lv2/lv2plug.in/ns/ext/atom/forge.h
@@ -248,7 +248,7 @@ static inline void
lv2_atom_forge_set_buffer(LV2_Atom_Forge* forge, uint8_t* buf, size_t size)
{
forge->buf = buf;
- forge->size = size;
+ forge->size = (uint32_t)size;
forge->offset = 0;
forge->deref = NULL;
forge->sink = NULL;
@@ -370,7 +370,8 @@ lv2_atom_forge_primitive(LV2_Atom_Forge* forge, const LV2_Atom* a)
if (lv2_atom_forge_top_is(forge, forge->Vector)) {
return lv2_atom_forge_raw(forge, LV2_ATOM_BODY_CONST(a), a->size);
} else {
- return lv2_atom_forge_write(forge, a, sizeof(LV2_Atom) + a->size);
+ return lv2_atom_forge_write(
+ forge, a, (uint32_t)sizeof(LV2_Atom) + a->size);
}
}
diff --git a/lv2/lv2plug.in/ns/ext/atom/util.h b/lv2/lv2plug.in/ns/ext/atom/util.h
index 97f6dfb..d306e1c 100644
--- a/lv2/lv2plug.in/ns/ext/atom/util.h
+++ b/lv2/lv2plug.in/ns/ext/atom/util.h
@@ -41,14 +41,14 @@ extern "C" {
static inline uint32_t
lv2_atom_pad_size(uint32_t size)
{
- return (size + 7) & (~7);
+ return (size + 7U) & (~7U);
}
/** Return the total size of @p atom, including the header. */
static inline uint32_t
lv2_atom_total_size(const LV2_Atom* atom)
{
- return sizeof(LV2_Atom) + atom->size;
+ return (uint32_t)sizeof(LV2_Atom) + atom->size;
}
/** Return true iff @p atom is null. */
@@ -207,8 +207,8 @@ lv2_atom_object_next(const LV2_Atom_Property_Body* i)
const LV2_Atom* const value = (const LV2_Atom*)(
(const uint8_t*)i + 2 * sizeof(uint32_t));
return (LV2_Atom_Property_Body*)(
- (const uint8_t*)i + lv2_atom_pad_size(sizeof(LV2_Atom_Property_Body)
- + value->size));
+ (const uint8_t*)i + lv2_atom_pad_size(
+ (uint32_t)sizeof(LV2_Atom_Property_Body) + value->size));
}
/**
diff --git a/lv2/lv2plug.in/ns/ext/event/event-helpers.h b/lv2/lv2plug.in/ns/ext/event/event-helpers.h
index 5420271..b748395 100644
--- a/lv2/lv2plug.in/ns/ext/event/event-helpers.h
+++ b/lv2/lv2plug.in/ns/ext/event/event-helpers.h
@@ -50,7 +50,7 @@ extern "C" {
static inline uint16_t
lv2_event_pad_size(uint16_t size)
{
- return (size + 7) & (~7);
+ return (uint16_t)(size + 7U) & (uint16_t)(~7U);
}
@@ -60,7 +60,7 @@ lv2_event_pad_size(uint16_t size)
static inline void
lv2_event_buffer_reset(LV2_Event_Buffer* buf,
uint16_t stamp_type,
- uint8_t *data)
+ uint8_t* data)
{
buf->data = data;
buf->header_size = sizeof(LV2_Event_Buffer);
@@ -130,7 +130,8 @@ lv2_event_increment(LV2_Event_Iterator* iter)
LV2_Event* const ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);
- iter->offset += lv2_event_pad_size(sizeof(LV2_Event) + ev->size);
+ iter->offset += lv2_event_pad_size(
+ (uint16_t)((uint16_t)sizeof(LV2_Event) + ev->size));
return true;
}
@@ -190,7 +191,7 @@ lv2_event_write(LV2_Event_Iterator* iter,
memcpy((uint8_t*)ev + sizeof(LV2_Event), data, size);
++iter->buf->event_count;
- size = lv2_event_pad_size(sizeof(LV2_Event) + size);
+ size = lv2_event_pad_size((uint16_t)(sizeof(LV2_Event) + size));
iter->buf->size += size;
iter->offset += size;
@@ -208,11 +209,12 @@ lv2_event_reserve(LV2_Event_Iterator* iter,
uint16_t type,
uint16_t size)
{
- if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size)
+ const uint16_t total_size = (uint16_t)(sizeof(LV2_Event) + size);
+ if (iter->buf->capacity - iter->buf->size < total_size)
return NULL;
- LV2_Event* const ev = (LV2_Event*)((uint8_t*)iter->buf->data +
- iter->offset);
+ LV2_Event* const ev = (LV2_Event*)(
+ (uint8_t*)iter->buf->data + iter->offset);
ev->frames = frames;
ev->subframes = subframes;
@@ -220,9 +222,9 @@ lv2_event_reserve(LV2_Event_Iterator* iter,
ev->size = size;
++iter->buf->event_count;
- size = lv2_event_pad_size(sizeof(LV2_Event) + size);
- iter->buf->size += size;
- iter->offset += size;
+ const uint16_t padded_size = lv2_event_pad_size(total_size);
+ iter->buf->size += padded_size;
+ iter->offset += padded_size;
return (uint8_t*)ev + sizeof(LV2_Event);
}
@@ -238,19 +240,20 @@ lv2_event_write_event(LV2_Event_Iterator* iter,
const LV2_Event* ev,
const uint8_t* data)
{
- if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + ev->size)
+ const uint16_t total_size = (uint16_t)(sizeof(LV2_Event) + ev->size);
+ if (iter->buf->capacity - iter->buf->size < total_size)
return false;
LV2_Event* const write_ev = (LV2_Event*)(
- (uint8_t*)iter->buf->data + iter->offset);
+ (uint8_t*)iter->buf->data + iter->offset);
*write_ev = *ev;
memcpy((uint8_t*)write_ev + sizeof(LV2_Event), data, ev->size);
++iter->buf->event_count;
- const uint16_t size = lv2_event_pad_size(sizeof(LV2_Event) + ev->size);
- iter->buf->size += size;
- iter->offset += size;
+ const uint16_t padded_size = lv2_event_pad_size(total_size);
+ iter->buf->size += padded_size;
+ iter->offset += padded_size;
return true;
}