diff lib/misc.c @ 532:bccfdbfaac00

2004-8-17 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c - added #defines for encoding and decoding file sizes that will work properly for large files (GFTP_OFF_T_HEX_PRINTF_MOD, GFTP_OFF_T_INTL_PRINTF_MOD, GFTP_OFF_T_PRINTF_MOD, GFTP_OFF_T_11PRINTF_MOD and gftp_parse_file_size). Fixed file size not being displayed properly when the system does not support the ' printf formatter * acinclude.m4 (AC_INTL_PRINTF) - check to see if _LARGEFILE_SOURCE is defined. If so, use %'lld instead of %'ld
author masneyb
date Wed, 18 Aug 2004 01:58:43 +0000
parents fbb5a02beddb
children 8d310e2fd570
line wrap: on
line diff
--- a/lib/misc.c	Wed Aug 18 00:56:58 2004 +0000
+++ b/lib/misc.c	Wed Aug 18 01:58:43 2004 +0000
@@ -27,9 +27,9 @@
 insert_commas (off_t number, char *dest_str, size_t dest_len)
 {
   if (dest_str != NULL)
-    g_snprintf (dest_str, dest_len, GFTP_OFF_T_PRINTF_MOD, number);
+    g_snprintf (dest_str, dest_len, GFTP_OFF_T_INTL_PRINTF_MOD, number);
   else
-    dest_str = g_strdup_printf (GFTP_OFF_T_PRINTF_MOD, number);
+    dest_str = g_strdup_printf (GFTP_OFF_T_INTL_PRINTF_MOD, number);
 
   return (dest_str);
 }
@@ -871,13 +871,7 @@
   if (GFTP_IS_SPECIAL_DEVICE (fle->st_mode))
     tempstr2 = g_strdup_printf ("%d, %d", major (fle->size), minor (fle->size));
   else
-    {
-#if defined (_LARGEFILE_SOURCE)
-      tempstr2 = g_strdup_printf ("%11lld", fle->size);
-#else
-      tempstr2 = g_strdup_printf ("%11ld", fle->size);
-#endif
-    }
+    tempstr2 = g_strdup_printf (GFTP_OFF_T_11PRINTF_MOD, fle->size);
 
   time (&t);
 
@@ -1176,17 +1170,6 @@
 }
 
 
-off_t
-gftp_parse_file_size (char *str)
-{
-#if defined (_LARGEFILE_SOURCE)
-  return (strtoll (str, NULL, 10));
-#else
-  return (strtol (str, NULL, 10));
-#endif
-}
-
-
 void
 gftp_locale_init (void)
 {