From 858fa5782ff29ce007e3f50a257efb7014cf556e Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 15 Feb 2013 17:09:34 -0500 Subject: src/tmx.c: Silence some compiler warnings. --- diff --git a/src/tmx.c b/src/tmx.c index 731f76c..4695a9e 100644 --- a/src/tmx.c +++ b/src/tmx.c @@ -119,9 +119,13 @@ tmx_start_image(struct tmx *cur_tmx, const char **attr) err(1, "Malformed TMX file"); } + source = NULL; foreach_tmx_attr (attr) { tmx_get_string_attr(attr, "source", source); } + if (source == NULL) { + err(1, "No \"source\" attribute found in \"image\" tag"); + } /* TODO: Move to end tag handler and check for "loadimage" property. */ path = malloc(strlen(cur_tmx->dirname) + strlen(source) + 2); @@ -265,6 +269,10 @@ tmx_end_data(struct tmx *cur_tmx) } decompress(decoded_buf, decoded_len, decomp_buf, decomp_len); free(decoded_buf); + } else { + /* This should never happen. This branch exists only to silence + * GCC's maybe-uninitialized warning on decomp_buf below. */ + return; } free(cur_tmx->layer_data); -- cgit v0.9.1