Bug Hunting Session
Bug 44989 - tools: SvStream: simplify LockRegion
Summary: tools: SvStream: simplify LockRegion
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.7.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2012-01-20 06:03 UTC by Michael Meeks
Modified: 2015-12-15 23:50 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2012-01-20 06:03:54 UTC
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 :-)
Comment 1 Julien Nabet 2012-01-20 15:20:38 UTC
Except if I missed something, it seems there's not much left about LockRegion and UnlockRegion.

Opengrok finds this for LockRegion :
  /core/shell/source/win32/shlxthandler/thumbviewer/
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)
  /core/tools/inc/tools/
stream.hxx 	165 virtual ErrCode LockRegion(sal_Size, sal_Size, LockType);
  /core/tools/source/stream/
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 ?)
Comment 2 Michael Meeks 2012-01-24 06:51:05 UTC
Yep - we should get rid of the LockRegion / UnlockRegion methods :-)
thanks.
Comment 3 Florian Reisinger 2012-05-18 09:14:32 UTC
Deteted "Easyhack" from summary
Comment 4 Not Assigned 2012-08-15 14:44:31 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1be58f5c257b5dd467110d3e5faf3f8f48db4995

Related fdo#44989: Bin (Un)LockRegion functions
Comment 5 Michael Meeks 2012-11-25 12:59:11 UTC
fixed long ago but un-closed :-)
Comment 6 Robinson Tryon (qubit) 2015-12-15 23:50:45 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)
[NinjaEdit]