Skip to content
Permalink
Browse files

Changed from int to size_t in some places

  • Loading branch information
homann committed Sep 13, 2012
1 parent 35f7a1c commit bb17e8237274fad737bcd63c0140af8cce679733
Showing with 9 additions and 9 deletions.
  1. +3 −3 src/core/qgsrasterdataprovider.cpp
  2. +6 −6 src/core/qgsrasterprojector.cpp
@@ -64,7 +64,7 @@ void QgsRasterDataProvider::readBlock( int bandNo, QgsRectangle
return;

// Allocate memory for not projected source data
int mySize = dataTypeSize( bandNo ) / 8;
size_t mySize = dataTypeSize( bandNo ) / 8;
void *mySrcData = malloc( mySize * myProjector.srcRows() * myProjector.srcCols() );

time.restart();
@@ -265,9 +265,9 @@ QString QgsRasterDataProvider::lastErrorFormat()
QByteArray QgsRasterDataProvider::noValueBytes( int theBandNo )
{
int type = dataType( theBandNo );
int size = dataTypeSize( theBandNo ) / 8;
size_t size = dataTypeSize( theBandNo ) / 8;
QByteArray ba;
ba.resize( size );
ba.resize(( int )size );
char * data = ba.data();
double noval = mNoDataValue[theBandNo-1];
unsigned char uc;
@@ -194,7 +194,7 @@ void QgsRasterProjector::calc()
}
// What is the maximum reasonable size of transformatio matrix?
// TODO: consider better when to break - ratio
if ( mCPRows * mCPCols > 0.0625 * mDestRows * mDestCols )
if ( mCPRows * mCPCols > 0.25 * mDestRows * mDestCols )
{
QgsDebugMsg( "Too large CP matrix" );
mApproximate = false;
@@ -679,11 +679,11 @@ void * QgsRasterProjector::readBlock( int bandNo, QgsRectangle const & extent,

if ( !inputData ) return 0;

int pixelSize = mInput->typeSize( mInput->dataType( bandNo ) ) / 8;
size_t pixelSize = mInput->typeSize( mInput->dataType( bandNo ) ) / 8;

int inputSize = pixelSize * srcCols() * srcRows();
size_t inputSize = pixelSize * srcCols() * srcRows();

int outputSize = width * height * pixelSize;
size_t outputSize = width * height * pixelSize;
void * outputData = malloc( outputSize );

// Check for allcoation error
@@ -701,8 +701,8 @@ void * QgsRasterProjector::readBlock( int bandNo, QgsRectangle const & extent,
for ( int j = 0; j < width; ++j )
{
srcRowCol( i, j, &srcRow, &srcCol );
int srcIndex = pixelSize * ( srcRow * mSrcCols + srcCol );
int destIndex = pixelSize * ( i * width + j );
size_t srcIndex = pixelSize * ( srcRow * mSrcCols + srcCol );
size_t destIndex = pixelSize * ( i * width + j );

if ( srcIndex >= inputSize || destIndex >= outputSize ) continue; // should not happen

0 comments on commit bb17e82

Please sign in to comment.
You can’t perform that action at this time.