]> granicus.if.org Git - mutt/commitdiff
Large file support for mutt_pretty_size().
authorRocco Rutte <pdmef@gmx.net>
Thu, 25 Oct 2007 15:03:03 +0000 (17:03 +0200)
committerRocco Rutte <pdmef@gmx.net>
Thu, 25 Oct 2007 15:03:03 +0000 (17:03 +0200)
Based on a patch by Corinna Vinschen, adjusted for LOFF_T/OFF_T_FMT
(closes #2191).

muttlib.c
protos.h

index d1aba78ee7504b5789db6cc23c84734c836254bb..5e7a6791d5650f8810a9b2b495aa9c5a27ce9f91 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -812,7 +812,7 @@ void mutt_pretty_mailbox (char *s)
   }
 }
 
-void mutt_pretty_size (char *s, size_t len, long n)
+void mutt_pretty_size (char *s, size_t len, LOFF_T n)
 {
   if (n == 0)
     strfcpy (s, "0K", len);
@@ -821,14 +821,14 @@ void mutt_pretty_size (char *s, size_t len, long n)
   else if (n < 1023949) /* 10K - 999K */
   {
     /* 51 is magic which causes 10189/10240 to be rounded up to 10 */
-    snprintf (s, len, "%ldK", (n + 51) / 1024);
+    snprintf (s, len, OFF_T_FMT "K", (n + 51) / 1024);
   }
   else if (n < 10433332) /* 1.0M - 9.9M */
     snprintf (s, len, "%3.1fM", n / 1048576.0);
   else /* 10M+ */
   {
     /* (10433332 + 52428) / 1048576 = 10 */
-    snprintf (s, len, "%ldM", (n + 52428) / 1048576);
+    snprintf (s, len, OFF_T_FMT "M", (n + 52428) / 1048576);
   }
 }
 
index 7a156b695246a1adf04233d27969dad3684d8e71..43115963e49fec6a3486245140d0c0fb8c3f3c2a 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -229,7 +229,7 @@ void mutt_perror (const char *);
 void mutt_prepare_envelope (ENVELOPE *, int);
 void mutt_unprepare_envelope (ENVELOPE *);
 void mutt_pretty_mailbox (char *);
-void mutt_pretty_size (char *, size_t, long);
+void mutt_pretty_size (char *, size_t, LOFF_T);
 void mutt_pipe_message (HEADER *);
 void mutt_print_message (HEADER *);
 void mutt_print_patchlist (void);