size_t old_size, new_size, start;
assert(m);
-
- if (m->poisoned)
- return NULL;
+ assert_return(!m->poisoned, NULL);
old_size = sizeof(struct bus_header) + m->header->fields_size;
start = ALIGN_TO(old_size, align);
struct bus_body_part *part;
assert(m);
-
- if (m->poisoned)
- return NULL;
+ assert_return(!m->poisoned, NULL);
if (m->n_body_parts <= 0) {
part = &m->body;
assert(m);
assert(align > 0);
assert(!m->sealed);
-
- if (m->poisoned)
- return NULL;
+ assert_return(!m->poisoned, NULL);
start_body = ALIGN_TO((size_t) m->header->body_size, align);
end_body = start_body + sz;
}
static size_t determine_word_size(size_t sz, size_t extra) {
- if (sz <= 0 && extra == 0)
- return 0;
- else if (sz + extra <= 0xFF)
+ if (sz + extra <= 0xFF)
return 1;
else if (sz + extra*2 <= 0xFFFF)
return 2;
}
part = find_part(m, start, nbytes, (void**) &q);
- if (!part || !q)
+ if (!part || (nbytes > 0 && !q))
return -EBADMSG;
*rindex = end;
m->rindex = c->begin;
}
+ c->offset_index = 0;
+ c->item_size = c->n_offsets > 0 ? c->offsets[0] : c->end;
+
return !isempty(c->signature);
}
uint32_t unix_fds = 0;
void *offsets = NULL;
unsigned n_offsets = 0;
- size_t sz;
+ size_t sz = 0;
unsigned i = 0;
assert(m);
if (m->n_fds != unix_fds)
return -EBADMSG;
- if (isempty(m->root_container.signature) != (BUS_MESSAGE_BODY_SIZE(m) == 0))
- return -EBADMSG;
-
switch (m->header->type) {
case SD_BUS_MESSAGE_SIGNAL: