aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder-summary.c
diff options
context:
space:
mode:
authorNotZed <NotZed@HelixCode.com>2000-05-06 02:58:05 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-06 02:58:05 +0800
commit659c7faac5e09acd919c2e9c596da27a962b2ed2 (patch)
treef3e68f879e1e1a867a76220328f2f61356ba7e25 /camel/camel-folder-summary.c
parent52051385f2d802b982fa7427f7277609332cccb6 (diff)
downloadgsoc2013-evolution-659c7faac5e09acd919c2e9c596da27a962b2ed2.tar.gz
gsoc2013-evolution-659c7faac5e09acd919c2e9c596da27a962b2ed2.tar.zst
gsoc2013-evolution-659c7faac5e09acd919c2e9c596da27a962b2ed2.zip
And same here ... (camel_folder_summary_encode_fixed_int32): Ugh, fwrite
2000-05-05 NotZed <NotZed@HelixCode.com> * camel-folder-summary.c: And same here ... (camel_folder_summary_encode_fixed_int32): Ugh, fwrite doesn't return -1 on error .. (camel_folder_summary_decode_fixed_int32): Neither deos fread. (camel_folder_summary_encode_token): Fix here too. svn path=/trunk/; revision=2819
Diffstat (limited to 'camel/camel-folder-summary.c')
-rw-r--r--camel/camel-folder-summary.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 0879d0fc37..ee879b3f7f 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -23,6 +23,7 @@
#include <netinet/in.h>
#include <ctype.h>
#include <string.h>
+#include <errno.h>
#include "camel-folder-summary.h"
@@ -468,7 +469,9 @@ camel_folder_summary_encode_fixed_int32(FILE *out, gint32 value)
guint32 save;
save = htonl(value);
- return fwrite(&save, sizeof(save), 1, out);
+ if (fwrite(&save, sizeof(save), 1, out) != 1)
+ return -1;
+ return 0;
}
int
@@ -476,7 +479,7 @@ camel_folder_summary_decode_fixed_int32(FILE *in, gint32 *dest)
{
guint32 save;
- if (fread(&save, sizeof(save), 1, in) != -1) {
+ if (fread(&save, sizeof(save), 1, in) == 1) {
*dest = ntohl(save);
return 0;
} else {
@@ -549,7 +552,8 @@ camel_folder_summary_encode_token(FILE *out, char *str)
} else {
if (camel_folder_summary_encode_uint32(out, len+32) == -1)
return -1;
- return fwrite(str, len, 1, out);
+ if (fwrite(str, len, 1, out) != 1)
+ return -1;
}
}
return 0;
@@ -583,7 +587,7 @@ camel_folder_summary_decode_token(FILE *in, char **str)
} else {
len -= 32;
ret = g_malloc(len+1);
- if (fread(ret, len, 1, in) == -1) {
+ if (fread(ret, len, 1, in) != 1) {
g_free(ret);
*str = NULL;
return -1;
@@ -606,7 +610,9 @@ camel_folder_summary_encode_string(FILE *out, char *str)
len = strlen(str);
if (camel_folder_summary_encode_uint32(out, len+1) == -1)
return -1;
- return fwrite(str, len, 1, out);
+ if (fwrite(str, len, 1, out) == 1)
+ return 0;
+ return -1;
}
@@ -628,7 +634,7 @@ camel_folder_summary_decode_string(FILE *in, char **str)
}
ret = g_malloc(len+1);
- if (fread(ret, len, 1, in) == -1) {
+ if (fread(ret, len, 1, in) != 1) {
g_free(ret);
*str = NULL;
return -1;
@@ -1045,7 +1051,6 @@ int main(int argc, char **argv)
CamelFolderSummary *s;
char *buffer;
int len;
- extern int strdup_count, malloc_count, free_count;
ibex *index;
gtk_init(&argc, &argv);
@@ -1095,6 +1100,10 @@ int main(int argc, char **argv)
}
}
+ printf("Saivng summary\n");
+ camel_folder_summary_set_filename(s, "index.summary");
+ camel_folder_summary_save(s);
+
gtk_object_unref(mp);
gtk_object_unref(s);