From 37f5bfe24c2fdb9fedd1fb77b4c3eb0f2d10b772 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 18 Oct 2017 17:15:56 +0200 Subject: [PATCH] c++: more porting --- include/villas/fpga/ips/model.h | 18 +++++++++++------- include/villas/node_type.h | 2 +- include/villas/plugin.h | 4 ++-- lib/hooks/restart.c | 4 ++-- lib/node_type.c | 2 +- lib/path.c | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/villas/fpga/ips/model.h b/include/villas/fpga/ips/model.h index dadefe4fd..441ae2cf1 100644 --- a/include/villas/fpga/ips/model.h +++ b/include/villas/fpga/ips/model.h @@ -53,6 +53,15 @@ union model_parameter_value { bool bol; }; +struct xsg_model { + uint32_t *map; + ssize_t maplen; +}; + +struct hls_model { + +}; + struct model { enum model_type type; /**< Either HLS or XSG model */ @@ -60,13 +69,8 @@ struct model { struct list infos; /**< A list of key / value pairs with model details */ union { - struct xsg_model { - uint32_t *map; - ssize_t maplen; - } xsg; /**< XSG specific model data */ - struct hls_model { - - } hls; /**< HLS specific model data */ + struct xsg_model xsg; /**< XSG specific model data */ + struct hls_model hls; /**< HLS specific model data */ }; }; diff --git a/include/villas/node_type.h b/include/villas/node_type.h index 5b3948bab..1667cfc7d 100644 --- a/include/villas/node_type.h +++ b/include/villas/node_type.h @@ -164,6 +164,6 @@ int node_type_start(struct node_type *vt, struct super_node *sn); int node_type_stop(struct node_type *vt); /** Return a printable representation of the node-type. */ -char * node_type_name(struct node_type *vt); +const char * node_type_name(struct node_type *vt); /** @} */ diff --git a/include/villas/plugin.h b/include/villas/plugin.h index 9b71b7e46..0277ccc62 100644 --- a/include/villas/plugin.h +++ b/include/villas/plugin.h @@ -60,8 +60,8 @@ enum plugin_type { }; struct plugin { - char *name; - char *description; + const char *name; + const char *description; void *handle; char *path; diff --git a/lib/hooks/restart.c b/lib/hooks/restart.c index 5b72418bf..0ff87433f 100644 --- a/lib/hooks/restart.c +++ b/lib/hooks/restart.c @@ -54,7 +54,7 @@ static int restart_stop(struct hook *h) static int restart_read(struct hook *h, struct sample *smps[], unsigned *cnt) { - int i; + unsigned i; struct restart *r = (struct restart *) h->_vd; struct sample *prev, *cur = NULL; @@ -65,7 +65,7 @@ static int restart_read(struct hook *h, struct sample *smps[], unsigned *cnt) if (prev) { /* A wrap around of the sequence no should not be treated as a simulation restart */ - if (cur->sequence == 0 && prev->sequence <= UINT32_MAX - 128) { + if (cur->sequence == 0 && prev->sequence <= (int) (UINT32_MAX - 128)) { warn("Simulation from node %s restarted (previous->seq=%u, current->seq=%u)", node_name(h->node), prev->sequence, cur->sequence); diff --git a/lib/node_type.c b/lib/node_type.c index e128b4d1b..2459bba2c 100644 --- a/lib/node_type.c +++ b/lib/node_type.c @@ -65,7 +65,7 @@ int node_type_stop(struct node_type *vt) return ret; } -char * node_type_name(struct node_type *vt) +const char * node_type_name(struct node_type *vt) { return plugin_name(vt); } diff --git a/lib/path.c b/lib/path.c index 3c0ae3a5f..ab61e281a 100644 --- a/lib/path.c +++ b/lib/path.c @@ -604,7 +604,7 @@ int path_start(struct path *p) struct path_source *ps = (struct path_source *) list_at(&p->sources, i); for (size_t j = 0; j < list_length(&ps->mappings); j++) { - struct mapping_entry *me = (struct path_source *) list_at(&ps->mappings, j); + struct mapping_entry *me = (struct mapping_entry *) list_at(&ps->mappings, j); int len = me->length; int off = me->offset;