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, 24 Nov 2012 12:32:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

David Ryskalczyk <address@hidden> writes:

> Also, %lld won't work with MinGW either, because MinGW uses the GCC
> compiler together with the Win32 API, rather than the POSIX layer that
> Cygwin provides.
> Going full-on C99 would be tying people to the rather heavy Cygwin
> runtime, which I don't think is a good idea.
>
> Any chance that the original bug will be fixed?

I have pushed the following patch:

>From 1e229375aa89cdc0bba07335fbe10d4f66180f68 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Sat, 24 Nov 2012 12:27:16 +0100
Subject: [PATCH] warc: fix format string for off_t

---
 src/ChangeLog |    5 +++++
 src/warc.c    |    9 ++-------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index cba2113..07152a5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-24  Giuseppe Scrivano  <address@hidden>
+
+       * warc.c (warc_write_block_from_file): Use `number_to_string' to
+       convert the content-length to a string.
+
 2012-11-15  Giuseppe Scrivano  <address@hidden>
 
        * retr.c (write_data): Fix comment.
diff --git a/src/warc.c b/src/warc.c
index de99bf7..99e7016 100644
--- a/src/warc.c
+++ b/src/warc.c
@@ -245,15 +245,10 @@ static bool
 warc_write_block_from_file (FILE *data_in)
 {
   /* Add the Content-Length header. */
-  char *content_length;
+  char content_length[22];
   fseeko (data_in, 0L, SEEK_END);
-  if (! asprintf (&content_length, "%ld", ftello (data_in)))
-    {
-      warc_write_ok = false;
-      return false;
-    }
+  number_to_string (content_length, ftello (data_in));
   warc_write_header ("Content-Length", content_length);
-  free (content_length);
 
   /* End of the WARC header section. */
   warc_write_string ("\r\n");
-- 
1.7.10.4




reply via email to

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