bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [PATCH] Invalid Content-Length header in WARC files, on s


From: Giuseppe Scrivano
Subject: Re: [Bug-wget] [PATCH] Invalid Content-Length header in WARC files, on some platforms
Date: Sat, 17 Nov 2012 13:43:36 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Tim Ruehsen <address@hidden> writes:

> BTW, I had a private discussion with Guiseppe at April 13th 2012.
> It was about C99/POSIX and using getline().
> Guiseppe's last words were:
>
> "I had to check it better before give an answer, but yeah, the answer is:
> let's use C99 and POSIX-2008."
>
> @Guiseppe: can you confirm this officially on the mailing list ?

Before I apply your patch, let's get a final decision about this issue.

Let's be realistic, is there any platform/system (with more than 3
users) where C99 is a problem?

Visual Studio is not a problem as there are other ways to build wget on
Windows that don't stick us to something more than 20 years old.

Giuseppe



This is the version of your patch squashed in one commit, I have not
pushed it yet.

>From d0744b1b9464b864fee1e938dd72356d1a83e1c4 Mon Sep 17 00:00:00 2001
From: Tim Ruehsen <address@hidden>
Date: Wed, 14 Nov 2012 11:11:34 +0100
Subject: [PATCH] warc: fix format string for off_t

* warc.c (warc_write_block_from_file): fix off_t format string
and asprintf return value.
* warc.c (warc_write_cdx_record): fix off_t format string.
---
 src/warc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/warc.c b/src/warc.c
index de99bf7..85f7ba3 100644
--- a/src/warc.c
+++ b/src/warc.c
@@ -247,7 +247,7 @@ warc_write_block_from_file (FILE *data_in)
   /* Add the Content-Length header. */
   char *content_length;
   fseeko (data_in, 0L, SEEK_END);
-  if (! asprintf (&content_length, "%ld", ftello (data_in)))
+  if (asprintf (&content_length, "%lld", (long long)ftello (data_in)) != -1)
     {
       warc_write_ok = false;
       return false;
@@ -1231,9 +1231,9 @@ warc_write_cdx_record (const char *url, const char 
*timestamp_str,
     redirect_location = "-";
 
   /* Print the CDX line. */
-  fprintf (warc_current_cdx_file, "%s %s %s %s %d %s %s - %ld %s %s\n", url,
+  fprintf (warc_current_cdx_file, "%s %s %s %s %d %s %s - %lld %s %s\n", url,
            timestamp_str_cdx, url, mime_type, response_code, checksum,
-           redirect_location, offset, warc_current_filename, response_uuid);
+           redirect_location, (long long)offset, warc_current_filename, 
response_uuid);
   fflush (warc_current_cdx_file);
 
   return true;
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]