Skip to content

Commit 96099b9

Browse files
dos1SiegeLord
authored andcommitted
bitmap_io: try to identify bitmap format for unknown extensions
Allows to load identificable bitmaps stored with custom extension.
1 parent de95567 commit 96099b9

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/bitmap_io.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,11 @@ ALLEGRO_BITMAP *al_load_bitmap_flags(const char *filename, int flags)
193193
Handler *h;
194194
ALLEGRO_BITMAP *ret;
195195

196-
ext = strrchr(filename, '.');
196+
ext = al_identify_bitmap(filename);
197197
if (!ext) {
198-
ext = al_identify_bitmap(filename);
198+
ext = strrchr(filename, '.');
199199
if (!ext) {
200-
ALLEGRO_ERROR("Bitmap %s has no extension and filetype "
201-
"identification failed - not even trying to load it.\n",
202-
filename);
200+
ALLEGRO_ERROR("Could not identify bitmap %s!", filename);
203201
return NULL;
204202
}
205203
}
@@ -208,12 +206,11 @@ ALLEGRO_BITMAP *al_load_bitmap_flags(const char *filename, int flags)
208206
if (h && h->loader) {
209207
ret = h->loader(filename, flags);
210208
if (!ret)
211-
ALLEGRO_ERROR("Failed loading %s with %s handler.\n", filename,
212-
ext);
209+
ALLEGRO_ERROR("Failed loading bitmap %s with %s handler.\n",
210+
filename, ext);
213211
}
214212
else {
215-
ALLEGRO_ERROR("No handler for bitmap extension %s - "
216-
"therefore not trying to load %s.\n", ext, filename);
213+
ALLEGRO_ERROR("No handler for bitmap %s!", filename);
217214
ret = NULL;
218215
}
219216

0 commit comments

Comments
 (0)