The standard states that if a length is not given, the character array
must be nul-terminated.
static const char bmp_sig[] = "BM";
if(sig.size()<sizeof(bmp_sig))
return false;
- return !sig.compare(0, 2, bmp_sig);
+ return !sig.compare(0, sizeof(bmp_sig), bmp_sig, sizeof(bmp_sig));
}
void BmpLoader::load(Image::Data &data)
static const char jpeg_sig[] = { '\xFF', '\xD8', '\xFF' };
if(sig.size()<sizeof(jpeg_sig))
return false;
- return !sig.compare(0, sizeof(jpeg_sig), jpeg_sig);
+ return !sig.compare(0, sizeof(jpeg_sig), jpeg_sig, sizeof(jpeg_sig));
}
void JpegLoader::load(Image::Data &data)