The tools/ code has some legacy 'LockRegion' and 'UnlockRegion' methods that are only ever used by 'LockFile' and 'UnlockFile' which in turn are only used on close and open (it seems).
We should get rid of the LockRegion / UnlockRegion methods - and since these are only ever called with:
return LockRange( 0UL, 0UL );
return UnlockRange( 0UL, 0UL );
We should collapse all of their contents into LockFile/UnlockFile - and we should propagate the conseqences of 0 length, and 0 size through the code.
That code is in tools/source/stream/strmunx.cxx and strmwnt.cxx
Do whichever platform you can compile on first :-)
We should also (as a separate patch) remove all these overly verbose function header comments with no content except the method name that just obscure the code :-)
Except if I missed something, it seems there's not much left about LockRegion and UnlockRegion.
Opengrok finds this for LockRegion :
thumbviewer.cxx 139 virtual HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
282 HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD)
stream.hxx 165 virtual ErrCode LockRegion(sal_Size, sal_Size, LockType);
stream.cxx 268 ErrCode SvLockBytes::LockRegion(sal_Size, sal_Size, LockType)
270 OSL_FAIL("SvLockBytes::LockRegion(): Not implemented");
And there's the equivalent for UnlockRegion.
May we just remove this (and the same for UnlockRegion ?)
Yep - we should get rid of the LockRegion / UnlockRegion methods :-)
Deteted "Easyhack" from summary
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":
Related fdo#44989: Bin (Un)LockRegion functions
fixed long ago but un-closed :-)
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)