* rename _edje_strbuf_append to _edje_strbuf_append1 and
_edje_strbuf_append2 in edje_util.c and edje_textblock_styles.c respectiveley (for amalgamation. See next commit) * fixes for vc++ SVN revision: 43428
This commit is contained in:
parent
3d77c82d15
commit
fd17f32a19
|
@ -17,10 +17,13 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#ifndef _WIN32
|
||||
# define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
|
|
|
@ -107,7 +107,7 @@ _edje_format_is_param(char *item)
|
|||
}
|
||||
|
||||
static char *
|
||||
_edje_strbuf_append(char *s, const char *s2, int *len, int *alloc)
|
||||
_edje_strbuf_append2(char *s, const char *s2, int *len, int *alloc)
|
||||
{
|
||||
int l2, tlen;
|
||||
|
||||
|
@ -131,14 +131,14 @@ _edje_strbuf_append(char *s, const char *s2, int *len, int *alloc)
|
|||
}
|
||||
|
||||
static char *
|
||||
_edje_strbuf_append_escaped(char *s, const char *unescaped_s, int *len, int *alloc)
|
||||
_edje_strbuf_append2_escaped(char *s, const char *unescaped_s, int *len, int *alloc)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = _edje_str_escape(unescaped_s);
|
||||
if (!tmp) return s;
|
||||
|
||||
s = _edje_strbuf_append(s, tmp, len, alloc);
|
||||
s = _edje_strbuf_append2(s, tmp, len, alloc);
|
||||
free(tmp);
|
||||
|
||||
return s;
|
||||
|
@ -183,9 +183,9 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret)
|
|||
char *tmpstr = NULL;
|
||||
int tmplen = 0, tmpalloc = 0;
|
||||
|
||||
tmpstr = _edje_strbuf_append(tmpstr, "fonts/",
|
||||
tmpstr = _edje_strbuf_append2(tmpstr, "fonts/",
|
||||
&tmplen, &tmpalloc);
|
||||
tmpstr = _edje_strbuf_append(tmpstr, val,
|
||||
tmpstr = _edje_strbuf_append2(tmpstr, val,
|
||||
&tmplen, &tmpalloc);
|
||||
(*tag_ret)->font = eina_stringshare_add(tmpstr);
|
||||
free(tmpstr);
|
||||
|
@ -201,8 +201,8 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret)
|
|||
s2 = _edje_str_escape(item);
|
||||
if (s2)
|
||||
{
|
||||
if (newstr) newstr = _edje_strbuf_append(newstr, " ", &newlen, &newalloc);
|
||||
newstr = _edje_strbuf_append(newstr, s2, &newlen, &newalloc);
|
||||
if (newstr) newstr = _edje_strbuf_append2(newstr, " ", &newlen, &newalloc);
|
||||
newstr = _edje_strbuf_append2(newstr, s2, &newlen, &newalloc);
|
||||
free(s2);
|
||||
}
|
||||
}
|
||||
|
@ -211,8 +211,8 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (newstr) newstr = _edje_strbuf_append(newstr, " ", &newlen, &newalloc);
|
||||
newstr = _edje_strbuf_append(newstr, item, &newlen, &newalloc);
|
||||
if (newstr) newstr = _edje_strbuf_append2(newstr, " ", &newlen, &newalloc);
|
||||
newstr = _edje_strbuf_append2(newstr, item, &newlen, &newalloc);
|
||||
}
|
||||
free(item);
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ _edje_textblock_style_all_update(Edje *ed)
|
|||
if (!tag->key) continue;
|
||||
|
||||
/* Add Tag Key */
|
||||
buf = _edje_strbuf_append(buf, tag->key, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "='", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, tag->key, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "='", &buflen, &bufalloc);
|
||||
|
||||
/* Configure fonts from text class if it exists */
|
||||
if ((tc = _edje_text_class_find(ed, tag->text_class)))
|
||||
|
@ -270,19 +270,19 @@ _edje_textblock_style_all_update(Edje *ed)
|
|||
}
|
||||
|
||||
/* Add and Ha`ndle tag parsed data */
|
||||
buf = _edje_strbuf_append(buf, tag->value, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, tag->value, &buflen, &bufalloc);
|
||||
|
||||
if (!strcmp(tag->key, "DEFAULT"))
|
||||
{
|
||||
if (fontset)
|
||||
{
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font_fallbacks=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, fontset, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font_fallbacks=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, fontset, &buflen, &bufalloc);
|
||||
}
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font_source=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, fontsource, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font_source=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, fontsource, &buflen, &bufalloc);
|
||||
}
|
||||
if (tag->font_size != 0)
|
||||
{
|
||||
|
@ -293,24 +293,24 @@ _edje_textblock_style_all_update(Edje *ed)
|
|||
else
|
||||
snprintf(font_size, sizeof(font_size), "%f", tag->font_size);
|
||||
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font_size=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, font_size, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font_size=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, font_size, &buflen, &bufalloc);
|
||||
}
|
||||
/* Add font name last to save evas from multiple loads */
|
||||
if (tag->font)
|
||||
{
|
||||
const char *f;
|
||||
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font=", &buflen, &bufalloc);
|
||||
|
||||
f = (found) ? tc->font : tag->font;
|
||||
buf = _edje_strbuf_append_escaped(buf, f, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2_escaped(buf, f, &buflen, &bufalloc);
|
||||
}
|
||||
found = 0;
|
||||
|
||||
buf = _edje_strbuf_append(buf, "'", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "'", &buflen, &bufalloc);
|
||||
}
|
||||
if (fontset) free(fontset);
|
||||
if (fontsource) free(fontsource);
|
||||
|
@ -398,8 +398,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
|
|||
if (!tag->key) continue;
|
||||
|
||||
/* Add Tag Key */
|
||||
buf = _edje_strbuf_append(buf, tag->key, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "='", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, tag->key, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "='", &buflen, &bufalloc);
|
||||
|
||||
ts = _edje_format_reparse(edf, tag->value, &(tag));
|
||||
|
||||
|
@ -409,7 +409,7 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
|
|||
if (eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
|
||||
eina_stringshare_del(tag->value);
|
||||
tag->value = eina_stringshare_add(ts);
|
||||
buf = _edje_strbuf_append(buf, tag->value, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, tag->value, &buflen, &bufalloc);
|
||||
free(ts);
|
||||
}
|
||||
|
||||
|
@ -417,31 +417,31 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
|
|||
{
|
||||
if (fontset)
|
||||
{
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font_fallbacks=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, fontset, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font_fallbacks=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, fontset, &buflen, &bufalloc);
|
||||
}
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font_source=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, fontsource, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font_source=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, fontsource, &buflen, &bufalloc);
|
||||
}
|
||||
if (tag->font_size > 0)
|
||||
{
|
||||
char font_size[32];
|
||||
|
||||
snprintf(font_size, sizeof(font_size), "%f", tag->font_size);
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font_size=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, font_size, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font_size=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, font_size, &buflen, &bufalloc);
|
||||
}
|
||||
/* Add font name last to save evas from multiple loads */
|
||||
if (tag->font)
|
||||
{
|
||||
buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, "font=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append_escaped(buf, tag->font, &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, " ", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "font=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2_escaped(buf, tag->font, &buflen, &bufalloc);
|
||||
}
|
||||
buf = _edje_strbuf_append(buf, "'", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append2(buf, "'", &buflen, &bufalloc);
|
||||
}
|
||||
if (fontset) free(fontset);
|
||||
if (fontsource) free(fontsource);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "edje_private.h"
|
||||
|
||||
typedef struct _Edje_Box_Layout Edje_Box_Layout;
|
||||
|
@ -1294,8 +1295,9 @@ edje_object_part_text_get(const Evas_Object *obj, const char *part)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_edje_strbuf_append(char **p_str, size_t *allocated, size_t *used, const char *news, size_t news_len)
|
||||
_edje_strbuf_append1(char **p_str, size_t *allocated, size_t *used, const char *news, size_t news_len)
|
||||
{
|
||||
if (*used + news_len >= *allocated)
|
||||
{
|
||||
|
@ -1349,12 +1351,12 @@ _edje_text_escape(const char *text)
|
|||
else
|
||||
escaped_len = strlen(escaped);
|
||||
|
||||
if (!_edje_strbuf_append(&ret, &ret_len, &used, escaped, escaped_len))
|
||||
if (!_edje_strbuf_append1(&ret, &ret_len, &used, escaped, escaped_len))
|
||||
return NULL;
|
||||
text += advance;
|
||||
}
|
||||
|
||||
if (!_edje_strbuf_append(&ret, &ret_len, &used, "", 1))
|
||||
if (!_edje_strbuf_append1(&ret, &ret_len, &used, "", 1))
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
||||
|
@ -1397,7 +1399,7 @@ _edje_text_unescape(const char *text)
|
|||
|
||||
if (len > 0)
|
||||
{
|
||||
if (!_edje_strbuf_append(&ret, &ret_len, &used, str, len))
|
||||
if (!_edje_strbuf_append1(&ret, &ret_len, &used, str, len))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1418,7 +1420,7 @@ _edje_text_unescape(const char *text)
|
|||
len = text + 1 - escape_start;
|
||||
}
|
||||
|
||||
if (!_edje_strbuf_append(&ret, &ret_len, &used, str, len))
|
||||
if (!_edje_strbuf_append1(&ret, &ret_len, &used, str, len))
|
||||
return NULL;
|
||||
|
||||
escape_start = NULL;
|
||||
|
@ -1432,11 +1434,11 @@ _edje_text_unescape(const char *text)
|
|||
if (last && (text > last))
|
||||
{
|
||||
size_t len = text - last;
|
||||
if (!_edje_strbuf_append(&ret, &ret_len, &used, last, len))
|
||||
if (!_edje_strbuf_append1(&ret, &ret_len, &used, last, len))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!_edje_strbuf_append(&ret, &ret_len, &used, "", 1))
|
||||
if (!_edje_strbuf_append1(&ret, &ret_len, &used, "", 1))
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue