AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
+AC_CHECK_SIZEOF(off_t)
AC_PATH_PROG(DBX, dbx, no)
AC_PATH_PROG(GDB, gdb, no)
AH_BOTTOM([/* fseeko portability defines */
#ifdef HAVE_FSEEKO
# define LOFF_T off_t
+# if SIZEOF_OFF_T == 8
+# define OFF_T_FMT "%lld"
+# else
+# define OFF_T_FMT "%ld"
+# endif
#else
# define LOFF_T long
# define fseeko fseek
# define ftello ftell
+# define OFF_T_FMT "%ld"
#endif
])
MUTT_C99_INTTYPES
if (flags & CH_UPDATE_LEN &&
(flags & CH_NOLEN) == 0)
{
- fprintf (out, "Content-Length: %ld\n", h->content->length);
+ fprintf (out, "Content-Length: " OFF_T_FMT "\n", h->content->length);
if (h->lines != 0 || h->content->length == 0)
fprintf (out, "Lines: %d\n", h->lines);
}
}
/* Count the number of lines and bytes to be deleted in this body*/
-static int count_delete_lines (FILE *fp, BODY *b, long *length, size_t datelen)
+static int count_delete_lines (FILE *fp, BODY *b, LOFF_T *length, size_t datelen)
{
int dellines = 0;
long l;
if (b->deleted)
{
- fseek (fp, b->offset, SEEK_SET);
+ fseeko (fp, b->offset, SEEK_SET);
for (l = b->length ; l ; l --)
{
ch = getc (fp);
{
char prefix[SHORT_STRING];
STATE s;
- long new_offset = -1;
+ LOFF_T new_offset = -1;
int rc = 0;
if (flags & M_CM_PREFIX)
else if (hdr->attach_del && (chflags & CH_UPDATE_LEN))
{
int new_lines;
- long new_length = body->length;
+ LOFF_T new_length = body->length;
char date[SHORT_STRING];
mutt_make_date (date, sizeof (date));
if (mutt_copy_header (fpin, hdr, fpout,
chflags | CH_NOLEN | CH_NONEWLINE, NULL))
return -1;
- fprintf (fpout, "Content-Length: %ld\n", new_length);
+ fprintf (fpout, "Content-Length: " OFF_T_FMT "\n", new_length);
if (new_lines <= 0)
new_lines = 0;
else
#ifdef DEBUG
{
- long fail = ((ftell (fpout) - new_offset) - new_length);
+ LOFF_T fail = ((ftello (fpout) - new_offset) - new_length);
if (fail)
{
(chflags & CH_PREFIX) ? prefix : NULL) == -1)
return -1;
- new_offset = ftell (fpout);
+ new_offset = ftello (fpout);
}
if (flags & M_CM_DECODE)
{
fprintf (fpout,
"Content-Type: message/external-body; access-type=x-mutt-deleted;\n"
- "\texpiration=%s; length=%ld\n"
+ "\texpiration=%s; length=" OFF_T_FMT "\n"
"\n", date + 5, part->length);
if (ferror (fpout))
return -1;
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: " OFF_T_FMT "\n", (LOFF_T) ftell (tempfp));
fprintf (msg->fp, "Lines: %d\n\n", lines);
/* copy the body and clean up */