ReactOS 0.4.17-dev-966-gf06eace
dictionary.c File Reference
#include <stdarg.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "olectl.h"
#include "dispex.h"
#include "scrrun.h"
#include "scrrun_private.h"
#include "wine/debug.h"
#include "wine/list.h"
Include dependency graph for dictionary.c:

Go to the source code of this file.

Classes

struct  keyitem_pair
 
struct  dictionary
 
struct  dictionary_enum
 

Macros

#define COBJMACROS
 
#define BUCKET_COUNT   509
 
#define DICT_HASH_MOD   1201
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (scrrun)
 
static struct dictionary * impl_from_IDictionary (IDictionary *iface)
 
static struct dictionary_enum * impl_from_IEnumVARIANT (IEnumVARIANT *iface)
 
static struct list * get_bucket_head (struct dictionary *dict, DWORD hash)
 
static BOOL is_string_key (const VARIANT *key)
 
static BOOL is_ptr_key (const VARIANT *key)
 
static BOOL is_numeric_key (const VARIANT *key)
 
static WCHAR * get_key_strptr (const VARIANT *key)
 
static int strcmp_key (const struct dictionary *dict, const VARIANT *key1, const VARIANT *key2)
 
static BOOL numeric_key_eq (const VARIANT *key1, const VARIANT *key2)
 
static BOOL is_matching_key (const struct dictionary *dict, const struct keyitem_pair *pair, const VARIANT *key, DWORD hash)
 
static struct keyitem_pair * get_keyitem_pair (struct dictionary *dict, VARIANT *key)
 
static HRESULT add_keyitem_pair (struct dictionary *dict, VARIANT *key, VARIANT *item)
 
static void free_keyitem_pair (struct keyitem_pair *pair)
 
static HRESULT WINAPI dict_enum_QueryInterface (IEnumVARIANT *iface, REFIID riid, void **obj)
 
static ULONG WINAPI dict_enum_AddRef (IEnumVARIANT *iface)
 
static ULONG WINAPI dict_enum_Release (IEnumVARIANT *iface)
 
static HRESULT WINAPI dict_enum_Next (IEnumVARIANT *iface, ULONG count, VARIANT *keys, ULONG *fetched)
 
static HRESULT WINAPI dict_enum_Skip (IEnumVARIANT *iface, ULONG count)
 
static HRESULT WINAPI dict_enum_Reset (IEnumVARIANT *iface)
 
static HRESULT create_dict_enum (struct dictionary *, IUnknown **)
 
static HRESULT WINAPI dict_enum_Clone (IEnumVARIANT *iface, IEnumVARIANT **cloned)
 
static void notify_remove_pair (struct list *notifier, struct list *pair)
 
static HRESULT WINAPI dictionary_QueryInterface (IDictionary *iface, REFIID riid, void **obj)
 
static ULONG WINAPI dictionary_AddRef (IDictionary *iface)
 
static ULONG WINAPI dictionary_Release (IDictionary *iface)
 
static HRESULT WINAPI dictionary_GetTypeInfoCount (IDictionary *iface, UINT *pctinfo)
 
static HRESULT WINAPI dictionary_GetTypeInfo (IDictionary *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI dictionary_GetIDsOfNames (IDictionary *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI dictionary_Invoke (IDictionary *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI dictionary_putref_Item (IDictionary *iface, VARIANT *key, VARIANT *item)
 
static HRESULT WINAPI dictionary_put_Item (IDictionary *iface, VARIANT *key, VARIANT *item)
 
static HRESULT WINAPI dictionary_get_Item (IDictionary *iface, VARIANT *key, VARIANT *item)
 
static HRESULT WINAPI dictionary_Add (IDictionary *iface, VARIANT *key, VARIANT *item)
 
static HRESULT WINAPI dictionary_get_Count (IDictionary *iface, LONG *count)
 
static HRESULT WINAPI dictionary_Exists (IDictionary *iface, VARIANT *key, VARIANT_BOOL *exists)
 
static HRESULT WINAPI dictionary_Items (IDictionary *iface, VARIANT *items)
 
static HRESULT WINAPI dictionary_put_Key (IDictionary *iface, VARIANT *key, VARIANT *newkey)
 
static HRESULT WINAPI dictionary_Keys (IDictionary *iface, VARIANT *keys)
 
static HRESULT WINAPI dictionary_Remove (IDictionary *iface, VARIANT *key)
 
static HRESULT WINAPI dictionary_RemoveAll (IDictionary *iface)
 
static HRESULT WINAPI dictionary_put_CompareMode (IDictionary *iface, CompareMethod method)
 
static HRESULT WINAPI dictionary_get_CompareMode (IDictionary *iface, CompareMethod *method)
 
static HRESULT WINAPI dictionary__NewEnum (IDictionary *iface, IUnknown **ret)
 
static DWORD get_str_hash (const WCHAR *str, CompareMethod method)
 
static DWORD get_num_hash (FLOAT num)
 
static HRESULT get_flt_hash (FLOAT flt, LONG *hash)
 
static DWORD get_ptr_hash (void *ptr)
 
static HRESULT WINAPI dictionary_get_HashVal (IDictionary *iface, VARIANT *key, VARIANT *hash)
 
HRESULT WINAPI Dictionary_CreateInstance (IClassFactory *factory, IUnknown *outer, REFIID riid, void **ret)
 

Variables

static const IEnumVARIANTVtbl dictenumvtbl
 
static const struct IDictionaryVtbl dictionary_vtbl
 

Macro Definition Documentation

◆ BUCKET_COUNT

#define BUCKET_COUNT   509

Definition at line 41 of file dictionary.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file dictionary.c.

◆ DICT_HASH_MOD

#define DICT_HASH_MOD   1201

Definition at line 42 of file dictionary.c.

Function Documentation

◆ add_keyitem_pair()

static HRESULT add_keyitem_pair ( struct dictionary *  dict,
VARIANT *  key,
VARIANT *  item 
)
static

Definition at line 241 of file dictionary.c.

242{
243 struct keyitem_pair *pair;
244 struct list *head;
246 HRESULT hr;
247
248 hr = IDictionary_get_HashVal(&dict->IDictionary_iface, key, &hash);
249 if (FAILED(hr))
250 return hr;
251
252 if (!(pair = malloc(sizeof(*pair))))
253 return E_OUTOFMEMORY;
254
255 pair->hash = V_I4(&hash);
256 VariantInit(&pair->key);
257 VariantInit(&pair->item);
258
259 hr = VariantCopyInd(&pair->key, key);
260 if (FAILED(hr))
261 goto failed;
262
263 hr = VariantCopyInd(&pair->item, item);
264 if (FAILED(hr))
265 goto failed;
266
267 head = get_bucket_head(dict, pair->hash);
268 if (!head->next)
269 /* this only happens once per bucket */
271
272 /* link to bucket list and to full list */
273 list_add_tail(head, &pair->bucket);
274 list_add_tail(&dict->pairs, &pair->entry);
275 dict->count++;
276 return S_OK;
277
278failed:
279 VariantClear(&pair->key);
280 VariantClear(&pair->item);
281 free(pair);
282 return hr;
283}
struct outqueuenode * head
Definition: adnsresfilter.c:66
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
Definition: list.h:39
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
static struct list * get_bucket_head(struct dictionary *dict, DWORD hash)
Definition: dictionary.c:101
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define V_I4(A)
Definition: oleauto.h:247
struct list pairs
Definition: dictionary.c:76
LONG count
Definition: dictionary.c:75
IDictionary IDictionary_iface
Definition: dictionary.c:71
Definition: copy.c:22
Definition: _pair.h:47
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:626
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, const VARIANTARG *pvargSrc)
Definition: variant.c:823
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:547

Referenced by dictionary_Add(), dictionary_put_Item(), and dictionary_putref_Item().

◆ create_dict_enum()

static HRESULT create_dict_enum ( struct dictionary *  dict,
IUnknown **  ret 
)
static

Definition at line 411 of file dictionary.c.

412{
413 struct dictionary_enum *object;
414
415 *ret = NULL;
416
417 if (!(object = calloc(1, sizeof(*object))))
418 return E_OUTOFMEMORY;
419
420 object->IEnumVARIANT_iface.lpVtbl = &dictenumvtbl;
421 object->ref = 1;
422 object->cur = list_head(&dict->pairs);
423 list_add_tail(&dict->notifier, &object->notify);
424 object->dict = dict;
425 IDictionary_AddRef(&dict->IDictionary_iface);
426
427 *ret = (IUnknown *)&object->IEnumVARIANT_iface;
428
429 return S_OK;
430}
#define NULL
Definition: types.h:112
static const IEnumVARIANTVtbl dictenumvtbl
Definition: dictionary.c:401
return ret
Definition: mutex.c:147
#define calloc
Definition: rosglue.h:14
struct dictionary * dict
Definition: dictionary.c:86
Definition: list.h:15

Referenced by dict_enum_Clone(), and dictionary__NewEnum().

◆ dict_enum_AddRef()

static ULONG WINAPI dict_enum_AddRef ( IEnumVARIANT *  iface)
static

Definition at line 310 of file dictionary.c.

311{
314 TRACE("%p, refcount %lu.\n", iface, ref);
315 return ref;
316}
#define InterlockedIncrement
Definition: armddk.h:53
static struct dictionary_enum * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: dictionary.c:96
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ dict_enum_Clone()

static HRESULT WINAPI dict_enum_Clone ( IEnumVARIANT *  iface,
IEnumVARIANT **  cloned 
)
static

Definition at line 394 of file dictionary.c.

395{
397 TRACE("(%p)->(%p)\n", This, cloned);
398 return create_dict_enum(This->dict, (IUnknown**)cloned);
399}
static HRESULT create_dict_enum(struct dictionary *, IUnknown **)
Definition: dictionary.c:411

◆ dict_enum_Next()

static HRESULT WINAPI dict_enum_Next ( IEnumVARIANT *  iface,
ULONG  count,
VARIANT *  keys,
ULONG *  fetched 
)
static

Definition at line 335 of file dictionary.c.

336{
338 struct keyitem_pair *pair;
339 ULONG i = 0;
340
341 TRACE("%p, %lu, %p, %p.\n", iface, count, keys, fetched);
342
343 if (fetched)
344 *fetched = 0;
345
346 if (!count)
347 return S_OK;
348
349 while (This->cur && i < count) {
350 pair = LIST_ENTRY(This->cur, struct keyitem_pair, entry);
351 VariantCopy(&keys[i], &pair->key);
352 This->cur = list_next(&This->dict->pairs, This->cur);
353 i++;
354 }
355
356 if (fetched)
357 *fetched = i;
358
359 return i < count ? S_FALSE : S_OK;
360}
const UINT * keys
Definition: locale.c:418
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32_t entry
Definition: isohybrid.c:63
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:117
#define LIST_ENTRY(type)
Definition: queue.h:175
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, const VARIANTARG *pvargSrc)
Definition: variant.c:724
#define S_FALSE
Definition: winerror.h:3451

◆ dict_enum_QueryInterface()

static HRESULT WINAPI dict_enum_QueryInterface ( IEnumVARIANT *  iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 292 of file dictionary.c.

293{
295
296 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
297
298 if (IsEqualIID(riid, &IID_IEnumVARIANT) || IsEqualIID(riid, &IID_IUnknown)) {
299 *obj = iface;
300 IEnumVARIANT_AddRef(iface);
301 return S_OK;
302 }
303 else {
304 WARN("interface not supported %s\n", debugstr_guid(riid));
305 *obj = NULL;
306 return E_NOINTERFACE;
307 }
308}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ dict_enum_Release()

static ULONG WINAPI dict_enum_Release ( IEnumVARIANT *  iface)
static

Definition at line 318 of file dictionary.c.

319{
322
323 TRACE("%p, refcount %lu.\n", iface, ref);
324
325 if (!ref)
326 {
327 list_remove(&This->notify);
328 IDictionary_Release(&This->dict->IDictionary_iface);
329 free(This);
330 }
331
332 return ref;
333}
#define InterlockedDecrement
Definition: armddk.h:52
static void list_remove(struct list_entry *entry)
Definition: list.h:90
long LONG
Definition: pedump.c:60

◆ dict_enum_Reset()

static HRESULT WINAPI dict_enum_Reset ( IEnumVARIANT *  iface)
static

Definition at line 382 of file dictionary.c.

383{
385
386 TRACE("(%p)\n", This);
387
388 This->cur = list_head(&This->dict->pairs);
389 return S_OK;
390}

◆ dict_enum_Skip()

static HRESULT WINAPI dict_enum_Skip ( IEnumVARIANT *  iface,
ULONG  count 
)
static

Definition at line 362 of file dictionary.c.

363{
365
366 TRACE("%p, %lu.\n", iface, count);
367
368 if (!count)
369 return S_OK;
370
371 if (!This->cur)
372 return S_FALSE;
373
374 while (count--) {
375 This->cur = list_next(&This->dict->pairs, This->cur);
376 if (!This->cur) break;
377 }
378
379 return count == 0 ? S_OK : S_FALSE;
380}

◆ dictionary__NewEnum()

static HRESULT WINAPI dictionary__NewEnum ( IDictionary *  iface,
IUnknown **  ret 
)
static

Definition at line 813 of file dictionary.c.

814{
816
817 TRACE("%p, %p.\n", iface, ret);
818
820}
static struct dictionary * impl_from_IDictionary(IDictionary *iface)
Definition: dictionary.c:91

◆ dictionary_Add()

static HRESULT WINAPI dictionary_Add ( IDictionary *  iface,
VARIANT *  key,
VARIANT *  item 
)
static

Definition at line 609 of file dictionary.c.

610{
612
613 TRACE("%p, %s, %s.\n", iface, debugstr_variant(key), debugstr_variant(item));
614
616 return CTL_E_KEY_ALREADY_EXISTS;
617
619}
static struct keyitem_pair * get_keyitem_pair(struct dictionary *dict, VARIANT *key)
Definition: dictionary.c:206
static HRESULT add_keyitem_pair(struct dictionary *dict, VARIANT *key, VARIANT *item)
Definition: dictionary.c:241
static const char * debugstr_variant(const VARIANT *var)
Definition: dom.c:505

◆ dictionary_AddRef()

static ULONG WINAPI dictionary_AddRef ( IDictionary *  iface)
static

Definition at line 487 of file dictionary.c.

488{
491
492 TRACE("%p, refcount %lu.\n", iface, ref);
493
494 return ref;
495}
LONG ref
Definition: dictionary.c:72

◆ Dictionary_CreateInstance()

HRESULT WINAPI Dictionary_CreateInstance ( IClassFactory *  factory,
IUnknown *  outer,
REFIID  riid,
void **  ret 
)

Definition at line 972 of file dictionary.c.

973{
974 struct dictionary *object;
975
976 TRACE("(%p, %p, %s, %p)\n", factory, outer, debugstr_guid(riid), ret);
977
978 *ret = NULL;
979
980 if (!(object = calloc(1, sizeof(*object))))
981 return E_OUTOFMEMORY;
982
983 object->IDictionary_iface.lpVtbl = &dictionary_vtbl;
984 object->ref = 1;
985 object->method = BinaryCompare;
986 list_init(&object->pairs);
987 list_init(&object->notifier);
988
989 init_classinfo(&CLSID_Dictionary, (IUnknown *)&object->IDictionary_iface, &object->classinfo);
990
991 *ret = &object->IDictionary_iface;
992
993 return S_OK;
994}
static const struct IDictionaryVtbl dictionary_vtbl
Definition: dictionary.c:946
static IUnknown * outer
Definition: compobj.c:82
@ BinaryCompare
Definition: scrrun.idl:47
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:230
Definition: main.c:439

◆ dictionary_Exists()

static HRESULT WINAPI dictionary_Exists ( IDictionary *  iface,
VARIANT *  key,
VARIANT_BOOL *  exists 
)
static

Definition at line 631 of file dictionary.c.

632{
634
635 TRACE("%p, %s, %p.\n", iface, debugstr_variant(key), exists);
636
637 if (!exists)
639
640 *exists = get_keyitem_pair(dictionary, key) != NULL ? VARIANT_TRUE : VARIANT_FALSE;
641 return S_OK;
642}
#define CTL_E_ILLEGALFUNCTIONCALL
Definition: olectl.h:267

◆ dictionary_get_CompareMode()

static HRESULT WINAPI dictionary_get_CompareMode ( IDictionary *  iface,
CompareMethod *  method 
)
static

Definition at line 803 of file dictionary.c.

804{
806
807 TRACE("%p, %p.\n", iface, method);
808
810 return S_OK;
811}
method
Definition: dragdrop.c:54
CompareMethod method
Definition: dictionary.c:74

◆ dictionary_get_Count()

static HRESULT WINAPI dictionary_get_Count ( IDictionary *  iface,
LONG *  count 
)
static

Definition at line 621 of file dictionary.c.

622{
624
625 TRACE("%p, %p.\n", iface, count);
626
628 return S_OK;
629}

◆ dictionary_get_HashVal()

static HRESULT WINAPI dictionary_get_HashVal ( IDictionary *  iface,
VARIANT *  key,
VARIANT *  hash 
)
static

Definition at line 870 of file dictionary.c.

871{
873
874 TRACE("%p, %s, %p.\n", iface, debugstr_variant(key), hash);
875
876 V_VT(hash) = VT_I4;
877 switch (V_VT(key))
878 {
879 case VT_BSTR|VT_BYREF:
880 case VT_BSTR:
882 break;
883 case VT_UI1|VT_BYREF:
884 case VT_UI1:
886 break;
887 case VT_I2|VT_BYREF:
888 case VT_I2:
890 break;
891 case VT_I4|VT_BYREF:
892 case VT_I4:
894 break;
895 case VT_UNKNOWN|VT_BYREF:
897 case VT_UNKNOWN:
898 case VT_DISPATCH:
899 {
901 IUnknown *unk = NULL;
902
903 if (!src) {
904 V_I4(hash) = 0;
905 return S_OK;
906 }
907
908 IUnknown_QueryInterface(src, &IID_IUnknown, (void**)&unk);
909 if (!unk) {
910 V_I4(hash) = ~0u;
912 }
913 V_I4(hash) = get_ptr_hash(unk);
914 IUnknown_Release(unk);
915 break;
916 }
917 case VT_DATE|VT_BYREF:
918 case VT_DATE:
920 case VT_R4|VT_BYREF:
921 case VT_R4:
922 return get_flt_hash(V_VT(key) & VT_BYREF ? *V_R4REF(key) : V_R4(key), &V_I4(hash));
923 case VT_R8|VT_BYREF:
924 case VT_R8:
925 return get_flt_hash(V_VT(key) & VT_BYREF ? *V_R8REF(key) : V_R8(key), &V_I4(hash));
926 case VT_EMPTY:
927 case VT_NULL:
928 V_I4(hash) = 0;
929 return S_OK;
930 case VT_INT:
931 case VT_UINT:
932 case VT_I1:
933 case VT_I8:
934 case VT_UI2:
935 case VT_UI4:
936 V_I4(hash) = ~0u;
938 default:
939 FIXME("not implemented for type %d\n", V_VT(key));
940 return E_NOTIMPL;
941 }
942
943 return S_OK;
944}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
@ VT_BSTR
Definition: compat.h:2303
@ VT_INT
Definition: compat.h:2316
@ VT_R4
Definition: compat.h:2299
@ VT_NULL
Definition: compat.h:2296
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_BYREF
Definition: compat.h:2342
@ VT_UI2
Definition: compat.h:2312
@ VT_R8
Definition: compat.h:2300
@ VT_I8
Definition: compat.h:2314
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_DATE
Definition: compat.h:2302
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
@ VT_UINT
Definition: compat.h:2317
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
@ VT_UI1
Definition: compat.h:2311
static DWORD get_str_hash(const WCHAR *str, CompareMethod method)
Definition: dictionary.c:822
static WCHAR * get_key_strptr(const VARIANT *key)
Definition: dictionary.c:133
static DWORD get_num_hash(FLOAT num)
Definition: dictionary.c:840
static HRESULT get_flt_hash(FLOAT flt, LONG *hash)
Definition: dictionary.c:845
static DWORD get_ptr_hash(void *ptr)
Definition: dictionary.c:861
GLenum src
Definition: glext.h:6340
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define V_UI1(A)
Definition: oleauto.h:266
#define V_R4REF(A)
Definition: oleauto.h:261
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_UNKNOWNREF(A)
Definition: oleauto.h:282
#define V_VT(A)
Definition: oleauto.h:211
#define V_DATEREF(A)
Definition: oleauto.h:232
#define V_R4(A)
Definition: oleauto.h:260
#define V_R8(A)
Definition: oleauto.h:262
#define V_I2REF(A)
Definition: oleauto.h:246
#define V_DATE(A)
Definition: oleauto.h:231
#define V_UI1REF(A)
Definition: oleauto.h:267
#define V_R8REF(A)
Definition: oleauto.h:263
#define V_I2(A)
Definition: oleauto.h:245
#define V_I4REF(A)
Definition: oleauto.h:248

◆ dictionary_get_Item()

static HRESULT WINAPI dictionary_get_Item ( IDictionary *  iface,
VARIANT *  key,
VARIANT *  item 
)
static

Definition at line 592 of file dictionary.c.

593{
595 struct keyitem_pair *pair;
596
597 TRACE("%p, %s, %p.\n", iface, debugstr_variant(key), item);
598
600 VariantCopy(item, &pair->item);
601 else {
603 return IDictionary_Add(iface, key, item);
604 }
605
606 return S_OK;
607}

◆ dictionary_GetIDsOfNames()

static HRESULT WINAPI dictionary_GetIDsOfNames ( IDictionary *  iface,
REFIID  riid,
LPOLESTR *  rgszNames,
UINT  cNames,
LCID  lcid,
DISPID *  rgDispId 
)
static

Definition at line 528 of file dictionary.c.

530{
532 HRESULT hr;
533
534 TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
535
537 if(SUCCEEDED(hr))
538 {
539 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
540 ITypeInfo_Release(typeinfo);
541 }
542
543 return hr;
544}
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:125
LCID lcid
Definition: locale.c:5660
#define SUCCEEDED(hr)
Definition: intsafe.h:50
@ IDictionary_tid

◆ dictionary_GetTypeInfo()

static HRESULT WINAPI dictionary_GetTypeInfo ( IDictionary *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 521 of file dictionary.c.

522{
523 TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
524
525 return get_typeinfo(IDictionary_tid, ppTInfo);
526}

◆ dictionary_GetTypeInfoCount()

static HRESULT WINAPI dictionary_GetTypeInfoCount ( IDictionary *  iface,
UINT *  pctinfo 
)
static

Definition at line 513 of file dictionary.c.

514{
515 TRACE("%p, %p.\n", iface, pctinfo);
516
517 *pctinfo = 1;
518 return S_OK;
519}

◆ dictionary_Invoke()

static HRESULT WINAPI dictionary_Invoke ( IDictionary *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT *  pVarResult,
EXCEPINFO *  pExcepInfo,
UINT *  puArgErr 
)
static

Definition at line 546 of file dictionary.c.

549{
551 HRESULT hr;
552
553 TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
554 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
555
557 if(SUCCEEDED(hr))
558 {
559 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
560 ITypeInfo_Release(typeinfo);
561 }
562
563 return hr;
564}
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337

◆ dictionary_Items()

static HRESULT WINAPI dictionary_Items ( IDictionary *  iface,
VARIANT *  items 
)
static

Definition at line 644 of file dictionary.c.

645{
647 struct keyitem_pair *pair;
648 SAFEARRAYBOUND bound;
649 SAFEARRAY *sa;
650 VARIANT *v;
651 HRESULT hr;
652 LONG i;
653
654 TRACE("%p, %p.\n", iface, items);
655
656 if (!items)
657 return S_OK;
658
659 bound.lLbound = 0;
660 bound.cElements = dictionary->count;
661 sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
662 if (!sa)
663 return E_OUTOFMEMORY;
664
665 hr = SafeArrayAccessData(sa, (void**)&v);
666 if (FAILED(hr)) {
668 return hr;
669 }
670
671 i = 0;
673 {
674 VariantCopy(&v[i], &pair->item);
675 i++;
676 }
678
680 V_ARRAY(items) = sa;
681 return S_OK;
682}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
@ VT_ARRAY
Definition: compat.h:2341
@ VT_VARIANT
Definition: compat.h:2307
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:600
const GLdouble * v
Definition: gl.h:2040
#define V_ARRAY(A)
Definition: oleauto.h:222
static TCHAR * items[]
Definition: page1.c:45
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236

◆ dictionary_Keys()

static HRESULT WINAPI dictionary_Keys ( IDictionary *  iface,
VARIANT *  keys 
)
static

Definition at line 709 of file dictionary.c.

710{
712 struct keyitem_pair *pair;
713 SAFEARRAYBOUND bound;
714 SAFEARRAY *sa;
715 VARIANT *v;
716 HRESULT hr;
717 LONG i;
718
719 TRACE("%p, %p.\n", iface, keys);
720
721 if (!keys)
722 return S_OK;
723
724 bound.lLbound = 0;
725 bound.cElements = dictionary->count;
726 sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
727 if (!sa)
728 return E_OUTOFMEMORY;
729
730 hr = SafeArrayAccessData(sa, (void**)&v);
731 if (FAILED(hr)) {
733 return hr;
734 }
735
736 i = 0;
738 {
739 VariantCopy(&v[i], &pair->key);
740 i++;
741 }
743
745 V_ARRAY(keys) = sa;
746 return S_OK;
747}

◆ dictionary_put_CompareMode()

static HRESULT WINAPI dictionary_put_CompareMode ( IDictionary *  iface,
CompareMethod  method 
)
static

Definition at line 790 of file dictionary.c.

791{
793
794 TRACE("%p, %d.\n", iface, method);
795
796 if (dictionary->count)
798
800 return S_OK;
801}

◆ dictionary_put_Item()

static HRESULT WINAPI dictionary_put_Item ( IDictionary *  iface,
VARIANT *  key,
VARIANT *  item 
)
static

Definition at line 579 of file dictionary.c.

580{
582 struct keyitem_pair *pair;
583
584 TRACE("%p, %s, %s.\n", iface, debugstr_variant(key), debugstr_variant(item));
585
587 return VariantCopyInd(&pair->item, item);
588
590}

◆ dictionary_put_Key()

static HRESULT WINAPI dictionary_put_Key ( IDictionary *  iface,
VARIANT *  key,
VARIANT *  newkey 
)
static

Definition at line 684 of file dictionary.c.

685{
687 struct keyitem_pair *pair;
689 HRESULT hr;
690
691 TRACE("%p, %s, %s.\n", iface, debugstr_variant(key), debugstr_variant(newkey));
692
694 {
695 /* found existing pair for a key, add new pair with new key
696 and old item and remove old pair after that */
697
698 hr = IDictionary_Add(iface, newkey, &pair->item);
699 if (FAILED(hr))
700 return hr;
701
702 return IDictionary_Remove(iface, key);
703 }
704
706 return IDictionary_Add(iface, newkey, &empty);
707}
static const WCHAR empty[1]
Definition: string.c:47

◆ dictionary_putref_Item()

static HRESULT WINAPI dictionary_putref_Item ( IDictionary *  iface,
VARIANT *  key,
VARIANT *  item 
)
static

Definition at line 566 of file dictionary.c.

567{
569 struct keyitem_pair *pair;
570
571 TRACE("%p, %s, %s.\n", iface, debugstr_variant(key), debugstr_variant(item));
572
574 return VariantCopyInd(&pair->item, item);
575
577}

◆ dictionary_QueryInterface()

static HRESULT WINAPI dictionary_QueryInterface ( IDictionary *  iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 447 of file dictionary.c.

448{
450
451 TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
452
453 *obj = NULL;
454
457 IsEqualIID(riid, &IID_IDictionary))
458 {
460 }
462 {
463 *obj = &dictionary->classinfo.IProvideClassInfo_iface;
464 }
465 else if ( IsEqualGUID( riid, &IID_IDispatchEx ))
466 {
467 TRACE("Interface IDispatchEx not supported - returning NULL\n");
468 *obj = NULL;
469 return E_NOINTERFACE;
470 }
471 else if ( IsEqualGUID( riid, &IID_IObjectWithSite ))
472 {
473 TRACE("Interface IObjectWithSite not supported - returning NULL\n");
474 *obj = NULL;
475 return E_NOINTERFACE;
476 }
477 else
478 {
479 WARN("interface %s not implemented\n", debugstr_guid(riid));
480 return E_NOINTERFACE;
481 }
482
483 IUnknown_AddRef((IUnknown*)*obj);
484 return S_OK;
485}
const IID IID_IObjectWithSite
const GUID IID_IProvideClassInfo
const GUID IID_IDispatch
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
struct provideclassinfo classinfo
Definition: dictionary.c:70

◆ dictionary_Release()

static ULONG WINAPI dictionary_Release ( IDictionary *  iface)
static

Definition at line 497 of file dictionary.c.

498{
501
502 TRACE("%p, refcount %lu.\n", iface, ref);
503
504 if (!ref)
505 {
506 IDictionary_RemoveAll(iface);
508 }
509
510 return ref;
511}

◆ dictionary_Remove()

static HRESULT WINAPI dictionary_Remove ( IDictionary *  iface,
VARIANT *  key 
)
static

Definition at line 749 of file dictionary.c.

750{
752 struct keyitem_pair *pair;
753
754 TRACE("%p, %s.\n", iface, debugstr_variant(key));
755
757 return CTL_E_ELEMENT_NOT_FOUND;
758
760 list_remove(&pair->entry);
761 list_remove(&pair->bucket);
762 dictionary->count--;
763
765 return S_OK;
766}
static void notify_remove_pair(struct list *notifier, struct list *pair)
Definition: dictionary.c:432
static void free_keyitem_pair(struct keyitem_pair *pair)
Definition: dictionary.c:285
struct list notifier
Definition: dictionary.c:78

◆ dictionary_RemoveAll()

static HRESULT WINAPI dictionary_RemoveAll ( IDictionary *  iface)
static

Definition at line 768 of file dictionary.c.

769{
771 struct keyitem_pair *pair, *pair2;
772
773 TRACE("%p.\n", iface);
774
775 if (!dictionary->count)
776 return S_OK;
777
780 {
781 list_remove(&pair->entry);
782 list_remove(&pair->bucket);
784 }
785 dictionary->count = 0;
786
787 return S_OK;
788}
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242

◆ free_keyitem_pair()

static void free_keyitem_pair ( struct keyitem_pair *  pair)
static

Definition at line 285 of file dictionary.c.

286{
287 VariantClear(&pair->key);
288 VariantClear(&pair->item);
289 free(pair);
290}

Referenced by dictionary_Remove(), and dictionary_RemoveAll().

◆ get_bucket_head()

static struct list * get_bucket_head ( struct dictionary *  dict,
DWORD  hash 
)
inlinestatic

Definition at line 101 of file dictionary.c.

102{
103 return &dict->buckets[hash % BUCKET_COUNT];
104}
#define BUCKET_COUNT
Definition: dictionary.c:41
struct list buckets[BUCKET_COUNT]
Definition: dictionary.c:77

Referenced by add_keyitem_pair(), and get_keyitem_pair().

◆ get_flt_hash()

static HRESULT get_flt_hash ( FLOAT  flt,
LONG *  hash 
)
static

Definition at line 845 of file dictionary.c.

846{
847 if (isinf(flt)) {
848 *hash = 0;
849 return S_OK;
850 }
851 else if (!isnan(flt)) {
852 *hash = get_num_hash(flt);
853 return S_OK;
854 }
855
856 /* NaN case */
857 *hash = ~0u;
859}
#define isinf(x)
Definition: math.h:359
#define isnan(x)
Definition: math.h:360

Referenced by dictionary_get_HashVal().

◆ get_key_strptr()

static WCHAR * get_key_strptr ( const VARIANT *  key)
inlinestatic

Definition at line 133 of file dictionary.c.

134{
135 if (V_VT(key) == VT_BSTR)
136 return V_BSTR(key);
137
138 if (V_BSTRREF(key))
139 return *V_BSTRREF(key);
140
141 return NULL;
142}
#define V_BSTRREF(A)
Definition: oleauto.h:227
#define V_BSTR(A)
Definition: oleauto.h:226

Referenced by dictionary_get_HashVal(), and strcmp_key().

◆ get_keyitem_pair()

static struct keyitem_pair * get_keyitem_pair ( struct dictionary *  dict,
VARIANT *  key 
)
static

Definition at line 206 of file dictionary.c.

207{
208 struct keyitem_pair *pair;
209 struct list *head, *entry;
210 VARIANT hash, v;
211 HRESULT hr;
212
213 hr = IDictionary_get_HashVal(&dict->IDictionary_iface, key, &hash);
214 if (FAILED(hr))
215 return NULL;
216
217 head = get_bucket_head(dict, V_I4(&hash));
218 if (!head->next || list_empty(head))
219 return NULL;
220
221 VariantInit(&v);
222 if (FAILED(VariantCopyInd(&v, key)))
223 return NULL;
224
226 do
227 {
228 pair = LIST_ENTRY(entry, struct keyitem_pair, bucket);
229 if (is_matching_key(dict, pair, &v, V_I4(&hash)))
230 {
231 VariantClear(&v);
232 return pair;
233 }
234 } while ((entry = list_next(head, entry)));
235
236 VariantClear(&v);
237
238 return NULL;
239}
static int list_empty(struct list_entry *head)
Definition: list.h:58
static BOOL is_matching_key(const struct dictionary *dict, const struct keyitem_pair *pair, const VARIANT *key, DWORD hash)
Definition: dictionary.c:169

Referenced by dictionary_Add(), dictionary_Exists(), dictionary_get_Item(), dictionary_put_Item(), dictionary_put_Key(), dictionary_putref_Item(), and dictionary_Remove().

◆ get_num_hash()

static DWORD get_num_hash ( FLOAT  num)
static

Definition at line 840 of file dictionary.c.

841{
842 return (*((DWORD*)&num)) % DICT_HASH_MOD;
843}
#define DICT_HASH_MOD
Definition: dictionary.c:42
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618

Referenced by dictionary_get_HashVal(), get_flt_hash(), and test_hash_value().

◆ get_ptr_hash()

static DWORD get_ptr_hash ( void *  ptr)
static

Definition at line 861 of file dictionary.c.

862{
864#ifdef _WIN64
865 hash ^= (ULONG_PTR)ptr >> 32;
866#endif
867 return hash % 1201;
868}
#define ULONG_PTR
Definition: config.h:101
#define PtrToUlong(u)
Definition: config.h:107
static PVOID ptr
Definition: dispmode.c:27

Referenced by dictionary_get_HashVal(), and test_hash_value().

◆ get_str_hash()

static DWORD get_str_hash ( const WCHAR *  str,
CompareMethod  method 
)
static

Definition at line 822 of file dictionary.c.

823{
824 DWORD hash = 0;
825
826 if (str) {
827 while (*str) {
828 WCHAR ch;
829
831
832 hash += (hash << 4) + ch;
833 str++;
834 }
835 }
836
837 return hash % DICT_HASH_MOD;
838}
#define TextCompare
Definition: text.h:19
unsigned char ch[4][2]
Definition: console.c:118
@ DatabaseCompare
Definition: scrrun.idl:49
short WCHAR
Definition: pedump.c:58
const WCHAR * str
#define towlower(c)
Definition: wctype.h:97

Referenced by dictionary_get_HashVal(), and test_hash_value().

◆ impl_from_IDictionary()

◆ impl_from_IEnumVARIANT()

static struct dictionary_enum * impl_from_IEnumVARIANT ( IEnumVARIANT *  iface)
inlinestatic

Definition at line 96 of file dictionary.c.

97{
98 return CONTAINING_RECORD(iface, struct dictionary_enum, IEnumVARIANT_iface);
99}

Referenced by dict_enum_AddRef(), dict_enum_Clone(), dict_enum_Next(), dict_enum_QueryInterface(), dict_enum_Release(), dict_enum_Reset(), and dict_enum_Skip().

◆ is_matching_key()

static BOOL is_matching_key ( const struct dictionary *  dict,
const struct keyitem_pair *  pair,
const VARIANT *  key,
DWORD  hash 
)
static

Definition at line 169 of file dictionary.c.

170{
171 if (is_string_key(key) != is_string_key(&pair->key))
172 {
173 return FALSE;
174 }
175 else if (is_string_key(key) && is_string_key(&pair->key))
176 {
177 return hash == pair->hash && !strcmp_key(dict, key, &pair->key);
178 }
179 else if (is_ptr_key(key) != is_ptr_key(&pair->key))
180 {
181 return FALSE;
182 }
183 else if (is_ptr_key(key) && is_ptr_key(&pair->key))
184 {
185 return hash == pair->hash && V_UNKNOWN(key) == V_UNKNOWN(&pair->key);
186 }
187 else if (is_numeric_key(key) != is_numeric_key(&pair->key))
188 {
189 return FALSE;
190 }
191 else if (is_numeric_key(key) && is_numeric_key(&pair->key))
192 {
193 return hash == pair->hash && numeric_key_eq(key, &pair->key);
194 }
195 else if (V_VT(&pair->key) == VT_EMPTY || V_VT(&pair->key) == VT_NULL)
196 {
197 return V_VT(&pair->key) == V_VT(key);
198 }
199 else
200 {
201 WARN("Unexpected key type %#x.\n", V_VT(key));
202 return FALSE;
203 }
204}
#define FALSE
Definition: types.h:117
static BOOL is_ptr_key(const VARIANT *key)
Definition: dictionary.c:111
static int strcmp_key(const struct dictionary *dict, const VARIANT *key1, const VARIANT *key2)
Definition: dictionary.c:145
static BOOL is_string_key(const VARIANT *key)
Definition: dictionary.c:106
static BOOL is_numeric_key(const VARIANT *key)
Definition: dictionary.c:116
static BOOL numeric_key_eq(const VARIANT *key1, const VARIANT *key2)
Definition: dictionary.c:154

Referenced by get_keyitem_pair().

◆ is_numeric_key()

static BOOL is_numeric_key ( const VARIANT *  key)
inlinestatic

Definition at line 116 of file dictionary.c.

117{
118 switch (V_VT(key))
119 {
120 case VT_UI1:
121 case VT_I2:
122 case VT_I4:
123 case VT_DATE:
124 case VT_R4:
125 case VT_R8:
126 return TRUE;
127 default:
128 return FALSE;
129 }
130}
#define TRUE
Definition: types.h:120

Referenced by is_matching_key().

◆ is_ptr_key()

static BOOL is_ptr_key ( const VARIANT *  key)
inlinestatic

Definition at line 111 of file dictionary.c.

112{
113 return V_VT(key) == VT_UNKNOWN || V_VT(key) == VT_DISPATCH;
114}

Referenced by is_matching_key().

◆ is_string_key()

static BOOL is_string_key ( const VARIANT *  key)
inlinestatic

Definition at line 106 of file dictionary.c.

107{
108 return V_VT(key) == VT_BSTR;
109}

Referenced by is_matching_key().

◆ notify_remove_pair()

static void notify_remove_pair ( struct list *  notifier,
struct list *  pair 
)
static

Definition at line 432 of file dictionary.c.

433{
434 struct dictionary_enum *dict_enum;
435 struct list *cur;
436
437 LIST_FOR_EACH(cur, notifier) {
438 dict_enum = LIST_ENTRY(cur, struct dictionary_enum, notify);
439 if (!pair)
440 dict_enum->cur = list_head(&dict_enum->dict->pairs);
441 else if (dict_enum->cur == pair) {
442 dict_enum->cur = list_next(&dict_enum->dict->pairs, dict_enum->cur);
443 }
444 }
445}
FxCollectionEntry * cur
int notify
Definition: msacm.c:1366
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:226
struct list * cur
Definition: dictionary.c:87

Referenced by dictionary_Remove(), and dictionary_RemoveAll().

◆ numeric_key_eq()

static BOOL numeric_key_eq ( const VARIANT *  key1,
const VARIANT *  key2 
)
inlinestatic

Definition at line 154 of file dictionary.c.

155{
156 VARIANT v1, v2;
157
158 VariantInit(&v1);
160 return FALSE;
161
162 VariantInit(&v2);
163 if (FAILED(VariantChangeType(&v2, key2, 0, VT_R4)))
164 return FALSE;
165
166 return V_R4(&v1) == V_R4(&v2);
167}
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
Definition: glext.h:10608
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, const VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:939

Referenced by is_matching_key().

◆ strcmp_key()

static int strcmp_key ( const struct dictionary *  dict,
const VARIANT *  key1,
const VARIANT *  key2 
)
inlinestatic

Definition at line 145 of file dictionary.c.

146{
147 const WCHAR *str1, *str2;
148
150 str2 = get_key_strptr(key2);
151 return dict->method == BinaryCompare ? wcscmp(str1, str2) : wcsicmp(str1, str2);
152}
#define wcsicmp
Definition: compat.h:15
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
Definition: parser.h:35
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
Definition: parser.h:35

Referenced by is_matching_key().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( scrrun  )

Variable Documentation

◆ dictenumvtbl

const IEnumVARIANTVtbl dictenumvtbl
static
Initial value:
= {
}
static HRESULT WINAPI dict_enum_Skip(IEnumVARIANT *iface, ULONG count)
Definition: dictionary.c:362
static ULONG WINAPI dict_enum_AddRef(IEnumVARIANT *iface)
Definition: dictionary.c:310
static HRESULT WINAPI dict_enum_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **obj)
Definition: dictionary.c:292
static HRESULT WINAPI dict_enum_Clone(IEnumVARIANT *iface, IEnumVARIANT **cloned)
Definition: dictionary.c:394
static HRESULT WINAPI dict_enum_Next(IEnumVARIANT *iface, ULONG count, VARIANT *keys, ULONG *fetched)
Definition: dictionary.c:335
static ULONG WINAPI dict_enum_Release(IEnumVARIANT *iface)
Definition: dictionary.c:318
static HRESULT WINAPI dict_enum_Reset(IEnumVARIANT *iface)
Definition: dictionary.c:382

Definition at line 401 of file dictionary.c.

Referenced by create_dict_enum().

◆ dictionary_vtbl

const struct IDictionaryVtbl dictionary_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI dictionary_QueryInterface(IDictionary *iface, REFIID riid, void **obj)
Definition: dictionary.c:447
static HRESULT WINAPI dictionary_GetIDsOfNames(IDictionary *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: dictionary.c:528
static HRESULT WINAPI dictionary_get_HashVal(IDictionary *iface, VARIANT *key, VARIANT *hash)
Definition: dictionary.c:870
static HRESULT WINAPI dictionary__NewEnum(IDictionary *iface, IUnknown **ret)
Definition: dictionary.c:813
static HRESULT WINAPI dictionary_GetTypeInfo(IDictionary *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: dictionary.c:521
static HRESULT WINAPI dictionary_get_Item(IDictionary *iface, VARIANT *key, VARIANT *item)
Definition: dictionary.c:592
static ULONG WINAPI dictionary_AddRef(IDictionary *iface)
Definition: dictionary.c:487
static HRESULT WINAPI dictionary_Items(IDictionary *iface, VARIANT *items)
Definition: dictionary.c:644
static ULONG WINAPI dictionary_Release(IDictionary *iface)
Definition: dictionary.c:497
static HRESULT WINAPI dictionary_Remove(IDictionary *iface, VARIANT *key)
Definition: dictionary.c:749
static HRESULT WINAPI dictionary_putref_Item(IDictionary *iface, VARIANT *key, VARIANT *item)
Definition: dictionary.c:566
static HRESULT WINAPI dictionary_Invoke(IDictionary *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: dictionary.c:546
static HRESULT WINAPI dictionary_put_Item(IDictionary *iface, VARIANT *key, VARIANT *item)
Definition: dictionary.c:579
static HRESULT WINAPI dictionary_Add(IDictionary *iface, VARIANT *key, VARIANT *item)
Definition: dictionary.c:609
static HRESULT WINAPI dictionary_put_Key(IDictionary *iface, VARIANT *key, VARIANT *newkey)
Definition: dictionary.c:684
static HRESULT WINAPI dictionary_Keys(IDictionary *iface, VARIANT *keys)
Definition: dictionary.c:709
static HRESULT WINAPI dictionary_Exists(IDictionary *iface, VARIANT *key, VARIANT_BOOL *exists)
Definition: dictionary.c:631
static HRESULT WINAPI dictionary_RemoveAll(IDictionary *iface)
Definition: dictionary.c:768
static HRESULT WINAPI dictionary_put_CompareMode(IDictionary *iface, CompareMethod method)
Definition: dictionary.c:790
static HRESULT WINAPI dictionary_GetTypeInfoCount(IDictionary *iface, UINT *pctinfo)
Definition: dictionary.c:513
static HRESULT WINAPI dictionary_get_CompareMode(IDictionary *iface, CompareMethod *method)
Definition: dictionary.c:803
static HRESULT WINAPI dictionary_get_Count(IDictionary *iface, LONG *count)
Definition: dictionary.c:621

Definition at line 946 of file dictionary.c.

Referenced by Dictionary_CreateInstance().