git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 05/10] zip: use GIT_SHA1_HEXSZ for trailers

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 13, 2015, 23:39 UTC
Message-ID
<1426289976-568060-6-git-send-email-sandals@crustytoothpaste.net>
In-Reply-To
<1426289976-568060-1-git-send-email-sandals@crustytoothpaste.net>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 archive-zip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/archive-zip.c b/archive-zip.c
index 4bde019..b669e50 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -427,12 +427,12 @@ static void write_zip_trailer(const unsigned char *sha1)
 	copy_le16(trailer.entries, zip_dir_entries);
 	copy_le32(trailer.size, zip_dir_offset);
 	copy_le32(trailer.offset, zip_offset);
-	copy_le16(trailer.comment_length, sha1 ? 40 : 0);
+	copy_le16(trailer.comment_length, sha1 ? GIT_SHA1_HEXSZ : 0);
 
 	write_or_die(1, zip_dir, zip_dir_offset);
 	write_or_die(1, &trailer, ZIP_DIR_TRAILER_SIZE);
 	if (sha1)
-		write_or_die(1, sha1_to_hex(sha1), 40);
+		write_or_die(1, sha1_to_hex(sha1), GIT_SHA1_HEXSZ);
 }
 
 static void dos_time(time_t *time, int *dos_date, int *dos_time)
-- 
2.2.1.209.g41e5f3a
Previous: brian m. carlsonNext: brian m. carlson
Message 6 of 12 in “Use a structure for object IDs.”
  1. 00/10 Use a structure for object IDs.brian m. carlson, Mar 13, 2015
  2. 01/10 Define a structure for object IDs.brian m. carlson, Mar 13, 2015
  3. 02/10 Define utility functions for object IDs.brian m. carlson, Mar 13, 2015
  4. 03/10 bisect.c: convert leaf functions to use struct object_idbrian m. carlson, Mar 13, 2015
  5. 04/10 archive.c: convert to use struct object_idbrian m. carlson, Mar 13, 2015
  6. 05/10 zip: use GIT_SHA1_HEXSZ for trailersbrian m. carlson, Mar 13, 2015
  7. 06/10 bulk-checkin.c: convert to use struct object_idbrian m. carlson, Mar 13, 2015
  8. 07/10 diff: convert struct combine_diff_path to object_idbrian m. carlson, Mar 13, 2015
  9. 08/10 commit: convert parts to struct object_idbrian m. carlson, Mar 13, 2015
  10. 09/10 patch-id: convert to use struct object_idbrian m. carlson, Mar 13, 2015
  11. 10/10 apply: convert threeway_stage to object_idbrian m. carlson, Mar 13, 2015
  12. brian m. carlsonMar 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.