Changeset 12338
- Timestamp:
- 10/05/07 22:02:08 (1 year ago)
- Files:
-
- branches/1.4/gdal/frmts/gtiff/geotiff.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.4/gdal/frmts/gtiff/geotiff.cpp
r12001 r12338 388 388 389 389 /* -------------------------------------------------------------------- */ 390 /* The bottom most partial tiles and strips are sometimes only */ 391 /* partially encoded. This code reduces the requested data so */ 392 /* an error won't be reported in this case. (#1179) */ 393 /* -------------------------------------------------------------------- */ 394 int nBlockReqSize = nBlockBufSize; 395 396 if( (nBlockYOff+1) * nBlockYSize > nRasterYSize ) 397 { 398 nBlockReqSize = (nBlockBufSize / nBlockYSize) 399 * (nBlockYSize - (((nBlockYOff+1) * nBlockYSize) % nRasterYSize)); 400 } 401 402 /* -------------------------------------------------------------------- */ 390 403 /* Handle the case of a strip or tile that doesn't exist yet. */ 391 404 /* Just set to zeros and return. */ … … 405 418 || poGDS->nPlanarConfig == PLANARCONFIG_SEPARATE ) 406 419 { 420 if( nBlockReqSize < nBlockBufSize ) 421 memset( pImage, 0, nBlockBufSize ); 422 407 423 if( TIFFIsTiled( poGDS->hTIFF ) ) 408 424 { 409 425 if( TIFFReadEncodedTile( poGDS->hTIFF, nBlockId, pImage, 410 nBlock BufSize ) == -1 )426 nBlockReqSize ) == -1 ) 411 427 { 412 428 memset( pImage, 0, nBlockBufSize ); … … 420 436 { 421 437 if( TIFFReadEncodedStrip( poGDS->hTIFF, nBlockId, pImage, 422 nBlock BufSize ) == -1 )438 nBlockReqSize ) == -1 ) 423 439 { 424 440 memset( pImage, 0, nBlockBufSize ); … … 1744 1760 1745 1761 /* -------------------------------------------------------------------- */ 1762 /* The bottom most partial tiles and strips are sometimes only */ 1763 /* partially encoded. This code reduces the requested data so */ 1764 /* an error won't be reported in this case. (#1179) */ 1765 /* -------------------------------------------------------------------- */ 1766 int nBlockReqSize = nBlockBufSize; 1767 int nBlocksPerRow = (nRasterXSize + nBlockXSize - 1) / nBlockXSize; 1768 int nBlockYOff = (nBlockId % nBlocksPerBand) / nBlocksPerRow; 1769 1770 if( (int)((nBlockYOff+1) * nBlockYSize) > nRasterYSize ) 1771 { 1772 nBlockReqSize = (nBlockBufSize / nBlockYSize) 1773 * (nBlockYSize - (((nBlockYOff+1) * nBlockYSize) % nRasterYSize)); 1774 memset( pabyBlockBuf, 0, nBlockBufSize ); 1775 } 1776 1777 /* -------------------------------------------------------------------- */ 1746 1778 /* If we don't have this block already loaded, and we know it */ 1747 1779 /* doesn't yet exist on disk, just zero the memory buffer and */ … … 1761 1793 { 1762 1794 if( TIFFReadEncodedTile(hTIFF, nBlockId, pabyBlockBuf, 1763 nBlock BufSize) == -1 )1795 nBlockReqSize) == -1 ) 1764 1796 { 1765 1797 /* Once TIFFError() is properly hooked, this can go away */ … … 1775 1807 { 1776 1808 if( TIFFReadEncodedStrip(hTIFF, nBlockId, pabyBlockBuf, 1777 nBlock BufSize) == -1 )1809 nBlockReqSize) == -1 ) 1778 1810 { 1779 1811 /* Once TIFFError() is properly hooked, this can go away */
