[Libreoffice-commits] core.git: include/tools

Stephan Bergmann sbergman at redhat.com
Thu Sep 17 05:47:39 PDT 2015


 include/tools/inetmime.hxx |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

New commits:
commit 63e7b7afa75252298606c84e8ec82adaee5fa28a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Sep 17 14:42:55 2015 +0200

    Don't violate unordered container hash+pred requirements
    
    "Two values k1 and k2 of type Key are considered equivalent if the container's
    key equality predicate returns true when passed those values.  If k1 and k2 are
    equivalent, the container's hash function shall return the same value for both."
    [unord.req]
    
    But for INetContentTypeParameterList, all inserted keys are already lower-case
    by construction, and all queries happen to be done with (literal) lower-case
    keys, so just document the requirement here that insertion and query needs to be
    done with lower-case keys.
    
    Change-Id: Ic46845b7bb0376e995e7736b57fa80c777d1c263

diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx
index 78dd8e5..b5d4786 100644
--- a/include/tools/inetmime.hxx
+++ b/include/tools/inetmime.hxx
@@ -106,17 +106,9 @@ struct INetContentTypeParameter
     }
 };
 
-struct OString_equalsIgnoreAsciiCase
-{
-    bool operator()(const OString& r1, const OString& r2) const
-    {
-        return r1.equalsIgnoreAsciiCase(r2);
-    }
-};
-
-// the key is the m_sAttribute again
-typedef std::unordered_map<OString, INetContentTypeParameter, OStringHash,
-            OString_equalsIgnoreAsciiCase> INetContentTypeParameterList;
+// the key is the m_sAttribute again; all keys are lower case:
+typedef std::unordered_map<OString, INetContentTypeParameter, OStringHash>
+    INetContentTypeParameterList;
 
 
 class TOOLS_DLLPUBLIC INetMIME


More information about the Libreoffice-commits mailing list