summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drm_fb.c9
-rw-r--r--src/libs/din/din.c2
-rw-r--r--src/libs/ray/ray_light_emitter.h1
-rw-r--r--src/libs/ray/ray_render_object_point.h2
-rw-r--r--src/libs/txt/txt.c4
-rw-r--r--src/main.c1
-rw-r--r--src/mem_fb.c7
-rw-r--r--src/modules/checkers/checkers.c5
-rw-r--r--src/modules/flui2d/flui2d.c2
-rw-r--r--src/modules/meta2d/v2f.h4
-rw-r--r--src/modules/meta2d/v3f.h6
-rw-r--r--src/modules/mixer/mixer.c2
-rw-r--r--src/modules/montage/montage.c10
-rw-r--r--src/modules/plato/plato.c5
-rw-r--r--src/modules/ray/ray.c2
-rw-r--r--src/modules/rkt/rkt.c1
-rw-r--r--src/modules/spiro/spiro.c1
-rw-r--r--src/modules/swarm/swarm.c8
-rw-r--r--src/modules/voronoi/v2f.h4
-rw-r--r--src/sdl_fb.c2
-rw-r--r--src/til.c7
-rw-r--r--src/til_settings.c3
-rw-r--r--src/til_stream.c4
23 files changed, 42 insertions, 50 deletions
diff --git a/src/drm_fb.c b/src/drm_fb.c
index 7c0aadc..de43bd9 100644
--- a/src/drm_fb.c
+++ b/src/drm_fb.c
@@ -149,7 +149,7 @@ static void free_strv(const char **strv)
static int connector_desc_generator(const til_settings_t *settings, til_setup_t *setup_context, const til_setting_desc_t **res_desc)
{
drm_fb_setup_t *s = (drm_fb_setup_t *)setup_context;
- const char **connectors;
+ const char **connectors = NULL;
int r;
assert(s);
@@ -251,7 +251,7 @@ _out_con:
drmModeFreeConnector(con);
_out_fd:
close(fd);
-_out:
+
return r;
}
@@ -259,7 +259,7 @@ _out:
static int mode_desc_generator(const til_settings_t *settings, til_setup_t *setup_context, const til_setting_desc_t **res_desc)
{
drm_fb_setup_t *s = (drm_fb_setup_t *)setup_context;
- const char **modes;
+ const char **modes = NULL;
int r;
assert(s);
@@ -357,9 +357,6 @@ static int drm_fb_init(const til_setup_t *setup, void **res_context)
{
drm_fb_setup_t *s = (drm_fb_setup_t *)setup;
drm_fb_t *c;
- const char *dev;
- const char *connector;
- const char *mode;
drmModeEncoder *enc;
int r;
diff --git a/src/libs/din/din.c b/src/libs/din/din.c
index 4290d41..b2c2823 100644
--- a/src/libs/din/din.c
+++ b/src/libs/din/din.c
@@ -18,7 +18,7 @@ typedef struct din_t {
/* return random number between -1 and +1 */
static inline float randf(unsigned *seed)
{
- return 2.f / RAND_MAX * rand_r(seed) - 1.f;
+ return 2.f / ((float)RAND_MAX) * rand_r(seed) - 1.f;
}
diff --git a/src/libs/ray/ray_light_emitter.h b/src/libs/ray/ray_light_emitter.h
index 3b5509e..4a1dce5 100644
--- a/src/libs/ray/ray_light_emitter.h
+++ b/src/libs/ray/ray_light_emitter.h
@@ -5,6 +5,7 @@
#include "ray_object_sphere.h"
typedef enum ray_light_emitter_type_t {
+ RAY_LIGHT_EMITTER_TYPE_SENTINEL, /* TODO: this is fragile, the enum values align with ray_object_type_t so the object-specific .type can be assigned as object types to silence compiler warnings, without producing wrong type values in the ray_light_emitter_t.type. What should probably be done is splitting out the rudimentary objects into even simpler structs without a type member so we can have light variants and object variants each with their own enum typed type members... not now. */
RAY_LIGHT_EMITTER_TYPE_SPHERE,
RAY_LIGHT_EMITTER_TYPE_POINT,
} ray_light_emitter_type_t;
diff --git a/src/libs/ray/ray_render_object_point.h b/src/libs/ray/ray_render_object_point.h
index 52c6fd6..3479c22 100644
--- a/src/libs/ray/ray_render_object_point.h
+++ b/src/libs/ray/ray_render_object_point.h
@@ -31,7 +31,7 @@ static inline int ray_render_object_point_intersects_ray(ray_render_object_point
static inline ray_3f_t ray_render_object_point_normal(ray_render_object_point_t *point, ray_3f_t *_point)
{
- ray_3f_t normal;
+ ray_3f_t normal = {};
return normal;
}
diff --git a/src/libs/txt/txt.c b/src/libs/txt/txt.c
index e5eeec6..f087aeb 100644
--- a/src/libs/txt/txt.c
+++ b/src/libs/txt/txt.c
@@ -153,7 +153,7 @@ static int overlaps(int x1, int y1, unsigned w1, unsigned h1, int x2, int y2, un
}
-static inline void draw_char(til_fb_fragment_t *fragment, uint32_t color, int x, int y, char c)
+static inline void draw_char(til_fb_fragment_t *fragment, uint32_t color, int x, int y, unsigned char c)
{
/* TODO: this could be optimized to skip characters with no overlap */
for (int i = 0; i < ASCII_HEIGHT; i++) {
@@ -168,7 +168,7 @@ static inline void draw_char(til_fb_fragment_t *fragment, uint32_t color, int x,
void txt_render_fragment(txt_t *txt, til_fb_fragment_t *fragment, uint32_t color, int x, int y, txt_align_t alignment)
{
int jx, jy, col, row;
- char c, *str;
+ char *str;
assert(txt);
assert(fragment);
diff --git a/src/main.c b/src/main.c
index 8306b64..28d4b70 100644
--- a/src/main.c
+++ b/src/main.c
@@ -85,7 +85,6 @@ static int setup_video(const til_settings_t *settings, til_setting_t **res_setti
video = til_settings_get_value_by_idx(settings, 0, &setting);
if (!video || !setting->desc) {
- til_setting_desc_t *desc;
const char *values[] = {
#ifdef HAVE_DRM
"drm",
diff --git a/src/mem_fb.c b/src/mem_fb.c
index 2d8f936..2dfa5bb 100644
--- a/src/mem_fb.c
+++ b/src/mem_fb.c
@@ -99,9 +99,6 @@ static void mem_fb_shutdown(til_fb_t *fb, void *context)
static int mem_fb_acquire(til_fb_t *fb, void *context, void *page)
{
- mem_fb_t *c = context;
- mem_fb_page_t *p = page;
-
return 0;
}
@@ -135,7 +132,6 @@ static void * mem_fb_page_alloc(til_fb_t *fb, void *context, til_fb_fragment_t *
static int mem_fb_page_free(til_fb_t *fb, void *context, void *page)
{
- mem_fb_t *c = context;
mem_fb_page_t *p = page;
free(p);
@@ -146,9 +142,6 @@ static int mem_fb_page_free(til_fb_t *fb, void *context, void *page)
static int mem_fb_page_flip(til_fb_t *fb, void *context, void *page)
{
- mem_fb_t *c = context;
- mem_fb_page_t *p = page;
-
/* TODO: add a timer for supporting an fps setting? */
return 0;
}
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c
index 5987b7d..3608582 100644
--- a/src/modules/checkers/checkers.c
+++ b/src/modules/checkers/checkers.c
@@ -225,7 +225,6 @@ static int checkers_fragmenter(til_module_context_t *context, const til_fb_fragm
static void checkers_prepare_frame(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
checkers_context_t *ctxt = (checkers_context_t *)context;
- til_fb_fragment_t *fragment = *fragment_ptr;
/* XXX: note cpu_affinity is required when fill_module is used, to ensure module_contexts
* have a stable relationship to fragnum. Otherwise the output would be unstable because the
@@ -277,6 +276,8 @@ static void checkers_render_fragment(til_module_context_t *context, til_stream_t
case CHECKERS_PATTERN_RANDOM:
state = hash((context->seed + fragment->number) * 0x61C88647) & 0x1;
break;
+ default:
+ assert(0);
}
/* now that state has been determined, set the frame size */
@@ -299,6 +300,8 @@ static void checkers_render_fragment(til_module_context_t *context, til_stream_t
case CHECKERS_DYNAMICS_RANDOM: /* note: the big multiply here is just to get up out of the low bits */
state &= hash((context->seed + fragment->number) * 0x61C88647 + (unsigned)((float)ticks * ctxt->setup->rate)) & 0x1;
break;
+ default:
+ assert(0);
}
if (fill == CHECKERS_FILL_RANDOM || fill == CHECKERS_FILL_MIXED)
diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c
index 09869b3..147bb32 100644
--- a/src/modules/flui2d/flui2d.c
+++ b/src/modules/flui2d/flui2d.c
@@ -365,7 +365,7 @@ static void flui2d_render_fragment(til_module_context_t *context, til_stream_t *
y1 = y0 + 1;
for (int x = fragment->x; x < fragment->x + fragment->width; x++) {
- float X, dens, dx0, dx1;
+ float X, dx0, dx1;
int x0, x1;
float r, g, b;
diff --git a/src/modules/meta2d/v2f.h b/src/modules/meta2d/v2f.h
index 088772d..8483f00 100644
--- a/src/modules/meta2d/v2f.h
+++ b/src/modules/meta2d/v2f.h
@@ -281,8 +281,8 @@ static inline v2f_t * v2f_trilerp(v2f_t *res, const v2f_t *aaa, const v2f_t *aba
static inline v2f_t _v2f_rand(unsigned *seedp, const v2f_t *min, const v2f_t *max)
{
return (v2f_t){
- .x = min->x + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->x - min->x),
- .y = min->y + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->y - min->y),
+ .x = min->x + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->x - min->x),
+ .y = min->y + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->y - min->y),
};
}
diff --git a/src/modules/meta2d/v3f.h b/src/modules/meta2d/v3f.h
index d923ecc..b1d3f4c 100644
--- a/src/modules/meta2d/v3f.h
+++ b/src/modules/meta2d/v3f.h
@@ -300,9 +300,9 @@ static inline v3f_t * v3f_cross(v3f_t *res, const v3f_t *a, const v3f_t *b)
static inline v3f_t _v3f_rand(unsigned *seedp, const v3f_t *min, const v3f_t *max)
{
return (v3f_t){
- .x = min->x + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->x - min->x),
- .y = min->y + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->y - min->y),
- .z = min->z + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->z - min->z),
+ .x = min->x + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->x - min->x),
+ .y = min->y + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->y - min->y),
+ .z = min->z + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->z - min->z),
};
}
diff --git a/src/modules/mixer/mixer.c b/src/modules/mixer/mixer.c
index 55234d3..1a2566c 100644
--- a/src/modules/mixer/mixer.c
+++ b/src/modules/mixer/mixer.c
@@ -113,7 +113,7 @@ static void mixer_destroy_context(til_module_context_t *context)
static inline float randf(unsigned *seed)
{
- return 1.f / RAND_MAX * rand_r(seed);
+ return 1.f / ((float)RAND_MAX) * rand_r(seed);
}
static void mixer_render_fragment(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index 18e1252..c7c2eb0 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -158,11 +158,10 @@ static int montage_fragment_tile(const til_fb_fragment_t *fragment, unsigned til
*/
static int montage_fragmenter(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
- montage_context_t *ctxt = (montage_context_t *)context;
- float root = sqrtf(((montage_setup_t *)context->setup)->n_tiles);
- unsigned tile_width = fragment->frame_width / ceilf(root); /* screens are wide, always give excess to the width */
- unsigned tile_height = fragment->frame_height / rintf(root); /* only give to the height when fraction is >= .5f */
- int ret;
+ float root = sqrtf(((montage_setup_t *)context->setup)->n_tiles);
+ unsigned tile_width = fragment->frame_width / ceilf(root); /* screens are wide, always give excess to the width */
+ unsigned tile_height = fragment->frame_height / rintf(root); /* only give to the height when fraction is >= .5f */
+ int ret;
/* XXX: this could all be more clever and make some tiles bigger than others to deal with fractional square roots,
* but this is good enough for now considering the simplicity.
@@ -252,7 +251,6 @@ static int montage_setup(const til_settings_t *settings, til_setting_t **res_set
tiles_settings = (*res_setting)->value_as_nested_settings;
{
til_setting_t *tile_setting;
- const char *layer;
for (size_t i = 0; til_settings_get_value_by_idx(tiles_settings, i, &tile_setting); i++) {
if (!tile_setting->value_as_nested_settings) {
diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c
index 5551268..f43eda3 100644
--- a/src/modules/plato/plato.c
+++ b/src/modules/plato/plato.c
@@ -524,6 +524,8 @@ static inline m4f_t m4f_rotate(const m4f_t *m, const v3f_t *axis, float radians)
return m4f_mult(m, &rotate);
}
+#if 0
+/* these aren't currently used, but may come in handy later */
/* this is a simple perpsective projection matrix taken from an opengl tutorial */
static inline m4f_t m4f_frustum(float bot, float top, float left, float right, float nnear, float ffar)
@@ -565,7 +567,7 @@ static inline uint32_t color_to_uint32(v3f_t color) {
return pixel;
}
-
+#endif
static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
{
@@ -742,7 +744,6 @@ static int plato_setup(const til_settings_t *settings, til_setting_t **res_setti
if (res_setup) {
plato_setup_t *setup;
- int i;
setup = til_setup_new(settings, sizeof(*setup), NULL);
if (!setup)
diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c
index 9ed023d..ea44491 100644
--- a/src/modules/ray/ray.c
+++ b/src/modules/ray/ray.c
@@ -86,7 +86,7 @@ static ray_object_t lights[] = {
.type = RAY_OBJECT_TYPE_LIGHT,
.brightness = 15.0f,
.emitter = {
- .point.type = RAY_LIGHT_EMITTER_TYPE_POINT,
+ .point.type = RAY_OBJECT_TYPE_POINT,
.point.center = { .x = 3.0f, .y = 3.0f, .z = 3.0f },
.point.surface = {
.color = { .x = 1.0f, .y = 1.0f, .z = 1.0f },
diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c
index 3a7b880..257671a 100644
--- a/src/modules/rkt/rkt.c
+++ b/src/modules/rkt/rkt.c
@@ -368,7 +368,6 @@ static int rkt_setup(const til_settings_t *settings, til_setting_t **res_setting
scenes_settings = (*res_setting)->value_as_nested_settings;
{
til_setting_t *scene_setting;
- const char *scene_module;
for (size_t i = 0; til_settings_get_value_by_idx(scenes_settings, i, &scene_setting); i++) {
if (!scene_setting->value_as_nested_settings) {
diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c
index ef9e7b6..75f4438 100644
--- a/src/modules/spiro/spiro.c
+++ b/src/modules/spiro/spiro.c
@@ -34,7 +34,6 @@ typedef struct spiro_context_t {
static til_module_context_t * spiro_create_context(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup)
{
spiro_context_t *ctxt;
- float z;
ctxt = til_module_context_new(module, sizeof(spiro_context_t), stream, seed, ticks, n_cpus, setup);
if (!ctxt)
diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c
index 8e2d853..97a04d0 100644
--- a/src/modules/swarm/swarm.c
+++ b/src/modules/swarm/swarm.c
@@ -197,9 +197,11 @@ static til_module_context_t * swarm_create_context(const til_module_t *module, t
static void swarm_update(swarm_context_t *ctxt, unsigned ticks)
{
v3f_t avg_direction = {};
- float avg_velocity = 0.f;
v3f_t avg_center = {};
float wleader, wcenter, wdirection;
+ /* commented out since it's unused currently and upsets -Wall -Werror, but retained for potential future modifications
+ * float avg_velocity = 0.f;
+ */
{ /* [0] = leader */
float r = M_PI * 2 * ((cosf((float)ticks * .001f) * .5f + .5f));
@@ -239,10 +241,10 @@ static void swarm_update(swarm_context_t *ctxt, unsigned ticks)
avg_center = v3f_add(avg_center, b->position);
avg_direction = v3f_add(avg_direction, b->direction);
- avg_velocity += b->velocity;
+ /* avg_velocity += b->velocity; */
}
- avg_velocity *= (1.f / (float)SWARM_SIZE);
+ /* avg_velocity *= (1.f / (float)SWARM_SIZE); */
avg_center = v3f_mult_scalar(avg_center, (1.f / (float)SWARM_SIZE));
avg_direction = v3f_mult_scalar(avg_direction, (1.f / (float)SWARM_SIZE));
v3f_normalize(&avg_direction);
diff --git a/src/modules/voronoi/v2f.h b/src/modules/voronoi/v2f.h
index 8f51ee0..3cef962 100644
--- a/src/modules/voronoi/v2f.h
+++ b/src/modules/voronoi/v2f.h
@@ -281,8 +281,8 @@ static inline v2f_t * v2f_trilerp(v2f_t *res, const v2f_t *aaa, const v2f_t *aba
static inline v2f_t _v2f_rand(const v2f_t *min, const v2f_t *max)
{
return (v2f_t){
- .x = min->x + (float)rand() * (1.f/RAND_MAX) * (max->x - min->x),
- .y = min->y + (float)rand() * (1.f/RAND_MAX) * (max->y - min->y),
+ .x = min->x + (float)rand() * (1.f/(float)RAND_MAX) * (max->x - min->x),
+ .y = min->y + (float)rand() * (1.f/(float)RAND_MAX) * (max->y - min->y),
};
}
diff --git a/src/sdl_fb.c b/src/sdl_fb.c
index 2b0a605..d1e3cd5 100644
--- a/src/sdl_fb.c
+++ b/src/sdl_fb.c
@@ -196,7 +196,6 @@ static void sdl_fb_shutdown(til_fb_t *fb, void *context)
static int sdl_fb_acquire(til_fb_t *fb, void *context, void *page)
{
sdl_fb_t *c = context;
- sdl_fb_page_t *p = page;
c->window = SDL_CreateWindow("rototiller", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, c->width, c->height, c->flags);
if (!c->window)
@@ -254,7 +253,6 @@ static void * sdl_fb_page_alloc(til_fb_t *fb, void *context, til_fb_fragment_t *
static int sdl_fb_page_free(til_fb_t *fb, void *context, void *page)
{
- sdl_fb_t *c = context;
sdl_fb_page_t *p = page;
SDL_FreeSurface(p->surface);
diff --git a/src/til.c b/src/til.c
index e4df34e..fd9b167 100644
--- a/src/til.c
+++ b/src/til.c
@@ -467,10 +467,9 @@ int til_module_setup(const til_settings_t *settings, til_setting_t **res_setting
name = til_settings_get_value_by_idx(settings, 0, &setting);
if (!name || !setting->desc) {
- const char *values[nelems(modules) + 1] = {};
- const char *annotations[nelems(modules) + 1] = {};
- til_setting_desc_t *desc;
- int r;
+ const char *values[nelems(modules) + 1] = {};
+ const char *annotations[nelems(modules) + 1] = {};
+ int r;
for (unsigned i = 0, j = 0; i < nelems(modules); i++) {
/* XXX: This only skips experimental modules when no module setting was pre-specified,
diff --git a/src/til_settings.c b/src/til_settings.c
index fe4546b..2985635 100644
--- a/src/til_settings.c
+++ b/src/til_settings.c
@@ -85,7 +85,6 @@ til_settings_t * til_settings_new(const char *prefix, const til_settings_t *pare
const char *p;
til_settings_t *settings;
til_str_t *value_str;
- char *value_buf;
assert(label);
@@ -719,4 +718,6 @@ int til_settings_fprint_path(const til_settings_t *settings, FILE *out)
r = -EPIPE;
free(buf);
+
+ return r;
}
diff --git a/src/til_stream.c b/src/til_stream.c
index e04f807..c24f239 100644
--- a/src/til_stream.c
+++ b/src/til_stream.c
@@ -273,7 +273,7 @@ int til_stream_tap(til_stream_t *stream, const void *owner, const void *owner_fo
void til_stream_untap_owner(til_stream_t *stream, const void *owner)
{
for (int i = 0; i < TIL_STREAM_PIPE_BUCKETS_COUNT; i++) {
- for (til_stream_pipe_t *p = stream->pipe_buckets[i], *p_next, *p_prev; p != NULL; p = p_next) {
+ for (til_stream_pipe_t *p = stream->pipe_buckets[i], *p_next, *p_prev = NULL; p != NULL; p = p_next) {
p_next = p->next;
if (p->owner == owner || p->driving_tap->owner == owner) {
@@ -682,6 +682,8 @@ static int til_stream_fprint_module_context_cb(void *arg, til_stream_module_cont
for (size_t i = 0; i < n_module_contexts; i++)
fprintf(out, "%s{rc=%u, n_cpus=%u}", i ? ", " : " ", contexts[i]->refcount, contexts[i]->n_cpus);
fprintf(out, "\n");
+
+ return 0;
}
© All Rights Reserved