src/strutil.c: Fix returning empty string with partially wrong recoding

This commit is contained in:
Slava Zanko 2009-04-20 14:09:32 +03:00
parent cc54a2083b
commit 45abfa28a4

View File

@ -106,14 +106,16 @@ _str_convert (GIConv coder, char *string, int size, GString * buffer)
gsize bytes_read, bytes_written; gsize bytes_read, bytes_written;
GError *error = NULL; GError *error = NULL;
errno = 0; errno = 0;
if (string == NULL || buffer == NULL) if (string == NULL || buffer == NULL)
return ESTR_FAILURE; return ESTR_FAILURE;
/*
if (! used_class.is_valid_string (string)) if (! used_class.is_valid_string (string))
{ {
return ESTR_FAILURE; return ESTR_FAILURE;
} }
*/
state = 0; state = 0;
if (size < 0) if (size < 0)
{ {
@ -208,7 +210,8 @@ _str_convert (GIConv coder, char *string, int size, GString * buffer)
{ {
if (tmp_buff != NULL) if (tmp_buff != NULL)
{ {
if (*tmp_buff){ if (*tmp_buff)
{
g_string_append (buffer, tmp_buff); g_string_append (buffer, tmp_buff);
g_free (tmp_buff); g_free (tmp_buff);
string += bytes_read; string += bytes_read;