author | Junio C Hamano <gitster@pobox.com> | |
Thu, 22 Jan 2009 00:55:17 +0000 (16:55 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 22 Jan 2009 00:55:17 +0000 (16:55 -0800) |
* lt/maint-wrap-zlib:
Wrap inflate and other zlib routines for better error reporting
Conflicts:
http-push.c
http-walker.c
sha1_file.c
Wrap inflate and other zlib routines for better error reporting
Conflicts:
http-push.c
http-walker.c
sha1_file.c
1 | 2 | |||
---|---|---|---|---|
builtin-apply.c | patch | | diff1 | | diff2 | | blob | history |
builtin-pack-objects.c | patch | | diff1 | | diff2 | | blob | history |
builtin-unpack-objects.c | patch | | diff1 | | diff2 | | blob | history |
cache.h | patch | | diff1 | | diff2 | | blob | history |
http-push.c | patch | | diff1 | | diff2 | | blob | history |
http-walker.c | patch | | diff1 | | diff2 | | blob | history |
index-pack.c | patch | | diff1 | | diff2 | | blob | history |
sha1_file.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc builtin-apply.c
Simple merge
diff --cc builtin-pack-objects.c
Simple merge
diff --cc builtin-unpack-objects.c
Simple merge
diff --cc cache.h
Simple merge
diff --cc http-push.c
index 6ad853e2d01b4ee3b3ee282b30b8b7f374ae3d47,6d977ea6e17ce3a03e47fbfdbc83f8d33f6dd94b..cb5bf95a736c571259aef51884cc20e4169bf707
--- 1/http-push.c
--- 2/http-push.c
+++ b/http-push.c
do {
request->stream.next_out = expn;
request->stream.avail_out = sizeof(expn);
- request->zret = inflate(&request->stream, Z_SYNC_FLUSH);
+ request->zret = git_inflate(&request->stream, Z_SYNC_FLUSH);
- SHA1_Update(&request->c, expn,
+ git_SHA1_Update(&request->c, expn,
sizeof(expn) - request->stream.avail_out);
} while (request->stream.avail_in && request->zret == Z_OK);
data_received++;
memset(&request->stream, 0, sizeof(request->stream));
- inflateInit(&request->stream);
+ git_inflate_init(&request->stream);
- SHA1_Init(&request->c);
+ git_SHA1_Init(&request->c);
url = xmalloc(strlen(remote->url) + 50);
request->url = xmalloc(strlen(remote->url) + 50);
file; also rewind to the beginning of the local file. */
if (prev_read == -1) {
memset(&request->stream, 0, sizeof(request->stream));
- inflateInit(&request->stream);
+ git_inflate_init(&request->stream);
- SHA1_Init(&request->c);
+ git_SHA1_Init(&request->c);
if (prev_posn>0) {
prev_posn = 0;
lseek(request->local_fileno, 0, SEEK_SET);
if (request->http_code == 416)
fprintf(stderr, "Warning: requested range invalid; we may already have all the data.\n");
- inflateEnd(&request->stream);
+ git_inflate_end(&request->stream);
- SHA1_Final(request->real_sha1, &request->c);
+ git_SHA1_Final(request->real_sha1, &request->c);
if (request->zret != Z_STREAM_END) {
unlink(request->tmpfile);
} else if (hashcmp(request->obj->sha1, request->real_sha1)) {
diff --cc http-walker.c
index 7271c7d19d3b08ef76c9c868ae57f6872f6186d0,747d3adef884ec4d5c0370fc5c086e1904a7d442..0dbad3c888c6c9441af4d9550fd147ecb5b1aaf3
--- 1/http-walker.c
--- 2/http-walker.c
+++ b/http-walker.c
do {
obj_req->stream.next_out = expn;
obj_req->stream.avail_out = sizeof(expn);
- obj_req->zret = inflate(&obj_req->stream, Z_SYNC_FLUSH);
+ obj_req->zret = git_inflate(&obj_req->stream, Z_SYNC_FLUSH);
- SHA1_Update(&obj_req->c, expn,
+ git_SHA1_Update(&obj_req->c, expn,
sizeof(expn) - obj_req->stream.avail_out);
} while (obj_req->stream.avail_in && obj_req->zret == Z_OK);
data_received++;
memset(&obj_req->stream, 0, sizeof(obj_req->stream));
- inflateInit(&obj_req->stream);
+ git_inflate_init(&obj_req->stream);
- SHA1_Init(&obj_req->c);
+ git_SHA1_Init(&obj_req->c);
url = xmalloc(strlen(obj_req->repo->base) + 51);
obj_req->url = xmalloc(strlen(obj_req->repo->base) + 51);
file; also rewind to the beginning of the local file. */
if (prev_read == -1) {
memset(&obj_req->stream, 0, sizeof(obj_req->stream));
- inflateInit(&obj_req->stream);
+ git_inflate_init(&obj_req->stream);
- SHA1_Init(&obj_req->c);
+ git_SHA1_Init(&obj_req->c);
if (prev_posn>0) {
prev_posn = 0;
lseek(obj_req->local, 0, SEEK_SET);
return;
}
- inflateEnd(&obj_req->stream);
+ git_inflate_end(&obj_req->stream);
- SHA1_Final(obj_req->real_sha1, &obj_req->c);
+ git_SHA1_Final(obj_req->real_sha1, &obj_req->c);
if (obj_req->zret != Z_STREAM_END) {
unlink(obj_req->tmpfile);
return;
diff --cc index-pack.c
Simple merge
diff --cc sha1_file.c
index f08493f039fa28c90e3edc708bbcf0a527e4f659,71c2282c9c56a00be75e3bc395e6e695dae229f2..360f7e5a028b4842b152f1fcbd9f39f3a8623b5c
--- 1/sha1_file.c
--- 2/sha1_file.c
+++ b/sha1_file.c
curpos += stream.next_in - in;
} while ((st == Z_OK || st == Z_BUF_ERROR) &&
stream.total_out < sizeof(delta_head));
- inflateEnd(&stream);
+ git_inflate_end(&stream);
- if ((st != Z_STREAM_END) && stream.total_out != sizeof(delta_head))
- die("delta data unpack-initial failed");
+ if ((st != Z_STREAM_END) && stream.total_out != sizeof(delta_head)) {
+ error("delta data unpack-initial failed");
+ return 0;
+ }
/* Examine the initial part of the delta to figure out
* the result size.