aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-08-03 10:53:36 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-08-03 10:53:36 +0200
commitea1ad7bdf737c4aef17e7daee5512842e108e96d (patch)
treec06d086e0dfcdd8d06462bff9200391e975442ea
parent25ed6fac428124f667a86312ae919e5c012598c1 (diff)
downloadd2tk-ea1ad7bdf737c4aef17e7daee5512842e108e96d.zip
d2tk-ea1ad7bdf737c4aef17e7daee5512842e108e96d.tar.gz
d2tk-ea1ad7bdf737c4aef17e7daee5512842e108e96d.tar.bz2
d2tk-ea1ad7bdf737c4aef17e7daee5512842e108e96d.tar.xz
valgrind: fix uninitialized values.
-rw-r--r--VERSION2
-rw-r--r--src/base.c16
-rw-r--r--test/base.c4
3 files changed, 13 insertions, 9 deletions
diff --git a/VERSION b/VERSION
index e9d9580..509a32c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.759
+0.1.761
diff --git a/src/base.c b/src/base.c
index da1df31..04a665d 100644
--- a/src/base.c
+++ b/src/base.c
@@ -483,7 +483,7 @@ d2tk_layout_begin(const d2tk_rect_t *rect, unsigned N, const d2tk_coord_t *frac,
unsigned tot = 0;
unsigned missing = 0;
- for(unsigned i = 0; i < N; i ++)
+ for(unsigned i = 0; i < N; i++)
{
tot += frac[i];
@@ -536,13 +536,16 @@ d2tk_layout_begin(const d2tk_rect_t *rect, unsigned N, const d2tk_coord_t *frac,
D2TK_API bool
d2tk_layout_not_end(d2tk_layout_t *lay)
{
- return lay->k < lay->N;
+ return lay;
}
D2TK_API d2tk_layout_t *
d2tk_layout_next(d2tk_layout_t *lay)
{
- ++lay->k;
+ if(++lay->k >= lay->N)
+ {
+ return NULL;
+ }
if(lay->flag & D2TK_FLAG_LAYOUT_Y)
{
@@ -3126,6 +3129,8 @@ D2TK_API d2tk_flowmatrix_t *
d2tk_flowmatrix_begin(d2tk_base_t *base, const d2tk_rect_t *rect, d2tk_id_t id,
d2tk_flowmatrix_t *flowmatrix)
{
+ memset(flowmatrix, 0x0, sizeof(d2tk_flowmatrix_t));
+
flowmatrix->base = base;
flowmatrix->id = id;
flowmatrix->rect = rect;
@@ -3142,9 +3147,6 @@ d2tk_flowmatrix_begin(d2tk_base_t *base, const d2tk_rect_t *rect, d2tk_id_t id,
flowmatrix->r = flowmatrix->scale * 4; //FIXME
flowmatrix->s = flowmatrix->scale * 20; //FIXME
- flowmatrix->src_conn = false;
- flowmatrix->dst_conn = false;
-
d2tk_core_t *core = base->core;
flowmatrix->ref = d2tk_core_bbox_container_push(core, false, flowmatrix->rect);
@@ -3417,6 +3419,8 @@ d2tk_flowmatrix_arc_begin(d2tk_base_t *base, d2tk_flowmatrix_t *flowmatrix,
unsigned N, unsigned M, const d2tk_pos_t *src, const d2tk_pos_t *dst,
d2tk_pos_t *pos, d2tk_flowmatrix_arc_t *arc)
{
+ memset(arc, 0x0, sizeof(d2tk_flowmatrix_arc_t));
+
// derive initial position
if( (pos->x == 0) && (pos->y == 0) )
{
diff --git a/test/base.c b/test/base.c
index 87b57fe..f470c79 100644
--- a/test/base.c
+++ b/test/base.c
@@ -779,7 +779,7 @@ _test_layout_relative_x()
const d2tk_rect_t rect = D2TK_RECT(0, 0, DIM_W, DIM_H);
assert(base);
- const d2tk_coord_t frac [N] = {
+ static const d2tk_coord_t frac [N] = {
1, 2, 4, 0
};
unsigned i = 0;
@@ -809,7 +809,7 @@ _test_layout_relative_y()
const d2tk_rect_t rect = D2TK_RECT(0, 0, DIM_W, DIM_H);
assert(base);
- const d2tk_coord_t frac [N] = {
+ static const d2tk_coord_t frac [N] = {
1, 2, 4, 0
};
unsigned i = 0;