# HG changeset patch # User masneyb # Date 1181786801 0 # Node ID 7b5aa0420fe209cf96048bc5594d237f85f46460 # Parent 8dc2c1624fbf8ad124cdd9e523d656df74881217 2007-6-13 Brian Masney * lib/misc.c (insert_commas) lib/gftp.h - explictly cast the number to a long long if it is supported on the system. This fixes a problem where the number is converted to an integer when the sizeof (off_t) != sizeof (long long) diff -r 8dc2c1624fbf -r 7b5aa0420fe2 ChangeLog --- a/ChangeLog Sat Jun 09 11:50:40 2007 +0000 +++ b/ChangeLog Thu Jun 14 02:06:41 2007 +0000 @@ -1,3 +1,9 @@ +2007-6-13 Brian Masney + * lib/misc.c (insert_commas) lib/gftp.h - explictly cast the number to + a long long if it is supported on the system. This fixes a problem + where the number is converted to an integer when the sizeof (off_t) != + sizeof (long long) + 2007-5-18 Brian Masney * lib/protocols.c (gftp_request_destroy) - initialize the request->server_type if the request structure isn't destroyed. diff -r 8dc2c1624fbf -r 7b5aa0420fe2 lib/gftp.h --- a/lib/gftp.h Sat Jun 09 11:50:40 2007 +0000 +++ b/lib/gftp.h Thu Jun 14 02:06:41 2007 +0000 @@ -167,12 +167,14 @@ #define GFTP_OFF_T_PRINTF_MOD "%lld" #define GFTP_OFF_T_11PRINTF_MOD "%11lld" #define gftp_parse_file_size(str) strtoll (str, NULL, 10) +#define GFTP_OFF_T_PRINTF_CONVERSION long long #else #define GFTP_OFF_T_HEX_PRINTF_MOD "%lx" #define GFTP_OFF_T_INTL_PRINTF_MOD "%'ld" #define GFTP_OFF_T_PRINTF_MOD "%ld" #define GFTP_OFF_T_11PRINTF_MOD "%11ld" #define gftp_parse_file_size(str) strtol (str, NULL, 10) +#define GFTP_OFF_T_PRINTF_CONVERSION off_t #endif /* Server types (used by FTP protocol from SYST command) */ diff -r 8dc2c1624fbf -r 7b5aa0420fe2 lib/misc.c --- a/lib/misc.c Sat Jun 09 11:50:40 2007 +0000 +++ b/lib/misc.c Thu Jun 14 02:06:41 2007 +0000 @@ -27,9 +27,11 @@ 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_INTL_PRINTF_MOD, number); + g_snprintf (dest_str, dest_len, GFTP_OFF_T_INTL_PRINTF_MOD, + (GFTP_OFF_T_PRINTF_CONVERSION) number); else - dest_str = g_strdup_printf (GFTP_OFF_T_INTL_PRINTF_MOD, number); + dest_str = g_strdup_printf (GFTP_OFF_T_INTL_PRINTF_MOD, + (GFTP_OFF_T_PRINTF_CONVERSION) number); return (dest_str); } @@ -324,6 +326,15 @@ printf ("sizeof (off_t) = %d\n", sizeof (off_t)); +#ifdef HAVE_INTL_PRINTF + printf ("#define HAVE_INTL_PRINTF\n"); +#endif + + printf ("GFTP_OFF_T_HEX_PRINTF_MOD = %s\n", GFTP_OFF_T_HEX_PRINTF_MOD); + printf ("GFTP_OFF_T_INTL_PRINTF_MOD = %s\n", GFTP_OFF_T_INTL_PRINTF_MOD); + printf ("GFTP_OFF_T_PRINTF_MOD = %s\n", GFTP_OFF_T_PRINTF_MOD); + printf ("GFTP_OFF_T_11PRINTF_MOD = %s\n", GFTP_OFF_T_11PRINTF_MOD); + #ifdef HAVE_GETADDRINFO printf ("#define HAVE_GETADDRINFO\n"); #endif @@ -352,10 +363,6 @@ printf ("#define HAVE_GETTEXT\n"); #endif -#ifdef HAVE_INTL_PRINTF - printf ("#define HAVE_INTL_PRINTF\n"); -#endif - printf ("glib version: %d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);