[Insight-users] Visual Studio and std::streampos

Julien Michel julien.michel at c-s.fr
Mon Jan 18 11:58:06 EST 2010


Dear ITK users,

ImageIOBase and ImageFileReader use std::streamoff (via the SizeType 
typedef) to manipulate the size of the image in bytes.

On my linux, std::streamoff is defined as long long, which seems well 
enough. But on my Visual Studio (32 bits) std::streamoff is defined as 
long, and it happens that I have an image (actually quite huge: 45519 x 
27365) for which long is not enough. As a matter of consequences, the 
GetImageSizeInBytes() in ImageIOBase returns -1 803 712 426, instead of 
2 491 254 870, which outpasses the long signed range (max value: 2 147 
489 647).

The memory allocation next line does not seem to appreciate being given 
a negative size ...

So my question is : is there anything to do appart from changing the 
SizeType typedef to something wider ? Does it sounds like a bug to you ?

Best regards,

Julien
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Julien MICHEL - Ingénieur d'études - Traitement d'images
CS Systèmes d'Information - Division ESPACE
Département Information Géographique & Image
Téléphone : +33 561 17 64 27
Email : julien.michel at c-s.fr

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Insight-users mailing list