Skip to content

Commit

Permalink
typo and minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
chacha21 committed Nov 19, 2021
1 parent 7915151 commit 88467ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gcore/gdalabstractbandblockcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ApplyCacheHelperFlushHandler( const GDALDataset* currentDataset, const GDALDatas
*
* @param pfnCacheHelperHandlerNew new GDALCacheFlushHelperHandler, can be 0 to set none
* @param cacheManager unused for now, just in case in the future a cache redesign could allow several cache block pools
* @param pUserData custom use data, that must be remain valid until the handler is uninstalled
* @param pUserData custom user data, that must remain valid until the handler is uninstalled
* @return the previous GDALCacheFlushHelperHandler
*/

Expand Down
7 changes: 4 additions & 3 deletions gcore/gdalrasterblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,9 +989,10 @@ CPLErr GDALRasterBlock::Internalize()
}
else if (nDisableDirtyBlockFlushCounter == 0)
{
GDALDataset* otherDataset = poTarget->poBand->GetDataset();
const bool canFlushOtherDataset = ApplyCacheHelperFlushHandler(poThisDS, otherDataset, 0);
if( (poTarget->poBand->GetDataset() == poThisDS ) || canFlushOtherDataset)
GDALDataset* targetDataset = poTarget->poBand->GetDataset();
const bool isSameDataset = (targetDataset == poThisDS);
const bool canFlushTargetDataset = isSameDataset || ApplyCacheHelperFlushHandler(poThisDS, targetDataset, 0);
if( canFlushTargetDataset )
{
if( CPLAtomicCompareAndExchange(
&(poTarget->nLockCount), 0, -1) )
Expand Down

0 comments on commit 88467ca

Please sign in to comment.