[AD] Empty Datafile Bug

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Please don't commit this without having someone taking a good look.  Attached is a small patch for datafile.c.  I noticed that empty datafiles within a datafile result in the empty one being turned into a DAT_END.  Here's an example; I hope you're viewing with a mono-spaced font:

FILE  - File1
FILE  |- File2   <-- Problem
BMP   |- Bitmap

As a DAT_END, File2 prevents access to the bitmap.  The attached patch circumvents this with an explicit check for empty datafiles in load_file_object.  If one is found, a FILE is created just for the property set--no data.  I chose not to call load_object on this file, as it didn't fit well into the loop and I'm not sure how safe it would be.   The assignments are simple.

No warnings were generated by the patch.  I tested with a datafile and experienced no problems.

  - Grady

Relevant Allegro.cc thread:  http://www.allegro.cc/forums/view_thread.php?_id=483695

Attachment: datafile.c.diff
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/