Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
xpcmaps.cpp File Reference
#include "xpcprivate.h"

Go to the source code of this file.

Classes

struct  JSDHashTableOps
struct  JSDHashTableOps
struct  JSDHashTableOps
struct  JSDHashTableOps
struct  JSDHashTableOps

Functions

static JSDHashNumber
JS_DLL_CALLBACK 
HashIIDPtrKey (JSDHashTable *table, const void *key)
static JSBool JS_DLL_CALLBACK MatchIIDPtrKey (JSDHashTable *table, const JSDHashEntryHdr *entry, const void *key)
static JSDHashNumber
JS_DLL_CALLBACK 
HashNativeKey (JSDHashTable *table, const void *key)

Class Documentation

struct JSDHashTableOps

Definition at line 338 of file jsdhash.h.

Class Members
JSDHashAllocTable allocTable
Clear
JSDHashClearEntry clearEntry
JSDHashFinalize finalize
JSDHashFreeTable freeTable
JSDHashGetKey getKey
GetKey
Hash
HashIIDPtrKey
JSDHashHashKey hashKey
HashNativeKey
JSDHashInitEntry initEntry
JS_DHashAllocTable
JS_DHashClearEntryStub
JS_DHashFreeTable
JS_DHashGetKeyStub
JS_DHashMoveEntryStub
Match
JSDHashMatchEntry matchEntry
MatchIIDPtrKey
JSDHashMoveEntry moveEntry
struct JSDHashTableOps

Definition at line 338 of file jsdhash.h.

Class Members
JSDHashAllocTable allocTable
Clear
JSDHashClearEntry clearEntry
JSDHashFinalize finalize
JSDHashFreeTable freeTable
JSDHashGetKey getKey
GetKey
Hash
HashIIDPtrKey
JSDHashHashKey hashKey
HashNativeKey
JSDHashInitEntry initEntry
JS_DHashAllocTable
JS_DHashClearEntryStub
JS_DHashFreeTable
JS_DHashGetKeyStub
JS_DHashMoveEntryStub
Match
JSDHashMatchEntry matchEntry
MatchIIDPtrKey
JSDHashMoveEntry moveEntry
struct JSDHashTableOps

Definition at line 338 of file jsdhash.h.

Class Members
JSDHashAllocTable allocTable
Clear
JSDHashClearEntry clearEntry
JSDHashFinalize finalize
JSDHashFreeTable freeTable
JSDHashGetKey getKey
GetKey
Hash
HashIIDPtrKey
JSDHashHashKey hashKey
HashNativeKey
JSDHashInitEntry initEntry
JS_DHashAllocTable
JS_DHashClearEntryStub
JS_DHashFreeTable
JS_DHashGetKeyStub
JS_DHashMoveEntryStub
Match
JSDHashMatchEntry matchEntry
MatchIIDPtrKey
JSDHashMoveEntry moveEntry
struct JSDHashTableOps

Definition at line 338 of file jsdhash.h.

Class Members
JSDHashAllocTable allocTable
Clear
JSDHashClearEntry clearEntry
JSDHashFinalize finalize
JSDHashFreeTable freeTable
JSDHashGetKey getKey
GetKey
Hash
HashIIDPtrKey
JSDHashHashKey hashKey
HashNativeKey
JSDHashInitEntry initEntry
JS_DHashAllocTable
JS_DHashClearEntryStub
JS_DHashFreeTable
JS_DHashGetKeyStub
JS_DHashMoveEntryStub
Match
JSDHashMatchEntry matchEntry
MatchIIDPtrKey
JSDHashMoveEntry moveEntry
struct JSDHashTableOps

Definition at line 338 of file jsdhash.h.

Class Members
JSDHashAllocTable allocTable
Clear
JSDHashClearEntry clearEntry
JSDHashFinalize finalize
JSDHashFreeTable freeTable
JSDHashGetKey getKey
GetKey
Hash
HashIIDPtrKey
JSDHashHashKey hashKey
HashNativeKey
JSDHashInitEntry initEntry
JS_DHashAllocTable
JS_DHashClearEntryStub
JS_DHashFreeTable
JS_DHashGetKeyStub
JS_DHashMoveEntryStub
Match
JSDHashMatchEntry matchEntry
MatchIIDPtrKey
JSDHashMoveEntry moveEntry

Function Documentation

static JSDHashNumber JS_DLL_CALLBACK HashIIDPtrKey ( JSDHashTable table,
const void key 
) [static]

Definition at line 52 of file xpcmaps.cpp.

{
    return *((JSHashNumber*)key);
}
static JSDHashNumber JS_DLL_CALLBACK HashNativeKey ( JSDHashTable table,
const void key 
) [static]

Definition at line 67 of file xpcmaps.cpp.

{
    XPCNativeSetKey* Key = (XPCNativeSetKey*) key;

    JSDHashNumber h = 0;

    XPCNativeSet*       Set;
    XPCNativeInterface* Addition;
    PRUint16            Position;

    if(Key->IsAKey())
    {
        Set      = Key->GetBaseSet();
        Addition = Key->GetAddition();
        Position = Key->GetPosition();
    }
    else
    {
        Set      = (XPCNativeSet*) Key;
        Addition = nsnull;
        Position = 0;
    }

    if(!Set)
    {
        NS_ASSERTION(Addition, "bad key");
        // This would be an XOR like below. 
        // But "0 ^ x == x". So it does not matter.
        h = (JSHashNumber) NS_PTR_TO_INT32(Addition) >> 2;
    }
    else
    {
        XPCNativeInterface** Current = Set->GetInterfaceArray();
        PRUint16 count = Set->GetInterfaceCount();
        if(Addition)
        {
            count++;
            for(PRUint16 i = 0; i < count; i++)
            {
                if(i == Position)
                    h ^= (JSHashNumber) NS_PTR_TO_INT32(Addition) >> 2;
                else
                    h ^= (JSHashNumber) NS_PTR_TO_INT32(*(Current++)) >> 2;
            }
        }
        else
        {
            for(PRUint16 i = 0; i < count; i++)
                h ^= (JSHashNumber) NS_PTR_TO_INT32(*(Current++)) >> 2;
        }
    }

    return h;
}

Here is the call graph for this function:

static JSBool JS_DLL_CALLBACK MatchIIDPtrKey ( JSDHashTable table,
const JSDHashEntryHdr entry,
const void key 
) [static]

Definition at line 58 of file xpcmaps.cpp.

{
    return ((const nsID*)key)->
                Equals(*((const nsID*)((JSDHashEntryStub*)entry)->key));
}

Here is the call graph for this function: