scrrun: Add basic IDictionary getHasVal support

Piotr Caban piotr.caban at gmail.com
Tue Oct 30 11:58:30 CDT 2012


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.



More information about the wine-devel mailing list