diff options
author | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-04-26 17:05:07 +0400 |
---|---|---|
committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-04-26 17:38:42 +0400 |
commit | 3aa351ea0fa0d9e8d155801cdac1e83d3b1717c1 (patch) | |
tree | 9b2d8994245744ca0d2c2d07ef2d61e420451172 /src/delta-apply.c | |
parent | eb3d71a5bcd78cb4840e62194e8998141508af88 (diff) |
error handling: move the missing parts over to the new error handling
Diffstat (limited to 'src/delta-apply.c')
-rw-r--r-- | src/delta-apply.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/delta-apply.c b/src/delta-apply.c index 24eba2bda..c8c662fa8 100644 --- a/src/delta-apply.c +++ b/src/delta-apply.c @@ -51,11 +51,15 @@ int git__delta_apply( * if not we would underflow while accessing data from the * base object, resulting in data corruption or segfault. */ - if ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) - return git__throw(GIT_ERROR, "Failed to apply delta. Base size does not match given data"); + if ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) { + giterr_set(GITERR_INVALID, "Failed to apply delta. Base size does not match given data"); + return -1; + } - if (hdr_sz(&res_sz, &delta, delta_end) < 0) - return git__throw(GIT_ERROR, "Failed to apply delta. Base size does not match given data"); + if (hdr_sz(&res_sz, &delta, delta_end) < 0) { + giterr_set(GITERR_INVALID, "Failed to apply delta. Base size does not match given data"); + return -1; + } if ((res_dp = git__malloc(res_sz + 1)) == NULL) return GIT_ENOMEM; @@ -111,5 +115,6 @@ int git__delta_apply( fail: git__free(out->data); out->data = NULL; - return git__throw(GIT_ERROR, "Failed to apply delta"); + giterr_set(GITERR_INVALID, "Failed to apply delta"); + return -1; } |