we're grownups now. don't care about stupid OS'es that don't know what an
authorPierre Habouzit <madcoder@debian.org>
Sat, 28 Oct 2006 00:37:25 +0000 (02:37 +0200)
committerPierre Habouzit <madcoder@debian.org>
Sat, 28 Oct 2006 00:37:25 +0000 (02:37 +0200)
off_t is. we're in 2006 not 1980

also use %zd instead of ugly %lld

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
19 files changed:
configure.in
copy.c
copy.h
crypt-gpgme.c
edit.c
handler.c
mbox.c
mutt.h
mutt_idna.c
mutt_idna.h
nntp/newsrc.c
pager.c
parse.c
pgp.c
pgpmicalg.c
pgppacket.c
pgppubring.c
protos.h
sendlib.c

index 30fdc13..705402d 100644 (file)
@@ -87,21 +87,6 @@ AH_TEMPLATE([ICONV_NONTRANS],
             [Define as 1 if iconv() only converts exactly and we should treat
              all return values other than (size_t)(-1) as equivalent.])
 
-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
 
 ac_aux_path_sendmail=/usr/sbin:/usr/lib
diff --git a/copy.c b/copy.c
index 7dbbb97..48dcabb 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -38,7 +38,7 @@ static int copy_delete_attach (BODY * b, FILE * fpin, FILE * fpout,
  * below is to avoid creating a HEADER structure in message_handler().
  */
 int
-mutt_copy_hdr (FILE* in, FILE* out, LOFF_T off_start, LOFF_T off_end,
+mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
                int flags, const char *prefix) {
   int from = 0;
   int this_is_from;
@@ -445,7 +445,7 @@ mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags,
   }
 
   if (flags & CH_UPDATE_LEN && (flags & CH_NOLEN) == 0) {
-    fprintf (out, "Content-Length: " OFF_T_FMT "\n", h->content->length);
+    fprintf (out, "Content-Length: %zd\n", h->content->length);
     if (h->lines != 0 || h->content->length == 0)
       fprintf (out, "Lines: %d\n", h->lines);
   }
@@ -464,7 +464,7 @@ mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags,
 }
 
 /* Count the number of lines and bytes to be deleted in this body*/
-static int count_delete_lines (FILE * fp, BODY * b, LOFF_T *length,
+static int count_delete_lines (FILE * fp, BODY * b, off_t *length,
                                size_t datelen)
 {
   int dellines = 0;
@@ -517,7 +517,7 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body,
 {
   char prefix[SHORT_STRING];
   STATE s;
-  LOFF_T new_offset = -1;
+  off_t new_offset = -1;
   int rc = 0;
 
   if (flags & M_CM_PREFIX) {
@@ -534,7 +534,7 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body,
 
     else if (hdr->attach_del && (chflags & CH_UPDATE_LEN)) {
       int new_lines;
-      LOFF_T new_length = body->length;
+      off_t new_length = body->length;
       char date[SHORT_STRING];
 
       mutt_make_date (date, sizeof (date));
@@ -549,7 +549,7 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body,
       if (mutt_copy_header (fpin, hdr, fpout,
                             chflags | CH_NOLEN | CH_NONEWLINE, NULL))
         return -1;
-      fprintf (fpout, "Content-Length: " OFF_T_FMT "\n", new_length);
+      fprintf (fpout, "Content-Length: %zd\n", new_length);
       if (new_lines <= 0)
         new_lines = 0;
       else
@@ -565,7 +565,7 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body,
 
 #ifdef DEBUG
       {
-        LOFF_T fail = ((ftello (fpout) - new_offset) - new_length);
+        off_t fail = ((ftello (fpout) - new_offset) - new_length);
 
         if (fail) {
           mutt_error ("The length calculation was wrong by %ld bytes", fail);
@@ -778,7 +778,7 @@ static int copy_delete_attach (BODY * b, FILE * fpin, FILE * fpout,
       if (part->deleted) {
         fprintf (fpout,
                  "Content-Type: message/external-body; access-type=x-mutt-deleted;\n"
-                 "\texpiration=%s; length=" OFF_T_FMT "\n"
+                 "\texpiration=%s; length=%zd\n"
                  "\n", date + 5, part->length);
         if (ferror (fpout))
           return -1;
diff --git a/copy.h b/copy.h
index e997b05..39efe41 100644 (file)
--- a/copy.h
+++ b/copy.h
@@ -44,7 +44,7 @@
 #define M_CM_DECODE_CRYPT       (M_CM_DECODE_PGP | M_CM_DECODE_SMIME)
 #define M_CM_VERIFY             (1<<11) /* do signature verification */
 
-int mutt_copy_hdr (FILE *, FILE *, LOFF_T, LOFF_T, 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 *);
 int _mutt_copy_message (FILE * fpout, FILE * fpin,
                         HEADER * hdr, BODY * body, int flags, int chflags);
index e16bffa..ef199cb 100644 (file)
@@ -1772,7 +1772,7 @@ int pgp_gpgme_application_handler (BODY * m, STATE * s)
   int clearsign = 0;
   long start_pos = 0;
   long bytes;
-  LOFF_T last_pos, offset;
+  off_t last_pos, offset;
   char buf[HUGE_STRING];
   FILE *pgpout = NULL;
 
diff --git a/edit.c b/edit.c
index cb9ff23..966d1be 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -56,7 +56,7 @@ static char *EditorHelp = N_("\
 .              on a line by itself ends input\n");
 
 static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen,
-                             LOFF_T offset, int bytes, int prefix)
+                             off_t offset, int bytes, int prefix)
 {
   char tmp[HUGE_STRING];
   char *p = tmp;
index 53b519a..adce68c 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -936,7 +936,7 @@ static int message_handler (BODY * a, STATE * s)
 {
   struct stat st;
   BODY *b;
-  LOFF_T off_start;
+  off_t off_start;
   int rc = 0;
 
   off_start = ftello (s->fpin);
diff --git a/mbox.c b/mbox.c
index ebbd9ae..a7ee8e1 100644 (file)
--- a/mbox.c
+++ b/mbox.c
 /* struct used by mutt_sync_mailbox() to store new offsets */
 struct m_update_t {
   short valid;
-  LOFF_T hdr;
-  LOFF_T body;
+  off_t hdr;
+  off_t body;
   long lines;
-  LOFF_T length;
+  off_t length;
 };
 
 
@@ -94,7 +94,7 @@ static int mmdf_parse_mailbox (CONTEXT * ctx)
   int count = 0, oldmsgcount = ctx->msgcount;
   int lines;
   time_t t, tz;
-  LOFF_T loc, tmploc;
+  off_t loc, tmploc;
   HEADER *hdr;
   struct stat sb;
 
@@ -232,7 +232,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx)
   HEADER *curhdr;
   time_t t, tz;
   int count = 0, lines = 0;
-  LOFF_T loc;
+  off_t loc;
 
 #ifdef NFS_ATTRIBUTE_HACK
   struct utimbuf newtime;
@@ -299,7 +299,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx)
        * save time by not having to search for the next message marker).
        */
       if (curhdr->content->length > 0) {
-        LOFF_T tmploc;
+        off_t tmploc;
 
         loc = ftello (ctx->fp);
         tmploc = loc + curhdr->content->length + 1;
@@ -312,8 +312,8 @@ static int mbox_parse_mailbox (CONTEXT * ctx)
           if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
               fgets (buf, sizeof (buf), ctx->fp) == NULL ||
               str_ncmp ("From ", buf, 5) != 0) {
-            debug_print (1, ("bad content-length in message %d (cl="
-                             OFF_T_FMT ")\n", curhdr->index, curhdr->content->length));
+            debug_print (1, ("bad content-length in message %d (cl=%zd)\n",
+                             curhdr->index, curhdr->content->length));
             debug_print (1, ("LINE: %s\n", buf));
             if (fseeko (ctx->fp, loc, SEEK_SET) != 0) {  /* nope, return the previous position */
               debug_print (1, ("fseeko() failed\n"));
@@ -553,7 +553,7 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint)
   int rc = -1;
   int need_sort = 0;            /* flag to resort mailbox if new mail arrives */
   int first = -1;               /* first message to be written */
-  LOFF_T 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;
diff --git a/mutt.h b/mutt.h
index 10dfd10..6d834c5 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -605,13 +605,13 @@ typedef struct body {
   PARAMETER *parameter;         /* parameters of the content-type */
   char *description;            /* content-description */
   char *form_name;              /* Content-Disposition form-data name param */
-  LOFF_T 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
                                  */
-  LOFF_T offset;                /* offset where the actual data begins */
-  LOFF_T length;                /* length (in bytes) of attachment */
+  off_t offset;                 /* offset where the actual data begins */
+  off_t length;                 /* length (in bytes) of attachment */
   char *filename;               /* when sending a message, this is the file
                                  * to which this structure refers
                                  */
@@ -725,7 +725,7 @@ typedef struct header {
 
   time_t date_sent;             /* time when the message was sent (UTC) */
   time_t received;              /* time when the message was placed in the mailbox */
-  LOFF_T 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 */
index 78fe7be..6c52193 100644 (file)
@@ -248,7 +248,7 @@ void mutt_env_to_local (ENVELOPE * e)
      if (tag) *tag = #a; e = 1; err = NULL; \
   }
 
-int mutt_env_to_idna (ENVELOPE * env, char **tag, char **err)
+int mutt_env_to_idna (ENVELOPE * env, const char **tag, char **err)
 {
   int e = 0;
 
index 8462435..180b5b4 100644 (file)
@@ -26,7 +26,7 @@ int mutt_addrlist_to_idna (ADDRESS *, char **);
 int mutt_addrlist_to_local (ADDRESS *);
 
 void mutt_env_to_local (ENVELOPE *);
-int mutt_env_to_idna (ENVELOPE *, char **, char **);
+int mutt_env_to_idna (ENVELOPE *, const char **, char **);
 
 const char *mutt_addr_for_display (ADDRESS * a);
 
index 8e57a10..898b148 100644 (file)
@@ -944,7 +944,7 @@ int nntp_save_cache_group (CONTEXT * ctx)
       fputs (buf, f);
       if (h->env->references)
         mutt_write_references (h->env->references, f);
-      snprintf (buf, sizeof (buf), "\t" OFF_T_FMT "\t%d\tXref: %s\n",
+      snprintf (buf, sizeof (buf), "\t%zd\t%d\tXref: %s\n",
                 h->content->length, h->lines, NONULL (h->env->xref));
       if (fputs (buf, f) == EOF) {
         fclose (f);
diff --git a/pager.c b/pager.c
index 0ef2507..f255590 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -106,7 +106,7 @@ struct syntax_t {
 };
 
 struct line_t {
-  LOFF_T offset;
+  off_t offset;
   short type;
   short continuation;
   short chunks;
@@ -909,7 +909,7 @@ static int trim_incomplete_mbyte(unsigned char *buf, size_t len) {
 }
 
 static int
-fill_buffer (FILE * f, LOFF_T *last_pos, LOFF_T offset, unsigned char *buf,
+fill_buffer (FILE * f, off_t *last_pos, off_t offset, unsigned char *buf,
              unsigned char *fmt, size_t blen, int *buf_ready)
 {
   unsigned char *p;
@@ -1131,7 +1131,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
  */
 
 static int
-display_line (FILE * f, LOFF_T *last_pos, struct line_t **lineInfo, int n,
+display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n,
               int *last, int *max, int flags, struct q_class_t **QuoteList,
               int *q_level, int *force_redraw, regex_t * SearchRE)
 {
@@ -1424,7 +1424,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
   int r = -1;
   int redraw = REDRAW_FULL;
   FILE *fp = NULL;
-  LOFF_T last_pos = 0, last_offset = 0;
+  off_t last_pos = 0, last_offset = 0;
   int old_smart_wrap, old_markers;
   struct stat sb;
   regex_t SearchRE;
diff --git a/parse.c b/parse.c
index 7eebd2f..d623d44 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -572,7 +572,7 @@ BODY *mutt_parse_messageRFC822 (FILE * fp, BODY * parent)
  *     digest          1 if reading a multipart/digest, 0 otherwise
  */
 
-BODY *mutt_parse_multipart (FILE * fp, const char *boundary, LOFF_T end_off,
+BODY *mutt_parse_multipart (FILE * fp, const char *boundary, off_t end_off,
                             int digest)
 {
 #ifdef SUN_ATTACHMENT
@@ -1307,7 +1307,7 @@ ENVELOPE *mutt_read_rfc822_header (FILE * f, HEADER * hdr, short user_hdrs,
   LIST *last = NULL;
   char *line = mem_malloc (LONG_STRING);
   char *p;
-  LOFF_T loc;
+  off_t loc;
   int matched;
   size_t linelen = LONG_STRING;
   char buf[LONG_STRING + 1];
diff --git a/pgp.c b/pgp.c
index 13a5e1e..da199ce 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -239,7 +239,7 @@ int pgp_application_pgp_handler (BODY * m, STATE * s)
   int clearsign = 0, rv, rc;
   long start_pos = 0;
   long bytes;
-  LOFF_T last_pos, offset;
+  off_t last_pos, offset;
   char buf[HUGE_STRING];
   char outfile[_POSIX_PATH_MAX];
   char tmpfname[_POSIX_PATH_MAX];
index db7056a..0a45cc6 100644 (file)
@@ -59,8 +59,8 @@ static const char *pgp_hash_to_micalg (short id)
 static void pgp_dearmor (FILE * in, FILE * out)
 {
   char line[HUGE_STRING];
-  LOFF_T start;
-  LOFF_T end;
+  off_t start;
+  off_t end;
   char *r;
 
   STATE state;
index f43f516..9d48470 100644 (file)
@@ -57,7 +57,7 @@ static int read_material (size_t material, size_t * used, FILE * fp)
 unsigned char *pgp_read_packet (FILE * fp, size_t * len)
 {
   size_t used = 0;
-  LOFF_T startpos;
+  off_t startpos;
   unsigned char ctb;
   unsigned char b;
   size_t material;
index 5d97aa6..88b11e4 100644 (file)
@@ -579,7 +579,7 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp)
 #ifdef HAVE_FGETPOS
   fpos_t pos;
 #else
-  LOFF_T pos;
+  off_t pos;
 #endif
 
   pgp_key_t root = NULL;
@@ -730,7 +730,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[],
 #ifdef HAVE_FGETPOS
   fpos_t pos, keypos;
 #else
-  LOFF_T pos, keypos;
+  off_t pos, keypos;
 #endif
 
   unsigned char *buff = NULL;
index 688e32f..07506ff 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -61,7 +61,7 @@ BODY *mutt_make_message_attach (CONTEXT *, HEADER *, int);
 BODY *mutt_remove_multipart (BODY *);
 BODY *mutt_make_multipart (BODY *);
 BODY *mutt_new_body (void);
-BODY *mutt_parse_multipart (FILE *, const char *, LOFF_T, int);
+BODY *mutt_parse_multipart (FILE *, const char *, off_t, int);
 BODY *mutt_parse_messageRFC822 (FILE *, BODY *);
 BODY *mutt_read_mime_header (FILE *, int);
 
index dd633de..d55cd55 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1964,13 +1964,14 @@ static char **add_args (char **args, size_t * argslen, size_t * argsmax,
   return (args);
 }
 
-static char **add_option (char **args, size_t * argslen, size_t * argsmax,
-                          char *s)
+static char **add_option(char **args, size_t * argslen, size_t * argsmax,
+                         const char *s)
 {
-  if (*argslen == *argsmax)
-    mem_realloc (&args, (*argsmax += 5) * sizeof (char *));
-  args[(*argslen)++] = s;
-  return (args);
+    if (*argslen == *argsmax) {
+        mem_realloc(&args, (*argsmax += 5) * sizeof (char *));
+    }
+    args[(*argslen)++] = s;
+    return (args);
 }
 
 static int mutt_invoke_sendmail (ADDRESS * from,        /* the sender */
@@ -2503,7 +2504,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid,
     rewind (tempfp);
     while (fgets (sasha, sizeof (sasha), tempfp) != NULL)
       lines++;
-    fprintf (msg->fp, "Content-Length: " OFF_T_FMT "\n", ftello (tempfp));
+    fprintf (msg->fp, "Content-Length: %zd\n", ftello (tempfp));
     fprintf (msg->fp, "Lines: %d\n\n", lines);
 
     /* copy the body and clean up */