hiya,
…this is driving me nuts…I’m basing my PSD loading code on the
SDL_bmp.c code where the following is done:
/* Read in the BMP file header */
fp_offset = SDL_RWtell(src);
SDL_ClearError();
if ( SDL_RWread(src, magic, 1, 2) != 2 ) {
SDL_Error(SDL_EFREAD);
was_error = 1;
goto done;
}
if ( strncmp(magic, "BM", 2) != 0 ) {
SDL_SetError("File is not a Windows BMP file");
was_error = 1;
goto done;
}
bfSize = SDL_ReadLE32(src);=============================================
my code snippet is the following in cpp (on OSX):
SDL_RWops *src;
src = SDL_RWFromFile( FileName, "rb");
fp_offset = SDL_RWtell(src);
SDL_ClearError();
if ( SDL_RWread(src, magic, 1, 4) != 4 )
{
//SDL_Error(SDL_EFREAD);
SDL_RWclose(src);
return NULL;
}
if ( (magic[0] == 'B') && (magic[1] == 'M') ) //load BMP
{
//SDL_RWclose(src);
return NULL;
}
if ( (magic[0] == '8') && (magic[1] == 'B') ) //load PSD
{
PSDFile *Psd;
Psd->Version = SDL_ReadBE16(src);
=====================================================
…the problem is that everytime I get to SDL_ReadBE16(src), I get an
EXC_BAD_ACCESS! Am I overlooking something?
thanks,
jamie
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: text/enriched
Size: 2386 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030506/f4e468d9/attachment.bin