aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-06-06 02:07:05 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-06-06 02:07:05 +0000
commit62bf50ecad6384af66a943705db592e98a3c8492 (patch)
treeddadc7120d9f3b5d5c085d532d220f05b67f6db8 /src
parent8c7ec3389908808d0b572bc37e692f7b3d7ce0a4 (diff)
removed the restriction that the template body over 8KB could not be read.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2007 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/template.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/template.c b/src/template.c
index 1ade3d6f..074c6080 100644
--- a/src/template.c
+++ b/src/template.c
@@ -37,7 +37,6 @@ static Template *template_load(gchar *filename)
Template *tmpl;
FILE *fp;
gchar buf[BUFFSIZE];
- gint bytes_read;
if ((fp = g_fopen(filename, "rb")) == NULL) {
FILE_OP_ERROR(filename, "fopen");
@@ -76,15 +75,13 @@ static Template *template_load(gchar *filename)
return NULL;
}
- if ((bytes_read = fread(buf, 1, sizeof(buf), fp)) == 0) {
- if (ferror(fp)) {
- FILE_OP_ERROR(filename, "fread");
- template_free(tmpl);
- return NULL;
- }
+ tmpl->value = file_read_stream_to_str(fp);
+ if (!tmpl->value) {
+ g_warning("cannot read template body\n");
+ template_free(tmpl);
+ return NULL;
}
fclose(fp);
- tmpl->value = g_strndup(buf, bytes_read);
return tmpl;
}