Mercurial > gftp.yaz
diff lib/rfc2068.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 | c6a6e908dbaf |
children | 34a3f10d8bae |
line wrap: on
line diff
--- a/lib/rfc2068.c Wed Aug 18 00:56:58 2004 +0000 +++ b/lib/rfc2068.c Wed Aug 18 01:58:43 2004 +0000 @@ -144,13 +144,7 @@ sizeof (tempstr), request->datafd)) < 0) return (ret); -#ifdef _LARGEFILE_SOURCE - ret = sscanf (tempstr, "%llx", ¶ms->chunk_size); -#else - ret = sscanf (tempstr, "%lx", ¶ms->chunk_size); -#endif - - if (ret != 1) + if (sscanf (tempstr, GFTP_OFF_T_HEX_PRINTF_MOD, ¶ms->chunk_size) != 1) { request->logging_function (gftp_logging_recv, request, _("Received wrong response from server, disconnecting\nInvalid chunk size '%s' returned by the remote server\n"), @@ -305,23 +299,14 @@ if (use_http11 && startsize > 0) { -#if defined (_LARGEFILE_SOURCE) request->logging_function (gftp_logging_misc, request, - _("Starting the file transfer at offset %lld\n"), + _("Starting the file transfer at offset " GFTP_OFF_T_PRINTF_MOD "\n"), startsize); oldstr = tempstr; - tempstr = g_strdup_printf ("%sRange: bytes=%lld-\n", tempstr, startsize); + tempstr = g_strdup_printf ("%sRange: bytes=" GFTP_OFF_T_PRINTF_MOD "-\n", + tempstr, startsize); g_free (oldstr); -#else - request->logging_function (gftp_logging_misc, request, - _("Starting the file transfer at offset %ld\n"), - startsize); - - oldstr = tempstr; - tempstr = g_strdup_printf ("%sRange: bytes=%ld-\n", tempstr, startsize); - g_free (oldstr); -#endif } size = rfc2068_send_command (request, tempstr, strlen (tempstr)); @@ -852,13 +837,8 @@ *crlfpos = '\0'; crlfpos++; /* advance to line feed */ -#ifdef _LARGEFILE_SOURCE - ret = sscanf (stpos + 2, "%llx", ¶ms->chunk_size); -#else - ret = sscanf (stpos + 2, "%lx", ¶ms->chunk_size); -#endif - - if (ret != 1) + if (sscanf (stpos + 2, GFTP_OFF_T_HEX_PRINTF_MOD, + ¶ms->chunk_size) != 1) { request->logging_function (gftp_logging_recv, request, _("Received wrong response from server, disconnecting\nInvalid chunk size '%s' returned by the remote server\n"),