Giuseppe Scrivano writes:
From 1e229375aa89cdc0bba07335fbe10d4f66180f68 Mon Sep 17 00:00:00 2001
Subject: [PATCH] warc: fix format string for off_t

Good to see that that's fixed. However, there's another instance of this problem in the warc_write_cdx_record function in warc.c. (I saw that Tim Ruehsen fixed this in his version of the patch.)

The attached patch uses number_to_string to fix the printf in warc_write_cdx_record.

Regards,

Gijs
>From 21fc9f0dd9c71e2dc3aea29be4e16f14620d12a5 Mon Sep 17 00:00:00 2001
From: Gijs van Tulder <[email protected]>
Date: Sat, 24 Nov 2012 12:44:14 +0100
Subject: [PATCH] warc: fix format string for off_t in CDX function.

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

diff --git a/src/ChangeLog b/src/ChangeLog
index 07152a5..45b2a70 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-24  Gijs van Tulder  <[email protected]>
+
+	* warc.c (warc_write_cdx_record): Use `number_to_string' to
+	convert the offset to a string.
+
 2012-11-24  Giuseppe Scrivano  <[email protected]>
 
 	* warc.c (warc_write_block_from_file): Use `number_to_string' to
diff --git a/src/warc.c b/src/warc.c
index 99e7016..25a8517 100644
--- a/src/warc.c
+++ b/src/warc.c
@@ -1225,10 +1225,14 @@ warc_write_cdx_record (const char *url, const char *timestamp_str,
   if (redirect_location == NULL || strlen(redirect_location) == 0)
     redirect_location = "-";
 
+  char offset_string[22];
+  number_to_string (offset_string, offset);
+
   /* 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 - %s %s %s\n", url,
            timestamp_str_cdx, url, mime_type, response_code, checksum,
-           redirect_location, offset, warc_current_filename, response_uuid);
+           redirect_location, offset_string, warc_current_filename,
+           response_uuid);
   fflush (warc_current_cdx_file);
 
   return true;
-- 
1.7.9.5

Reply via email to