From: On behalf of John Marshall Date: Tue, 24 Nov 2009 14:45:35 +0000 (+0000) Subject: Format 'c'-encoded auxiliary fields correctly, as *signed* integers. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=13a7326f9008687ff6eeb76f9eb3233dc8c743a4;p=samtools.git Format 'c'-encoded auxiliary fields correctly, as *signed* integers. --- diff --git a/bam.c b/bam.c index ee7642b..56c95db 100644 --- 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; }