1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

mapping: default to node samplelen if now range for data mapping is given

This commit is contained in:
Steffen Vogel 2017-08-31 11:31:09 +02:00
parent bdd65982ed
commit 2001c49d53

View file

@ -27,6 +27,7 @@
#include "sample.h"
#include "list.h"
#include "utils.h"
#include "node.h"
int mapping_parse_str(struct mapping_entry *e, const char *str, struct list *nodes)
{
@ -158,7 +159,7 @@ int mapping_parse_str(struct mapping_entry *e, const char *str, struct list *nod
}
else {
e->data.offset = 0;
e->length = 0; /* Length in unkown.. we will take all values */
e->length = e->node->samplelen;
}
}
else
@ -193,7 +194,7 @@ int mapping_parse(struct mapping_entry *e, json_t *j, struct list *nodes)
int mapping_parse_list(struct list *l, json_t *cfg, struct list *nodes)
{
int ret, off, len;
int ret, off;
size_t i;
json_t *json_entry;
@ -209,7 +210,6 @@ int mapping_parse_list(struct list *l, json_t *cfg, struct list *nodes)
return -1;
off = 0;
len = json_array_size(json_mapping);
json_array_foreach(json_mapping, i, json_entry) {
struct mapping_entry *e = alloc(sizeof(struct mapping_entry));
@ -217,10 +217,6 @@ int mapping_parse_list(struct list *l, json_t *cfg, struct list *nodes)
if (ret)
return ret;
/* Variable length mapping entries are currently only supported as the last element in a mapping */
if (e->length == 0 && i != len - 1)
return -1;
e->offset = off;
off += e->length;
@ -359,4 +355,4 @@ int mapping_remap(struct list *m, struct sample *remapped, struct sample *origin
}
return 0;
}
}