Bug 83512 - [EasyHack] Make use of OUStringHash
Summary: [EasyHack] Make use of OUStringHash
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.4.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2014-09-04 22:33 UTC by Thomas Arnhold
Modified: 2015-12-15 23:57 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 Thomas Arnhold 2014-09-04 22:33:30 UTC
Like http://cgit.freedesktop.org/libreoffice/core/commit/?id=d5dd1216804afae35d7fe7dbb1d37b0ca1fcce88

we should use OUStringHash at many more points (grep for "return .*\.hashCode()" or something similar):

http://opengrok.libreoffice.org/xref/core/comphelper/source/container/embeddedobjectcontainer.cxx#57
http://opengrok.libreoffice.org/xref/core/desktop/source/deployment/registry/dp_registry.cxx#67
http://opengrok.libreoffice.org/xref/core/extensions/source/ole/ole2uno.hxx#85
http://opengrok.libreoffice.org/xref/core/filter/source/svg/svgwriter.hxx#177
http://opengrok.libreoffice.org/xref/core/idlc/inc/idlc/idlctypes.hxx#45
http://opengrok.libreoffice.org/xref/core/include/toolkit/controls/eventcontainer.hxx#43
http://opengrok.libreoffice.org/xref/core/scripting/source/stringresource/stringresource.hxx#60
http://opengrok.libreoffice.org/xref/core/sfx2/source/appl/newhelp.cxx#570
http://opengrok.libreoffice.org/xref/core/stoc/source/inspect/introspection.cxx#143
http://opengrok.libreoffice.org/xref/core/stoc/source/namingservice/namingservice.cxx#73
http://opengrok.libreoffice.org/xref/core/stoc/source/servicemanager/servicemanager.cxx#302
http://opengrok.libreoffice.org/xref/core/ucb/source/ucp/file/shell.hxx#129
http://opengrok.libreoffice.org/xref/core/ucb/source/ucp/hierarchy/hierarchyprovider.hxx#79
http://opengrok.libreoffice.org/xref/core/ucb/source/ucp/package/pkgprovider.cxx#107
http://opengrok.libreoffice.org/xref/core/ucb/source/ucp/webdav-neon/ContentProperties.hxx#63
http://opengrok.libreoffice.org/xref/core/ucb/source/ucp/webdav/ContentProperties.hxx#56
http://opengrok.libreoffice.org/xref/core/ucbhelper/source/provider/providerhelper.cxx#54
http://opengrok.libreoffice.org/xref/core/xmlhelp/source/cxxhelp/provider/databases.hxx#160
http://opengrok.libreoffice.org/xref/core/xmlhelp/source/cxxhelp/provider/databases.hxx#341
http://opengrok.libreoffice.org/xref/core/xmlhelp/source/cxxhelp/provider/db.hxx#78

http://opengrok.libreoffice.org/xref/core/cppu/source/uno/lbmap.cxx#126
http://opengrok.libreoffice.org/xref/core/stoc/source/corereflection/lrucache.hxx#229
Comment 1 d.sikeler94 2014-09-12 06:35:23 UTC
Most of the files are using OUStringHash or OStringHash now.

except for:
desktop/source/deployment/registry/dp_registry.cxx converts the string to lower ASCII case before computing hash.
struct ci_string_hash {
   ::std::size_t operator () ( OUString const & str ) const {
       return str.toAsciiLowerCase().hashCode();
   }
};

ucb/source/ucp/file/shell.hxx doesn't work directly on strings.
struct hMyProperty
{
     size_t operator()( const MyProperty& rName ) const
     {
         return rName.getPropertyName().hashCode();
     }
};
Comment 2 Thomas Arnhold 2014-09-12 07:53:57 UTC
That's not true. All files listed still call hashCode(). Please see commit d5dd1216804afae35d7fe7dbb1d37b0ca1fcce88 to get an idea how it would look like when using OUStringHash.
Comment 3 d.sikeler94 2014-09-12 08:27:24 UTC
Ouh yeah, I'm sorry. I pushed a patch to gerrit, which hasn't been merged now.
Comment 4 Thomas Arnhold 2014-09-12 08:40:17 UTC
Sorry, I didn't look at gerrit. Great that you did this! :)
Comment 5 Commit Notification 2014-09-18 11:15:14 UTC
Daniel Sikeler committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=32d6415617b5815bb5d18719f6d2df74becc0997

fdo#83512 Make use of OUStringHash and OStringHash



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Robinson Tryon (qubit) 2015-12-15 23:57:26 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp TopicCleanup)
[NinjaEdit]