static bool cpImage(Tiff inImage, Tiff outImage, readFunc fin, writeFunc fout, int imagelength, int imagewidth, short spp)
{
bool status = false;
int scanlinesize = inImage.RasterScanlineSize();
int bytes = scanlinesize * imagelength;
/*
* XXX: Check for integer overflow.
*/
if (scanlinesize != 0 && imagelength != 0 && (bytes / imagelength == scanlinesize))
{
byte[] buf = new byte[bytes];
if (fin(inImage, buf, imagelength, imagewidth, spp))
status = fout(outImage, buf, imagelength, imagewidth, spp);
}
else
{
Tiff.Error(inImage.FileName(), "Error, no space for image buffer");
}
return status;
}