File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,16 @@ extern "C"{
3939 * 2-item-long array of type co_ord_t, find and store the co-ords for the
4040 * corners of the square needed to contain the points.
4141 * NOTE: This should NEVER be called with a pointer to anything other than a
42- * 2-item struct of type co_ord_t
42+ * 2-item array of type co_ord_t
4343 *
4444 * Asserts:
4545 * - That spiral.co_ord_cache.co_ords.items is not NULL
46+ * - That bounds is not NULL
4647 */
4748static void get_bounds (sxbp_spiral_t spiral , sxbp_co_ord_t * bounds ) {
4849 // preconditional assertions
4950 assert (spiral .co_ord_cache .co_ords .items != NULL );
51+ assert (bounds != NULL );
5052 sxbp_tuple_item_t min_x = 0 ;
5153 sxbp_tuple_item_t min_y = 0 ;
5254 sxbp_tuple_item_t max_x = 0 ;
Original file line number Diff line number Diff line change 2020 * You should have received a copy of the GNU Affero General Public License
2121 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2222 */
23+ #include <assert.h>
2324#include <stdlib.h>
2425#include <string.h>
2526
@@ -83,10 +84,17 @@ static void cleanup_png_lib(
8384 * given a bitmap_t struct and a pointer to a blank buffer_t, write the bitmap
8485 * data as a PNG image to the buffer, using libpng.
8586 * returns a status struct containing error information, if any
87+ *
88+ * Asserts:
89+ * - That bitmap.pixels is not NULL
90+ * - That buffer->bytes is NULL
8691 */
8792sxbp_status_t sxbp_write_png_image (
8893 sxbp_bitmap_t bitmap , sxbp_buffer_t * buffer
8994) {
95+ // preconditional assertsions
96+ assert (bitmap .pixels != NULL );
97+ assert (buffer -> bytes == NULL );
9098 // result status
9199 sxbp_status_t result ;
92100 // init buffer
Original file line number Diff line number Diff line change @@ -35,6 +35,10 @@ extern "C"{
3535 * given a bitmap_t struct and a pointer to a blank buffer_t, write the bitmap
3636 * data as a PNG image to the buffer, using libpng.
3737 * returns a status struct containing error information, if any
38+ *
39+ * Asserts:
40+ * - That bitmap.pixels is not NULL
41+ * - That buffer->bytes is NULL
3842 */
3943sxbp_status_t sxbp_write_png_image (sxbp_bitmap_t bitmap , sxbp_buffer_t * buffer );
4044
You can’t perform that action at this time.
0 commit comments