struct lbx_image *lbximg_fopen(FILE *f)
{
- struct lbx_image tmp = {.f = f}, *new;
+ struct lbx_image tmp = {.f = f}, *new = NULL;
if (fread(&tmp.width, sizeof tmp.width, 1, f) != 1) goto readerr;
if (fread(&tmp.height, sizeof tmp.height, 1, f) != 1) goto readerr;
* If we never find any exceptions, we can replace the assertions with
* assumptions.
*/
- assert(tmp.wtf1 == 0);
- assert(tmp.offs == tmp.frames + 1);
+ _lbx_assert(tmp.wtf1 == 0);
+ _lbx_assert(tmp.offs == tmp.frames + 1);
new = malloc(sizeof *new + tmp.offs * sizeof *new->offsets);
if (!new) {
return -1;
}
+void lbximg_getinfo(struct lbx_image *img, struct lbx_imginfo *info)
+{
+ *info = (struct lbx_imginfo) {
+ .width = img->width,
+ .height = img->height,
+ .nframes = img->frames,
+ };
+}
+
void lbximg_close(struct lbx_image *img)
{
if (!img) return;