char *name;
int len;
int size;
+ int hash;
void *data;
unsigned char type;
unsigned char group_type;
/* STRING TYPE */
static int
+eet_data_get_string_hash(const Eet_Dictionary *ed, const void *src, const void *src_end)
+{
+ if (ed)
+ {
+ const char *str;
+ int index;
+
+ if (eet_data_get_int(ed, src, src_end, &index) < 0) return -1;
+
+ return eet_dictionary_string_get_hash(ed, index);
+ }
+
+ return -1;
+}
+
+static int
eet_data_get_string(const Eet_Dictionary *ed, const void *src, const void *src_end, void *dst)
{
char *s, **d;
}
chnk->len = ret2;
+
+ /* Precalc hash */
+ chnk->hash = eet_data_get_string_hash(ed, (s + 8), (s + size));
+
if (ed)
{
chnk->data = (char *)src + 4 + ret1 + sizeof(int);
}
static Eet_Data_Element *
-_eet_descriptor_hash_find(Eet_Data_Descriptor *edd, char *name)
+_eet_descriptor_hash_find(Eet_Data_Descriptor *edd, char *name, int hash)
{
- int hash;
Eet_Data_Descriptor_Hash *bucket;
- hash = _eet_hash_gen(name, 6);
+ if (hash < 0) hash = _eet_hash_gen(name, 6);
+ else hash &= 0x3f;
if (!edd->elements.hash.buckets[hash].element) return NULL;
if (!strcmp(edd->elements.hash.buckets[hash].element->name, name))
return edd->elements.hash.buckets[hash].element;
/* FIXME: don't REPLY on edd - work without */
if ((edd) && (!dumpfunc))
{
- ede = _eet_descriptor_hash_find(edd, echnk.name);
+ ede = _eet_descriptor_hash_find(edd, echnk.name, echnk.hash);
if (ede)
{
int group_type = EET_G_UNKNOWN, type = EET_T_UNKNOW;
int
eet_dictionary_string_get_size(const Eet_Dictionary *ed, int index)
{
- if (!ed)
- return 0;
- if (index < 0)
- return 0;
+ if (!ed) return 0;
+ if (index < 0) return 0;
if (index < ed->count)
return ed->all[index].len;
return 0;
}
+int
+eet_dictionary_string_get_hash(const Eet_Dictionary *ed, int index)
+{
+ if (!ed) return -1;
+ if (index < 0) return -1;
+ if (index < ed->count)
+ return ed->all[index].hash;
+ return -1;
+}
+
const char *
eet_dictionary_string_get_char(const Eet_Dictionary *ed, int index)
{
- if (!ed)
- return NULL;
- if (index < 0)
- return NULL;
+ if (!ed) return NULL;
+ if (index < 0) return NULL;
if (index < ed->count)
{
#ifdef _WIN32