diff --git a/pipi/stock.c b/pipi/stock.c index 923aea6..7aaf40a 100644 --- a/pipi/stock.c +++ b/pipi/stock.c @@ -30,18 +30,18 @@ pipi_image_t *pipi_load_stock(char const *name) { pipi_image_t *ret; pipi_pixels_t *pix; - float *data; /* Generate a Bayer dithering pattern. */ if(!strncmp(name, "bayer:", 6)) { - int w, h; + int w, h = 0; w = atoi(name + 6); name = strchr(name + 6, 'x'); - if(!name) - return NULL; - h = atoi(name + 1); + if(name) + h = atoi(name + 1); + if(!h) + h = w; return pipi_render_bayer(w, h); } @@ -168,13 +168,14 @@ pipi_image_t *pipi_load_stock(char const *name) /* Generate a completely random image. */ if(!strncmp(name, "random:", 7)) { - int w, h; + int w, h = 0; w = atoi(name + 7); name = strchr(name + 7, 'x'); - if(!name) - return NULL; - h = atoi(name + 1); + if(name) + h = atoi(name + 1); + if(!h) + h = w; if(w <= 0 || h <= 0) return NULL;