forked from enlightenment/efl
disable stringshare... something fishy.
SVN revision: 18698
This commit is contained in:
parent
a976ce3d4e
commit
7ea7bdf610
|
@ -94,7 +94,7 @@ evas_font_set_get(const char *name)
|
|||
p = strchr(name, ',');
|
||||
if (!p)
|
||||
{
|
||||
fonts = evas_list_append(fonts, evas_stringshare_add(name));
|
||||
fonts = evas_list_append(fonts, strdup(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ evas_font_set_get(const char *name)
|
|||
fonts = evas_list_append(fonts, nm);
|
||||
pp = p + 1;
|
||||
p = strchr(pp, ',');
|
||||
if (!p) fonts = evas_list_append(fonts, evas_stringshare_add(pp));
|
||||
if (!p) fonts = evas_list_append(fonts, strdup(pp));
|
||||
}
|
||||
}
|
||||
return fonts;
|
||||
|
@ -145,8 +145,8 @@ evas_font_free(Evas *evas, void *font)
|
|||
fd = evas_list_data(fonts_zero);
|
||||
if (fd->ref != 0) break;
|
||||
fonts_zero = evas_list_remove_list(fonts_zero, fonts_zero);
|
||||
if (fd->name) evas_stringshare_del(fd->name);
|
||||
if (fd->source) evas_stringshare_del(fd->source);
|
||||
if (fd->name) free(fd->name);
|
||||
if (fd->source) free(fd->source);
|
||||
evas->engine.func->font_free(evas->engine.data.output, fd->font);
|
||||
free(fd);
|
||||
}
|
||||
|
@ -323,14 +323,14 @@ evas_font_load(Evas *evas, const char *name, const char *source, int size)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
evas_stringshare_del(nm);
|
||||
free(nm);
|
||||
}
|
||||
evas_list_free(fonts);
|
||||
fd = calloc(1, sizeof(Fndat));
|
||||
if (fd)
|
||||
{
|
||||
fd->name = evas_stringshare_add(name);
|
||||
if (source) fd->source = evas_stringshare_add(source);
|
||||
fd->name = strdup(name);
|
||||
if (source) fd->source = strdup(source);
|
||||
fd->size = size;
|
||||
fd->font = font;
|
||||
fd->ref = 1;
|
||||
|
@ -525,7 +525,7 @@ object_text_font_cache_dir_add(char *dir)
|
|||
fn->type = 1;
|
||||
for (i = 0; i < 14; i++)
|
||||
{
|
||||
fn->x.prop[i] = evas_stringshare_add(font_prop[i]);
|
||||
fn->x.prop[i] = strdup(font_prop[i]);
|
||||
/* FIXME: what if strdup fails! */
|
||||
}
|
||||
fn->path = evas_file_path_join(dir, fname);
|
||||
|
@ -553,7 +553,7 @@ object_text_font_cache_dir_add(char *dir)
|
|||
if (fn)
|
||||
{
|
||||
fn->type = 0;
|
||||
fn->simple.name = evas_stringshare_add(fdir->data);
|
||||
fn->simple.name = strdup(fdir->data);
|
||||
if (fn->simple.name)
|
||||
{
|
||||
char *p;
|
||||
|
@ -591,11 +591,11 @@ object_text_font_cache_dir_add(char *dir)
|
|||
fa = calloc(1, sizeof(Evas_Font_Alias));
|
||||
if (fa)
|
||||
{
|
||||
fa->alias = evas_stringshare_add(fname);
|
||||
fa->alias = strdup(fname);
|
||||
fa->fn = object_text_font_cache_font_find_x(fd, fdef);
|
||||
if ((!fa->alias) || (!fa->fn))
|
||||
{
|
||||
if (fa->alias) evas_stringshare_del(fa->alias);
|
||||
if (fa->alias) free(fa->alias);
|
||||
free(fa);
|
||||
}
|
||||
else
|
||||
|
@ -637,10 +637,10 @@ object_text_font_cache_dir_del(char *dir, Evas_Font_Dir *fd)
|
|||
fd->fonts = evas_list_remove(fd->fonts, fn);
|
||||
for (i = 0; i < 14; i++)
|
||||
{
|
||||
if (fn->x.prop[i]) evas_stringshare_del(fn->x.prop[i]);
|
||||
if (fn->x.prop[i]) free(fn->x.prop[i]);
|
||||
}
|
||||
if (fn->simple.name) evas_stringshare_del(fn->simple.name);
|
||||
if (fn->path) evas_stringshare_del(fn->path);
|
||||
if (fn->simple.name) free(fn->simple.name);
|
||||
if (fn->path) free(fn->path);
|
||||
free(fn);
|
||||
}
|
||||
while (fd->aliases)
|
||||
|
@ -649,7 +649,7 @@ object_text_font_cache_dir_del(char *dir, Evas_Font_Dir *fd)
|
|||
|
||||
fa = fd->aliases->data;
|
||||
fd->aliases = evas_list_remove(fd->aliases, fa);
|
||||
if (fa->alias) evas_stringshare_del(fa->alias);
|
||||
if (fa->alias) free(fa->alias);
|
||||
free(fa);
|
||||
}
|
||||
free(fd);
|
||||
|
|
|
@ -22,13 +22,13 @@ evas_object_name_set(Evas_Object *obj, const char *name)
|
|||
if (obj->name)
|
||||
{
|
||||
obj->layer->evas->name_hash = evas_hash_del(obj->layer->evas->name_hash, obj->name, obj);
|
||||
evas_stringshare_del(obj->name);
|
||||
free(obj->name);
|
||||
}
|
||||
if (!name) obj->name = NULL;
|
||||
else
|
||||
{
|
||||
obj->name = evas_stringshare_add(name);
|
||||
obj->layer->evas->name_hash = evas_hash_direct_add(obj->layer->evas->name_hash, obj->name, obj);
|
||||
obj->name = strdup(name);
|
||||
obj->layer->evas->name_hash = evas_hash_add(obj->layer->evas->name_hash, obj->name, obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,11 +138,11 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
if ((o->cur.key) && (key) && (!strcmp(o->cur.key, key)))
|
||||
return;
|
||||
}
|
||||
if (o->cur.file) evas_stringshare_del(o->cur.file);
|
||||
if (o->cur.key) evas_stringshare_del(o->cur.key);
|
||||
if (file) o->cur.file = evas_stringshare_add(file);
|
||||
if (o->cur.file) free(o->cur.file);
|
||||
if (o->cur.key) free(o->cur.key);
|
||||
if (file) o->cur.file = strdup(file);
|
||||
else o->cur.file = NULL;
|
||||
if (key) o->cur.key = evas_stringshare_add(key);
|
||||
if (key) o->cur.key = strdup(key);
|
||||
else o->cur.key = NULL;
|
||||
o->prev.file = NULL;
|
||||
o->prev.key = NULL;
|
||||
|
@ -1330,8 +1330,8 @@ evas_object_image_free(Evas_Object *obj)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
/* free obj */
|
||||
if (o->cur.file) evas_stringshare_del(o->cur.file);
|
||||
if (o->cur.key) evas_stringshare_del(o->cur.key);
|
||||
if (o->cur.file) free(o->cur.file);
|
||||
if (o->cur.key) free(o->cur.key);
|
||||
if (o->engine_data)
|
||||
obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
|
||||
o->engine_data);
|
||||
|
|
|
@ -225,7 +225,7 @@ evas_object_smart_callback_add(Evas_Object *obj, const char *event, void (*func)
|
|||
if (!event) return;
|
||||
if (!func) return;
|
||||
cb = calloc(1, sizeof(Evas_Smart_Callback));
|
||||
cb->event = evas_stringshare_add(event);
|
||||
cb->event = strdup(event);
|
||||
cb->func = func;
|
||||
cb->func_data = (void *)data;
|
||||
obj->smart.callbacks = evas_list_prepend(obj->smart.callbacks, cb);
|
||||
|
@ -326,7 +326,7 @@ evas_object_smart_callbacks_clear(Evas_Object *obj)
|
|||
if (cb->delete_me)
|
||||
{
|
||||
obj->smart.callbacks = evas_list_remove(obj->smart.callbacks, cb);
|
||||
if (cb->event) evas_stringshare_add(cb->event);
|
||||
if (cb->event) free(cb->event);
|
||||
free(cb);
|
||||
}
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ evas_object_smart_cleanup(Evas_Object *obj)
|
|||
|
||||
cb = obj->smart.callbacks->data;
|
||||
obj->smart.callbacks = evas_list_remove(obj->smart.callbacks, cb);
|
||||
if (cb->event) evas_stringshare_add(cb->event);
|
||||
if (cb->event) free(cb->event);
|
||||
free(cb);
|
||||
}
|
||||
obj->smart.parent = NULL;
|
||||
|
|
|
@ -108,8 +108,8 @@ evas_object_text_font_source_set(Evas_Object *obj, const char *font_source)
|
|||
if ((o->cur.source) && (font_source) &&
|
||||
(!strcmp(o->cur.source, font_source)))
|
||||
return;
|
||||
if (o->cur.source) evas_stringshare_del(o->cur.source);
|
||||
if (font_source) o->cur.source = evas_stringshare_add(font_source);
|
||||
if (o->cur.source) free(o->cur.source);
|
||||
if (font_source) o->cur.source = strdup(font_source);
|
||||
else o->cur.source = NULL;
|
||||
}
|
||||
|
||||
|
@ -179,8 +179,8 @@ evas_object_text_font_set(Evas_Object *obj, const char *font, Evas_Font_Size siz
|
|||
o->engine_data = evas_font_load(obj->layer->evas, font, o->cur.source, size);
|
||||
if (!same_font)
|
||||
{
|
||||
if (o->cur.font) evas_stringshare_del(o->cur.font);
|
||||
if (font) o->cur.font = evas_stringshare_add(font);
|
||||
if (o->cur.font) free(o->cur.font);
|
||||
if (font) o->cur.font = strdup(font);
|
||||
else o->cur.font = NULL;
|
||||
o->prev.font = NULL;
|
||||
}
|
||||
|
@ -293,8 +293,8 @@ evas_object_text_text_set(Evas_Object *obj, const char *text)
|
|||
obj->layer->evas->pointer.x,
|
||||
obj->layer->evas->pointer.y, 1, 1);
|
||||
/* DO II */
|
||||
if (o->cur.text) evas_stringshare_del(o->cur.text);
|
||||
if (text && *text) o->cur.text = evas_stringshare_add(text);
|
||||
if (o->cur.text) free(o->cur.text);
|
||||
if (text && *text) o->cur.text = strdup(text);
|
||||
else o->cur.text = NULL;
|
||||
o->prev.text = NULL;
|
||||
if ((o->engine_data) && (o->cur.text))
|
||||
|
@ -917,7 +917,7 @@ evas_font_path_clear(Evas *e)
|
|||
MAGIC_CHECK_END();
|
||||
while (e->font_path)
|
||||
{
|
||||
evas_stringshare_del(e->font_path->data);
|
||||
free(e->font_path->data);
|
||||
e->font_path = evas_list_remove(e->font_path, e->font_path->data);
|
||||
}
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ evas_font_path_append(Evas *e, const char *path)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if (!path) return;
|
||||
e->font_path = evas_list_append(e->font_path, evas_stringshare_add(path));
|
||||
e->font_path = evas_list_append(e->font_path, strdup(path));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -951,7 +951,7 @@ evas_font_path_prepend(Evas *e, const char *path)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if (!path) return;
|
||||
e->font_path = evas_list_prepend(e->font_path, evas_stringshare_add(path));
|
||||
e->font_path = evas_list_prepend(e->font_path, strdup(path));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1197,9 +1197,9 @@ evas_object_text_free(Evas_Object *obj)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
/* free obj */
|
||||
if (o->cur.text) evas_stringshare_del(o->cur.text);
|
||||
if (o->cur.font) evas_stringshare_del(o->cur.font);
|
||||
if (o->cur.source) evas_stringshare_del(o->cur.source);
|
||||
if (o->cur.text) free(o->cur.text);
|
||||
if (o->cur.font) free(o->cur.font);
|
||||
if (o->cur.source) free(o->cur.source);
|
||||
if (o->engine_data) evas_font_free(obj->layer->evas, o->engine_data);
|
||||
o->magic = 0;
|
||||
free(o);
|
||||
|
|
|
@ -329,10 +329,14 @@ _strbuf_insert(char *s, char *s2, int pos, int *len, int *alloc)
|
|||
s = ts;
|
||||
*alloc = talloc;
|
||||
}
|
||||
tbuf = alloca(*len - pos);
|
||||
strncpy(tbuf, s + pos, *len - pos);
|
||||
strncpy(s + pos, s2, l2);
|
||||
strncpy(s + pos + l2, tbuf, *len - pos);
|
||||
tbuf = malloc(*len - pos);
|
||||
if (tbuf)
|
||||
{
|
||||
strncpy(tbuf, s + pos, *len - pos);
|
||||
strncpy(s + pos, s2, l2);
|
||||
strncpy(s + pos + l2, tbuf, *len - pos);
|
||||
free(tbuf);
|
||||
}
|
||||
*len = tlen;
|
||||
s[tlen] = 0;
|
||||
return s;
|
||||
|
@ -351,9 +355,10 @@ _strbuf_remove(char *s, int p, int p2, int *len, int *alloc)
|
|||
*alloc = 0;
|
||||
return NULL;
|
||||
}
|
||||
tbuf = alloca(*len - p2 + 1);
|
||||
tbuf = malloc(*len - p2 + 1);
|
||||
strcpy(tbuf, s + p2);
|
||||
strcpy(s + p, tbuf);
|
||||
free(tbuf);
|
||||
tlen = *len - (p2 - p);
|
||||
if (tlen < ((*alloc >> 5) << 15))
|
||||
{
|
||||
|
@ -392,9 +397,9 @@ _format_free(Evas_Object *obj, Evas_Object_Textblock_Format *fmt)
|
|||
{
|
||||
fmt->ref--;
|
||||
if (fmt->ref > 0) return;
|
||||
if (fmt->font.name) evas_stringshare_del(fmt->font.name);
|
||||
if (fmt->font.fallbacks) evas_stringshare_del(fmt->font.fallbacks);
|
||||
if (fmt->font.source) evas_stringshare_del(fmt->font.source);
|
||||
if (fmt->font.name) free(fmt->font.name);
|
||||
if (fmt->font.fallbacks) free(fmt->font.fallbacks);
|
||||
if (fmt->font.source) free(fmt->font.source);
|
||||
evas_font_free(obj->layer->evas, fmt->font.font);
|
||||
free(fmt);
|
||||
}
|
||||
|
@ -418,7 +423,7 @@ _line_free(Evas_Object *obj, Evas_Object_Textblock_Line *ln)
|
|||
|
||||
fi = (Evas_Object_Textblock_Format_Item *)ln->format_items;
|
||||
ln->format_items = evas_object_list_remove(ln->format_items, ln->format_items);
|
||||
if (fi->item) evas_stringshare_del(fi->item);
|
||||
if (fi->item) free(fi->item);
|
||||
free(fi);
|
||||
}
|
||||
free(ln);
|
||||
|
@ -700,11 +705,15 @@ _append_text_run(Evas_Object_Textblock *o, char *s, char *p)
|
|||
{
|
||||
char *ts;
|
||||
|
||||
ts = alloca(p - s + 1);
|
||||
strncpy(ts, s, p - s);
|
||||
ts[p - s] = 0;
|
||||
ts = _clean_white(0, 0, ts);
|
||||
evas_textblock_cursor_text_append(o->cursor, ts);
|
||||
ts = malloc(p - s + 1);
|
||||
if (ts)
|
||||
{
|
||||
strncpy(ts, s, p - s);
|
||||
ts[p - s] = 0;
|
||||
ts = _clean_white(0, 0, ts);
|
||||
evas_textblock_cursor_text_append(o->cursor, ts);
|
||||
free(ts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -773,8 +782,8 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, char *cmd,
|
|||
if ((!fmt->font.name) ||
|
||||
((fmt->font.name) && (strcmp(fmt->font.name, param))))
|
||||
{
|
||||
if (fmt->font.name) evas_stringshare_del(fmt->font.name);
|
||||
fmt->font.name = evas_stringshare_add(param);
|
||||
if (fmt->font.name) free(fmt->font.name);
|
||||
fmt->font.name = strdup(param);
|
||||
new_font = 1;
|
||||
}
|
||||
}
|
||||
|
@ -786,8 +795,8 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, char *cmd,
|
|||
/* policy - when we say "fallbacks" do we prepend and use prior
|
||||
* fallbacks... or shoudl we replace. for nwo we replace
|
||||
*/
|
||||
if (fmt->font.fallbacks) evas_stringshare_del(fmt->font.fallbacks);
|
||||
fmt->font.fallbacks = evas_stringshare_add(param);
|
||||
if (fmt->font.fallbacks) free(fmt->font.fallbacks);
|
||||
fmt->font.fallbacks = strdup(param);
|
||||
new_font = 1;
|
||||
}
|
||||
}
|
||||
|
@ -807,8 +816,8 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, char *cmd,
|
|||
if ((!fmt->font.source) ||
|
||||
((fmt->font.source) && (strcmp(fmt->font.source, param))))
|
||||
{
|
||||
if (fmt->font.source) evas_stringshare_del(fmt->font.source);
|
||||
fmt->font.source = evas_stringshare_add(param);
|
||||
if (fmt->font.source) free(fmt->font.source);
|
||||
fmt->font.source = strdup(param);
|
||||
new_font = 1;
|
||||
}
|
||||
}
|
||||
|
@ -858,11 +867,14 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, char *cmd,
|
|||
{
|
||||
char *ts, *p;
|
||||
|
||||
ts = alloca(strlen(param));
|
||||
strcpy(ts, param);
|
||||
p = strchr(ts, '%');
|
||||
*p = 0;
|
||||
fmt->halign = ((double)atoi(ts)) / 100.0;
|
||||
ts = strdup(param);
|
||||
if (ts)
|
||||
{
|
||||
p = strchr(ts, '%');
|
||||
*p = 0;
|
||||
fmt->halign = ((double)atoi(ts)) / 100.0;
|
||||
free(ts);
|
||||
}
|
||||
if (fmt->halign < 0.0) fmt->halign = 0.0;
|
||||
else if (fmt->halign > 1.0) fmt->halign = 1.0;
|
||||
}
|
||||
|
@ -885,11 +897,14 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, char *cmd,
|
|||
{
|
||||
char *ts, *p;
|
||||
|
||||
ts = alloca(strlen(param));
|
||||
strcpy(ts, param);
|
||||
p = strchr(ts, '%');
|
||||
*p = 0;
|
||||
fmt->valign = ((double)atoi(ts)) / 100.0;
|
||||
ts = strdup(param);
|
||||
if (ts)
|
||||
{
|
||||
p = strchr(ts, '%');
|
||||
*p = 0;
|
||||
fmt->valign = ((double)atoi(ts)) / 100.0;
|
||||
free(ts);
|
||||
}
|
||||
if (fmt->valign < 0.0) fmt->valign = 0.0;
|
||||
else if (fmt->valign > 1.0) fmt->valign = 1.0;
|
||||
}
|
||||
|
@ -1133,9 +1148,9 @@ _format_dup(Evas_Object *obj, Evas_Object_Textblock_Format *fmt)
|
|||
fmt2 = calloc(1, sizeof(Evas_Object_Textblock_Format));
|
||||
memcpy(fmt2, fmt, sizeof(Evas_Object_Textblock_Format));
|
||||
fmt2->ref = 1;
|
||||
if (fmt->font.name) fmt2->font.name = evas_stringshare_add(fmt->font.name);
|
||||
if (fmt->font.fallbacks) fmt2->font.fallbacks = evas_stringshare_add(fmt->font.fallbacks);
|
||||
if (fmt->font.source) fmt2->font.source = evas_stringshare_add(fmt->font.source);
|
||||
if (fmt->font.name) fmt2->font.name = strdup(fmt->font.name);
|
||||
if (fmt->font.fallbacks) fmt2->font.fallbacks = strdup(fmt->font.fallbacks);
|
||||
if (fmt->font.source) fmt2->font.source = strdup(fmt->font.source);
|
||||
|
||||
if ((fmt2->font.name) && (fmt2->font.fallbacks))
|
||||
{
|
||||
|
@ -1808,7 +1823,7 @@ _layout_format_item_add(Ctxt *c, Evas_Object_Textblock_Node *n, char *item)
|
|||
Evas_Object_Textblock_Format_Item *fi;
|
||||
|
||||
fi = calloc(1, sizeof(Evas_Object_Textblock_Format_Item));
|
||||
fi->item = evas_stringshare_add(item);
|
||||
fi->item = strdup(item);
|
||||
fi->source_node = n;
|
||||
c->ln->format_items = evas_object_list_append(c->ln->format_items, fi);
|
||||
return fi;
|
||||
|
|
|
@ -13,21 +13,22 @@ static Evas_Bool font_flush_free_glyph_cb(Evas_Hash *hash, const char *key, void
|
|||
RGBA_Font_Source *
|
||||
evas_common_font_source_memory_load(const char *name, const void *data, int data_size)
|
||||
{
|
||||
int error;
|
||||
int error, len;
|
||||
RGBA_Font_Source *fs;
|
||||
|
||||
fs = calloc(1, sizeof(RGBA_Font_Source) + data_size);
|
||||
len = strlen(name);
|
||||
fs = calloc(1, sizeof(RGBA_Font_Source) + len + 1 + data_size);
|
||||
if (!fs) return NULL;
|
||||
fs->name = evas_stringshare_add(name);
|
||||
fs->name = ((char *)fs) + sizeof(RGBA_Font_Source);
|
||||
strcpy(fs->name, name);
|
||||
fs->file = NULL;
|
||||
fs->data = ((unsigned char *)fs) + sizeof(RGBA_Font_Source);
|
||||
fs->data = fs->name + len + 1;
|
||||
fs->current_size = 0;
|
||||
memcpy(fs->data, data, data_size);
|
||||
fs->data_size = data_size;
|
||||
error = FT_New_Memory_Face(evas_ft_lib, fs->data, fs->data_size, 0, &(fs->ft.face));
|
||||
if (error)
|
||||
{
|
||||
evas_stringshare_del(fs->name);
|
||||
free(fs);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -45,12 +46,14 @@ evas_common_font_source_memory_load(const char *name, const void *data, int data
|
|||
RGBA_Font_Source *
|
||||
evas_common_font_source_load(const char *name)
|
||||
{
|
||||
int error;
|
||||
int error, len;
|
||||
RGBA_Font_Source *fs;
|
||||
|
||||
fs = calloc(1, sizeof(RGBA_Font_Source));
|
||||
len = strlen(name);
|
||||
fs = calloc(1, sizeof(RGBA_Font_Source) + len + 1);
|
||||
if (!fs) return NULL;
|
||||
fs->name = evas_stringshare_add(name);
|
||||
fs->name = ((char *)fs) + sizeof(RGBA_Font_Source);
|
||||
strcpy(fs->name, name);
|
||||
fs->file = fs->name;
|
||||
fs->data = NULL;
|
||||
fs->data_size = 0;
|
||||
|
@ -58,7 +61,6 @@ evas_common_font_source_load(const char *name)
|
|||
error = FT_New_Face(evas_ft_lib, fs->file, 0, &(fs->ft.face));
|
||||
if (error)
|
||||
{
|
||||
evas_stringshare_del(fs->name);
|
||||
free(fs);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -124,7 +126,6 @@ evas_common_font_source_free(RGBA_Font_Source *fs)
|
|||
|
||||
fonts_src = evas_object_list_remove(fonts_src, fs);
|
||||
FT_Done_Face(fs->ft.face);
|
||||
if (fs->name) evas_stringshare_del(fs->name);
|
||||
free(fs);
|
||||
}
|
||||
|
||||
|
|
|
@ -200,8 +200,15 @@ load_image_file_data_png(RGBA_Image *im, const char *file, const char *key)
|
|||
fclose(f);
|
||||
return -1;
|
||||
}
|
||||
lines = (unsigned char **) alloca(h * sizeof(unsigned char *));
|
||||
lines = (unsigned char **) malloc(h * sizeof(unsigned char *));
|
||||
|
||||
if (!lines)
|
||||
{
|
||||
evas_common_image_surface_free(im->image);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
|
||||
fclose(f);
|
||||
return -1;
|
||||
}
|
||||
if (hasg)
|
||||
{
|
||||
png_set_gray_to_rgb(png_ptr);
|
||||
|
@ -211,6 +218,7 @@ load_image_file_data_png(RGBA_Image *im, const char *file, const char *key)
|
|||
for (i = 0; i < h; i++)
|
||||
lines[i] = ((unsigned char *)(im->image->data)) + (i * w * sizeof(DATA32));
|
||||
png_read_image(png_ptr, lines);
|
||||
free(lines);
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
|
||||
fclose(f);
|
||||
|
@ -343,10 +351,16 @@ load_image_file_data_jpeg_internal(RGBA_Image *im, FILE *f)
|
|||
jpeg_destroy_decompress(&cinfo);
|
||||
return -1;
|
||||
}
|
||||
data = alloca(w * 16 * 3);
|
||||
data = malloc(w * 16 * 3);
|
||||
if (!data)
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return -1;
|
||||
}
|
||||
evas_common_image_surface_alloc(im->image);
|
||||
if (!im->image->data)
|
||||
{
|
||||
free(data);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return -1;
|
||||
}
|
||||
|
@ -397,6 +411,7 @@ load_image_file_data_jpeg_internal(RGBA_Image *im, FILE *f)
|
|||
}
|
||||
}
|
||||
}
|
||||
free(data);
|
||||
/* end data decoding */
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
@ -442,9 +457,15 @@ load_image_file_data_jpeg_alpha_internal(RGBA_Image *im, FILE *f)
|
|||
jpeg_destroy_decompress(&cinfo);
|
||||
return -1;
|
||||
}
|
||||
data = alloca(w * 16 * 3);
|
||||
data = malloc(w * 16 * 3);
|
||||
if (!data)
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return -1;
|
||||
}
|
||||
if (!im->image->data)
|
||||
{
|
||||
free(data);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return -1;
|
||||
}
|
||||
|
@ -497,6 +518,7 @@ load_image_file_data_jpeg_alpha_internal(RGBA_Image *im, FILE *f)
|
|||
}
|
||||
}
|
||||
}
|
||||
free(data);
|
||||
/* end data decoding */
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
@ -936,14 +958,15 @@ evas_common_load_image_from_file(const char *file, const char *key)
|
|||
// im->timestamp = mod_time;
|
||||
if (file)
|
||||
{
|
||||
im->info.file = evas_stringshare_add(file);
|
||||
im->info.file = strdup(file);
|
||||
// im->info.real_file = real_file;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (real_file) free(real_file);
|
||||
}
|
||||
if (key) im->info.key = evas_stringshare_add(key);
|
||||
if (key)
|
||||
im->info.key = strdup(key);
|
||||
evas_common_image_ref(im);
|
||||
return im;
|
||||
}
|
||||
|
|
|
@ -227,10 +227,10 @@ void
|
|||
evas_common_image_free(RGBA_Image *im)
|
||||
{
|
||||
if (im->image) evas_common_image_surface_free(im->image);
|
||||
if (im->info.file) evas_stringshare_del(im->info.file);
|
||||
// if (im->info.real_file) evas_stringshare_del(im->info.real_file);
|
||||
if (im->info.key) evas_stringshare_del(im->info.key);
|
||||
if (im->info.comment) evas_stringshare_del(im->info.comment);
|
||||
if (im->info.file) free(im->info.file);
|
||||
if (im->info.real_file) free(im->info.real_file);
|
||||
if (im->info.key) free(im->info.key);
|
||||
if (im->info.comment) free(im->info.comment);
|
||||
free(im);
|
||||
}
|
||||
|
||||
|
@ -335,9 +335,8 @@ evas_common_image_store(RGBA_Image *im)
|
|||
if (im->flags & RGBA_IMAGE_INDEXED) return;
|
||||
if ((!im->info.file) && (!im->info.key)) return;
|
||||
l1 = 0;
|
||||
// if (im->info.real_file) l1 = strlen(im->info.real_file);
|
||||
// else
|
||||
if (im->info.file) l1 = strlen(im->info.file);
|
||||
if (im->info.real_file) l1 = strlen(im->info.real_file);
|
||||
else if (im->info.file) l1 = strlen(im->info.file);
|
||||
l2 = 0;
|
||||
if (im->info.key) l2 = strlen(im->info.key);
|
||||
snprintf(buf, sizeof(buf), "%llx", im->timestamp);
|
||||
|
@ -345,9 +344,8 @@ evas_common_image_store(RGBA_Image *im)
|
|||
key = malloc(l1 + 5 + l2 + 5 + l3 +1);
|
||||
if (!key) return;
|
||||
key[0] = 0;
|
||||
// if (im->info.real_file) strcpy(key, im->info.real_file);
|
||||
// else
|
||||
if (im->info.file) strcpy(key, im->info.file);
|
||||
if (im->info.real_file) strcpy(key, im->info.real_file);
|
||||
else if (im->info.file) strcpy(key, im->info.file);
|
||||
strcat(key, "//://");
|
||||
if (im->info.key) strcat(key, im->info.key);
|
||||
strcat(key, "//://");
|
||||
|
@ -367,9 +365,8 @@ evas_common_image_unstore(RGBA_Image *im)
|
|||
if (!(im->flags & RGBA_IMAGE_INDEXED)) return;
|
||||
if ((!im->info.file) && (!im->info.key)) return;
|
||||
l1 = 0;
|
||||
// if (im->info.real_file) l1 = strlen(im->info.real_file);
|
||||
// else
|
||||
if (im->info.file) l1 = strlen(im->info.file);
|
||||
if (im->info.real_file) l1 = strlen(im->info.real_file);
|
||||
else if (im->info.file) l1 = strlen(im->info.file);
|
||||
l2 = 0;
|
||||
if (im->info.key) l2 = strlen(im->info.key);
|
||||
snprintf(buf, sizeof(buf), "%llx", im->timestamp);
|
||||
|
@ -377,9 +374,8 @@ evas_common_image_unstore(RGBA_Image *im)
|
|||
key = malloc(l1 + 5 + l2 + 5 + l3 +1);
|
||||
if (!key) return;
|
||||
key[0] = 0;
|
||||
// if (im->info.real_file) strcpy(key, im->info.real_file);
|
||||
// else
|
||||
if (im->info.file) strcpy(key, im->info.file);
|
||||
if (im->info.real_file) strcpy(key, im->info.real_file);
|
||||
else if (im->info.file) strcpy(key, im->info.file);
|
||||
strcat(key, "//://");
|
||||
if (im->info.key) strcat(key, im->info.key);
|
||||
strcat(key, "//://");
|
||||
|
@ -427,7 +423,7 @@ evas_common_image_find(const char *filename, const char *key, DATA64 timestamp)
|
|||
free(str);
|
||||
if (im)
|
||||
{
|
||||
// if (real_filename) free(real_filename);
|
||||
if (real_filename) free(real_filename);
|
||||
return im;
|
||||
}
|
||||
|
||||
|
@ -437,7 +433,6 @@ evas_common_image_find(const char *filename, const char *key, DATA64 timestamp)
|
|||
|
||||
im = (RGBA_Image *)l;
|
||||
ok = 0;
|
||||
/*
|
||||
if ((real_filename) && (im->info.real_file))
|
||||
{
|
||||
if ((im->info.real_file) &&
|
||||
|
@ -446,7 +441,6 @@ evas_common_image_find(const char *filename, const char *key, DATA64 timestamp)
|
|||
ok++;
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
if ((filename) && (im->info.file) &&
|
||||
(!strcmp(filename, im->info.file)))
|
||||
|
@ -463,11 +457,11 @@ evas_common_image_find(const char *filename, const char *key, DATA64 timestamp)
|
|||
ok++;
|
||||
if (ok >= 3)
|
||||
{
|
||||
// if (real_filename) free(real_filename);
|
||||
if (real_filename) free(real_filename);
|
||||
return im;
|
||||
}
|
||||
}
|
||||
// if (real_filename) free(real_filename);
|
||||
if (real_filename) free(real_filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -478,7 +472,7 @@ evas_common_image_ram_usage(RGBA_Image *im)
|
|||
|
||||
ram += sizeof(struct _RGBA_Image);
|
||||
if (im->info.file) ram += strlen(im->info.file);
|
||||
// if (im->info.real_file) ram += strlen(im->info.real_file);
|
||||
if (im->info.real_file) ram += strlen(im->info.real_file);
|
||||
if (im->info.key) ram += strlen(im->info.key);
|
||||
if (im->info.comment) ram += strlen(im->info.comment);
|
||||
if ((im->image) && (im->image->data) && (!im->image->no_free))
|
||||
|
|
|
@ -214,7 +214,7 @@ struct _RGBA_Image
|
|||
{
|
||||
int format;
|
||||
char *file;
|
||||
// char *real_file;
|
||||
char *real_file;
|
||||
char *key;
|
||||
char *comment;
|
||||
} info;
|
||||
|
|
Loading…
Reference in New Issue