forked from enlightenment/efl
elm entry - warn - write a specirfic string truncate func to avoid warnings
so gcc likes to warn even if the truncation is intended. there are verious ways around this, but in this case it's really just writing your own ... which is pretty simple. there is just too much warning noise for efl.
This commit is contained in:
parent
dd677aa2f6
commit
b601e6f54b
|
@ -3032,6 +3032,17 @@ _text_append_idler(void *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
my_string_copy_truncate(char *dest, const char *src, size_t len)
|
||||
{
|
||||
char *p;
|
||||
for (p = dest; len > 0; p++, src++, len--)
|
||||
{
|
||||
*p = *src;
|
||||
if (*src == 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_chars_add_till_limit(Evas_Object *obj,
|
||||
char **text,
|
||||
|
@ -3095,8 +3106,8 @@ _chars_add_till_limit(Evas_Object *obj,
|
|||
return;
|
||||
}
|
||||
can_add = 0;
|
||||
strncpy(new_text, new_text + idx,
|
||||
current_len - ((new_text + idx) - *text));
|
||||
my_string_copy_truncate(new_text, new_text + idx,
|
||||
current_len - ((new_text + idx) - *text));
|
||||
current_len -= idx;
|
||||
(*text)[current_len] = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue