git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: "Eric Sunshine" <sunshine@sunshineco.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"René Scharfe" <l.s.r@web.de>, "Jeff King" <peff@peff.net>
Subject: [PATCH v2 23/35] http: compute hash of downloaded objects using the_hash_algo
Date: Tue, 19 Feb 2019 00:05:14 +0000	[thread overview]
Message-ID: <20190219000526.476553-24-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20190219000526.476553-1-sandals@crustytoothpaste.net>

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 http.c | 10 +++++-----
 http.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/http.c b/http.c
index 993ddc956a..458d07fabb 100644
--- a/http.c
+++ b/http.c
@@ -2337,8 +2337,8 @@ static size_t fwrite_sha1_file(char *ptr, size_t eltsize, size_t nmemb,
 		freq->stream.next_out = expn;
 		freq->stream.avail_out = sizeof(expn);
 		freq->zret = git_inflate(&freq->stream, Z_SYNC_FLUSH);
-		git_SHA1_Update(&freq->c, expn,
-				sizeof(expn) - freq->stream.avail_out);
+		the_hash_algo->update_fn(&freq->c, expn,
+					 sizeof(expn) - freq->stream.avail_out);
 	} while (freq->stream.avail_in && freq->zret == Z_OK);
 	return size;
 }
@@ -2396,7 +2396,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
 
 	git_inflate_init(&freq->stream);
 
-	git_SHA1_Init(&freq->c);
+	the_hash_algo->init_fn(&freq->c);
 
 	freq->url = get_remote_object_url(base_url, hex, 0);
 
@@ -2431,7 +2431,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
 	if (prev_read == -1) {
 		memset(&freq->stream, 0, sizeof(freq->stream));
 		git_inflate_init(&freq->stream);
-		git_SHA1_Init(&freq->c);
+		the_hash_algo->init_fn(&freq->c);
 		if (prev_posn>0) {
 			prev_posn = 0;
 			lseek(freq->localfile, 0, SEEK_SET);
@@ -2502,7 +2502,7 @@ int finish_http_object_request(struct http_object_request *freq)
 	}
 
 	git_inflate_end(&freq->stream);
-	git_SHA1_Final(freq->real_oid.hash, &freq->c);
+	the_hash_algo->final_fn(freq->real_oid.hash, &freq->c);
 	if (freq->zret != Z_STREAM_END) {
 		unlink_or_warn(freq->tmpfile.buf);
 		return -1;
diff --git a/http.h b/http.h
index 4eb4e808e5..10d3cfdb80 100644
--- a/http.h
+++ b/http.h
@@ -225,7 +225,7 @@ struct http_object_request {
 	long http_code;
 	struct object_id oid;
 	struct object_id real_oid;
-	git_SHA_CTX c;
+	git_hash_ctx c;
 	git_zstream stream;
 	int zret;
 	int rename;

  parent reply	other threads:[~2019-02-19  0:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19  0:04 [PATCH v2 00/35] Hash function transition part 16 brian m. carlson
2019-02-19  0:04 ` [PATCH v2 01/35] t/lib-submodule-update: use appropriate length constant brian m. carlson
2019-02-19  0:04 ` [PATCH v2 02/35] khash: move oid hash table definition brian m. carlson
2019-02-19  0:04 ` [PATCH v2 03/35] pack-bitmap: make bitmap header handling hash agnostic brian m. carlson
2019-02-19  0:04 ` [PATCH v2 04/35] pack-bitmap: convert struct stored_bitmap to object_id brian m. carlson
2019-02-19  0:04 ` [PATCH v2 05/35] pack-bitmap: replace sha1_to_hex brian m. carlson
2019-02-19  0:04 ` [PATCH v2 06/35] pack-bitmap: switch hard-coded constants to the_hash_algo brian m. carlson
2019-02-19  0:04 ` [PATCH v2 07/35] pack-bitmap: switch hash tables to use struct object_id brian m. carlson
2019-02-19  0:04 ` [PATCH v2 08/35] submodule: avoid hard-coded constants brian m. carlson
2019-02-19  0:05 ` [PATCH v2 09/35] notes-merge: switch to use the_hash_algo brian m. carlson
2019-02-19  0:05 ` [PATCH v2 10/35] notes: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 11/35] notes: replace sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 12/35] object-store: rename and expand packed_git's sha1 member brian m. carlson
2019-02-19  0:05 ` [PATCH v2 13/35] builtin/name-rev: make hash-size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 14/35] fast-import: " brian m. carlson
2019-02-19  0:05 ` [PATCH v2 15/35] fast-import: replace sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 16/35] builtin/am: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 17/35] builtin/pull: make hash-size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 18/35] http-push: convert to use the_hash_algo brian m. carlson
2019-02-19  0:05 ` [PATCH v2 19/35] http-backend: allow 64-character hex names brian m. carlson
2019-02-19  0:05 ` [PATCH v2 20/35] http-push: remove remaining uses of sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 21/35] http-walker: replace sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 22/35] http: replace hard-coded constant with the_hash_algo brian m. carlson
2019-02-19  0:05 ` brian m. carlson [this message]
2019-02-19  0:05 ` [PATCH v2 24/35] http: replace sha1_to_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 25/35] remote-curl: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 26/35] hash: add a function to lookup hash algorithm by length brian m. carlson
2019-02-19  0:05 ` [PATCH v2 27/35] get-tar-commit-id: parse comment record brian m. carlson
2019-02-19  0:05 ` [PATCH v2 28/35] builtin/get-tar-commit-id: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 29/35] archive: convert struct archiver_args to object_id brian m. carlson
2019-02-19  0:05 ` [PATCH v2 30/35] refspec: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 31/35] builtin/difftool: use parse_oid_hex brian m. carlson
2019-02-19  0:05 ` [PATCH v2 32/35] dir: make untracked cache extension hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 33/35] read-cache: read data in a hash-independent way brian m. carlson
2019-02-19  0:05 ` [PATCH v2 34/35] Git.pm: make hash size independent brian m. carlson
2019-02-19  0:05 ` [PATCH v2 35/35] gitweb: " brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190219000526.476553-24-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).