Changeset 12316
- Timestamp:
- 10/04/07 10:02:38 (1 year ago)
- Files:
-
- trunk/gdal/frmts/gtiff/geotiff.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/gdal/frmts/gtiff/geotiff.cpp
r12294 r12316 399 399 400 400 /* -------------------------------------------------------------------- */ 401 /* The bottom most partial tiles and strips are sometimes only */ 402 /* partially encoded. This code reduces the requested data so */ 403 /* an error won't be reported in this case. (#1179) */ 404 /* -------------------------------------------------------------------- */ 405 int nBlockReqSize = nBlockBufSize; 406 407 if( (nBlockYOff+1) * nBlockYSize > nRasterYSize ) 408 { 409 nBlockReqSize = (nBlockBufSize / nBlockYSize) 410 * (nBlockYSize - (((nBlockYOff+1) * nBlockYSize) % nRasterYSize)); 411 } 412 413 /* -------------------------------------------------------------------- */ 401 414 /* Handle the case of a strip or tile that doesn't exist yet. */ 402 415 /* Just set to zeros and return. */ … … 416 429 || poGDS->nPlanarConfig == PLANARCONFIG_SEPARATE ) 417 430 { 431 if( nBlockReqSize < nBlockBufSize ) 432 memset( pImage, 0, nBlockBufSize ); 433 418 434 if( TIFFIsTiled( poGDS->hTIFF ) ) 419 435 { 420 436 if( TIFFReadEncodedTile( poGDS->hTIFF, nBlockId, pImage, 421 nBlock BufSize ) == -1 )437 nBlockReqSize ) == -1 ) 422 438 { 423 439 memset( pImage, 0, nBlockBufSize ); … … 431 447 { 432 448 if( TIFFReadEncodedStrip( poGDS->hTIFF, nBlockId, pImage, 433 nBlock BufSize ) == -1 )449 nBlockReqSize ) == -1 ) 434 450 { 435 451 memset( pImage, 0, nBlockBufSize ); … … 1259 1275 1260 1276 { 1261 return poColorTable;1277 return poColorTable; 1262 1278 } 1263 1279 … … 1832 1848 1833 1849 /* -------------------------------------------------------------------- */ 1850 /* The bottom most partial tiles and strips are sometimes only */ 1851 /* partially encoded. This code reduces the requested data so */ 1852 /* an error won't be reported in this case. (#1179) */ 1853 /* -------------------------------------------------------------------- */ 1854 int nBlockReqSize = nBlockBufSize; 1855 int nBlockYOff = nBlockId % nBlocksPerBand; 1856 1857 if( (int)((nBlockYOff+1) * nBlockYSize) > nRasterYSize ) 1858 { 1859 nBlockReqSize = (nBlockBufSize / nBlockYSize) 1860 * (nBlockYSize - (((nBlockYOff+1) * nBlockYSize) % nRasterYSize)); 1861 memset( pabyBlockBuf, 0, nBlockBufSize ); 1862 } 1863 1864 /* -------------------------------------------------------------------- */ 1834 1865 /* If we don't have this block already loaded, and we know it */ 1835 1866 /* doesn't yet exist on disk, just zero the memory buffer and */ … … 1849 1880 { 1850 1881 if( TIFFReadEncodedTile(hTIFF, nBlockId, pabyBlockBuf, 1851 nBlock BufSize) == -1 )1882 nBlockReqSize) == -1 ) 1852 1883 { 1853 1884 /* Once TIFFError() is properly hooked, this can go away */ … … 1863 1894 { 1864 1895 if( TIFFReadEncodedStrip(hTIFF, nBlockId, pabyBlockBuf, 1865 nBlock BufSize) == -1 )1896 nBlockReqSize) == -1 ) 1866 1897 { 1867 1898 /* Once TIFFError() is properly hooked, this can go away */
