]> git.donarmstrong.com Git - samtools.git/commitdiff
use zlib for direct reading when BCF_LITE is in use
authorHeng Li <lh3@live.co.uk>
Wed, 10 Nov 2010 21:54:46 +0000 (21:54 +0000)
committerHeng Li <lh3@live.co.uk>
Wed, 10 Nov 2010 21:54:46 +0000 (21:54 +0000)
bcftools/bcf.c
bcftools/bcf.h

index 05eae5b7dc2bb8c54af062269950c679b9cddac8..bdc0a5eef5a4321805533f657ec7d0e610366eec 100644 (file)
@@ -13,7 +13,9 @@ bcf_t *bcf_open(const char *fn, const char *mode)
        } else {
                b->fp = strcmp(fn, "-")? bgzf_open(fn, mode) : bgzf_fdopen(fileno(stdin), mode);
        }
-       b->fp->owned_file = 1;
+#ifndef BCF_LITE
+       b->fp->ownede_file = 1;
+#endif
        return b;
 }
 
index 89feeb89ac3bd2e278329866996d02e7709414aa..f87ac1e6fa3021964753f051a944fdc95a59549d 100644 (file)
 
 #include <stdint.h>
 #include <zlib.h>
+
+#ifndef BCF_LITE
 #include "bgzf.h"
+typedef BGZF *bcfFile;
+#else
+typedef gzFile bcfFile;
+#define bgzf_open(fn, mode) gzopen(fn, mode)
+#define bgzf_fdopen(fd, mode) gzdopen(fd, mode)
+#define bgzf_close(fp) gzclose(fp)
+#define bgzf_read(fp, buf, len) gzread(fp, buf, len)
+#define bgzf_write(fp, buf, len)
+#define bgzf_flush(fp)
+#endif
 
 /*
   A member in the structs below is said to "primary" if its content
@@ -74,7 +86,7 @@ typedef struct {
 typedef struct {
        int is_vcf; // if the file in operation is a VCF
        void *v; // auxillary data structure for VCF
-       BGZF *fp; // file handler for BCF
+       bcfFile fp; // file handler for BCF
 } bcf_t;
 
 struct __bcf_idx_t;