return the right buffer, iconv modify one

This commit is contained in:
Julien Danjou 2008-02-11 10:52:05 +01:00
parent 1a643a20bd
commit e244210943
1 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ draw_iso2utf8(char *iso)
{ {
iconv_t iso2utf8; iconv_t iso2utf8;
size_t len, utf8len; size_t len, utf8len;
char *utf8; char *utf8, *utf8p;
if(!(len = a_strlen(iso))) if(!(len = a_strlen(iso)))
return NULL; return NULL;
@ -58,19 +58,19 @@ draw_iso2utf8(char *iso)
} }
utf8len = (3 * len) / 2 + 1; utf8len = (3 * len) / 2 + 1;
utf8 = p_new(char, utf8len); utf8 = utf8p = p_new(char, utf8len);
if(iconv(iso2utf8, &iso, &len, &utf8, &utf8len) == (size_t) -1) if(iconv(iso2utf8, &iso, &len, &utf8, &utf8len) == (size_t) -1)
{ {
perror("awesome: text conversion failed"); perror("awesome: text conversion failed");
p_delete(&utf8); p_delete(&utf8p);
return NULL; return NULL;
} }
if(iconv_close(iso2utf8)) if(iconv_close(iso2utf8))
warn("error closing iconv"); warn("error closing iconv");
return utf8; return utf8p;
} }
/** Get a draw context /** Get a draw context