Skip to content

Commit

Permalink
Changed from int to size_t in some places
Browse files Browse the repository at this point in the history
  • Loading branch information
homann committed Sep 13, 2012
1 parent 35f7a1c commit bb17e82
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/core/qgsrasterdataprovider.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/core/qgsrasterprojector.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit bb17e82

Please sign in to comment.