[irrational poboxes com: PATCH: balsa-2.0.15-1 add LFS support]
- From: Andrew Lau <netsnipe users sourceforge net>
- To: balsa-list gnome org
- Subject: [irrational@poboxes.com: PATCH: balsa-2.0.15-1 add LFS support]
- Date: Thu, 30 Oct 2003 21:37:04 +1100
----- Forwarded message from irrational@poboxes.com -----
From: irrational@poboxes.com
To: Andrew Lau <netsnipe@users.sourceforge.net>
Subject: PATCH: balsa-2.0.15-1 add LFS support
X-Spam-Score: 0.3 (/)
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on espresso
X-Spam-Level:
X-Spam-Status: No, hits=-4.7 required=5.0 tests=BAYES_00,NO_REAL_NAME
autolearn=no version=2.60
Hi,
Please find attached, a patch resulting from changes I have recently
made to the debian balsa-2.0.15-1 source tree in order to enable
support for LFS.
Patch needs to be carefully checked prior any commit or parts forwarded
to upstream authors, although changes should be quite straightforward.
I am in the process of testing the resulting binary against a > 2gb
mbox format mailbox and have noticed no issues thus far. I cannot
speak for any other testing.
Please note that patch includes changes to debian/rules and to various
Makefile.in's that probably are not required or cleanest solution. The
former was a non-essential change to add threads support (on a whim)
and the latter was to enable necessary compiler defines
(_OFFSET_BITS=64 and _LARGEFILE_SOURCE) enabling seamless 32>64 bit
glibc file i/o translation that would be better handled via a
configure.in change to add AC_SYS_LARGEFILE.
I hope this wasn't a duplication of effort. I checked mutt list
archives and didn't find anything.
I would be interested in hearing feedback re upstream source changes.
Kind Regards,
Scott M.
Sydney, Australia.
diff -urN balsa-2.0.15-1_orig/debian/rules balsa-2.0.15-1/debian/rules
--- balsa-2.0.15-1_orig/debian/rules Tue Oct 28 18:14:46 2003
+++ balsa-2.0.15-1/debian/rules Thu Oct 23 07:25:23 2003
@@ -12,7 +12,7 @@
include /usr/share/cdbs/1/class/gnome.mk
# Compile options
-DEB_CONFIGURE_EXTRA_FLAGS := --with-gpgme --with-gss --with-ldap --with-ssl
+DEB_CONFIGURE_EXTRA_FLAGS := --with-gpgme --with-gss --with-ldap --with-ssl --with-threads
# Debhelper arguments
DEB_DH_INSTALL_ARGS := debian/gnome-balsa2.xpm \
diff -urN balsa-2.0.15-1_orig/libbalsa/Makefile.in balsa-2.0.15-1/libbalsa/Makefile.in
--- balsa-2.0.15-1_orig/libbalsa/Makefile.in Mon Sep 29 05:33:41 2003
+++ balsa-2.0.15-1/libbalsa/Makefile.in Fri Oct 24 02:38:07 2003
@@ -213,7 +213,9 @@
DEFS = -DLIBMUTT \
-DG_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
- -DGNOME_DISABLE_DEPRECATED
+ -DGNOME_DISABLE_DEPRECATED \
+ -D_FILE_OFFSET_BITS=64 \
+ -D_LARGEFILE_SOURCE
#Signal marshallers
diff -urN balsa-2.0.15-1_orig/libbalsa/body.c balsa-2.0.15-1/libbalsa/body.c
--- balsa-2.0.15-1_orig/libbalsa/body.c Thu Aug 14 17:27:15 2003
+++ balsa-2.0.15-1/libbalsa/body.c Sun Oct 26 11:16:41 2003
@@ -255,7 +255,7 @@
g_return_val_if_fail(stream != NULL, FALSE);
- fseek(stream, body->mutt_body->offset, 0);
+ fseeko(stream, body->mutt_body->offset, 0);
s.fpin = stream;
s.fpout = safe_fopen(filename, "w");
diff -urN balsa-2.0.15-1_orig/libbalsa/message.c balsa-2.0.15-1/libbalsa/message.c
--- balsa-2.0.15-1_orig/libbalsa/message.c Mon Sep 22 18:10:49 2003
+++ balsa-2.0.15-1/libbalsa/message.c Sun Oct 26 11:17:07 2003
@@ -885,7 +885,7 @@
/* mx_open_message may have downloaded more headers (IMAP): */
libbalsa_message_headers_update(message);
- fseek(msg->fp, cur->content->offset, 0);
+ fseeko(msg->fp, cur->content->offset, 0);
} else { /* disconnected mode */
if(!msg->fp) {
g_free(msg);
diff -urN balsa-2.0.15-1_orig/libbalsa/rfc3156.c balsa-2.0.15-1/libbalsa/rfc3156.c
--- balsa-2.0.15-1_orig/libbalsa/rfc3156.c Tue Jul 1 17:38:40 2003
+++ balsa-2.0.15-1/libbalsa/rfc3156.c Sun Oct 26 11:17:50 2003
@@ -319,7 +319,7 @@
plainStream.mailboxFile =
libbalsa_mailbox_get_message_stream(msg->mailbox, msg);
msg_body = body->mutt_body;
- fseek(plainStream.mailboxFile, msg_body->hdr_offset, 0);
+ fseeko(plainStream.mailboxFile, msg_body->hdr_offset, 0);
plainStream.bytes_left = msg_body->offset - msg_body->hdr_offset +
msg_body->length;
plainStream.last_was_cr = FALSE;
diff -urN balsa-2.0.15-1_orig/libinit_balsa/Makefile.in balsa-2.0.15-1/libinit_balsa/Makefile.in
--- balsa-2.0.15-1_orig/libinit_balsa/Makefile.in Mon Sep 29 05:33:41 2003
+++ balsa-2.0.15-1/libinit_balsa/Makefile.in Fri Oct 24 02:39:32 2003
@@ -149,7 +149,9 @@
DEFS = -DG_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
- -DGNOME_DISABLE_DEPRECATED
+ -DGNOME_DISABLE_DEPRECATED \
+ -D_FILE_OFFSET_BITS=64 \
+ -D_LARGEFILE_SOURCE
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
diff -urN balsa-2.0.15-1_orig/libmutt/Makefile.in balsa-2.0.15-1/libmutt/Makefile.in
--- balsa-2.0.15-1_orig/libmutt/Makefile.in Mon Sep 29 05:33:39 2003
+++ balsa-2.0.15-1/libmutt/Makefile.in Fri Oct 24 02:35:24 2003
@@ -171,7 +171,7 @@
SUBDIRS = imap
-DEFS = -DSHAREDIR=\"$(sharedir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -DLIBMUTT
+DEFS = -DSHAREDIR=\"$(sharedir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -DLIBMUTT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
INCLUDES = -I${top_srcdir} -I${top_srcdir}/imap -I${top_builddir}
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
diff -urN balsa-2.0.15-1_orig/libmutt/attach.c balsa-2.0.15-1/libmutt/attach.c
--- balsa-2.0.15-1_orig/libmutt/attach.c Tue Feb 26 02:36:09 2002
+++ balsa-2.0.15-1/libmutt/attach.c Sun Oct 26 09:47:39 2003
@@ -165,7 +165,7 @@
/* Remove headers by copying out data to another file, then
* copying the file back */
- fseek (fp, b->offset, 0);
+ fseeko (fp, b->offset, 0);
mutt_mktemp (tempfile);
if ((tfp = safe_fopen (tempfile, "w")) == NULL)
{
@@ -721,7 +721,7 @@
hn->msgno = hdr->msgno; /* required for MH/maildir */
hn->read = 1;
- fseek (fp, m->offset, 0);
+ fseeko (fp, m->offset, 0);
if (fgets (buf, sizeof (buf), fp) == NULL)
return -1;
if (mx_open_mailbox(path, M_APPEND | M_QUIET, &ctx) == NULL)
@@ -756,7 +756,7 @@
mutt_perror ("fopen");
return (-1);
}
- fseek ((s.fpin = fp), m->offset, 0);
+ fseeko ((s.fpin = fp), m->offset, 0);
mutt_decode_attachment (m, &s);
if (fclose (s.fpout) != 0)
diff -urN balsa-2.0.15-1_orig/libmutt/buffy.c balsa-2.0.15-1/libmutt/buffy.c
--- balsa-2.0.15-1_orig/libmutt/buffy.c Tue Jul 22 08:16:42 2003
+++ balsa-2.0.15-1/libmutt/buffy.c Sun Oct 26 09:52:33 2003
@@ -45,14 +45,14 @@
* message found - return -1 */
int fseek_last_message (FILE * f)
{
- long int pos;
+ off_t pos;
char buffer[BUFSIZ + 9]; /* 7 for "\n\nFrom " */
int bytes_read;
int i; /* Index into `buffer' for scanning. */
memset (buffer, 0, sizeof(buffer));
- fseek (f, 0, SEEK_END);
- pos = ftell (f);
+ fseeko (f, 0, SEEK_END);
+ pos = ftello (f);
/* Set `bytes_read' to the size of the last, probably partial, buffer; 0 <
* `bytes_read' <= `BUFSIZ'. */
@@ -65,14 +65,14 @@
{
/* we save in the buffer at the end the first 7 chars from the last read */
strncpy (buffer + BUFSIZ, buffer, 5+2); /* 2 == 2 * mutt_strlen(CRLF) */
- fseek (f, pos, SEEK_SET);
+ fseeko (f, pos, SEEK_SET);
bytes_read = fread (buffer, sizeof (char), bytes_read, f);
if (bytes_read == -1)
return -1;
for (i = bytes_read; --i >= 0;)
if (!mutt_strncmp (buffer + i, "\n\nFrom ", mutt_strlen ("\n\nFrom ")))
{ /* found it - go to the beginning of the From */
- fseek (f, pos + i + 2, SEEK_SET);
+ fseeko (f, pos + i + 2, SEEK_SET);
return 0;
}
bytes_read = BUFSIZ;
@@ -81,7 +81,7 @@
/* here we are at the beginning of the file */
if (!mutt_strncmp ("From ", buffer, 5))
{
- fseek (f, 0, 0);
+ fseeko (f, 0, 0);
return (0);
}
diff -urN balsa-2.0.15-1_orig/libmutt/copy.c balsa-2.0.15-1/libmutt/copy.c
--- balsa-2.0.15-1_orig/libmutt/copy.c Tue Feb 26 02:36:09 2002
+++ balsa-2.0.15-1/libmutt/copy.c Sun Oct 26 10:05:40 2003
@@ -42,7 +42,7 @@
* below is to avoid creating a HEADER structure in message_handler().
*/
int
-mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
+mutt_copy_hdr (FILE *in, FILE *out, off_t off_start, off_t off_end, int flags,
const char *prefix)
{
int from = 0;
@@ -56,8 +56,8 @@
int x;
int error;
- if (ftell (in) != off_start)
- fseek (in, off_start, 0);
+ if (ftello (in) != off_start)
+ fseeko (in, off_start, 0);
buf[0] = '\n';
buf[1] = 0;
@@ -67,7 +67,7 @@
/* Without these flags to complicate things
* we can do a more efficient line to line copying
*/
- while (ftell (in) < off_end)
+ while (ftello (in) < off_end)
{
nl = strchr (buf, '\n');
@@ -126,7 +126,7 @@
headers = safe_calloc (hdr_count, sizeof (char *));
/* Read all the headers into the array */
- while (ftell (in) < off_end)
+ while (ftello (in) < off_end)
{
nl = strchr (buf, '\n');
@@ -201,7 +201,7 @@
strcat (headers[x], buf); /* __STRCAT_CHECKED__ */
}
}
- } /* while (ftell (in) < off_end) */
+ } /* while (ftello (in) < off_end) */
/* Now output the headers in order */
for (x = 0; x < hdr_count; x++)
@@ -387,7 +387,7 @@
if (b->deleted)
{
- fseek (fp, b->offset, SEEK_SET);
+ fseeko (fp, b->offset, SEEK_SET);
for (l = b->length ; l ; l --)
{
ch = getc (fp);
@@ -434,7 +434,7 @@
{
char prefix[SHORT_STRING];
STATE s;
- long new_offset = -1;
+ off_t new_offset = -1;
#ifndef LIBMUTT
if (flags & M_CM_PREFIX)
@@ -461,7 +461,7 @@
date[5] = date[mutt_strlen (date) - 1] = '\"';
/* Count the number of lines and bytes to be deleted */
- fseek (fpin, body->offset, SEEK_SET);
+ fseeko (fpin, body->offset, SEEK_SET);
new_lines = hdr->lines -
count_delete_lines (fpin, body, &new_length, mutt_strlen (date));
@@ -476,16 +476,16 @@
fprintf (fpout, "Lines: %d\n\n", new_lines);
if (ferror (fpout) || feof (fpout))
return -1;
- new_offset = ftell (fpout);
+ new_offset = ftello (fpout);
/* Copy the body */
- fseek (fpin, body->offset, SEEK_SET);
+ fseeko (fpin, body->offset, SEEK_SET);
if (copy_delete_attach (body, fpin, fpout, date))
return -1;
#ifdef DEBUG
{
- long fail = ((ftell (fpout) - new_offset) - new_length);
+ off_t fail = ((ftello (fpout) - new_offset) - new_length);
if (fail)
{
@@ -513,7 +513,7 @@
(chflags & CH_PREFIX) ? prefix : NULL) == -1)
return -1;
- new_offset = ftell (fpout);
+ new_offset = ftello (fpout);
}
if (flags & M_CM_DECODE)
@@ -558,7 +558,7 @@
mutt_write_mime_header (cur, fpout);
fputc ('\n', fpout);
- fseek (fp, cur->offset, 0);
+ fseeko (fp, cur->offset, 0);
if (mutt_copy_bytes (fp, fpout, cur->length) == -1)
{
fclose (fp);
@@ -571,7 +571,7 @@
#endif
else
{
- fseek (fpin, body->offset, 0);
+ fseeko (fpin, body->offset, 0);
if (flags & M_CM_PREFIX)
{
int c;
@@ -682,7 +682,7 @@
if (part->deleted || part->parts)
{
/* Copy till start of this part */
- if (mutt_copy_bytes (fpin, fpout, part->hdr_offset - ftell (fpin)))
+ if (mutt_copy_bytes (fpin, fpout, part->hdr_offset - ftello (fpin)))
return -1;
if (part->deleted)
@@ -695,11 +695,11 @@
return -1;
/* Copy the original mime headers */
- if (mutt_copy_bytes (fpin, fpout, part->offset - ftell (fpin)))
+ if (mutt_copy_bytes (fpin, fpout, part->offset - ftello (fpin)))
return -1;
/* Skip the deleted body */
- fseek (fpin, part->offset + part->length, SEEK_SET);
+ fseeko (fpin, part->offset + part->length, SEEK_SET);
}
else
{
@@ -710,7 +710,7 @@
}
/* Copy the last parts */
- if (mutt_copy_bytes (fpin, fpout, b->offset + b->length - ftell (fpin)))
+ if (mutt_copy_bytes (fpin, fpout, b->offset + b->length - ftello (fpin)))
return -1;
return 0;
diff -urN balsa-2.0.15-1_orig/libmutt/copy.h balsa-2.0.15-1/libmutt/copy.h
--- balsa-2.0.15-1_orig/libmutt/copy.h Tue Feb 26 02:36:09 2002
+++ balsa-2.0.15-1/libmutt/copy.h Sun Oct 26 09:57:14 2003
@@ -34,7 +34,7 @@
-int mutt_copy_hdr (FILE *, FILE *, long, long, int, const char *);
+int mutt_copy_hdr (FILE *, FILE *, off_t, off_t, int, const char *);
int mutt_copy_header (FILE *, HEADER *, FILE *, int, const char *);
diff -urN balsa-2.0.15-1_orig/libmutt/handler.c balsa-2.0.15-1/libmutt/handler.c
--- balsa-2.0.15-1_orig/libmutt/handler.c Mon Apr 7 17:52:30 2003
+++ balsa-2.0.15-1/libmutt/handler.c Sun Oct 26 10:22:55 2003
@@ -1050,7 +1050,7 @@
if (l)
{
- fseek (s->fpin, -l, SEEK_CUR);
+ fseeko (s->fpin, -l, SEEK_CUR);
bytes += l;
}
}
@@ -1321,7 +1321,7 @@
{
if (s->flags & M_DISPLAY && !option (OPTWEED))
{
- fseek (s->fpin, choice->hdr_offset, 0);
+ fseeko (s->fpin, choice->hdr_offset, 0);
mutt_copy_bytes(s->fpin, s->fpout, choice->offset-choice->hdr_offset);
}
mutt_body_handler (choice, s);
@@ -1339,9 +1339,9 @@
{
struct stat st;
BODY *b;
- long off_start;
+ off_t off_start;
- off_start = ftell (s->fpin);
+ off_start = ftello (s->fpin);
if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE ||
a->encoding == ENCUUENCODED)
{
@@ -1465,7 +1465,7 @@
TYPE (p), p->subtype, ENCODING (p->encoding), length);
if (!option (OPTWEED))
{
- fseek (s->fpin, p->hdr_offset, 0);
+ fseeko (s->fpin, p->hdr_offset, 0);
mutt_copy_bytes(s->fpin, s->fpout, p->offset-p->hdr_offset);
}
else
@@ -1670,7 +1670,7 @@
state_printf (s, _("[-- on %s --]\n"), expiration);
}
- mutt_copy_hdr (s->fpin, s->fpout, ftell (s->fpin), b->parts->offset,
+ mutt_copy_hdr (s->fpin, s->fpout, ftello (s->fpin), b->parts->offset,
(option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
CH_DECODE , NULL);
}
@@ -1683,7 +1683,7 @@
"[-- and the indicated external source has --]\n"
"[-- expired. --]\n"),
TYPE(b->parts), b->parts->subtype);
- mutt_copy_hdr(s->fpin, s->fpout, ftell (s->fpin), b->parts->offset,
+ mutt_copy_hdr(s->fpin, s->fpout, ftello (s->fpin), b->parts->offset,
(option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
CH_DECODE, NULL);
}
@@ -1699,7 +1699,7 @@
state_printf (s,
_("[-- and the indicated access-type %s is unsupported --]\n"),
access_type);
- mutt_copy_hdr (s->fpin, s->fpout, ftell (s->fpin), b->parts->offset,
+ mutt_copy_hdr (s->fpin, s->fpout, ftello (s->fpin), b->parts->offset,
(option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
CH_DECODE , NULL);
}
@@ -1720,7 +1720,7 @@
cd = mutt_iconv_open (Charset, charset, M_ICONV_HOOK_FROM);
}
- fseek (s->fpin, b->offset, 0);
+ fseeko (s->fpin, b->offset, 0);
switch (b->encoding)
{
case ENCQUOTEDPRINTABLE:
@@ -1750,7 +1750,7 @@
FILE *fp = NULL;
char tempfile[_POSIX_PATH_MAX];
handler_t handler = NULL;
- long tmpoffset = 0;
+ off_t tmpoffset = 0;
size_t tmplength = 0;
char type[STRING];
@@ -1857,7 +1857,7 @@
if (plaintext || handler)
{
- fseek (s->fpin, b->offset, 0);
+ fseeko (s->fpin, b->offset, 0);
/* see if we need to decode this part before processing it */
if (b->encoding == ENCBASE64 || b->encoding == ENCQUOTEDPRINTABLE ||
@@ -1902,7 +1902,7 @@
if (decode)
{
- b->length = ftell (s->fpout);
+ b->length = ftello (s->fpout);
b->offset = 0;
fclose (s->fpout);
diff -urN balsa-2.0.15-1_orig/libmutt/mbox.c balsa-2.0.15-1/libmutt/mbox.c
--- balsa-2.0.15-1_orig/libmutt/mbox.c Fri May 31 04:39:10 2002
+++ balsa-2.0.15-1/libmutt/mbox.c Thu Oct 30 19:18:26 2003
@@ -43,11 +43,12 @@
#endif
/* struct used by mutt_sync_mailbox() to store new offsets */
+
struct m_update_t
{
short valid;
- long hdr;
- long body;
+ off_t hdr;
+ off_t body;
long lines;
long length;
};
@@ -127,7 +128,7 @@
if (mutt_strcmp (buf, ctx->magic == M_MMDF ? MMDF_SEP : KENDRA_SEP) == 0)
{
- loc = ftell (ctx->fp);
+ loc = ftello (ctx->fp);
count++;
if (!ctx->quiet && ReadInc && ((count % ReadInc == 0) || count == 1))
@@ -152,9 +153,9 @@
if (!is_from (buf, return_path, sizeof (return_path), &t))
{
- if (fseek (ctx->fp, loc, SEEK_SET) != 0)
+ if (fseeko (ctx->fp, loc, SEEK_SET) != 0)
{
- dprint (1, (debugfile, "mmdf_parse_mailbox: fseek() failed\n"));
+ dprint (1, (debugfile, "mmdf_parse_mailbox: fseeko() failed\n"));
mutt_error _("Mailbox is corrupt!");
return (-1);
}
@@ -164,7 +165,7 @@
hdr->env = mutt_read_rfc822_header (ctx->fp, hdr, 0, 0);
- loc = ftell (ctx->fp);
+ loc = ftello (ctx->fp);
if (hdr->content->length > 0 && hdr->lines > 0)
{
@@ -172,12 +173,12 @@
if (0 < tmploc && tmploc < ctx->size)
{
- if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
+ if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL ||
mutt_strcmp (ctx->magic == M_MMDF ? MMDF_SEP : KENDRA_SEP, buf) != 0)
{
- if (fseek (ctx->fp, loc, SEEK_SET) != 0)
- dprint (1, (debugfile, "mmdf_parse_mailbox: fseek() failed\n"));
+ if (fseeko (ctx->fp, loc, SEEK_SET) != 0)
+ dprint (1, (debugfile, "mmdf_parse_mailbox: fseeko() failed\n"));
hdr->content->length = -1;
}
}
@@ -191,7 +192,7 @@
{
lines = -1;
do {
- loc = ftell (ctx->fp);
+ loc = ftello (ctx->fp);
if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL)
break;
lines++;
@@ -238,7 +239,7 @@
HEADER *curhdr;
time_t t, tz;
int count = 0, lines = 0;
- long loc;
+ off_t loc;
#ifdef NFS_ATTRIBUTE_HACK
struct utimbuf newtime;
#endif
@@ -269,7 +270,7 @@
date received */
tz = mutt_local_tz (0);
- loc = ftell (ctx->fp);
+ loc = ftello (ctx->fp);
while (fgets (buf, sizeof (buf), ctx->fp) != NULL)
{
if (is_from (buf, return_path, sizeof (return_path), &t))
@@ -293,7 +294,7 @@
if (!ctx->quiet && ReadInc && ((count % ReadInc == 0) || count == 1))
mutt_message (_("Reading %s... %d (%d%%)"), ctx->path, count,
- ftell (ctx->fp) / (ctx->size / 100 + 1));
+ ftello (ctx->fp) / (ctx->size / 100 + 1));
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory (ctx);
@@ -316,9 +317,9 @@
*/
if (curhdr->content->length > 0)
{
- long tmploc;
+ off_t tmploc;
- loc = ftell (ctx->fp);
+ loc = ftello (ctx->fp);
tmploc = loc + curhdr->content->length + 1;
if (0 < tmploc && tmploc < ctx->size)
@@ -327,15 +328,15 @@
* check to see if the content-length looks valid. we expect to
* to see a valid message separator at this point in the stream
*/
- if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
+ if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
fgets (buf, sizeof (buf), ctx->fp) == NULL ||
mutt_strncmp ("From ", buf, 5) != 0)
{
dprint (1, (debugfile, "mbox_parse_mailbox: bad content-length in message %d (cl=%ld)\n", curhdr->index, curhdr->content->length));
dprint (1, (debugfile, "\tLINE: %s", buf));
- if (fseek (ctx->fp, loc, SEEK_SET) != 0) /* nope, return the previous position */
+ if (fseeko (ctx->fp, loc, SEEK_SET) != 0) /* nope, return the previous position */
{
- dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
+ dprint (1, (debugfile, "mbox_parse_mailbox: fseeko() failed\n"));
}
curhdr->content->length = -1;
}
@@ -358,8 +359,8 @@
int cl = curhdr->content->length;
/* count the number of lines in this message */
- if (fseek (ctx->fp, loc, SEEK_SET) != 0)
- dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
+ if (fseeko (ctx->fp, loc, SEEK_SET) != 0)
+ dprint (1, (debugfile, "mbox_parse_mailbox: fseeko() failed\n"));
while (cl-- > 0)
{
if (fgetc (ctx->fp) == '\n')
@@ -368,8 +369,8 @@
}
/* return to the offset of the next message separator */
- if (fseek (ctx->fp, tmploc, SEEK_SET) != 0)
- dprint (1, (debugfile, "mbox_parse_mailbox: fseek() failed\n"));
+ if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0)
+ dprint (1, (debugfile, "mbox_parse_mailbox: fseeko() failed\n"));
}
}
@@ -386,7 +387,7 @@
else
lines++;
- loc = ftell (ctx->fp);
+ loc = ftello (ctx->fp);
}
/*
@@ -399,7 +400,7 @@
{
if (PREV->content->length < 0)
{
- PREV->content->length = ftell (ctx->fp) - PREV->content->offset - 1;
+ PREV->content->length = ftello (ctx->fp) - PREV->content->offset - 1;
if (PREV->content->length < 0)
PREV->content->length = 0;
}
@@ -613,16 +614,16 @@
* see the message separator at *exactly* what used to be the end of the
* folder.
*/
- if (fseek (ctx->fp, ctx->size, SEEK_SET) != 0)
- dprint (1, (debugfile, "mbox_check_mailbox: fseek() failed\n"));
+ if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0)
+ dprint (1, (debugfile, "mbox_check_mailbox: fseeko() failed\n"));
if (fgets (buffer, sizeof (buffer), ctx->fp) != NULL)
{
if ((ctx->magic == M_MBOX && mutt_strncmp ("From ", buffer, 5) == 0) ||
(ctx->magic == M_MMDF && mutt_strcmp (MMDF_SEP, buffer) == 0) ||
(ctx->magic == M_KENDRA && mutt_strcmp(KENDRA_SEP, buffer) == 0))
{
- if (fseek (ctx->fp, ctx->size, SEEK_SET) != 0)
- dprint (1, (debugfile, "mbox_check_mailbox: fseek() failed\n"));
+ if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0)
+ dprint (1, (debugfile, "mbox_check_mailbox: fseeko() failed\n"));
if (ctx->magic == M_MBOX)
mbox_parse_mailbox (ctx);
else
@@ -688,7 +689,7 @@
int rc = -1;
int need_sort = 0; /* flag to resort mailbox if new mail arrives */
int first = -1; /* first message to be written */
- long offset; /* location in mailbox to write changed messages */
+ off_t offset; /* location in mailbox to write changed messages */
struct stat statbuf;
struct utimbuf utimebuf;
struct m_update_t *newOffset = NULL;
@@ -806,7 +807,7 @@
j++;
if (!ctx->quiet && WriteInc && ((i % WriteInc) == 0 || j == 1))
mutt_message (_("Writing messages... %d (%d%%)"), i,
- ftell (ctx->fp) / (ctx->size / 100 + 1));
+ ftello (ctx->fp) / (ctx->size / 100 + 1));
if (ctx->magic == M_MMDF)
{
@@ -834,7 +835,7 @@
* temporary file only contains saved message which are located after
* `offset' in the real mailbox
*/
- newOffset[i - first].hdr = ftell (fp) + offset;
+ newOffset[i - first].hdr = ftello (fp) + offset;
if (mutt_copy_message (fp, ctx, ctx->hdrs[i], M_CM_UPDATE, CH_FROM | CH_UPDATE | CH_UPDATE_LEN) == -1)
{
@@ -850,7 +851,7 @@
* we just flush the in memory cache so that the message will be reparsed
* if the user accesses it later.
*/
- newOffset[i - first].body = ftell (fp) - ctx->hdrs[i]->content->length + offset;
+ newOffset[i - first].body = ftello (fp) - ctx->hdrs[i]->content->length + offset;
mutt_free_body (&ctx->hdrs[i]->content->parts);
switch(ctx->magic)
@@ -915,7 +916,7 @@
return (-1);
}
- if (fseek (ctx->fp, offset, SEEK_SET) != 0 || /* seek the append location */
+ if (fseeko (ctx->fp, offset, SEEK_SET) != 0 || /* seek the append location */
/* do a sanity check to make sure the mailbox looks ok */
fgets (buf, sizeof (buf), ctx->fp) == NULL ||
(ctx->magic == M_MBOX && mutt_strncmp ("From ", buf, 5) != 0) ||
@@ -928,10 +929,10 @@
}
else
{
- if (fseek (ctx->fp, offset, SEEK_SET) != 0) /* return to proper offset */
+ if (fseeko (ctx->fp, offset, SEEK_SET) != 0) /* return to proper offset */
{
i = -1;
- dprint (1, (debugfile, "mbox_sync_mailbox: fseek() failed\n"));
+ dprint (1, (debugfile, "mbox_sync_mailbox: fseeko() failed\n"));
}
else
{
@@ -946,7 +947,7 @@
}
if (i == 0)
{
- ctx->size = ftell (ctx->fp); /* update the size of the mailbox */
+ ctx->size = ftello (ctx->fp); /* update the size of the mailbox */
ftruncate (fileno (ctx->fp), ctx->size);
}
}
@@ -1126,9 +1127,9 @@
case M_MBOX:
case M_MMDF:
case M_KENDRA:
- if (fseek (ctx->fp, 0, SEEK_SET) != 0)
+ if (fseeko (ctx->fp, 0, SEEK_SET) != 0)
{
- dprint (1, (debugfile, "mutt_reopen_mailbox: fseek() failed\n"));
+ dprint (1, (debugfile, "mutt_reopen_mailbox: fseeko() failed\n"));
rc = -1;
}
else
diff -urN balsa-2.0.15-1_orig/libmutt/mutt.h balsa-2.0.15-1/libmutt/mutt.h
--- balsa-2.0.15-1_orig/libmutt/mutt.h Tue Jan 21 10:01:35 2003
+++ balsa-2.0.15-1/libmutt/mutt.h Sat Oct 25 21:26:03 2003
@@ -565,12 +565,12 @@
PARAMETER *parameter; /* parameters of the content-type */
char *description; /* content-description */
char *form_name; /* Content-Disposition form-data name param */
- long hdr_offset; /* offset in stream where the headers begin.
+ off_t hdr_offset; /* offset in stream where the headers begin.
* this info is used when invoking metamail,
* where we need to send the headers of the
* attachment
*/
- long offset; /* offset where the actual data begins */
+ off_t offset; /* offset where the actual data begins */
long length; /* length (in bytes) of attachment */
char *filename; /* when sending a message, this is the file
* to which this structure refers
@@ -665,7 +665,7 @@
time_t date_sent; /* time when the message was sent (UTC) */
time_t received; /* time when the message was placed in the mailbox */
- long offset; /* where in the stream does this message begin? */
+ off_t offset; /* where in the stream does this message begin? */
int lines; /* how many lines in the body of this message? */
int index; /* the absolute (unsorted) message number */
int msgno; /* number displayed to the user */
diff -urN balsa-2.0.15-1_orig/libmutt/mx.c balsa-2.0.15-1/libmutt/mx.c
--- balsa-2.0.15-1_orig/libmutt/mx.c Fri May 31 04:39:10 2002
+++ balsa-2.0.15-1/libmutt/mx.c Sun Oct 26 10:24:10 2003
@@ -589,7 +589,7 @@
}
return (-1);
}
- fseek (ctx->fp, 0, 2);
+ fseeko (ctx->fp, 0, 2);
break;
case M_MH:
diff -urN balsa-2.0.15-1_orig/libmutt/parse.c balsa-2.0.15-1/libmutt/parse.c
--- balsa-2.0.15-1_orig/libmutt/parse.c Fri Jul 4 20:17:15 2003
+++ balsa-2.0.15-1/libmutt/parse.c Sun Oct 26 10:32:37 2003
@@ -433,7 +433,7 @@
char *line = safe_malloc (LONG_STRING);
size_t linelen = LONG_STRING;
- p->hdr_offset = ftell(fp);
+ p->hdr_offset = ftello(fp);
p->encoding = ENC7BIT; /* default from RFC1521 */
p->type = digest ? TYPEMESSAGE : TYPETEXT;
@@ -501,7 +501,7 @@
}
#endif
}
- p->offset = ftell (fp); /* Mark the start of the real data */
+ p->offset = ftello (fp); /* Mark the start of the real data */
if (p->type == TYPETEXT && !p->subtype)
p->subtype = safe_strdup ("plain");
else if (p->type == TYPEMESSAGE && !p->subtype)
@@ -526,7 +526,7 @@
#endif
bound = mutt_get_parameter ("boundary", b->parameter);
- fseek (fp, b->offset, SEEK_SET);
+ fseeko (fp, b->offset, SEEK_SET);
b->parts = mutt_parse_multipart (fp, bound,
b->offset + b->length,
ascii_strcasecmp ("digest", b->subtype) == 0);
@@ -535,7 +535,7 @@
case TYPEMESSAGE:
if (b->subtype)
{
- fseek (fp, b->offset, SEEK_SET);
+ fseeko (fp, b->offset, SEEK_SET);
if (mutt_is_message_type(b->type, b->subtype))
b->parts = mutt_parse_messageRFC822 (fp, b);
else if (ascii_strcasecmp (b->subtype, "external-body") == 0)
@@ -573,7 +573,7 @@
BODY *msg;
parent->hdr = mutt_new_header ();
- parent->hdr->offset = ftell (fp);
+ parent->hdr->offset = ftello (fp);
#ifdef LIBMUTT
/* BALSA: we want to know **everything** about embedded messages */
parent->hdr->env = mutt_read_rfc822_header (fp, parent->hdr, 1, 0);
@@ -608,7 +608,7 @@
* digest 1 if reading a multipart/digest, 0 otherwise
*/
-BODY *mutt_parse_multipart (FILE *fp, const char *boundary, long end_off, int digest)
+BODY *mutt_parse_multipart (FILE *fp, const char *boundary, off_t end_off, int digest)
{
#ifdef SUN_ATTACHMENT
int lines;
@@ -626,7 +626,7 @@
}
blen = mutt_strlen (boundary);
- while (ftell (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL)
+ while (ftello (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL)
{
len = mutt_strlen (buffer);
@@ -637,9 +637,9 @@
{
if (last)
{
- last->length = ftell (fp) - last->offset - len - 1 - crlf;
+ last->length = ftello (fp) - last->offset - len - 1 - crlf;
if (last->parts && last->parts->length == 0)
- last->parts->length = ftell (fp) - last->parts->offset - len - 1 - crlf;
+ last->parts->length = ftello (fp) - last->parts->offset - len - 1 - crlf;
/* if the body is empty, we can end up with a -1 length */
if (last->length < 0)
last->length = 0;
@@ -663,7 +663,7 @@
if (mutt_get_parameter ("content-lines", new->parameter)) {
for (lines = atoi(mutt_get_parameter ("content-lines", new->parameter));
lines; lines-- )
- if (ftell (fp) >= end_off || fgets (buffer, LONG_STRING, fp) == NULL)
+ if (ftello (fp) >= end_off || fgets (buffer, LONG_STRING, fp) == NULL)
break;
}
#endif
@@ -1293,7 +1293,7 @@
LIST *last = NULL;
char *line = safe_malloc (LONG_STRING);
char *p;
- long loc;
+ off_t loc;
int matched;
size_t linelen = LONG_STRING;
@@ -1314,7 +1314,7 @@
}
}
- while ((loc = ftell (f)),
+ while ((loc = ftello (f)),
*(line = read_rfc822_line (f, line, &linelen)) != 0)
{
matched = 0;
@@ -1335,7 +1335,7 @@
continue;
}
- fseek (f, loc, 0);
+ fseeko (f, loc, 0);
break; /* end of header */
}
@@ -1354,7 +1354,7 @@
if (hdr)
{
hdr->content->hdr_offset = hdr->offset;
- hdr->content->offset = ftell (f);
+ hdr->content->offset = ftello (f);
/* do RFC2047 decoding */
rfc2047_decode_adrlist (e->from);
diff -urN balsa-2.0.15-1_orig/libmutt/pattern.c balsa-2.0.15-1/libmutt/pattern.c
--- balsa-2.0.15-1_orig/libmutt/pattern.c Tue Mar 5 09:17:47 2002
+++ balsa-2.0.15-1/libmutt/pattern.c Sun Oct 26 10:51:20 2003
@@ -148,7 +148,7 @@
STATE s;
struct stat st;
FILE *fp = NULL;
- long lng = 0;
+ off_t lng = 0;
int match = 0;
HEADER *h = ctx->hdrs[msgno];
@@ -191,15 +191,15 @@
- fseek (msg->fp, h->offset, 0);
+ fseeko (msg->fp, h->offset, 0);
mutt_body_handler (h->content, &s);
}
fp = s.fpout;
fflush (fp);
- fseek (fp, 0, 0);
+ fseeko (fp, 0, 0);
fstat (fileno (fp), &st);
- lng = (long) st.st_size;
+ lng = (off_t) st.st_size;
}
else
{
@@ -207,13 +207,13 @@
fp = msg->fp;
if (op != M_BODY)
{
- fseek (fp, h->offset, 0);
+ fseeko (fp, h->offset, 0);
lng = h->content->offset - h->offset;
}
if (op != M_HEADER)
{
if (op == M_BODY)
- fseek (fp, h->content->offset, 0);
+ fseeko (fp, h->content->offset, 0);
lng += h->content->length;
}
}
diff -urN balsa-2.0.15-1_orig/libmutt/protos.h balsa-2.0.15-1/libmutt/protos.h
--- balsa-2.0.15-1_orig/libmutt/protos.h Wed Mar 19 19:39:15 2003
+++ balsa-2.0.15-1/libmutt/protos.h Sun Oct 26 10:29:40 2003
@@ -96,7 +96,7 @@
BODY *mutt_make_multipart (BODY *b, char *subtype);
#endif
BODY *mutt_new_body (void);
-BODY *mutt_parse_multipart (FILE *, const char *, long, int);
+BODY *mutt_parse_multipart (FILE *, const char *, off_t, int);
BODY *mutt_parse_messageRFC822 (FILE *, BODY *);
BODY *mutt_read_mime_header (FILE *, int);
diff -urN balsa-2.0.15-1_orig/libmutt/sendlib.c balsa-2.0.15-1/libmutt/sendlib.c
--- balsa-2.0.15-1_orig/libmutt/sendlib.c Wed Mar 19 19:39:15 2003
+++ balsa-2.0.15-1/libmutt/sendlib.c Sun Oct 26 10:58:52 2003
@@ -1131,7 +1131,7 @@
goto cleanup;
}
- fseek (fpin, a->offset, 0);
+ fseeko (fpin, a->offset, 0);
a->parts = mutt_parse_messageRFC822 (fpin, a);
transform_to_7bit (a->parts, fpin);
@@ -2311,7 +2311,7 @@
if (!option (OPTBOUNCEDELIVERED))
ch_flags |= CH_WEED_DELIVERED;
- fseek (fp, h->offset, 0);
+ fseeko (fp, h->offset, 0);
mutt_copy_header (fp, h, f, ch_flags, NULL);
fprintf (f, "Resent-From: %s", resent_from);
fprintf (f, "\nResent-%s", mutt_make_date (date, sizeof(date)));
@@ -2515,10 +2515,10 @@
* this will happen, and it can cause problems parsing the mailbox
* later.
*/
- fseek (tempfp, -1, 2);
+ fseeko (tempfp, -1, 2);
if (fgetc (tempfp) != '\n')
{
- fseek (tempfp, 0, 2);
+ fseeko (tempfp, 0, 2);
fputc ('\n', tempfp);
}
@@ -2538,7 +2538,7 @@
rewind (tempfp);
while (fgets (sasha, sizeof (sasha), tempfp) != NULL)
lines++;
- fprintf (msg->fp, "Content-Length: %ld\n", (long) ftell (tempfp));
+ fprintf (msg->fp, "Content-Length: %ld\n", (long) ftello (tempfp));
fprintf (msg->fp, "Lines: %d\n\n", lines);
/* copy the body and clean up */
diff -urN balsa-2.0.15-1_orig/src/Makefile.in balsa-2.0.15-1/src/Makefile.in
--- balsa-2.0.15-1_orig/src/Makefile.in Mon Sep 29 05:33:42 2003
+++ balsa-2.0.15-1/src/Makefile.in Fri Oct 24 02:37:20 2003
@@ -226,7 +226,9 @@
DEFS = -DG_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
- -DGNOME_DISABLE_DEPRECATED
+ -DGNOME_DISABLE_DEPRECATED \
+ -D_FILE_OFFSET_BITS=64 \
+ -D_LARGEFILE_SOURCE
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
----- End forwarded message -----
--
---------------------------------------------------------------------------
Andrew "Netsnipe" Lau Computer Sci. UNSW & Debian GNU/Linux
<netsnipe(+)users.sf.net\0> <alau(+)cse.unsw.edu.au\0>
GnuPG 1024D/2E8B68BD: 0B77 73D0 4F3B F286 63F1 9F4A 9B24 C07D 2E8B 68BD
-
"Nobody expects the Debian Inquisition!
Our two weapons are fear and surprise...and ruthless efficiency!"
---------------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]