]> git.donarmstrong.com Git - samtools.git/commitdiff
Format 'c'-encoded auxiliary fields correctly, as *signed* integers.
authorOn behalf of John Marshall <lh3@sanger.ac.uk>
Tue, 24 Nov 2009 14:45:35 +0000 (14:45 +0000)
committerOn behalf of John Marshall <lh3@sanger.ac.uk>
Tue, 24 Nov 2009 14:45:35 +0000 (14:45 +0000)
bam.c

diff --git a/bam.c b/bam.c
index ee7642b3434248c9b44ef918435f150f101cae00..56c95db4e2c42c404627e41bd1ca2360a496af73 100644 (file)
--- a/bam.c
+++ b/bam.c
@@ -268,7 +268,7 @@ char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int of)
                ksprintf(&str, "\t%c%c:", key[0], key[1]);
                if (type == 'A') { ksprintf(&str, "A:%c", *s); ++s; }
                else if (type == 'C') { ksprintf(&str, "i:%u", *s); ++s; }
-               else if (type == 'c') { ksprintf(&str, "i:%d", *s); ++s; }
+               else if (type == 'c') { ksprintf(&str, "i:%d", *(int8_t*)s); ++s; }
                else if (type == 'S') { ksprintf(&str, "i:%u", *(uint16_t*)s); s += 2; }
                else if (type == 's') { ksprintf(&str, "i:%d", *(int16_t*)s); s += 2; }
                else if (type == 'I') { ksprintf(&str, "i:%u", *(uint32_t*)s); s += 4; }