Re: working with bitmaps in C
- From: "Malcolm McLean" <regniztar@xxxxxxxxxxxxxx>
- Date: Thu, 27 Dec 2007 23:38:53 -0000
"Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx> wrote in message
Malcolm McLean wrote, On 27/12/07 17:16:The object of the exercise is to read the data, not to check the file for adherence to the format.
Actually, the best thing is normally to start off by checking the length is within a valid range, then check the data is valid, then check that you hit a valid tag in the place expected. If any of those things fail you report the file as being corrupt or a format you can't handle.
The question is what to do with as yet unspecified versions. Presumably MS will extend the header field, maybe add new chunks. The question is whether the raster data will still be readable without the new information, and it is impossible for MS to guarantee that, because they won't change the format for fun, but because some need arises.
That's a good point. It should be returning -1 instead of zero on an unrecognised header size, at least. Probably we should try to read it as a 40. However to do a really good job we've got to skip to the raster bits, which means a total rewrite and lots of complications.
Don't advertise your code as being reliable then, advertise it as supporting some but not all BMP files.
I should be able to read every current format, barring bugs, but some are obsolete.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm
.
- Follow-Ups:
- Re: working with bitmaps in C
- From: Ernie Wright
- Re: working with bitmaps in C
- From: Flash Gordon
- Re: working with bitmaps in C
- References:
- working with bitmaps in C
- From: Stephen . Schoenberger
- Re: working with bitmaps in C
- From: Malcolm McLean
- Re: working with bitmaps in C
- From: Ernie Wright
- Re: working with bitmaps in C
- From: Malcolm McLean
- Re: working with bitmaps in C
- From: Ernie Wright
- Re: working with bitmaps in C
- From: Malcolm McLean
- Re: working with bitmaps in C
- From: Flash Gordon
- working with bitmaps in C
- Prev by Date: Re: Programming in standard c
- Next by Date: Re: how free() works
- Previous by thread: Re: working with bitmaps in C
- Next by thread: Re: working with bitmaps in C
- Index(es):
Relevant Pages
|