Commit 3972c2cc authored by Kitware Robot's avatar Kitware Robot Committed by T.J. Corona
Browse files

metaio: update to master

Code extracted from:

    https://github.com/Kitware/MetaIO.git

at commit 4c85a18eb668d6426e36a974472b07c0cb7ce3f7.
parent 8bd5a1ff
......@@ -1150,7 +1150,7 @@ M_ReadElements(METAIO_STREAM::ifstream * _fstream, void * _data,
_fstream->seekg(0, METAIO_STREAM::ios::beg);
}
unsigned char* compr = new unsigned char[m_CompressedElementDataSize];
unsigned char* compr = new unsigned char[static_cast<size_t>(m_CompressedElementDataSize)];
_fstream->read((char *)compr, (size_t)m_CompressedElementDataSize);
MET_PerformUncompression(compr, m_CompressedElementDataSize,
......
......@@ -554,7 +554,7 @@ InitializeEssential(int _nDims,
{
m_AutoFreeElementData = true;
MET_SizeOfType(m_ElementType, &i);
m_ElementData = new char[m_Quantity*m_ElementNumberOfChannels*i];
m_ElementData = new char[static_cast<size_t>(m_Quantity*m_ElementNumberOfChannels*i)];
if(m_ElementData == NULL)
{
METAIO_STREAM::cerr << "MetaImage:: M_Allocate:: Insufficient memory"
......@@ -986,7 +986,7 @@ ConvertElementDataTo(MET_ValueEnumType _elementType,
{
int eSize;
MET_SizeOfType(_elementType, &eSize);
void * newElementData = new char[m_Quantity*m_ElementNumberOfChannels*eSize];
void * newElementData = new char[static_cast<size_t>(m_Quantity*m_ElementNumberOfChannels*eSize)];
ElementByteOrderFix();
if(!ElementMinMaxValid())
......@@ -2525,7 +2525,7 @@ M_ReadElements(METAIO_STREAM::ifstream * _fstream, void * _data,
_fstream->seekg(0, METAIO_STREAM::ios::beg);
}
unsigned char* compr = new unsigned char[m_CompressedDataSize];
unsigned char* compr = new unsigned char[static_cast<size_t>(m_CompressedDataSize)];
M_ReadElementData( _fstream, compr, m_CompressedDataSize );
......@@ -3203,7 +3203,7 @@ M_ReadElementsROI(METAIO_STREAM::ifstream * _fstream, void * _data,
if(subSamplingFactor > 1)
{
unsigned char* subdata = new unsigned char[bytesToRead];
unsigned char* subdata = new unsigned char[static_cast<size_t>(bytesToRead)];
METAIO_STL::streamoff rOff =
MET_UncompressStream(_fstream, seekoff, subdata,
bytesToRead, m_CompressedDataSize,
......@@ -3350,7 +3350,7 @@ M_ReadElementsROI(METAIO_STREAM::ifstream * _fstream, void * _data,
}
else // Binary data
{
char* subdata = new char[elementsToRead*elementNumberOfBytes];
char* subdata = new char[static_cast<size_t>(elementsToRead*elementNumberOfBytes)];
_fstream->read(subdata, size_t(elementsToRead*elementNumberOfBytes));
......
......@@ -330,7 +330,7 @@ M_Read(void)
MET_SizeOfType(m_ElementType, &elementSize);
METAIO_STL::streamsize readSize = m_NPoints*(m_NDims+4)*elementSize;
char* _data = new char[readSize];
char* _data = new char[static_cast<size_t>(readSize)];
m_ReadStream->read((char *)_data, readSize);
METAIO_STL::streamsize gc = m_ReadStream->gcount();
......
......@@ -581,7 +581,7 @@ METAIO_STL::streamoff MET_UncompressStream(METAIO_STREAM::ifstream * stream,
firstchunk = false;
}
unsigned char* outdata = new unsigned char[buffersize];
unsigned char* outdata = new unsigned char[static_cast<size_t>(buffersize)];
d_stream->avail_out = (uInt)( buffersize );
......@@ -597,7 +597,7 @@ METAIO_STL::streamoff MET_UncompressStream(METAIO_STREAM::ifstream * stream,
inputBufferSize = compressedDataSize-zseekpos;
}
unsigned char* inputBuffer = new unsigned char[inputBufferSize];
unsigned char* inputBuffer = new unsigned char[static_cast<size_t>(inputBufferSize)];
stream->seekg(currentPos+zseekpos,METAIO_STREAM::ios::beg);
stream->read((char *)inputBuffer, (size_t)inputBufferSize);
......@@ -701,9 +701,9 @@ unsigned char * MET_PerformCompression(const unsigned char * source,
METAIO_STL::streamoff buffer_size = sourceSize;
unsigned char * input_buffer = const_cast<unsigned char *>(source);
unsigned char * output_buffer = new unsigned char[buffer_size];
unsigned char * output_buffer = new unsigned char[static_cast<size_t>(buffer_size)];
compressedData = new unsigned char[buffer_size];
compressedData = new unsigned char[static_cast<size_t>(buffer_size)];
deflateInit(&z, compression_rate);
......@@ -727,7 +727,7 @@ unsigned char * MET_PerformCompression(const unsigned char * source,
// when the output is bigger than the input (true for small images)
if(j+count>=buffer_size)
{
unsigned char* compressedDataTemp = new unsigned char[j+count+1];
unsigned char* compressedDataTemp = new unsigned char[static_cast<size_t>(j+count+1)];
memcpy(compressedDataTemp,compressedData,(size_t)buffer_size);
delete [] compressedData;
compressedData = compressedDataTemp;
......@@ -744,7 +744,7 @@ unsigned char * MET_PerformCompression(const unsigned char * source,
{
if(j+count>=buffer_size)
{
unsigned char* compressedDataTemp = new unsigned char[j+count+1];
unsigned char* compressedDataTemp = new unsigned char[static_cast<size_t>(j+count+1)];
memcpy(compressedDataTemp,compressedData,(size_t)buffer_size);
delete [] compressedData;
compressedData = compressedDataTemp;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment