evas: textblock - Added Null checking in evas_textblock_text_markup_to_utf8 before calling eina_strbuf_append_length API.

Summary:
When input string has non-finished markup tags or escaped tags,
eina_strbuf_append_length is called with Null string.
There is a Null checking in eina_strbuf_* API, but it will print error message when input string is Null.
Strictly speaking, *_markup_to_utf8 API could be used with any kind of input string.
So, we need to add Null checking for removing the useless error message.

Test Plan:
Call the API like the following code.
evas_textblock_text_markup_to_utf8(NULL, "test_text&&&&");

ERR message will be printed.

Reviewers: woohyun, tasn, seoz, Hermet, hbr4570

CC: cedric

Differential Revision: https://phab.enlightenment.org/D493
This commit is contained in:
Youngbok Shin 2014-02-05 13:23:55 +00:00 committed by Tom Hacohen
parent eea4fbff6a
commit c48c9827ff
1 changed files with 27 additions and 6 deletions

View File

@ -6557,8 +6557,15 @@ evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text)
}
else if (*p == 0)
{
eina_strbuf_append_length(sbuf, s, p - s);
s = NULL;
if (s)
{
eina_strbuf_append_length(sbuf, s, p - s);
s = NULL;
}
else
{
ERR("There is a invalid markup tag. Please check the text.");
}
}
if (*p == 0)
break;
@ -6571,8 +6578,15 @@ evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text)
* mark the start of the tag */
tag_start = p;
tag_end = NULL;
eina_strbuf_append_length(sbuf, s, p - s);
s = NULL;
if (s)
{
eina_strbuf_append_length(sbuf, s, p - s);
s = NULL;
}
else
{
ERR("There is a invalid markup tag. Please check the text.");
}
}
}
else if (*p == '>')
@ -6591,8 +6605,15 @@ evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text)
* the start of the escape sequence */
esc_start = p;
esc_end = NULL;
eina_strbuf_append_length(sbuf, s, p - s);
s = NULL;
if (s)
{
eina_strbuf_append_length(sbuf, s, p - s);
s = NULL;
}
else
{
ERR("There is a invalid markup tag. Please check the text.");
}
}
}
else if (*p == ';')