commit 774a368532e6c004fca291cd74c37409d362e4a7
parent 3035e23fe446bff3623522f7819f84245518bc75
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Wed, 22 Jan 2020 17:49:14 +0100
Fix warnings
Diffstat:
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/test_sg2_utils.h b/src/test_sg2_utils.h
@@ -41,7 +41,8 @@ check_memory_allocator(struct mem_allocator* allocator)
* Geometry
******************************************************************************/
/* 2D square */
-static double square_vertices[4/*#vertices*/ * 2/*#coords per vertex*/] = {
+static const double
+square_vertices[4/*#vertices*/ * 2/*#coords per vertex*/] = {
0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
@@ -50,7 +51,8 @@ static double square_vertices[4/*#vertices*/ * 2/*#coords per vertex*/] = {
static const unsigned
nvertices = sizeof(square_vertices) / (2 * sizeof(*square_vertices));
/* Distorded square */
-static double box_vertices[4/*#vertices*/ * 2/*#coords per vertex*/] = {
+static const double
+box_vertices[4/*#vertices*/ * 2/*#coords per vertex*/] = {
0.1, 0.0,
1.0, 0.0,
0.0, 1.1,
@@ -78,8 +80,8 @@ static const unsigned
nsegments = sizeof(box_indices) / (2 * sizeof(*box_indices));
struct context {
- double* positions;
- unsigned* indices;
+ const double* positions;
+ const unsigned* indices;
const unsigned* front_media;
const unsigned* back_media;
const unsigned* intface;
diff --git a/src/test_sg2_utils2.h b/src/test_sg2_utils2.h
@@ -30,6 +30,8 @@ create_circle
double step_theta;
unsigned itheta;
unsigned islice;
+ double* d = NULL;
+ unsigned* u = NULL;
ASSERT(radius > 0 && nslices >= 3 && ctx);
step_theta = 2 * PI / (double)nslices;
@@ -37,16 +39,18 @@ create_circle
const double theta = (double)itheta * step_theta;
const double x = cos(theta);
const double y = sin(theta);
- sa_push(ctx->positions, x * radius);
- sa_push(ctx->positions, y * radius);
+ sa_push(d, x * radius);
+ sa_push(d, y * radius);
}
+ ctx->positions = d;
FOR_EACH(islice, 0, nslices) {
const unsigned v0 = islice;
const unsigned v1 = ((islice + 1) % nslices);
- sa_push(ctx->indices, v0);
- sa_push(ctx->indices, v1);
+ sa_push(u, v0);
+ sa_push(u, v1);
}
+ ctx->indices = u;
}
static INLINE void