diff options
Diffstat (limited to 'tools/gfx.c')
-rw-r--r-- | tools/gfx.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/gfx.c b/tools/gfx.c index 2928637c..7fbbfaab 100644 --- a/tools/gfx.c +++ b/tools/gfx.c @@ -61,7 +61,7 @@ void parse_args(int argc, char *argv[]) { break; case 'r': for (char *token = strtok(optarg, ","); token; token = strtok(NULL, ",")) { - options.preserved = realloc(options.preserved, ++options.num_preserved * sizeof(*options.preserved)); + options.preserved = xrealloc(options.preserved, ++options.num_preserved * sizeof(*options.preserved)); options.preserved[options.num_preserved-1] = strtoul(token, NULL, 0); } break; @@ -212,7 +212,7 @@ const uint8_t flipped[256] = { }; bool flip_exists(const uint8_t *tile, const uint8_t *tiles, int tile_size, int num_tiles, bool xflip, bool yflip) { - uint8_t flip[tile_size]; + uint8_t flip[tile_size]; // VLA memset(flip, 0, tile_size); int half_size = tile_size / 2; for (int i = 0; i < tile_size; i++) { @@ -250,7 +250,7 @@ void interleave(struct Graphic *graphic, int width) { int tile_size = options.depth * 8; int width_tiles = width / 8; int num_tiles = graphic->size / tile_size; - uint8_t *interleaved = malloc(graphic->size); + uint8_t *interleaved = xmalloc(graphic->size); for (int i = 0; i < num_tiles; i++) { int row = i / width_tiles; int tile = i * 2 - (row % 2 ? width_tiles * (row + 1) - 1 : width_tiles * row); @@ -280,7 +280,7 @@ int main(int argc, char *argv[]) { if (!options.png_file) { error_exit("--interleave needs --png to infer dimensions"); } - int width = read_png_width_verbose(options.png_file); + int width = read_png_width(options.png_file); interleave(&graphic, width); } if (options.remove_duplicates) { |