1
0
forked from 0ad/0ad

minor bugfix / commenting

This was SVN commit r958.
This commit is contained in:
janwas 2004-08-10 15:59:11 +00:00
parent e4867475dd
commit 7c36638fd0
2 changed files with 7 additions and 2 deletions

View File

@ -226,7 +226,7 @@ static HDATA* h_data_any_type(const Handle h)
// used by most functions accessing handle data.
static HDATA* h_data(const Handle h, const H_Type type)
{
if(!h)
if(h <= 0)
return 0;
HDATA* hd = h_data_any_type(h);
@ -349,6 +349,10 @@ static int free_idx(i32 idx)
int h_free(Handle& h, H_Type type)
{
HDATA* hd = h_data(h, type);
h = 0;
// wipe out the handle, to prevent reuse.
// TODO: should we do this after checking if valid?
// (would help debugging, but handle wouldn't always be reset)
if(!hd)
return ERR_INVALID_HANDLE;

View File

@ -504,7 +504,8 @@ static inline bool bmp_fmt(u8* p, size_t size)
{
UNUSED(size)
// bfType == BM? (check single bytes => endian safe)
// check header signature (BITMAPFILEHEADER.bfType == "BM"?).
// we compare single bytes to be endian-safe.
return p[0] == 'B' && p[1] == 'M';
}