minor changes

This commit is contained in:
Heng Li 2011-10-28 16:15:33 -04:00
parent c499eb196c
commit 74bb4c4073
2 changed files with 7 additions and 6 deletions

8
bgzf.c
View File

@ -104,8 +104,8 @@ static BGZF *bgzf_read_init()
BGZF *fp;
fp = calloc(1, sizeof(BGZF));
fp->open_mode = 'r';
fp->uncompressed_block = malloc(BGZF_BLOCK_SIZE);
fp->compressed_block = malloc(BGZF_BLOCK_SIZE);
fp->uncompressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
fp->compressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
#ifdef BGZF_CACHE
fp->cache = kh_init(cache);
#endif
@ -117,8 +117,8 @@ static BGZF *bgzf_write_init(int compress_level) // compress_level==-1 for the d
BGZF *fp;
fp = calloc(1, sizeof(BGZF));
fp->open_mode = 'w';
fp->uncompressed_block = malloc(BGZF_BLOCK_SIZE);
fp->compressed_block = malloc(BGZF_BLOCK_SIZE);
fp->uncompressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
fp->compressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
fp->compress_level = compress_level < 0? Z_DEFAULT_COMPRESSION : compress_level; // Z_DEFAULT_COMPRESSION==-1
if (fp->compress_level > 9) fp->compress_level = Z_DEFAULT_COMPRESSION;
return fp;

5
bgzf.h
View File

@ -32,7 +32,8 @@
#include <stdio.h>
#include <zlib.h>
#define BGZF_BLOCK_SIZE 0x10000 // 64k
#define BGZF_BLOCK_SIZE 0x10000
#define BGZF_MAX_BLOCK_SIZE 0x10000
#define BGZF_ERR_ZLIB 1
#define BGZF_ERR_HEADER 2
@ -71,7 +72,7 @@ extern "C" {
* @param fd file descriptor
* @param mode mode matching /[rwu0-9]+/: 'r' for reading, 'w' for writing and a digit specifies
* the zlib compression level; if both 'r' and 'w' are present, 'w' is ignored.
* @return BGZF file handler; 0 on error
* @return BGZF file handler; 0 on error
*/
BGZF* bgzf_dopen(int fd, const char *mode);