]> sjero.net Git - wget/commitdiff
warc: fix format string for off_t
authorGiuseppe Scrivano <gscrivano@gnu.org>
Sat, 24 Nov 2012 11:27:16 +0000 (12:27 +0100)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Sat, 24 Nov 2012 11:27:16 +0000 (12:27 +0100)
src/ChangeLog
src/warc.c

index cba211359d5e0d8cd05a3f692e3fc79c2d19a4e4..07152a576bf672c85fe875936dab7121fa153b80 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-24  Giuseppe Scrivano  <gscrivano@gnu.org>
+
+       * warc.c (warc_write_block_from_file): Use `number_to_string' to
+       convert the content-length to a string.
+
 2012-11-15  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * retr.c (write_data): Fix comment.
 2012-11-15  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * retr.c (write_data): Fix comment.
index de99bf7cbf9a76e2e0df5cfb70a216897e3cc8ae..99e70166d9e3e7bdd5e0319213be55fba3ccc9ec 100644 (file)
@@ -245,15 +245,10 @@ static bool
 warc_write_block_from_file (FILE *data_in)
 {
   /* Add the Content-Length header. */
 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);
   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);
   warc_write_header ("Content-Length", content_length);
-  free (content_length);
 
   /* End of the WARC header section. */
   warc_write_string ("\r\n");
 
   /* End of the WARC header section. */
   warc_write_string ("\r\n");