mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-28 04:55:08 +00:00
simplify iconv_convert() a bit (exit early on error)
This commit is contained in:
parent
938af98ff3
commit
d9dbd528c4
@ -79,8 +79,6 @@ void free_iconv(struct text_object *obj)
|
||||
|
||||
void iconv_convert(size_t *a, char *buff_in, char *p, size_t p_max_size)
|
||||
{
|
||||
if (*a > 0 && iconv_converting && iconv_selected > 0
|
||||
&& (iconv_cd[iconv_selected - 1] != (iconv_t) (-1))) {
|
||||
int bytes;
|
||||
size_t dummy1, dummy2;
|
||||
#ifdef __FreeBSD__
|
||||
@ -90,6 +88,10 @@ void iconv_convert(size_t *a, char *buff_in, char *p, size_t p_max_size)
|
||||
#endif
|
||||
char *outptr = p;
|
||||
|
||||
if (*a <= 0 || !iconv_converting || iconv_selected <= 0
|
||||
|| iconv_cd[iconv_selected - 1] == (iconv_t) (-1))
|
||||
return;
|
||||
|
||||
dummy1 = dummy2 = *a;
|
||||
|
||||
strncpy(buff_in, p, p_max_size);
|
||||
@ -109,7 +111,6 @@ void iconv_convert(size_t *a, char *buff_in, char *p, size_t p_max_size)
|
||||
//a = outptr - p;
|
||||
//(*a) = *a - dummy2;
|
||||
(*a) = outptr - p;
|
||||
}
|
||||
}
|
||||
|
||||
void init_iconv_start(struct text_object *obj, void *free_at_crash, const char *arg)
|
||||
|
Loading…
Reference in New Issue
Block a user