* src/compose.c
src/gtkstext.[ch]: removed the hardcoded shortcuts in GtkSText,
and made them customizable.
+ * src/utils.[ch]: added get_file_size_as_crlf() which returns
+ the file size when converting LF to CR+LF.
2002-01-22
+2002-01-24 [paul] 0.7.0claws24
+
+ * more sync with sylpheed 0.7.0cvs15
+ get_file_size_as_clrf(), see ChangeLog entry 2002-01-23
+
2002-01-23 [sergey] 0.7.0claws23
* src/importldif.c
* src/compose.c
src/gtkstext.[ch]: GtkSText Ãæ¤Î¥Ï¡¼¥É¥³¡¼¥É¤µ¤ì¤Æ¤¤¤ë¥·¥ç¡¼¥È
¥«¥Ã¥È¤òºï½ü¤·¡¢¥«¥¹¥¿¥Þ¥¤¥º²Äǽ¤Ë¤·¤¿¡£
+ * src/utils.[ch]: LF ¤ò CR+LF ¤ËÊÑ´¹¤·¤¿¤È¤¤Î¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ò
+ ÊÖ¤¹ get_file_size_as_crlf() ¤òÄɲá£
2002-01-22
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws23
+EXTRA_VERSION=claws24
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
g_return_val_if_fail(file != NULL, IMAP_ERROR);
- size = get_file_size(file);
+ size = get_file_size_as_crlf(file);
QUOTE_IF_REQUIRED(destfolder_, destfolder);
imap_cmd_gen_send(sock, "APPEND %s {%d}", destfolder_, size);
ok = imap_cmd_ok(sock, NULL);
return s.st_size;
}
+off_t get_file_size_as_crlf(const gchar *file)
+{
+ FILE *fp;
+ off_t size = 0;
+ gint left;
+ gint line_len;
+ gchar buf[BUFSIZ];
+ gchar *p, *prev;
+
+ if ((fp = fopen(file, "r")) == NULL) {
+ FILE_OP_ERROR(file, "fopen");
+ return -1;
+ }
+
+ while ((left = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
+ prev = buf;
+
+ if (left < sizeof(buf) && ferror(fp))
+ break;
+
+ do {
+ p = memchr(prev, '\n', left);
+ if (p != NULL) {
+ line_len = p - prev;
+ if (p > buf && *(p - 1) == '\r')
+ size += line_len + 1;
+ else
+ size += line_len + 2;
+ left -= line_len + 1;
+ prev = p + 1;
+ } else {
+ size += left;
+ break;
+ }
+ } while (left > 0);
+ }
+
+ if (ferror(fp)) {
+ FILE_OP_ERROR(file, "fread");
+ size = -1;
+ }
+
+ fclose(fp);
+
+ return size;
+}
+
off_t get_left_file_size(FILE *fp)
{
glong pos;
/* file / directory handling */
off_t get_file_size (const gchar *file);
+off_t get_file_size_as_crlf (const gchar *file);
off_t get_left_file_size (FILE *fp);
gboolean file_exist (const gchar *file,
gboolean allow_fifo);