Skip to content

Commit 7747d1f

Browse files
committedJan 18, 2012
Better to use unsigned char
1 parent 53500e7 commit 7747d1f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

‎src/analysis/raster/qgsrelief.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ int QgsRelief::processRaster( QProgressDialog* p )
164164
float* scanLine2 = ( float * ) CPLMalloc( sizeof( float ) * xSize );
165165
float* scanLine3 = ( float * ) CPLMalloc( sizeof( float ) * xSize );
166166

167-
char* resultRedLine = ( char * ) CPLMalloc( sizeof( char ) * xSize );
168-
char* resultGreenLine = ( char * ) CPLMalloc( sizeof( char ) * xSize );
169-
char* resultBlueLine = ( char * ) CPLMalloc( sizeof( char ) * xSize );
167+
unsigned char* resultRedLine = ( unsigned char * ) CPLMalloc( sizeof( unsigned char ) * xSize );
168+
unsigned char* resultGreenLine = ( unsigned char * ) CPLMalloc( sizeof( unsigned char ) * xSize );
169+
unsigned char* resultBlueLine = ( unsigned char * ) CPLMalloc( sizeof( unsigned char ) * xSize );
170170

171171
if ( p )
172172
{
@@ -278,7 +278,7 @@ int QgsRelief::processRaster( QProgressDialog* p )
278278
}
279279

280280
bool QgsRelief::processNineCellWindow( float* x1, float* x2, float* x3, float* x4, float* x5, float* x6, float* x7, float* x8, float* x9,
281-
char* red, char* green, char* blue )
281+
unsigned char* red, unsigned char* green, unsigned char* blue )
282282
{
283283
//1. component: colour and hillshade from 300 degrees
284284
int r = 0;
@@ -363,9 +363,9 @@ bool QgsRelief::processNineCellWindow( float* x1, float* x2, float* x3, float* x
363363
b = b3 * 0.1 + b * 0.9;
364364
}
365365

366-
*red = ( char )r;
367-
*green = ( char )g;
368-
*blue = ( char )b;
366+
*red = ( unsigned char )r;
367+
*green = ( unsigned char )g;
368+
*blue = ( unsigned char )b;
369369
return true;
370370
}
371371

‎src/analysis/raster/qgsrelief.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class ANALYSIS_EXPORT QgsRelief
8989
QList< ReliefColor > mReliefColors;
9090

9191
bool processNineCellWindow( float* x1, float* x2, float* x3, float* x4, float* x5, float* x6, float* x7, float* x8, float* x9,
92-
char* red, char* green, char* blue );
92+
unsigned char* red, unsigned char* green, unsigned char* blue );
9393

9494
/**Opens the input file and returns the dataset handle and the number of pixels in x-/y- direction*/
9595
GDALDatasetH openInputFile( int& nCellsX, int& nCellsY );

0 commit comments

Comments
 (0)
Please sign in to comment.