diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-18 19:43:06 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-18 19:43:06 (EDT) |
commit | 373c9218245263fe986f4b93ef62cfa9af6c644b (patch) | |
tree | 4db01ec2d312879e9810060c50a816a992343c44 /src/font.c | |
parent | 8225911a9c19f5c738397488ccebf510490536f3 (diff) |
assert() function arguments
Diffstat (limited to 'src/font.c')
-rw-r--r-- | src/font.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -21,6 +21,7 @@ #include "font.h" +#include <assert.h> #include <limits.h> #include <stdio.h> #include <string.h> @@ -53,6 +54,8 @@ font_list(FILE *stream) { size_t i; + assert(stream); + for (i = 0; i < *(&fonts + 1) - fonts; ++i) { fprintf(stream, "%s\n", fonts[i]->name); } @@ -81,6 +84,8 @@ font_find(const char *name) { size_t i; + assert(name); + if (!name) { return NULL; } @@ -96,12 +101,16 @@ font_find(const char *name) int font_get_width(const struct font *font) { + assert(font); + return font->desc.width; } int font_get_height(const struct font *font) { + assert(font); + return font->desc.height; } @@ -116,6 +125,11 @@ font_render(const struct font *font, png_const_colorp fg, png_const_colorp bg, size_t byte; unsigned char font_ch; + assert(font); + assert(fg); + assert(bg); + assert(rows && *rows); + for (y = 0, r = row * FONT_H(font); y < FONT_H(font); ++y, ++r) { for (x = 0, c = col * FONT_W(font); x < FONT_W(font); ++x, ++c){ byte = ((ch * FONT_H(font)) + y) * FONT_W_BYTES(font) + |