diff options
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/din/din.c | 2 | ||||
-rw-r--r-- | src/libs/ray/ray_light_emitter.h | 1 | ||||
-rw-r--r-- | src/libs/ray/ray_render_object_point.h | 2 | ||||
-rw-r--r-- | src/libs/txt/txt.c | 4 |
4 files changed, 5 insertions, 4 deletions
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); |