text_file: don't strip trailing whitespace

Only delete the newline characters (\n and optionally \r).  This
allows the database file to store file names with trailing whitespace.
This commit is contained in:
Max Kellermann
2010-01-17 12:52:11 +01:00
parent 828a5f552f
commit 02526eda86

View File

@@ -57,7 +57,12 @@ read_text_line(FILE *file, GString *buffer)
g_string_set_size(buffer, length + step); g_string_set_size(buffer, length + step);
} }
/* remove the newline characters */
if (buffer->str[length - 1] == '\n')
--length;
if (buffer->str[length - 1] == '\r')
--length;
g_string_set_size(buffer, length); g_string_set_size(buffer, length);
g_strchomp(buffer->str);
return buffer->str; return buffer->str;
} }