forked from enlightenment/efl
fix dfb engine - correctness changes for hash
SVN revision: 19845
This commit is contained in:
parent
e754564803
commit
76f7428de7
|
@ -210,22 +210,48 @@ evas_hash_del(Evas_Hash *hash, const char *key, const void *data)
|
||||||
Evas_Object_List *l;
|
Evas_Object_List *l;
|
||||||
|
|
||||||
if (!hash) return NULL;
|
if (!hash) return NULL;
|
||||||
hash_num = _evas_hash_gen(key);
|
if (!key)
|
||||||
for (l = hash->buckets[hash_num]; l; l = l->next)
|
|
||||||
{
|
{
|
||||||
el = (Evas_Hash_El *)l;
|
int hash_num;
|
||||||
if (((key) && (!strcmp(el->key, key))) ||
|
|
||||||
((!key) && (el->data == data)))
|
for (hash_num = 0; hash_num < 256; hash_num++)
|
||||||
{
|
{
|
||||||
hash->buckets[hash_num] = evas_object_list_remove(hash->buckets[hash_num], el);
|
for (l = hash->buckets[hash_num]; l; l = l->next)
|
||||||
free(el);
|
|
||||||
hash->population--;
|
|
||||||
if (hash->population <= 0)
|
|
||||||
{
|
{
|
||||||
free(hash);
|
el = (Evas_Hash_El *)l;
|
||||||
hash = NULL;
|
if (el->data == data)
|
||||||
|
{
|
||||||
|
hash->buckets[hash_num] = evas_object_list_remove(hash->buckets[hash_num], el);
|
||||||
|
free(el);
|
||||||
|
hash->population--;
|
||||||
|
if (hash->population <= 0)
|
||||||
|
{
|
||||||
|
free(hash);
|
||||||
|
hash = NULL;
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hash_num = _evas_hash_gen(key);
|
||||||
|
for (l = hash->buckets[hash_num]; l; l = l->next)
|
||||||
|
{
|
||||||
|
el = (Evas_Hash_El *)l;
|
||||||
|
if (!strcmp(el->key, key))
|
||||||
|
{
|
||||||
|
hash->buckets[hash_num] = evas_object_list_remove(hash->buckets[hash_num], el);
|
||||||
|
free(el);
|
||||||
|
hash->population--;
|
||||||
|
if (hash->population <= 0)
|
||||||
|
{
|
||||||
|
free(hash);
|
||||||
|
hash = NULL;
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
}
|
}
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include <evas_private.h>
|
#include <evas_private.h>
|
||||||
|
|
||||||
Evas_List *evas_modules = NULL;
|
Evas_List *evas_modules = NULL;
|
||||||
|
|
||||||
static Evas_List *evas_module_paths = NULL;
|
static Evas_List *evas_module_paths = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -182,6 +181,7 @@ evas_module_init(void)
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1066,7 +1066,7 @@ evas_engine_cairo_x11_image_format_get(void *data, void *image)
|
||||||
|
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
return "";
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "evas_engine_dfb.h"
|
~#include "evas_engine_dfb.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ evas_engine_directfb_image_load(void *data, char *file, char *key, int *error)
|
||||||
*error = 0;
|
*error = 0;
|
||||||
|
|
||||||
if (!file) return NULL;
|
if (!file) return NULL;
|
||||||
mod_time = evas_file_modified_time(file);
|
// mod_time = evas_file_modified_time(file);
|
||||||
im = _dfb_image_find(file, key, mod_time);
|
im = _dfb_image_find(file, key, mod_time);
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ evas_engine_directfb_image_load(void *data, char *file, char *key, int *error)
|
||||||
if (img_desc.caps & DICAPS_ALPHACHANNEL)
|
if (img_desc.caps & DICAPS_ALPHACHANNEL)
|
||||||
im->flags |= RGBA_IMAGE_HAS_ALPHA;
|
im->flags |= RGBA_IMAGE_HAS_ALPHA;
|
||||||
|
|
||||||
im->timestamp = mod_time;
|
// im->timestamp = mod_time;
|
||||||
if (file)
|
if (file)
|
||||||
im->info.file = strdup(file);
|
im->info.file = strdup(file);
|
||||||
if (key)
|
if (key)
|
||||||
|
@ -705,8 +705,10 @@ _dfb_image_store(RGBA_Image *im)
|
||||||
if (im->info.file) l1 = strlen(im->info.file);
|
if (im->info.file) l1 = strlen(im->info.file);
|
||||||
l2 = 0;
|
l2 = 0;
|
||||||
if (im->info.key) l2 = strlen(im->info.key);
|
if (im->info.key) l2 = strlen(im->info.key);
|
||||||
snprintf(buf, sizeof(buf), "%llx", im->timestamp);
|
// snprintf(buf, sizeof(buf), "%llx", im->timestamp);
|
||||||
l3 = strlen(buf);
|
// l3 = strlen(buf);
|
||||||
|
buf[0] = 0;
|
||||||
|
l3 = 0;
|
||||||
key = malloc(l1 + 3 + l2 + 3 + l3 +1);
|
key = malloc(l1 + 3 + l2 + 3 + l3 +1);
|
||||||
if (!key) return;
|
if (!key) return;
|
||||||
key[0] = 0;
|
key[0] = 0;
|
||||||
|
@ -733,8 +735,10 @@ _dfb_image_unstore(RGBA_Image *im)
|
||||||
if (im->info.file) l1 = strlen(im->info.file);
|
if (im->info.file) l1 = strlen(im->info.file);
|
||||||
l2 = 0;
|
l2 = 0;
|
||||||
if (im->info.key) l2 = strlen(im->info.key);
|
if (im->info.key) l2 = strlen(im->info.key);
|
||||||
snprintf(buf, sizeof(buf), "%llx", im->timestamp);
|
// snprintf(buf, sizeof(buf), "%llx", im->timestamp);
|
||||||
l3 = strlen(buf);
|
// l3 = strlen(buf);
|
||||||
|
buf[0] = 0;
|
||||||
|
l3 = 0;
|
||||||
key = malloc(l1 + 3 + l2 + 3 + l3 +1);
|
key = malloc(l1 + 3 + l2 + 3 + l3 +1);
|
||||||
if (!key) return;
|
if (!key) return;
|
||||||
key[0] = 0;
|
key[0] = 0;
|
||||||
|
@ -763,8 +767,10 @@ _dfb_image_find(const char *filename, const char *key, DATA64 timestamp)
|
||||||
if (filename) l1 = strlen(filename);
|
if (filename) l1 = strlen(filename);
|
||||||
l2 = 0;
|
l2 = 0;
|
||||||
if (key) l2 = strlen(key);
|
if (key) l2 = strlen(key);
|
||||||
sprintf(buf, "%llx", timestamp);
|
// sprintf(buf, "%llx", timestamp);
|
||||||
l3 = strlen(buf);
|
// l3 = strlen(buf);
|
||||||
|
buf[0] = 0;
|
||||||
|
l3 = 0;
|
||||||
str = malloc(l1 + 3 + l2 + 3 + l3 +1);
|
str = malloc(l1 + 3 + l2 + 3 + l3 +1);
|
||||||
if (!str) return NULL;
|
if (!str) return NULL;
|
||||||
str[0] = 0;
|
str[0] = 0;
|
||||||
|
@ -793,9 +799,9 @@ _dfb_image_find(const char *filename, const char *key, DATA64 timestamp)
|
||||||
ok++;
|
ok++;
|
||||||
if ((!key) && (!im->info.key))
|
if ((!key) && (!im->info.key))
|
||||||
ok++;
|
ok++;
|
||||||
if (im->timestamp == timestamp)
|
// if (im->timestamp == timestamp)
|
||||||
ok++;
|
// ok++;
|
||||||
if (ok >= 3) return im;
|
if (ok >= 2) return im;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue