Changeset 12108
- Timestamp:
- 09/10/07 19:07:53 (1 year ago)
- Files:
-
- trunk/gdal/frmts/gtiff/gt_overview.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/gdal/frmts/gtiff/gt_overview.cpp
r10645 r12108 238 238 /* Do we have a palette? If so, create a TIFF compatible version. */ 239 239 /* -------------------------------------------------------------------- */ 240 unsigned short anTRed[65536], anTGreen[65536], anTBlue[65536];241 240 unsigned short *panRed=NULL, *panGreen=NULL, *panBlue=NULL; 242 241 … … 246 245 int nColorCount = MIN(65536,poCT->GetColorEntryCount()); 247 246 248 memset( anTRed, 0, 65536 * 2);249 memset( anTGreen, 0, 65536 * 2);250 memset( anTBlue, 0, 65536 * 2);247 panRed = (unsigned short *) CPLCalloc(nColorCount,sizeof(unsigned short)); 248 panGreen = (unsigned short *) CPLCalloc(nColorCount,sizeof(unsigned short)); 249 panBlue = (unsigned short *) CPLCalloc(nColorCount,sizeof(unsigned short)); 251 250 252 251 for( int iColor = 0; iColor < nColorCount; iColor++ ) … … 256 255 poCT->GetColorEntryAsRGB( iColor, &sRGB ); 257 256 258 anTRed[iColor] = (unsigned short) (256 * sRGB.c1); 259 anTGreen[iColor] = (unsigned short) (256 * sRGB.c2); 260 anTBlue[iColor] = (unsigned short) (256 * sRGB.c3); 261 } 262 263 panRed = anTRed; 264 panGreen = anTGreen; 265 panBlue = anTBlue; 257 panRed[iColor] = (unsigned short) (256 * sRGB.c1); 258 panGreen[iColor] = (unsigned short) (256 * sRGB.c2); 259 panBlue[iColor] = (unsigned short) (256 * sRGB.c3); 260 } 266 261 } 267 262 … … 288 283 } 289 284 285 if (panRed) 286 { 287 CPLFree(panRed); 288 CPLFree(panGreen); 289 CPLFree(panBlue); 290 panRed = panGreen = panBlue = NULL; 291 } 292 290 293 XTIFFClose( hOTIFF ); 291 294
