forked from enlightenment/efl
parent
53a768b573
commit
c1a90b065a
|
@ -4,6 +4,13 @@
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_str_ncpy(char *dest, const char *src, size_t count)
|
||||||
|
{
|
||||||
|
if ((!dest) || (!src)) return NULL;
|
||||||
|
return strncpy(dest, src, count);
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_str_append(char *str, const char *txt, int *len, int *alloc)
|
_str_append(char *str, const char *txt, int *len, int *alloc)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +58,7 @@ _elm_util_mkup_to_text(const char *mkup)
|
||||||
ttag = malloc(tag_end - tag_start);
|
ttag = malloc(tag_end - tag_start);
|
||||||
if (ttag)
|
if (ttag)
|
||||||
{
|
{
|
||||||
strncpy(ttag, tag_start + 1, tag_end - tag_start - 1);
|
_str_ncpy(ttag, tag_start + 1, tag_end - tag_start - 1);
|
||||||
ttag[tag_end - tag_start - 1] = 0;
|
ttag[tag_end - tag_start - 1] = 0;
|
||||||
if (!strcmp(ttag, "br"))
|
if (!strcmp(ttag, "br"))
|
||||||
str = _str_append(str, "\n", &str_len, &str_alloc);
|
str = _str_append(str, "\n", &str_len, &str_alloc);
|
||||||
|
@ -75,7 +82,7 @@ _elm_util_mkup_to_text(const char *mkup)
|
||||||
if (ts)
|
if (ts)
|
||||||
{
|
{
|
||||||
const char *esc;
|
const char *esc;
|
||||||
strncpy(ts, esc_start, esc_end - esc_start);
|
_str_ncpy(ts, esc_start, esc_end - esc_start);
|
||||||
ts[esc_end - esc_start] = 0;
|
ts[esc_end - esc_start] = 0;
|
||||||
esc = evas_textblock_escape_string_get(ts);
|
esc = evas_textblock_escape_string_get(ts);
|
||||||
if (esc)
|
if (esc)
|
||||||
|
@ -89,7 +96,7 @@ _elm_util_mkup_to_text(const char *mkup)
|
||||||
ts = malloc(p - s + 1);
|
ts = malloc(p - s + 1);
|
||||||
if (ts)
|
if (ts)
|
||||||
{
|
{
|
||||||
strncpy(ts, s, p - s);
|
_str_ncpy(ts, s, p - s);
|
||||||
ts[p - s] = 0;
|
ts[p - s] = 0;
|
||||||
str = _str_append(str, ts, &str_len, &str_alloc);
|
str = _str_append(str, ts, &str_len, &str_alloc);
|
||||||
free(ts);
|
free(ts);
|
||||||
|
@ -106,7 +113,7 @@ _elm_util_mkup_to_text(const char *mkup)
|
||||||
ts = malloc(p - s + 1);
|
ts = malloc(p - s + 1);
|
||||||
if (ts)
|
if (ts)
|
||||||
{
|
{
|
||||||
strncpy(ts, s, p - s);
|
_str_ncpy(ts, s, p - s);
|
||||||
ts[p - s] = 0;
|
ts[p - s] = 0;
|
||||||
str = _str_append(str, ts, &str_len, &str_alloc);
|
str = _str_append(str, ts, &str_len, &str_alloc);
|
||||||
free(ts);
|
free(ts);
|
||||||
|
@ -131,7 +138,7 @@ _elm_util_mkup_to_text(const char *mkup)
|
||||||
ts = malloc(p - s + 1);
|
ts = malloc(p - s + 1);
|
||||||
if (ts)
|
if (ts)
|
||||||
{
|
{
|
||||||
strncpy(ts, s, p - s);
|
_str_ncpy(ts, s, p - s);
|
||||||
ts[p - s] = 0;
|
ts[p - s] = 0;
|
||||||
str = _str_append(str, ts, &str_len, &str_alloc);
|
str = _str_append(str, ts, &str_len, &str_alloc);
|
||||||
free(ts);
|
free(ts);
|
||||||
|
@ -181,7 +188,7 @@ _elm_util_text_to_mkup(const char *text)
|
||||||
{
|
{
|
||||||
char tstr[16];
|
char tstr[16];
|
||||||
|
|
||||||
strncpy(tstr, text + pos, pos2 - pos);
|
_str_ncpy(tstr, text + pos, pos2 - pos);
|
||||||
tstr[pos2 - pos] = 0;
|
tstr[pos2 - pos] = 0;
|
||||||
str = _str_append(str, tstr, &str_len, &str_alloc);
|
str = _str_append(str, tstr, &str_len, &str_alloc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue