diff --git a/src/osgPlugins/bmp/ReaderWriterBMP.cpp b/src/osgPlugins/bmp/ReaderWriterBMP.cpp index 501ab1e3f..bd678b57e 100644 --- a/src/osgPlugins/bmp/ReaderWriterBMP.cpp +++ b/src/osgPlugins/bmp/ReaderWriterBMP.cpp @@ -143,11 +143,16 @@ int *numComponents_ret) // BMP - sponsored by Seagate. // unsigned char palette[256][3]; unsigned char *buffer=NULL; // returned to sender & as read from the disk + long filelen; bmperror = ERROR_NO_FILE; FILE *fp = fopen(filename, "rb"); if (!fp) return NULL; + fseek(fp, 0, SEEK_END); + filelen = ftell(fp); // determine file size so we can fill it in later if FileSize == 0 + fseek(fp, 0, SEEK_SET); + int ncolours; int ncomp=0; bool swap=false; // dont need to swap bytes @@ -206,6 +211,10 @@ int *numComponents_ret) long size = hd.siz[1]*65536+hd.siz[0]; osg::notify(osg::INFO) << "new size calc = "<