[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: scrrun: Add basic IDictionary getHasVal support
From:       Piotr Caban <piotr.caban () gmail ! com>
Date:       2012-10-30 16:58:30
Message-ID: 50900736.8070902 () gmail ! com
[Download RAW message or body]

Hi,

On 10/30/12 09:51, Alistair Leslie-Hughes wrote:
+static LONG create_hash_val(BSTR name)
+{
+    LONG hash = 0;
+    int len = SysStringLen(name);
+    int i;
+
+    for(i =0; i < len; i++)
+    {
+	hash += name[i];
+    }
+
+    return hash;
+}
This hashing function will have lots of conflicts when used in
hash-table. It's quite easy to guess how it's done in native dll:

for(i=0; i<len; i++)
     hash = (hash<<4) + hash + name[i];
hash %= 1201;

It would be nice to add some tests for strings containing '\0'
characters and for other VARIANT types. I don't know how scrrun stores
data internally, if it's using a hash-table, the function may change
after adding some elements.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic