diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-09-29 15:49:28 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-09-29 15:49:28 +0200 |
commit | c103d7b4b7e5fff1e5ec548ca24c16b1d2be33b8 (patch) | |
tree | 25814d7265372d790c76b1c8d847f026a2d04570 /src/filebuf.c | |
parent | 8af4d074cc3bcc8ea63d75f147be892e4925075b (diff) | |
download | libgit2-c103d7b4b7e5fff1e5ec548ca24c16b1d2be33b8.tar.gz |
odb: Pass compression settings to filebuf
Diffstat (limited to 'src/filebuf.c')
-rw-r--r-- | src/filebuf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/filebuf.c b/src/filebuf.c index bc1a8dceb..1a98e3f43 100644 --- a/src/filebuf.c +++ b/src/filebuf.c @@ -129,7 +129,7 @@ static int write_deflate(git_filebuf *file, void *source, size_t len) int git_filebuf_open(git_filebuf *file, const char *path, int flags) { - int error; + int error, compression; size_t path_len; assert(file && path); @@ -155,11 +155,12 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags) } } - /* If we are deflating on-write, */ - if (flags & GIT_FILEBUF_DEFLATE_CONTENTS) { + compression = flags >> GIT_FILEBUF_DEFLATE_SHIFT; + /* If we are deflating on-write, */ + if (compression != 0) { /* Initialize the ZLib stream */ - if (deflateInit(&file->zs, Z_BEST_SPEED) != Z_OK) { + if (deflateInit(&file->zs, compression) != Z_OK) { error = git__throw(GIT_EZLIB, "Failed to initialize zlib"); goto cleanup; } |